dos33fsprogs/games/mist_hgr/handle_pages.s
Vince Weaver 3fec7e69fa mist_hgr: hooray, can go through book to a featureless void
that void is mist island, but apparently really foggy
2021-07-13 15:22:29 -04:00

98 lines
1.5 KiB
ArmAsm

; FIXME: should be able to drop pages back where we picked them up
;==============================
; Take Blue Page
;==============================
; A should be page to take (i.e. MECHE_PAGE or similar)
take_blue_page:
pha
jsr drop_current_page
pla
pha
eor BLUE_PAGES_TAKEN ; toggle the taken flag
sta BLUE_PAGES_TAKEN
pla
ora #HOLDING_BLUE_PAGE ; put it in hand
sta HOLDING_PAGE
rts
;==============================
; Take Red Page
;==============================
; A should be page to take (i.e. MECHE_PAGE or similar)
take_red_page:
pha
jsr drop_current_page
pla
pha
eor RED_PAGES_TAKEN
sta RED_PAGES_TAKEN
pla
ora #HOLDING_RED_PAGE
sta HOLDING_PAGE
rts
;==============================
; Take White Page
;==============================
take_white_page:
pha
jsr drop_current_page
pla
pha
lda #1
sta WHITE_PAGE_TAKEN
pla
ora #HOLDING_WHITE_PAGE
sta HOLDING_PAGE
rts
;==============================
; Drop current page
;==============================
; clicked on a page while holding another
drop_current_page:
lda HOLDING_PAGE
and #$c0
cmp #HOLDING_RED_PAGE
beq drop_red_page
cmp #HOLDING_BLUE_PAGE
beq drop_blue_page
cmp #HOLDING_WHITE_PAGE
beq drop_white_page
; there was no page?
rts
drop_white_page:
lda #0
sta WHITE_PAGE_TAKEN
rts
drop_red_page:
lda HOLDING_PAGE
and #$3f
eor RED_PAGES_TAKEN
sta RED_PAGES_TAKEN
rts
drop_blue_page:
lda HOLDING_PAGE
and #$3f
eor BLUE_PAGES_TAKEN
sta BLUE_PAGES_TAKEN
rts