Skip to content

Commit

Permalink
z80uuser1: fix the helpers now we have reg vars
Browse files Browse the repository at this point in the history
  • Loading branch information
EtchedPixels committed Nov 1, 2023
1 parent 0bb0570 commit 504f4d9
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions Kernel/lib/z80uuser1.s
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,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 @@ -86,12 +97,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 @@ -100,6 +113,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 504f4d9

Please sign in to comment.