2020-07-14 22:42:47 +00:00
|
|
|
; 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:
|
2020-05-20 06:02:19 +00:00
|
|
|
pha
|
2020-04-21 21:12:08 +00:00
|
|
|
jsr drop_current_page
|
2020-05-20 06:02:19 +00:00
|
|
|
pla
|
2020-04-21 21:12:08 +00:00
|
|
|
|
2020-05-20 06:02:19 +00:00
|
|
|
pha
|
2020-04-21 21:12:08 +00:00
|
|
|
eor BLUE_PAGES_TAKEN ; toggle the taken flag
|
|
|
|
sta BLUE_PAGES_TAKEN
|
2020-05-20 06:02:19 +00:00
|
|
|
pla
|
2020-04-21 21:12:08 +00:00
|
|
|
|
2020-05-20 06:02:19 +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:
|
2020-05-20 06:02:19 +00:00
|
|
|
pha
|
2020-04-21 21:12:08 +00:00
|
|
|
jsr drop_current_page
|
2020-05-20 06:02:19 +00:00
|
|
|
pla
|
2020-04-21 21:12:08 +00:00
|
|
|
|
2020-05-20 06:02:19 +00:00
|
|
|
pha
|
2020-04-21 21:12:08 +00:00
|
|
|
eor RED_PAGES_TAKEN
|
|
|
|
sta RED_PAGES_TAKEN
|
2020-05-20 06:02:19 +00:00
|
|
|
pla
|
2020-04-21 21:12:08 +00:00
|
|
|
|
2020-05-20 06:02:19 +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:
|
2020-05-20 06:02:19 +00:00
|
|
|
pha
|
2020-04-21 21:12:08 +00:00
|
|
|
jsr drop_current_page
|
2020-05-20 06:02:19 +00:00
|
|
|
pla
|
2020-04-21 21:12:08 +00:00
|
|
|
|
2020-05-20 06:02:19 +00:00
|
|
|
pha
|
|
|
|
lda #1
|
|
|
|
sta WHITE_PAGE_TAKEN
|
|
|
|
pla
|
2020-04-21 21:12:08 +00:00
|
|
|
|
2020-05-20 06:02:19 +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
|
|
|
|
;==============================
|
2020-05-20 06:02:19 +00:00
|
|
|
; clicked on a page while holding another
|
2020-04-21 21:12:08 +00:00
|
|
|
drop_current_page:
|
2020-05-20 06:02:19 +00:00
|
|
|
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
|
|
|
|
2020-05-20 06:02:19 +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
|
|
|
|
|
2020-05-20 06:02:19 +00:00
|
|
|
drop_blue_page:
|
|
|
|
lda HOLDING_PAGE
|
|
|
|
and #$3f
|
|
|
|
eor BLUE_PAGES_TAKEN
|
|
|
|
sta BLUE_PAGES_TAKEN
|
|
|
|
rts
|
|
|
|
|
|
|
|
|