Note: Refer to TimerHacks.asm for actual code update; this file is now out of date. 90:E0E6 JSL $809DE7 - Call timer code. If SEC at return, white screen of death Run 9DFB,X (X is 2*0943, the timer type) Options: 9E1A, 9E09, 9E1C, 9E2F, 9E41, 9E58, 9E89 .. only 6 options. Easily expanded though 1: Center timer, set to 1 minute, set to type 3 JSL $809E93 ; $1E93 IN ROM LDA #$0100 JSL $809E8C ; $1E8C IN ROM LDA #$8003 STA $0943 0: Nothing CLC RTS 2: Center timer, set to 3 minutes, set to type 3 JSL $809E93 ; $1E93 IN ROM LDA #$0300 JSL $809E8C ; $1E8C IN ROM LDA #$8003 STA $0943 CLC RTS 3: Wait 16 frames then continue to 4 SEP #$20 INC $0948 LDA $0948 CMP #$10 BCC BRANCH_ALPHA INC $0943 BRANCH_ALPHA: REP #$21 RTS 4: Count down timer. Wait 80 frames then continue to 5 SEP #$20 INC $0948 LDA $0948 CMP #$60 BCC BRANCH_BETA STZ $0948 INC $0943 BRANCH_BETA: REP #$20 JMP $9EA9 ; $1EA9 IN ROM 5: Count down timer. Move timer to DC,30. When it's there, move on to 6. LDY #$0000 LDA #$00E0 CLC ADC $0948 CMP #$DC00 BCC BRANCH_ZETA INY LDA #$DC00 BRANCH_ZETA: STA $0948 LDA #$FF3F CLC ADC $094A CMP #$3000 BCS BRANCH_THETA INY LDA #$3000 BRANCH_THETA: STA $094A CPY #$0002 BNE BRANCH_IOTA INC $0943 BRANCH_IOTA: ;And 6: Count down timer JMP $9EA9 ; $1EA9 IN ROM 80:9E8C: Set centiseconds to 0 and seconds/minutes to Accumulator STZ $0945 STA $0946 RTL 80:9E93: Place timer at center of screen, 0 seconds / centiseconds, and type 0. LDA #$8000 STA $0948 LDA #$8000 STA $094A STZ $0945 STZ $0946 STZ $0943 RTL 80:9EA9: Decrement timer SEP #$39 LDA $05B6 AND #$7F TAX LDA $0945 SBC $9EEC, X STA $0945 BCS BRANCH_GAMMA LDA $0946 SBC #$00 STA $0946 BCS BRANCH_GAMMA LDA $0947 SBC #$00 STA $0947 BCC BRANCH_DELTA LDA #$59 STA $0946 BRA BRANCH_GAMMA BRANCH_DELTA: STZ $0945 STZ $0946 STZ $0947 BRANCH_GAMMA: REP #$39 LDA $0945 ORA $0946 BNE BRANCH_EPSILON SEC BRANCH_EPSILON: RTS TimerTable: ;Was 9EEC DB 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2 Things I'll need: Store any given time to timer, start timer (Go to count down) Count timer down (stop at 0) Count timer up (stop at 59'59"99) JSL $809F6C - Display timer (run when 0943 is not 0) I may as well disassemble, and completely rewrite this code later. Will handle movement of timer (use high byte of 0943 for instruction index, and low of 0948 and 094A for variables) Instruction options: Display normal Display glitched (room dependant) Wait 0948 frames till 094A instruction (will probably simplify this later) Move 7E:0943 Timer type (00 = No timer, 01 = Count down, 02 = Count up) 7E:0944 Timer movement (00 = Do nothing, 01 = Center timer, 02 = Move to topright) 7E:0945 Timer, centiseconds (in decimal) 7E:0946 Timer, seconds (in decimal) 7E:0947 Timer, minutes (in decimal) 7E:0948 Timer Y position (pixels) 7E:0949 Timer X position (pixels) 7E:094A Timer Display (0 = normal, 1 = scroll with screen, 2 = glitched graphics) 7E:094B Timer Motion Delay XKAS CODE START org $82836F JSL TimerMotion org $828390 JSL TimerMotion org $82E267 JSL TimerMotion org $82E297 JSL TimerMotion org $90E10F JSL TimerMotion org $90E114 JSL TimerMotion org $90E1C3 JSL TimerMotion org $90E1F2 JSL TimerMotion org $809DFB ;Stop before 80:9FD4 TimerModifications: DW NoTimer, CountDown, CountUp ;Fill with as many as needed NoTimer: CLC RTS GetModifier: LDA $05B6 STA $4204 SEP #$38 LDA #$03 STA $4206 NOP NOP CLC RTS CountDown: JSR GetModifier LDA #$99 LDX $4216 BEQ + DEC + ADC $0945 STA $0945 BCS + LDA $0946 SBC #$00 STA $0946 BCS + LDA $0947 SBC #$00 STA $0947 BCC ++ LDA #$59 STA $0946 BRA + ++ STZ $0945 STZ $0946 STZ $0947 + REP #$39 LDA $0945 ORA $0946 BNE + SEC + RTS CountUp: JSR GetModifier LDA #$01 LDX $4216 BEQ + INC + ADC $0945 STA $0945 BCC +++ LDA $0946 ADC #$00 CMP #$60 BNE + LDA $0947 ADC #$01 BCS ++ STA $0947 TDC + STA $0946 ++ REP #$39 RTS TimerMotion: PHB PHK PLB LDA $0944 AND #$00FF BEQ ++ DEC ASL TAX JSR (TimerMotions,X) ++ LDA $094A AND #$00FF ASL TAX JMP (TimerDisplays,X) TimerDisplays: DW NormalDisplay, GlitchedDisplay, ScrollingDisplay NormalDisplay: LDY #$A060 TDC JSR NDisplay1 LDA $0947 LDX #$FFE4 JSR NDisplay2 LDA $0946 LDX #$FFFC JSR NDisplay2 LDA $0945 LDX #$0014 JSR NDisplay2 PLB RTL NDisplay2: PHX PHA AND #$00F0 LSR A LSR A LSR A TAX LDY $9FD4, X LDA $03, S JSR NDisplay1 PLA AND #$000F ASL A TAX LDY $9FD4, X PLA ADC #$0008 NDisplay1: STA $14 LDA $0949 AND #$00FF CLC ADC $14 STA $14 LDA $0948 AND #$00FF STA $12 LDA #$0A00 STA $16 JSL $81879F ; $879F IN ROM RTS GlitchedDisplay: LDY.w #GT TDC JSR NDisplay1 LDA $0947 LDX #$FFE4 JSR GDisplay2 LDA $0946 LDX #$FFFC JSR GDisplay2 LDA $0945 LDX #$0014 JSR GDisplay2 PLB RTL GDisplay2: PHX PHA AND #$00F0 LSR A LSR A LSR A TAX LDY.w GNumbers, X LDA $03, S JSR NDisplay1 PLA AND #$000F ASL A TAX LDY.w GNumbers, X PLA ADC #$0008 JMP NDisplay1 GNumbers: DW G0, G1, G2, G3, G4, G5, G6, G7, G8, G9 G0: DB $02,$00, $FC,$01,$00,$BA,$3B DB $FC,$01,$F8,$B0,$3B G1: DB $02,$00, $FC,$01,$00,$BB,$3B DB $FC,$01,$F8,$B1,$3B G2: DB $02,$00, $FC,$01,$00,$BC,$3B DB $FC,$01,$F8,$B2,$3B G3: DB $02,$00, $FC,$01,$00,$BD,$3B DB $FC,$01,$F8,$B3,$3B G4: DB $02,$00, $FC,$01,$00,$BE,$3B DB $FC,$01,$F8,$B4,$3B G5: DB $02,$00, $FC,$01,$00,$BF,$3B DB $FC,$01,$F8,$B5,$3B G6: DB $02,$00, $FC,$01,$00,$C0,$3B DB $FC,$01,$F8,$B6,$3B G7: DB $02,$00, $FC,$01,$00,$C1,$3B DB $FC,$01,$F8,$B7,$3B G8: DB $02,$00, $FC,$01,$00,$C2,$3B DB $FC,$01,$F8,$B8,$3B G9: DB $02,$00, $FC,$01,$00,$C3,$3B DB $FC,$01,$F8,$B9,$3B GT: DB $05,$00, $F0,$01,$F0,$C8,$3B DB $E8,$01,$F0,$C7,$3B DB $E0,$01,$F0,$C6,$3B DB $08,$00,$F8,$C5,$3B DB $F0,$01,$F8,$C4,$3B ScrollingDisplay: LDY #$A060 TDC JSR SDisplay1 LDA $0947 LDX #$FFE4 JSR SDisplay2 LDA $0946 LDX #$FFFC JSR SDisplay2 LDA $0945 LDX #$0014 JSR SDisplay2 PLB RTL SDisplay2: PHX PHA AND #$00F0 LSR A LSR A LSR A TAX LDY $9FD4, X LDA $03, S JSR SDisplay1 PLA AND #$000F ASL A TAX LDY $9FD4, X PLA ADC #$0008 SDisplay1: STA $14 LDA $0949 SEC SBC $0911 AND #$00FF CLC ADC $14 STA $14 LDA $0948 SEC SBC $0915 AND #$00FF STA $12 LDA #$0A00 STA $16 JSL $81879F ; $879F IN ROM RTS TimerMotions: DW CenterTimer,Delay,MoveUpRight CenterTimer: LDA #$8080 STA $0948 INC $0944 LDA #$FF00 STA $094A RTS Delay: LDA $094B AND #$00FF BEQ + DEC $094B RTS + INC $0944 RTS MoveUpRight: LDA $0948 SEP #$20 CMP #$31 SBC #$00 STA $0948 XBA INC STA $0949 CMP #$DC BNE + STZ $0944 + REP #$20 RTS ;Switch to later in bank when this area is full. DO NOT OVERWRITE TOO MUCH XKAS CODE END Implementation notes: A6C126 is where Ridley sets it.