os-z80/kernel/proc_map.z80
2023-01-29 11:03:53 -06:00

56 lines
683 B
Z80 Assembly

.global proc_map_init
.global proc_map_set
.global proc_map_load
proc_map_init:
call get_free_frame
ld a, c
ld (map_frame), a
ld (map_frame+1), hl
ret
; Clobbers A, BC, HL, IX
; Sets the type id in DE to HL
proc_map_set:
push de
push hl
ld c, 0xE
ld a, (map_frame)
ld b, a
ld de, (map_frame+1)
call set_frame
pop de
pop hl
add hl, hl
ld a, h
or 0xE
ld h, a
ld (hl), e
inc hl
ld (hl), d
ret
; Clobbers A, BC, HL, IX, DE
; Gets the value of the type id in DE and puts it in HL
proc_map_load:
push de
ld c, 0xE
ld a, (map_frame)
ld b, a
ld de, (map_frame+1)
call set_frame
pop hl
add hl, hl
ld a, h
or 0xE
ld h, a
ld e, (hl)
inc hl
ld d, (hl)
push de
pop hl
ret
map_frame: .ds.b 3