os-z80/kernel/proc_map.z80

67 lines
825 B
Z80 Assembly
Raw Normal View History

2023-01-29 11:03:53 -06:00
.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
2023-09-03 10:03:51 -05:00
ld c, 0xE
ld a, (map_frame)
ld b, a
ld de, (map_frame+1)
call set_frame
xor a
ld (0xE000), a
ld hl, 0xE000
ld de, 0xE001
ld bc, 4096-1
ldir
2023-01-29 11:03:53 -06:00
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
2023-09-03 10:03:51 -05:00
or 0xE0
2023-01-29 11:03:53 -06:00
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
2023-09-03 10:03:51 -05:00
or 0xE0
2023-01-29 11:03:53 -06:00
ld h, a
ld e, (hl)
inc hl
ld d, (hl)
push de
pop hl
ret
map_frame: .ds.b 3