Kanbei85
Member
For the purpose of trying to make BucketMouse's work on the Day/Night cycle functional, I have determined that an understanding of what exactly is going on with the TriggerScreen Macro must be had.
But so far nobody seems to understand what this code actually does:
Somewhere up here, the screen is getting triggered in a way that stays persistent even if you reload the screen. If we understood how this worked, we might be able to get it to change a screen into night mode, or night triggered mode, at will as well.
This would give us a second and even a third triggered state for the screen, which could be highly useful. I have need of it already, because it could solve the problem that pickups don't stay gone after you collect them.
But so far nobody seems to understand what this code actually does:
MACRO TriggerScreen arg0
;; arg0 = screen to change, usually held in variable screenType
TXA
STA tempx
TYA
STA tempy
lda arg0 ;; this is the value of the screen to change.
AND #%00000111 ;; look at last bits to know what bit to check, 0-7
TAX
LDA ValToBitTable_inverse,x
STA temp2
lda arg0 ;; this is the value of the screen to change
LSR
LSR
LSR
;;; now we have the right *byte* out of the 32 needed for 256 screen bytes
TAY
LDA screenTriggers,y ;; now the rigth bit is loaded into the accum
ORA temp2
STA screenTriggers,y
LDX tempx
LDY tempy
ENDM
Somewhere up here, the screen is getting triggered in a way that stays persistent even if you reload the screen. If we understood how this worked, we might be able to get it to change a screen into night mode, or night triggered mode, at will as well.
This would give us a second and even a third triggered state for the screen, which could be highly useful. I have need of it already, because it could solve the problem that pickups don't stay gone after you collect them.