Skip to content

Commit

Permalink
sbc2g: complete port to new compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
EtchedPixels committed Nov 1, 2023
1 parent 504f4d9 commit fdeb6cc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Kernel/platform/platform-sbc2g/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Kernel/platform/platform-sbc2g/ide.S
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
46 changes: 30 additions & 16 deletions Kernel/platform/platform-sbc2g/tricks.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fdeb6cc

Please sign in to comment.