Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- norom
- macro org(bank, offset)
- org $10+((<offset>-$8000)%$2000)+($2000*<bank>)
- base <offset>
- endmacro
- !dropped_count_pos = $42
- !input_display_pos = $22
- !ud_tile = $85
- !uD_tile = $86
- !Ud_tile = $87
- !UD_tile = $89
- !ab_tile = $80
- !aB_tile = $82
- !Ab_tile = $83
- !AB_tile = $84
- !l_tile = $8A
- !L_tile = $8B
- !r_tile = $8D
- !R_tile = $8E
- current_input = $F7
- counter_60hz = $11
- previous_60hz = $1F
- dropped_frames = $0500
- real_frames_elapsed = $0501
- timer_frames = $0502
- timer_seconds = $0503
- timer_minutes = $0504
- jump_fcount = $1F
- is_jumping_r = $0505
- jump_x_speed = $0506
- coords_1y = $0507
- jump_x_pos = $0508
- jump_x_sub = $0509
- disp_y_speed = $050A
- attempt_count = $050B
- frames_held = $050C
- sb_score = $7F4A
- player_in_air = $D8
- player_x_pos = $90
- player_x_sub = $074D
- player_x_speed = $BD
- player_y_pos = $A2
- player_y_sub = $075F
- player_y_speed = $CF
- ; $0300-$036B
- gfx_buffer_index = $0300
- gfx_buffer = $0301
- ; increase 60Hz counter every frame from NMI
- %org(31, $F57E)
- JSR nmi_hijack
- %org(31, $E911)
- nmi_hijack:
- INC counter_60hz
- JMP $FC6F
- ; dont get cards hmm
- ; %org(31, $FD44)
- ; PHA
- ; %org(30, $8DD8)
- ; JSR $96E5
- %org(30, $9701)
- JSR every_frame
- %org(30, $9614)
- every_frame:
- STA $1C
- CLI
- LDA is_jumping_r
- BNE .check_jump_end
- ; check jump start
- LDA.b player_in_air
- BNE .check_pipe_stuff
- LDA.b player_x_speed
- CMP #$08
- BMI .nope
- LDA.b current_input
- BPL .nope
- LDA.b player_y_pos
- CMP #$80
- BNE .nope
- ; detected jump to the right
- INC is_jumping_r
- LDA.b player_x_pos
- STA jump_x_pos
- LDA player_x_sub
- STA jump_x_sub
- LDA player_x_speed
- STA jump_x_speed
- LDA #$00
- STA.b jump_fcount
- RTS
- .check_jump_end:
- INC.b jump_fcount
- LDA.b current_input
- BMI .check_pipe_stuff
- ; done jumping
- DEC is_jumping_r
- LDA.b jump_fcount
- STA frames_held
- .check_pipe_stuff:
- LDA.b player_x_speed
- CMP #$38
- BMI .nope
- LDA.b player_y_speed
- BMI .nope
- ; accept 5E-61 range
- LDA player_y_pos
- SEC
- SBC #$5E
- CMP #$04
- BCS .nope
- INC attempt_count
- ; LDA.b player_x_pos
- ; STA coords_1x
- LDA.b player_y_pos
- STA coords_1y
- LDA.b player_y_speed
- STA disp_y_speed
- .nope:
- RTS
- warnpc $A000
- %org(26, $B073)
- coins:
- LDY #$00
- LDA frames_held
- CMP #100
- BCC +
- SBC #100
- STA frames_held
- JMP $B094
- +
- JMP $B09F
- ; %org(30, $897D)
- ; STA $7CF2
- ; JSR level_transition
- ; status bar template
- org $35438
- db $2B, $28
- db $0C, $EF, $EF, $EF, $EF, $EF, $EF, $AE, $AF, $FE, $EC, $F0, $F0
- db $2B, $45
- db $0F, $FE, $F0, $FE, $F0, $F0, $F0, $F0, $F0, $F0, $FE, $FE, $ED, $F0, $F0, $F0
- db $00
- ; draw lag frames instead of (M)/(L)
- ; %org(26, $A3CD)
- ; JSR draw_dropped_frames
- %org(26, $B175)
- score:
- LDA $65
- ORA $66
- BNE .level
- RTS
- .level:
- LDY #$00
- LDA jump_x_pos
- JSR draw_hex_to_score
- INY
- LDA jump_x_sub
- LSR
- LSR
- LSR
- LSR
- JSR draw_hex_to_score_low
- LDY #$03
- LDA jump_x_speed
- JSR draw_hex_to_score
- INY
- LDA coords_1y
- JSR draw_hex_to_score_low
- ; can draw other stuff here
- JSR draw_saved_y_speed
- JMP draw_input_display
- draw_hex_to_score:
- PHA
- LSR
- LSR
- LSR
- LSR
- CMP #$0A
- BCC +
- SBC #$6A
- +
- ADC #$F0
- STA sb_score,y
- PLA
- .low:
- AND #$0F
- CMP #$0A
- BCC +
- SBC #$6A
- +
- ADC #$F0
- STA sb_score+1,y
- RTS
- warnpc $B24A
- ; meme
- %org(10, $CF1C)
- JSR check_if_hands_asleep
- ; free space
- %org(10, $D550)
- check_if_hands_asleep:
- LDA $7F53
- BNE .no_hand
- LDA $0746,x
- CMP #$04
- BEQ .no_hand
- LDA $0782,x
- RTS
- .no_hand:
- LDA #$01
- RTS
- ; anchor is a powerup
- %org(26, $A554)
- dw $A5B8
- ; anchor sfx
- %org(26, $A55C)
- db $90
- %org(26, $A5CC)
- JSR check_small_powerup
- %org(26, $B03C)
- ; attempt count to lives counter
- lives:
- LDA attempt_count
- BPL +
- EOR #$FF
- CLC
- ADC #$01
- +
- LDY #$00
- JMP $B056
- ; empty
- %org(26, $B520)
- draw_saved_y_speed:
- LDY gfx_buffer_index
- LDA disp_y_speed
- ; decimal
- ; LDX #$F0
- ; -
- ; CMP #10
- ; BCC +
- ; SBC #10
- ; INX
- ; BCS -
- ; +
- ; ORA #$F0
- ; STA gfx_buffer+4,y
- ; TXA
- ; STA gfx_buffer+3,y
- ; hex
- PHA
- LSR
- LSR
- LSR
- LSR
- CMP #$0A ; adjust tile # for A-F digits
- BCC +
- SBC #$6A
- +
- CLC
- ADC #$F0
- STA gfx_buffer+3,y
- PLA
- AND #$0F
- CMP #$0A
- BCC +
- SBC #$6A
- +
- CLC
- ADC #$F0
- STA gfx_buffer+4,y
- ; block terminator
- LDA #$00
- STA gfx_buffer+5,y
- ; copypasta
- LDX #$27
- LDA $03EF ; vertical level
- BNE ++
- LDX #$2B
- LDA $070A ; level tileset
- CMP #16
- BEQ +
- CMP #17
- BNE ++
- +
- LDX #$23
- ++
- TXA
- ; vram hi
- STA gfx_buffer,y
- ; vram lo
- LDA #!dropped_count_pos
- STA gfx_buffer+1,y
- ; block size
- LDA #$02
- STA gfx_buffer+2,y
- ; update index
- LDA gfx_buffer_index
- CLC
- ADC #$05
- STA gfx_buffer_index
- RTS
- check_small_powerup:
- CMP #$0A
- BNE +
- LDA #$00
- +
- ASL
- ASL
- TAY
- RTS
- draw_input_display:
- LDY gfx_buffer_index
- ;bitwise: abet udlr
- LDA current_input
- ; right
- LSR
- PHA
- LDA #!r_tile
- BCC +
- LDA #!R_tile
- +
- STA gfx_buffer+5,y
- PLA
- ; left
- LSR
- PHA
- LDA #!l_tile
- BCC +
- LDA #!L_tile
- +
- STA gfx_buffer+3,y
- PLA
- ; up/down
- PHA
- AND #$03
- TAX
- LDA .ud_tiles,x
- STA gfx_buffer+4,y
- PLA
- ; a/b
- LSR
- LSR
- LSR
- LSR
- TAX
- LDA .ab_tiles,x
- STA gfx_buffer+6,y
- ; block terminator
- LDA #$00
- STA gfx_buffer+7,y
- ; copypasta
- LDX #$27
- LDA $03EF ; vertical level
- BNE ++
- LDX #$2B
- LDA $070A ; level tileset
- CMP #16
- BEQ +
- CMP #17
- BNE ++
- +
- LDX #$23
- ++
- TXA
- ; vram hi
- STA gfx_buffer,y
- ; vram lo
- LDA #!input_display_pos
- STA gfx_buffer+1,y
- ; block size
- LDA #$04
- STA gfx_buffer+2,y
- ; update index
- LDA gfx_buffer_index
- CLC
- ADC #$07
- STA gfx_buffer_index
- RTS
- .ud_tiles:
- db !ud_tile, !uD_tile, !Ud_tile, !UD_tile
- .ab_tiles:
- db !ab_tile, !aB_tile, !Ab_tile, !AB_tile
- warnpc $C000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement