From 504f4d96f63a8d94e1fdb3659647efd0ec744aa0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 1 Nov 2023 21:24:36 +0000 Subject: [PATCH] z80uuser1: fix the helpers now we have reg vars --- Kernel/lib/z80uuser1.s | 46 +++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/Kernel/lib/z80uuser1.s b/Kernel/lib/z80uuser1.s index aa32c0238..94cb02a70 100644 --- a/Kernel/lib/z80uuser1.s +++ b/Kernel/lib/z80uuser1.s @@ -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 @@ -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 @@ -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