From e555f2e7b58566832c42fee6060a0d231518a54d Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 5 Feb 2023 11:02:32 -0600 Subject: [PATCH] Fix link_loop writing addresses instead of IDs --- kernel/ipc.z80 | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/kernel/ipc.z80 b/kernel/ipc.z80 index cbefb2b..f659296 100644 --- a/kernel/ipc.z80 +++ b/kernel/ipc.z80 @@ -52,7 +52,7 @@ ld b, 0 ret .global mb_read -;Reads a meddage from the MB specified in HL, +;Reads a message from the MB specified in HL, ; and returns the pointer in C:DE:HL. ; Returns 0 in B if the mailbox had a message, and 1 if it was full mb_read: @@ -118,24 +118,22 @@ ld (mb_next_frame_num), bc call get_mb_ptr push hl pop ix +pop hl push hl -pop iy +inc hl +/* push hl */ +/* pop iy */ link_loop: -inc iyh -ld a, iyh -cp 0xf0 -jp nz, iy_ok +ld (ix + 0), l +ld (ix + 1), h +inc hl +inc ixh +ld a, ixh +cp 0xef +jp nz, link_loop +link_loop_done: ld (ix + 0), 0 ld (ix + 1), 0 -jp link_loop_done -iy_ok: -push iy -pop bc -ld (ix + 0), c -ld (ix + 1), b -inc ixh -jp link_loop -link_loop_done: pop hl ld (mb_free_list), hl ld bc, (mb_free_list) @@ -154,9 +152,10 @@ pop ix ld a, (ix + 0) ld (mb_free_list), a ld a, (ix + 1) -ld (mb_free_list), a +ld (mb_free_list + 1), a ld hl, (temp) ret + ; Clobbers A, BC, DE, and IX get_mb_ptr: ld a, h