Compare commits

...

4 Commits

2 changed files with 19 additions and 22 deletions

View File

@ -1,7 +1,7 @@
.global _start
_start:
call get_free_mailbox ; Get a mailbox
push hl
ld (mailbox_num), hl
ld de, 1
call get_free_frame ; Set up a frame to send messages at 0x8000
ld b, c
@ -18,7 +18,7 @@ call set_frame
ld c, 0
ld de, 1
ld hl, 0xA000
ri_find_loop:
initrd_read_loop:
push bc
push de
push hl
@ -29,7 +29,7 @@ push de
ld b, 0 ; Load the filename length in BC
ld a, (0x8000)
ld c, a
inc hl
ld hl, 0x8001
ldir
ld a, (hl)
ld (de), a
@ -79,10 +79,8 @@ ld d, h
ld a, c
adc a, 0
ld c, a
jp ri_find_loop
jp initrd_read_loop
call proc_map_set ; Register ourselves as ID 1
pop hl
ld (mailbox_num), hl
msg_loop:
call yield
ld hl, (mailbox_num)

View File

@ -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