67 lines
825 B
Z80 Assembly
67 lines
825 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
|
|
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
|
|
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 0xE0
|
|
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 0xE0
|
|
ld h, a
|
|
ld e, (hl)
|
|
inc hl
|
|
ld d, (hl)
|
|
push de
|
|
pop hl
|
|
ret
|
|
|
|
map_frame: .ds.b 3
|