From fdeb6cc1fa0cd30e652893ae2fdba2c22101daa1 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 1 Nov 2023 21:24:54 +0000 Subject: [PATCH] sbc2g: complete port to new compiler --- Kernel/platform/platform-sbc2g/Makefile | 2 +- Kernel/platform/platform-sbc2g/ide.S | 2 ++ Kernel/platform/platform-sbc2g/tricks.s | 46 ++++++++++++++++--------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/Kernel/platform/platform-sbc2g/Makefile b/Kernel/platform/platform-sbc2g/Makefile index c82cfbe53..661851a74 100644 --- a/Kernel/platform/platform-sbc2g/Makefile +++ b/Kernel/platform/platform-sbc2g/Makefile @@ -85,7 +85,7 @@ diskimage: # Add the file system dd if=$(IMAGES)/filesys8.img of=$(IMAGES)/disk.img bs=512 seek=16512 conv=notrunc # Add the kernel - dd if=../../fuzix.bin of=$(IMAGES)/disk.img bs=512 seek=2 conv=notrunc + dd if=../../fuzix.bin of=$(IMAGES)/disk.img bs=256 skip=1 seek=4 conv=notrunc # Add the bootloader dd if=loader.bin of=$(IMAGES)/disk.img seek=16384 conv=notrunc # Make an emulator image of it diff --git a/Kernel/platform/platform-sbc2g/ide.S b/Kernel/platform/platform-sbc2g/ide.S index 489e5e0c3..11711147c 100644 --- a/Kernel/platform/platform-sbc2g/ide.S +++ b/Kernel/platform/platform-sbc2g/ide.S @@ -24,6 +24,7 @@ _devide_read_data: call ide_setup inir ; transfer first 256 bytes inir ; transfer second 256 bytes + pop bc jp map_kernel _devide_write_data: @@ -35,4 +36,5 @@ _devide_write_data: call ide_setup otir ; transfer first 256 bytes otir ; transfer second 256 bytes + pop bc jp map_kernel diff --git a/Kernel/platform/platform-sbc2g/tricks.s b/Kernel/platform/platform-sbc2g/tricks.s index cef1006ed..94590bfeb 100644 --- a/Kernel/platform/platform-sbc2g/tricks.s +++ b/Kernel/platform/platform-sbc2g/tricks.s @@ -109,41 +109,52 @@ uputget: ret ; Z is still false __uputc: - pop bc ; return - pop de ; char - pop hl ; dest - push hl - push de - push bc + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a call map_proc_always ld (hl), e uputc_out: jp map_kernel ; map the kernel back below common __uputw: - pop bc ; return - pop de ; word - pop hl ; dest - push hl - push de - push bc + ld hl,2 + add hl,sp + ld e,(hl) + inc hl + ld d,(hl) ; value + inc hl + ld a,(hl) + inc hl + ld h,(hl) + ld l,a call map_proc_always ld (hl), e inc hl ld (hl), d jp map_kernel -; -; ugetc and ugetw are fastcall so the address we need is already in -; HL -; __ugetc: + pop de + pop hl + push hl + push de call map_proc_always ld l, (hl) ld h, 0 jp map_kernel __ugetw: + pop de + pop hl + push hl + push de call map_proc_always ld a, (hl) inc hl @@ -155,12 +166,14 @@ __uput: push ix ld ix, 0 add ix, sp + push bc call uputget ; source in HL dest in DE, count in BC jr z, uput_out ; but count is at this point magic call map_proc_always ldir uput_out: call map_kernel + pop bc pop ix ld hl, 0 ret @@ -169,6 +182,7 @@ __uget: push ix ld ix, 0 add ix, sp + push bc call uputget ; source in HL dest in DE, count in BC jr z, uput_out ; but count is at this point magic call map_proc_always