dos33fsprogs/mist/handle_pages.s

98 lines
1.5 KiB
ArmAsm
Raw Normal View History

; FIXME: should be able to drop pages back where we picked them up
2020-04-21 21:12:08 +00:00
;==============================
; Take Blue Page
;==============================
; A should be page to take (i.e. MECHE_PAGE or similar)
take_blue_page:
pha
2020-04-21 21:12:08 +00:00
jsr drop_current_page
pla
2020-04-21 21:12:08 +00:00
pha
2020-04-21 21:12:08 +00:00
eor BLUE_PAGES_TAKEN ; toggle the taken flag
sta BLUE_PAGES_TAKEN
pla
2020-04-21 21:12:08 +00:00
ora #HOLDING_BLUE_PAGE ; put it in hand
2020-04-21 21:12:08 +00:00
sta HOLDING_PAGE
rts
2020-07-12 04:45:49 +00:00
;==============================
; Take Red Page
;==============================
; A should be page to take (i.e. MECHE_PAGE or similar)
2020-04-21 21:12:08 +00:00
take_red_page:
pha
2020-04-21 21:12:08 +00:00
jsr drop_current_page
pla
2020-04-21 21:12:08 +00:00
pha
2020-04-21 21:12:08 +00:00
eor RED_PAGES_TAKEN
sta RED_PAGES_TAKEN
pla
2020-04-21 21:12:08 +00:00
ora #HOLDING_RED_PAGE
2020-04-21 21:12:08 +00:00
sta HOLDING_PAGE
rts
2020-07-12 04:45:49 +00:00
;==============================
; Take White Page
;==============================
2020-04-21 21:12:08 +00:00
take_white_page:
pha
2020-04-21 21:12:08 +00:00
jsr drop_current_page
pla
2020-04-21 21:12:08 +00:00
pha
lda #1
sta WHITE_PAGE_TAKEN
pla
2020-04-21 21:12:08 +00:00
ora #HOLDING_WHITE_PAGE
2020-04-21 21:12:08 +00:00
sta HOLDING_PAGE
rts
2020-07-12 04:45:49 +00:00
;==============================
; Drop current page
;==============================
; clicked on a page while holding another
2020-04-21 21:12:08 +00:00
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
2020-04-21 21:12:08 +00:00
drop_red_page:
lda HOLDING_PAGE
and #$3f
eor RED_PAGES_TAKEN
sta RED_PAGES_TAKEN
2020-04-21 21:12:08 +00:00
rts
drop_blue_page:
lda HOLDING_PAGE
and #$3f
eor BLUE_PAGES_TAKEN
sta BLUE_PAGES_TAKEN
rts