Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .include Routines\BASE_4_5\\Game\Subroutines\TimerEndScripts.asm
- 09260 ;;; 00 = Loop
- 09260 end_loop_action:
- 09260
- 09260 60 RTS
- 09261 ;;; 01 = Advance
- 09261 advance_action:
- 09261 BD 9C 04 LDA Object_frame,x
- 09264 4A LSR
- 09265 4A LSR
- 09266 4A LSR
- 09267 29 07 AND #%00000111
- 09269 18 CLC
- 0926A 69 01 ADC #$01
- 0926C 29 07 AND #%00000111
- 0926E 85 08 STA tempB
- 09270 ;STA tempD ;; the action frame that was assigned during create macro.
- 09270 ;;;; object behavior tables are with the lut table.
- 09270 ;;;; the lut table is in bank 1C.
- 09270 ; SwitchBank #$1C
- 09270 ; ;;; Then, get the behavior for that object on that frame number.
- 09270 ; LDY Object_type,x
- 09270 ; LDA ObjectBehaviorTableLo,y
- 09270 ; STA pointer
- 09270 ; LDA ObjectBehaviorTableHi,y
- 09270 ; STA pointer+1
- 09270 ; LDY tempD
- 09270 ; LDA (pointer),y
- 09270 ; AND #%00001111
- 09270 ; STA tempB
- 09270 ; ReturnBank
- 09270 A5 08 LDA tempB
- 09272 0A ASL
- 09273 0A ASL
- 09274 0A ASL
- 09275 85 09 STA tempC
- 09277 BD 9C 04 LDA Object_frame,x
- 0927A 29 C7 AND #%11000111
- 0927C 05 09 ORA tempC
- 0927E 9D 9C 04 STA Object_frame,x
- 09281
- 09281 8A TXA
- 09282 85 07 STA tempA
- 09284
- 09284 8A 48 A5 07 85 0C A5 08.. DoObjectAction tempA, tempB
- 092AC ; ;arg0 = what object?
- 092AC ;arg1 = what step behavior?
- 092AC 60 RTS
- 092AD ;;; 02 = Repeat
- 092AD repeat_action:
- 092AD BD 9C 04 LDA Object_frame,x
- 092B0 4A LSR
- 092B1 4A LSR
- 092B2 4A LSR
- 092B3 29 07 AND #%00000111
- 092B5 85 08 STA tempB
- 092B7
- 092B7 8A TXA
- 092B8 85 07 STA tempA
- 092BA
- 092BA 8A 48 A5 07 85 0C A5 08.. DoObjectAction tempA, tempB
- 092E2 ; ;arg0 = what object?
- 092E2 ;arg1 = what step behavior?
- 092E2 60 RTS
- 092E3 ;;; 03 = Go To First
- 092E3 goToFirst_action:
- 092E3
- 092E3 A9 00 LDA #$00
- 092E5 85 08 STA tempB
- 092E7 ;;;; HURT END
- 092E7 BD 9C 04 LDA Object_frame,x
- 092EA 29 38 AND #%00111000
- 092EC C9 38 CMP #%00111000
- 092EE D0 16 BNE +notHurtFrame
- 092F0 A9 00 LDA #$00
- 092F2 9D 5B 04 STA Object_h_speed_hi,x
- 092F5 9D 4E 04 STA Object_h_speed_lo,x
- 092F8 9D 75 04 STA Object_v_speed_hi,x
- 092FB 9D 68 04 STA Object_v_speed_lo,x
- 092FE BD A9 04 LDA Object_direction,x
- 09301 29 0F AND #%00001111
- 09303 9D A9 04 STA Object_direction,x
- 09306 ;;;;;;;;;;;;;;;;;;;;
- 09306 +notHurtFrame
- 09306
- 09306 BD 9C 04 LDA Object_frame,x
- 09309 29 C7 AND #%11000111
- 0930B 9D 9C 04 STA Object_frame,x
- 0930E
- 0930E
- 0930E 8A TXA
- 0930F 85 07 STA tempA
- 09311
- 09311 8A 48 A5 07 85 0C A5 08.. DoObjectAction tempA, tempB
- 09339 ; ;arg0 = what object?
- 09339 ;arg1 = what step behavior?
- 09339 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 09339 ;; turn off move towards point if current action is 7.
- 09339 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 09339 60 RTS
- 0933A ;;; 04 = Go To Last
- 0933A goToLast_action:
- 0933A A9 07 LDA #$07
- 0933C 85 08 STA tempB
- 0933E
- 0933E
- 0933E BD 9C 04 LDA Object_frame,x
- 09341 09 38 ora #%00111000
- 09343 9D 9C 04 STA Object_frame,x
- 09346
- 09346 8A TXA
- 09347 85 07 STA tempA
- 09349
- 09349 8A 48 A5 07 85 0C A5 08.. DoObjectAction tempA, tempB
- 09371 ; ;arg0 = what object?
- 09371 ;arg1 = what step behavior?
- 09371 60 RTS
- 09372 ;;; 05 = Go To Previous
- 09372 goToPrev_action:
- 09372 BD 9C 04 LDA Object_frame,x
- 09375 BD 9C 04 LDA Object_frame,x
- 09378 4A LSR
- 09379 4A LSR
- 0937A 4A LSR
- 0937B 29 07 AND #%00000111
- 0937D 38 SEC
- 0937E E9 01 SBC #$01
- 09380 29 07 AND #%00000111
- 09382 85 08 STA tempB ;; the action frame that was assigned during create macro.
- 09384 ;;;; object behavior tables are with the lut table.
- 09384 ;;;; the lut table is in bank 1C.
- 09384 0A ASL
- 09385 0A ASL
- 09386 0A ASL
- 09387 85 09 STA tempC
- 09389 BD 9C 04 LDA Object_frame,x
- 0938C 29 C7 AND #%11000111
- 0938E 05 09 ORA tempC
- 09390 9D 9C 04 STA Object_frame,x
- 09393
- 09393 8A TXA
- 09394 85 07 STA tempA
- 09396
- 09396 8A 48 A5 07 85 0C A5 08.. DoObjectAction tempA, tempB
- 093BE ; ;arg0 = what object?
- 093BE ;arg1 = what step behavior?
- 093BE 60 RTS
- 093BF ;;; 06 = Destroy Me
- 093BF destroyMe_action:
- 093BF BD 00 04 29 3F 9D 00 04 DestroyObject
- 093C7 60 RTS
- 093C8 ;;; 07 = Go To Warp
- 093C8 goToWarp_action:
- 093C8 AD C8 06 8D A4 06 AD A3.. WarpToScreen warpToMap, warpToScreen, #$01
- 09407 60 RTS
- 09408 ;;; 08 = Show Message (1)
- 09408 show_message_action
- 09408
- 09408 60 RTS
- 09409 ;;; 09 = Go To Continue
- 09409 goToContinue_action:
- 09409 AD D5 06 LDA continueMap
- 0940C 8D A4 06 STA warpMap
- 0940F
- 0940F AD D2 06 LDA continueScreen
- 09412 8D 74 06 STA currentNametable
- 09415
- 09415 AE 6D 06 LDX player1_object
- 09418 9D 27 04 STA Object_screen,x
- 0941B
- 0941B A9 02 LDA #$02 ;; this is continue type warp.
- 0941D 8D A5 06 STA screenTransitionType ;; is of warp type
- 09420
- 09420
- 09420 AD AB 06 LDA gameHandler
- 09423 09 80 ORA #%10000000
- 09425 8D AB 06 STA gameHandler ;; this will set the next game loop to update the screen.
- 09428 8A 48 AD 6D 06 85 0C A9.. ChangeActionStep player1_object, #$00
- 09438 AE 6D 06 LDX player1_object
- 0943B A9 00 LDA #$00000000
- 0943D 9D A9 04 STA Object_direction,x
- 09440 60 RTS
- 09441 ;;; 10 = Restart Screen
- 09441 restartScreen_action:
- 09441 A9 02 LDA #$02
- 09443 8D A5 06 STA screenTransitionType
- 09446 AD AB 06 LDA gameHandler
- 09449 09 80 ORA #%10000000
- 0944B 8D AB 06 STA gameHandler ;; this will set the next game loop to update the screen.
- 0944E 8A 48 AD 6D 06 85 0C A9.. ChangeActionStep player1_object, #$00
- 0945E AE 6D 06 LDX player1_object
- 09461 A9 00 LDA #$00000000
- 09463 9D A9 04 STA Object_direction,x
- 09466 60 RTS
- 09467 ;;; 11 = Restart Game
- 09467 restartGame_action:
- 09467 4C 00 C0 JMP RESET
- 0946A 60 RTS
- 0946B ;;; 12 = User 0
- 0946B userEnd0_action:
- 0946B 60 RTS
- 0946C ;;; 13 = User 1
- 0946C userEnd1_action:
- 0946C 60 RTS
- 0946D
- 0946D
- 0946D EndAnimAndActions_Lo:
- 0946D 60 61 AD E3 3A 72 BF C8 .db #<end_loop_action, #<advance_action, #<repeat_action, #<goToFirst_action, #<goToLast_action, #<goToPrev_action, #<destroyMe_action, #<goToWarp_action
- 09475 08 09 41 67 6B 6C .db #<show_message_action, #<goToContinue_action, #<restartScreen_action, #<restartGame_action, #<userEnd0_action, #<userEnd1_action
- 0947B
- 0947B EndAnimAndActions_Hi:
- 0947B 92 92 92 92 93 93 93 93 .db #>end_loop_action, #>advance_action, #>repeat_action, #>goToFirst_action, #>goToLast_action, #>goToPrev_action, #>destroyMe_action, #>goToWarp_action
- 09483 94 94 94 94 94 94 .db #>show_message_action, #>goToContinue_action, #>restartScreen_action, #>restartGame_action, #>userEnd0_action, #>userEnd1_action
- 09489
- 09489
- 09489 .include Routines\BASE_4_5\\Game\Subroutines\doObjectAction.asm
- 09489 doObjectAction:
- 09489 8A TXA
- 0948A 48 PHA
- 0948B 98 TYA
- 0948C 48 PHA
- 0948D ;arg0 = what object?
- 0948D ;arg1 = what step behavior?
- 0948D A6 0C LDX arg0_hold
- 0948F ;SwitchBank #$1C
- 0948F
- 0948F
- 0948F BC 8F 04 LDY Object_type,x
- 09492 B9 D0 81 LDA ObjectBehaviorTableLo,y
- 09495 85 14 STA temp16
- 09497 B9 10 83 LDA ObjectBehaviorTableHi,y
- 0949A 85 15 STA temp16+1
- 0949C A4 0D LDY arg1_hold
- 0949E B1 14 LDA (temp16),y
- 094A0
- 094A0 ;;; this now holds the action type id and the action timer.
- 094A0 ;;; xxxxxyyy: x=action timer, y=action type, 0-7.
- 094A0 85 00 STA temp
- 094A2 29 0F AND #%00001111
- 094A4 85 07 STA tempA ;; use this to "do" the action.
- 094A6
- 094A6
- 094A6 A5 00 LDA temp
- 094A8 ;;; RIGHT HERE, assing the timer.
- 094A8 4A LSR
- 094A9 4A LSR
- 094AA 4A LSR
- 094AB 4A LSR
- 094AC D0 09 BNE notZeroForActionTimer ;;
- 094AE ;; set to a random number if zero
- 094AE 20 DD DD JSR doGetRandomNumber
- 094B1 29 3F AND #%00111111 ; 0-127 for a timer.
- 094B3 0A ASL
- 094B4 4C BB 94 JMP gotNewActionTimer
- 094B7 notZeroForActionTimer:
- 094B7 0A ASL
- 094B8 0A ASL
- 094B9 0A ASL
- 094BA 0A ASL
- 094BB gotNewActionTimer:
- 094BB 9D C3 04 STA Object_action_timer,x
- 094BE
- 094BE ;;;;;;;;;;;;;;;;;;;;;;;
- 094BE ;;; RESET ANIMATION TIMER
- 094BE ;;;;;;;;;;;;;;;;;;;;;;;;;
- 094BE BC 8F 04 LDY Object_type,x
- 094C1 B9 80 81 LDA ObjectAnimationSpeedTableLo,y
- 094C4 85 14 STA temp16
- 094C6 B9 C0 82 LDA ObjectAnimationSpeedTableHi,y
- 094C9 85 15 STA temp16+1
- 094CB
- 094CB BD 9C 04 LDA Object_frame,x
- 094CE 4A LSR
- 094CF 4A LSR
- 094D0 4A LSR
- 094D1 29 07 AND #%00000111
- 094D3 A8 TAY
- 094D4
- 094D4 B1 14 LDA (temp16),y ;; this now points to the proper spot on the anim speed table.
- 094D6 ;; we need to capture that number.
- 094D6 ;; Its high nibble is the "animation type"
- 094D6 29 0F AND #%00001111
- 094D8 ;; Now we have a value 0-16.
- 094D8 ;; This correlates to animation speed, but it probably shouldn't be a one-to-one comparision.
- 094D8 0A ASL
- 094D9 0A ASL
- 094DA 9D B6 04 STA Object_animation_timer,x
- 094DD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 094DD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 094DD
- 094DD BD 9C 04 LDA Object_frame,x
- 094E0 29 F8 AND #%11111000
- 094E2 9D 9C 04 STA Object_frame,x ;; reset animation frame.
- 094E5
- 094E5
- 094E5 A4 07 LDY tempA
- 094E7
- 094E7 B9 29 FB LDA AI_table_lo,y
- 094EA 85 14 STA temp16
- 094EC B9 39 FB LDA AI_table_hi,y
- 094EF 85 15 STA temp16+1
- 094F1
- 094F1 20 F7 94 JSR doObjectActionTrampoline
- 094F4 4C FA 94 JMP pastObjectActionTrampoline
- 094F7 doObjectActionTrampoline:
- 094F7 6C 14 00 JMP (temp16)
- 094FA ; ;;; make sure that the behavior ends in an RTS, and then it will
- 094FA ; ;;; slide right back to this part of the code.
- 094FA pastObjectActionTrampoline:
- 094FA ;;; Set this step's vulnerabilities.
- 094FA BC 8F 04 LDY Object_type,x
- 094FD B9 70 82 LDA VulnerabilityTableLo,y
- 09500 85 14 STA temp16
- 09502 B9 B0 83 LDA VulnerabilityTableHi,y
- 09505 85 15 STA temp16+1
- 09507 BD 9C 04 LDA Object_frame,x
- 0950A 4A LSR
- 0950B 4A LSR
- 0950C 4A LSR
- 0950D 29 07 AND #%00000111
- 0950F A8 TAY
- 09510 B1 14 LDA (temp16),y
- 09512 9D EA 04 STA Object_vulnerability,x
- 09515
- 09515
- 09515 ;ReturnBank
- 09515 68 PLA
- 09516 A8 TAY
- 09517 68 PLA
- 09518 AA TAX
- 09519 60 RTS0951A ;========================================================
- 0951A
- 0951A .include "Routines\BASE_4_5\Game\Subroutines\doCompareBoundingBoxes_multiScreen.asm"
- 0951A ;;;
- 0951A doCompareBoundingBoxes:
- 0951A ;;; more complicated than this
- 0951A ; LDA self_screen
- 0951A ; CMP other_screen
- 0951A ; BNE noBboxCollision
- 0951A
- 0951A
- 0951A ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Here we will check the horizontal collision.
- 0951A ;;; First we need to check the RIGHT SCREEN + RIGHT BBOX of self against the
- 0951A ;;; LEFT SCREEN + LEFT BBOX of other. If it is less, then there is no collision.
- 0951A
- 0951A AD DC 06 LDA self_screen_right
- 0951D CD DD 06 CMP other_screen_left
- 09520 F0 03 BEQ +theseAreEqual
- 09522 ;;; the self screen and other screen are not equal.
- 09522 ;;; But if the self screen is MORE than the other screen,
- 09522 ;;; it is still possible that this could return a collision.
- 09522 4C 40 95 JMP +checkOtherSide
- 09525
- 09525 +theseAreEqual
- 09525 ;;; we need to check the *other* side
- 09525 AD DB 06 LDA self_screen_left
- 09528 CD DE 06 CMP other_screen_right
- 0952B F0 0B BEQ +normalBoundsCheck
- 0952D ;; this means bounds are being straddled.
- 0952D AD 70 06 LDA bounds_right
- 09530 CD 60 06 CMP other_left
- 09533 90 39 BCC +noBboxCollision
- 09535 4C 5B 95 JMP +hCol
- 09538 +normalBoundsCheck
- 09538
- 09538 ;; the self screen and other screen are equal
- 09538 ;; which means now it is a matter of checking the
- 09538 ;; self right bbox against the left bbox.
- 09538 AD 70 06 LDA bounds_right
- 0953B CD 60 06 CMP other_left
- 0953E 90 2E BCC +noBboxCollision
- 09540
- 09540
- 09540 +continueCollisionCheck
- 09540 +checkOtherSide
- 09540 AD DB 06 LDA self_screen_left
- 09543 CD DE 06 CMP other_screen_right
- 09546 F0 03 BEQ +theseAreEqual
- 09548 4C 6E 95 JMP +noBboxCollision
- 0954B +theseAreEqual
- 0954B ;;; check the *other* side
- 0954B AD DC 06 LDA self_screen_right
- 0954E CD DD 06 CMP other_screen_left
- 09551 F0 00 BEQ +normalBoundsCheck
- 09553
- 09553 +normalBoundsCheck
- 09553 AD 6F 06 LDA bounds_left
- 09556 CD 62 06 CMP other_right
- 09559 B0 13 BCS +noBboxCollision
- 0955B
- 0955B +hCol
- 0955B
- 0955B AD 63 06 LDA other_bottom
- 0955E CD 71 06 CMP bounds_top
- 09561 90 0B BCC noBboxCollision
- 09563 AD 72 06 LDA bounds_bottom
- 09566 CD 61 06 CMP other_top
- 09569 90 03 BCC noBboxCollision
- 0956B ;;;;;;;;;;;;;;;;;;
- 0956B
- 0956B ;;;;;;;;;;;;;;;;;;
- 0956B
- 0956B
- 0956B
- 0956B A9 01 LDA #$01 ;; read that YES, there was a collision here. (could make this the object ID)
- 0956D 60 RTS
- 0956E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0956E noBboxCollision;; there is no collision here horizontally.
- 0956E A9 00 LDA #$00 ;; read that NO, there was no collision.
- 09570 60 RTS
- 09571
- 09571
- 09571 getOtherColBox:
- 09571 98 TYA
- 09572 48 PHA
- 09573
- 09573 ; LDA Object_x_hi,x
- 09573 ; CLC
- 09573 ; ADC #$10
- 09573 ; LDA Object_screen,x
- 09573 ; ADC #$00
- 09573 ; STA other_screen_right
- 09573 BC 8F 04 LDY Object_type,x
- 09576
- 09576 BD 1A 04 LDA Object_x_hi,x
- 09579 18 CLC
- 0957A 79 A0 8E ADC ObjectBboxLeft,y
- 0957D 8D 60 06 STA other_left
- 09580 BD 27 04 LDA Object_screen,x
- 09583 69 00 ADC #$00
- 09585 8D DD 06 STA other_screen_left
- 09588
- 09588 AD 60 06 LDA other_left
- 0958B 18 CLC
- 0958C 79 F0 8E ADC ObjectWidth,y
- 0958F 8D 62 06 STA other_right
- 09592 BD 27 04 LDA Object_screen,x
- 09595 69 00 ADC #$00
- 09597 8D DE 06 STA other_screen_right
- 0959A
- 0959A
- 0959A AD 62 06 LDA other_right
- 0959D
- 0959D 38 SEC
- 0959E ED 60 06 SBC other_left
- 095A1 4A LSR
- 095A2 8D 64 06 STA other_center_x
- 095A5
- 095A5 B9 40 8F LDA ObjectBboxTop,y
- 095A8 18 CLC
- 095A9 7D 41 04 ADC Object_y_hi,x
- 095AC 8D 61 06 STA other_top
- 095AF 18 CLC
- 095B0 79 90 8F ADC ObjectHeight,y
- 095B3 8D 63 06 STA other_bottom
- 095B6 38 SEC
- 095B7 ED 61 06 SBC other_top
- 095BA 4A LSR
- 095BB 8D 65 06 STA other_center_y ;; self center in the vertical direction.
- 095BE ; LDA Object_screen,x
- 095BE ; STA other_screen
- 095BE
- 095BE 68 PLA
- 095BF A8 TAY
- 095C0 60 RTS095C1
- 095C1 ;; do draw sprites
- 095C1 doDrawSprites:
- 095C1 .include "Routines\BASE_4_5\Game\Space Birds\Subroutines\doDrawSprites_ShooterBase -RTS Trick.asm"
- 095C1 ;; sprite drawing routine.
- 095C1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 095C1 ;;; For horizontal scrolling games, extra attention has to be taken to draw
- 095C1 ;;; sprites off screen if they are no longer in the camera render area.
- 095C1
- 095C1 AD AB 06 LDA gameHandler
- 095C4 29 40 AND #%01000000
- 095C6 F0 03 BEQ +checkScreenFlags
- 095C8 4C 32 99 JMP doneDrawingThisSprite
- 095CB
- 095CB +checkScreenFlags
- 095CB
- 095CB AD 9F 06 LDA ScreenFlags00
- 095CE 29 80 AND #%10000000
- 095D0 F0 03 BEQ doDrawThisSprite
- 095D2 4C 32 99 JMP doneDrawingThisSprite
- 095D5 doDrawThisSprite:
- 095D5 ;;;; loaded into x is the object calling this routine.
- 095D5
- 095D5 BD 00 04 LDA Object_status,x
- 095D8 29 80 AND #OBJECT_IS_ACTIVE
- 095DA D0 03 BNE +ObjectIsActiveSoDrawIt
- 095DC 4C 32 99 JMP doneDrawingThisSprite
- 095DF
- 095DF +ObjectIsActiveSoDrawIt
- 095DF BD 1A 04 LDA Object_x_hi,x
- 095E2 38 SEC
- 095E3 ED 85 06 SBC camX
- 095E6 85 07 STA tempA
- 095E8
- 095E8 BD 41 04 LDA Object_y_hi,x
- 095EB 85 08 STA tempB
- 095ED
- 095ED BD 8F 04 LDA Object_type,x
- 095F0 0A ASL
- 095F1 AA TAX
- 095F2
- 095F2 DrawSprite_opcode_launcher:
- 095F2 BD 4E D9 LDA DrawSprite_opcode_table+1,x
- 095F5 48 PHA
- 095F6 BD 4D D9 LDA DrawSprite_opcode_table,x
- 095F9 48 PHA
- 095FA 60 RTS
- 095FB
- 095FB DrawPlayer1:
- 095FB 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$00, #%00000000
- 09620 A5 07 LDA tempA
- 09622 18 CLC
- 09623 69 08 ADC #$08
- 09625 85 01 STA temp1 ;;equals tempA plus 8
- 09627 98 48 A4 2C A5 08 99 00.. DrawSprite temp1, tempB, #$01, #%00000000
- 0964C A5 08 LDA tempB
- 0964E 18 CLC
- 0964F 69 08 ADC #$08
- 09651 85 02 STA temp2 ;; equals tempB plus 8
- 09653 98 48 A4 2C A5 02 99 00.. DrawSprite tempA, temp2, #$10, #%00000000
- 09678 98 48 A4 2C A5 02 99 00.. DrawSprite temp1, temp2, #$11, #%00000000
- 0969D 60 RTS
- 0969E
- 0969E DrawPlayer2:
- 0969E
- 0969E 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$00, #%00000001
- 096C3 A5 07 LDA tempA
- 096C5 18 CLC
- 096C6 69 08 ADC #$08
- 096C8 85 01 STA temp1 ;;equals tempA plus 8
- 096CA 98 48 A4 2C A5 08 99 00.. DrawSprite temp1, tempB, #$01, #%00000001
- 096EF A5 08 LDA tempB
- 096F1 18 CLC
- 096F2 69 08 ADC #$08
- 096F4 85 02 STA temp2 ;; equals tempB plus 8
- 096F6 98 48 A4 2C A5 02 99 00.. DrawSprite tempA, temp2, #$10, #%00000001
- 0971B 98 48 A4 2C A5 02 99 00.. DrawSprite temp1, temp2, #$11, #%00000001
- 09740 60 RTS
- 09741
- 09741
- 09741 DrawMonsterBullet:
- 09741 A5 18 LDA vBlankTimer
- 09743 29 04 AND #%00000100
- 09745 F0 28 BEQ +isEvenFrame
- 09747 ;; is Odd Frame
- 09747 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$21, #%00000010
- 0976C 4C 32 99 JMP doneDrawingThisSprite
- 0976F +isEvenFrame
- 0976F ;; Draw Alien Weapon, Game Object 2
- 0976F 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$20, #%00000010
- 09794 60 rts
- 09795
- 09795 DrawMissile1:
- 09795 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$02, #%00000000
- 097BA 60 rts
- 097BB
- 097BB DrawMissile2:
- 097BB 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$02, #%00000001
- 097E0 60 RTS
- 097E1
- 097E1 DrawObject5:
- 097E1 60 rts
- 097E2 DrawObject6:
- 097E2 60 rts
- 097E3 DrawObject7:
- 097E3 60 rts
- 097E4 DrawObject8:
- 097E4 60 rts
- 097E5 DrawObject9:
- 097E5 60 rts
- 097E6 DrawObjectA:
- 097E6 60 rts
- 097E7 DrawObjectB:
- 097E7 60 rts
- 097E8 DrawObjectC:
- 097E8 60 rts
- 097E9 DrawObjectD:
- 097E9 60 rts
- 097EA DrawObjectE:
- 097EA 60 rts
- 097EB DrawObjectF:
- 097EB 60 rts
- 097EC DrawAlien:
- 097EC 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$80, #%00000010
- 09811 A5 07 LDA tempA
- 09813 18 CLC
- 09814 69 08 ADC #$08
- 09816 85 01 STA temp1 ;;equals tempA plus 8
- 09818 98 48 A4 2C A5 08 99 00.. DrawSprite temp1, tempB, #$81, #%00000010
- 0983D A5 08 LDA tempB
- 0983F 18 CLC
- 09840 69 08 ADC #$08
- 09842 85 02 STA temp2 ;; equals tempB plus 8
- 09844 98 48 A4 2C A5 02 99 00.. DrawSprite tempA, temp2, #$90, #%00000010
- 09869 98 48 A4 2C A5 02 99 00.. DrawSprite temp1, temp2, #$91, #%00000010
- 0988E 60 rts
- 0988F DrawAlienShooter:
- 0988F 98 48 A4 2C A5 08 99 00.. DrawSprite tempA, tempB, #$80, #%00000011
- 098B4 A5 07 LDA tempA
- 098B6 18 CLC
- 098B7 69 08 ADC #$08
- 098B9 85 01 STA temp1 ;;equals tempA plus 8
- 098BB 98 48 A4 2C A5 08 99 00.. DrawSprite temp1, tempB, #$81, #%00000011
- 098E0 A5 08 LDA tempB
- 098E2 18 CLC
- 098E3 69 08 ADC #$08
- 098E5 85 02 STA temp2 ;; equals tempB plus 8
- 098E7 98 48 A4 2C A5 02 99 00.. DrawSprite tempA, temp2, #$90, #%00000011
- 0990C 98 48 A4 2C A5 02 99 00.. DrawSprite temp1, temp2, #$91, #%00000011
- 09931 60 rts
- 09932
- 09932
- 09932 doneDrawingThisSprite:
- 09932 60 rts
- 09933
- 09933 09933 60 rts
- 09934
- 09934 doUpdateSpriteTimer:
- 09934 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 09934 ;blank09934 60 RTS
- 09935
- 09935 doUpdateActionTimer:
- 09935 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 09935 ;blank09935 60 RTS
- 09936 doObjectCollisions_bank1C:
- 09936 .include "Routines\BASE_4_5\Game\Subroutines\doObjectCollisionState.asm"
- 09936 ;do object collision state09936 .include "Routines\BASE_4_5\Game\MOD_shooter\Subroutines\doHandleObjectCollisions_shooter2.asm"
- 09936
- 09936 BD 00 04 LDA Object_status,x
- 09939 29 80 AND #%10000000
- 0993B D0 03 BNE +doCheckSelfForObjectCollision
- 0993D ;; object is inactive.
- 0993D 4C C7 9A JMP +skipObjectCollisionCheck
- 09940 +doCheckSelfForObjectCollision:
- 09940 ;;STEP 2: Check for hurt state.
- 09940 ;;; In this module, monsters will use action step 7 for their hurt state.
- 09940 8A TXA
- 09941 8D B1 06 STA selfObject
- 09944 85 00 STA temp
- 09946 A6 00 BD 9C 04 4A 4A 4A.. GetActionStep temp
- 09950 C9 07 CMP #$07
- 09952 D0 03 BNE +notHurt
- 09954 4C C7 9A JMP +skipObjectCollisionCheck
- 09957 +notHurt
- 09957 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 09957 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 09957 ;;STEP 3: Set up bounds for self collision.
- 09957 8A TXA
- 09958 48 PHA
- 09959 BC 8F 04 LDY Object_type,x
- 0995C B9 20 91 LDA ObjectFlags,y
- 0995F 85 07 STA tempA ;; temp A now holds the current object flags.
- 09961 ;; collision box is still held over from the physics routine.
- 09961
- 09961 AD 7A 06 LDA xHold_screen
- 09964 ;ADC #$00
- 09964 8D DB 06 STA self_screen_left
- 09967
- 09967 ; LDA Object_x_hi,x
- 09967 ; CLC
- 09967 ; ADC #$10
- 09967 ; LDA self_screen_left
- 09967 ; ADC #$00
- 09967 ; STA self_screen_right
- 09967
- 09967 AD 79 06 LDA xHold_hi
- 0996A 18 CLC
- 0996B 6D 59 06 ADC self_left
- 0996E BD 27 04 LDA Object_screen,x
- 09971 69 00 ADC #$00
- 09973 8D DB 06 STA self_screen_left
- 09976
- 09976 AD 79 06 LDA xHold_hi
- 09979 18 CLC
- 0997A 6D 5B 06 ADC self_right
- 0997D BD 27 04 LDA Object_screen,x
- 09980 69 00 ADC #$00
- 09982 8D DC 06 STA self_screen_right
- 09985
- 09985 ; LDA Object_x_hi,x
- 09985 ; CLC
- 09985 ; ADC #$10
- 09985 ; LDA self_screen_left
- 09985 ; ADC #$00
- 09985 ; STA self_screen_right
- 09985
- 09985 AD 79 06 LDA xHold_hi;Object_x_hi,x
- 09988 18 CLC
- 09989 6D 59 06 ADC self_left
- 0998C 8D 6F 06 STA bounds_left
- 0998F
- 0998F AD 79 06 LDA xHold_hi
- 09992 18 CLC
- 09993 6D 5B 06 ADC self_right
- 09996 8D 70 06 STA bounds_right
- 09999
- 09999 AD 7C 06 LDA yHold_hi;Object_y_hi,x
- 0999C 18 CLC
- 0999D 6D 5A 06 ADC self_top
- 099A0 8D 71 06 STA bounds_top
- 099A3 AD 7C 06 LDA yHold_hi;Object_y_hi,x
- 099A6 18 CLC
- 099A7 6D 5C 06 ADC self_bottom
- 099AA 8D 72 06 STA bounds_bottom
- 099AD
- 099AD
- 099AD
- 099AD 98 TYA
- 099AE 48 PHA
- 099AF ;;; we probably want this to live inside bank 1C
- 099AF ;;; so that we can access flag data easily with no RAM.
- 099AF ;;;; Right now, in this module, it is there by default.
- 099AF ;;;; If it is not, we will have to bankswap to 1c here.
- 099AF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 099AF ;;; Check the type of object.
- 099AF ;;; If it is a weapon, it will check against monsters only.
- 099AF BD D0 04 LDA Object_flags,x
- 099B2 29 04 AND #%00000100
- 099B4 D0 03 BNE +isWeapon
- 099B6 4C 07 9A JMP +notPlayerWeapon
- 099B9 +isWeapon
- 099B9
- 099B9 A2 00 LDX #$00
- 099BB loop_objectCollision:
- 099BB EC B1 06 CPX selfObject
- 099BE D0 03 BNE +notSelfObject
- 099C0 4C FC 99 JMP +skipCollision
- 099C3 +notSelfObject
- 099C3 BD 00 04 LDA Object_status,x
- 099C6 29 80 AND #%10000000
- 099C8 D0 03 BNE +isActive
- 099CA 4C FC 99 JMP +skipCollision
- 099CD +isActive:
- 099CD BD D0 04 LDA Object_flags,x
- 099D0 29 08 AND #%00001000
- 099D2 D0 03 BNE isMonsterWeaponCol
- 099D4 4C FC 99 JMP +notAmonsterWeaponCollision
- 099D7 isMonsterWeaponCol:
- 099D7 20 71 95 JSR getOtherColBox
- 099DA 20 1A 95 JSR doCompareBoundingBoxes
- 099DD ;;; if they have collided, it is a 1
- 099DD ;;; if not, it is a zero.
- 099DD F0 1D BEQ +skipCollision
- 099DF
- 099DF 8A TXA
- 099E0 8D B2 06 STA otherObject
- 099E3 ;; There was a collision between a monster and a weapon.
- 099E3 ;; weapon is self.
- 099E3 ;; monster is other.
- 099E3 BD 00 04 29 3F 9D 00 04 DestroyObject
- 099EB ;ChangeActionStep otherObject, #$07
- 099EB
- 099EB
- 099EB 20 23 9B JSR doHandleHurtMonster
- 099EE
- 099EE AE B1 06 LDX selfObject
- 099F1 BD 00 04 29 3F 9D 00 04 DestroyObject
- 099F9 4C C3 9A JMP +done
- 099FC +skipCollision
- 099FC +notAmonsterWeaponCollision
- 099FC E8 INX
- 099FD E0 0D CPX #TOTAL_MAX_OBJECTS
- 099FF F0 03 BEQ +lastCollisionForThisObject
- 09A01 4C BB 99 JMP loop_objectCollision
- 09A04 +lastCollisionForThisObject
- 09A04 4C C3 9A JMP +done
- 09A07
- 09A07
- 09A07 +notPlayerWeapon
- 09A07
- 09A07 BD D0 04 LDA Object_flags,x
- 09A0A 29 02 AND #%00000010
- 09A0C D0 03 BNE +isPlayerForCol
- 09A0E ;; not player for collions
- 09A0E 4C C3 9A JMP +notPlayerForCollisions
- 09A11 +isPlayerForCol
- 09A11 ;;; check against monsters.
- 09A11 A2 00 LDX #$00
- 09A13 loop_objectPlayerCollisions:
- 09A13 EC B1 06 CPX selfObject
- 09A16 D0 03 BNE +notSelfObject
- 09A18 4C B5 9A JMP +skipCollision
- 09A1B +notSelfObject
- 09A1B BD 00 04 LDA Object_status,x
- 09A1E 29 80 AND #%10000000
- 09A20 D0 03 BNE +isActive
- 09A22 4C B5 9A JMP +skipCollision
- 09A25 +isActive
- 09A25 BD D0 04 LDA Object_flags,x
- 09A28 29 18 AND #%00011000
- 09A2A D0 03 BNE +isPlayerMonsterCol
- 09A2C 4C 4B 9A JMP +notPlayerMonsterCollision
- 09A2F +isPlayerMonsterCol
- 09A2F
- 09A2F 20 71 95 JSR getOtherColBox
- 09A32 20 1A 95 JSR doCompareBoundingBoxes
- 09A35 ;;; if they have collided, it is a 1
- 09A35 ;;; if not, it is a zero.
- 09A35 D0 03 BNE +dontSkipCol
- 09A37 4C B5 9A JMP +skipCollision
- 09A3A +dontSkipCol
- 09A3A 8A TXA
- 09A3B 8D B2 06 STA otherObject
- 09A3E ;; There was a collision between a monster and a weapon.
- 09A3E ;; player is self.
- 09A3E ;; monster is other.
- 09A3E ;JMP RESET
- 09A3E
- 09A3E 8A TXA
- 09A3F 48 PHA
- 09A40 AE B1 06 LDX selfObject
- 09A43 20 C8 9A JSR doHandleHurtPlayer
- 09A46 68 PLA
- 09A47 AA TAX
- 09A48
- 09A48 4C C3 9A JMP +done
- 09A4B
- 09A4B +notPlayerMonsterCollision:
- 09A4B
- 09A4B BD D0 04 LDA Object_flags,x
- 09A4E 29 20 AND #%00100000
- 09A50 D0 03 BNE +isPlayerPowerupCol
- 09A52 4C 6F 9A JMP +isNotPlayerPowerupCol
- 09A55 +isPlayerPowerupCol
- 09A55 20 71 95 JSR getOtherColBox
- 09A58 20 1A 95 JSR doCompareBoundingBoxes
- 09A5B D0 03 BNE +doCollision
- 09A5D 4C B5 9A JMP +skipCollision
- 09A60 +doCollision
- 09A60 8A TXA
- 09A61 8D B2 06 STA otherObject
- 09A64 ;; There was a collision between a player and a powerup.
- 09A64 ;; player is self.
- 09A64 ;; powerup is other.
- 09A64 BD 00 04 29 3F 9D 00 04 DestroyObject
- 09A6C .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 09A6C ;blank09A6C 4C C3 9A JMP +done
- 09A6F
- 09A6F +isNotPlayerPowerupCol
- 09A6F BD D0 04 LDA Object_flags,x
- 09A72 29 80 AND #%10000000
- 09A74 D0 03 BNE +isPlayerNPCCol
- 09A76 4C B5 9A JMP +isNotPlayerNPCCol
- 09A79 +isPlayerNPCCol
- 09A79 20 71 95 JSR getOtherColBox
- 09A7C 20 1A 95 JSR doCompareBoundingBoxes
- 09A7F F0 34 BEQ +skipCollision
- 09A81 8A TXA
- 09A82 8D B2 06 STA otherObject
- 09A85 ;; There was a collision between a player and a powerup.
- 09A85 ;; player is self.
- 09A85 ;; powerup is other.
- 09A85 8A TXA
- 09A86 48 PHA
- 09A87 AE B1 06 LDX selfObject
- 09A8A AD 7F 06 LDA xPrev
- 09A8D 9D 1A 04 STA Object_x_hi,x
- 09A90 8D 79 06 STA xHold_hi
- 09A93
- 09A93 AD 80 06 LDA yPrev
- 09A96 9D 41 04 STA Object_y_hi,x
- 09A99 8D 7C 06 STA yHold_hi
- 09A9C
- 09A9C A9 00 LDA #$00
- 09A9E 9D 4E 04 STA Object_h_speed_lo,x
- 09AA1 9D 5B 04 STA Object_h_speed_hi,x
- 09AA4 9D 68 04 STA Object_v_speed_lo,x
- 09AA7 9D 75 04 STA Object_v_speed_hi,x
- 09AAA 9D 0D 04 STA Object_x_lo,x
- 09AAD 9D 34 04 STA Object_y_lo,x
- 09AB0 68 PLA
- 09AB1 AA TAX
- 09AB2 4C C3 9A JMP +done
- 09AB5
- 09AB5 +isNotPlayerNPCCol
- 09AB5
- 09AB5 +skipCollision
- 09AB5
- 09AB5 E8 INX
- 09AB6 E0 0D CPX #TOTAL_MAX_OBJECTS
- 09AB8 F0 03 BEQ +lastCollisionForThisObject
- 09ABA 4C 13 9A JMP loop_objectPlayerCollisions
- 09ABD +lastCollisionForThisObject
- 09ABD ; PLA
- 09ABD ; TAX
- 09ABD 4C C3 9A JMP +done
- 09AC0
- 09AC0
- 09AC0 ;; Add other object to object collision types here.
- 09AC0 4C C3 9A JMP +done
- 09AC3
- 09AC3
- 09AC3 +notPlayerForCollisions
- 09AC3
- 09AC3 +done
- 09AC3 68 PLA
- 09AC4 A8 TAY
- 09AC5 68 PLA
- 09AC6 AA TAX
- 09AC7 +skipObjectCollisionCheck09AC7 60 RTS
- 09AC8
- 09AC8
- 09AC8 ;; Game specific, common
- 09AC8 doHandleHurtPlayer:
- 09AC8 .include "Routines\BASE_4_5\Game\MOD_shooter\Common\hurtWithLives_shooter.asm"
- 09AC8
- 09AC8 ;;;;;;;;;;;;;;;;;; Presumes there is a variable called myLives defined in user variables.
- 09AC8 ;;;;;;;;;;;;;;;;;; You could also create your own variable for this.
- 09AC8
- 09AC8 AD AB 06 LDA gameHandler
- 09ACB 29 80 AND #%10000000
- 09ACD F0 03 BEQ +canHurtPlayer
- 09ACF 4C 22 9B JMP +skipHurt
- 09AD2 +canHurtPlayer:
- 09AD2
- 09AD2 C6 A4 DEC myLives
- 09AD4 A5 A4 LDA myLives
- 09AD6 D0 03 BNE myLivesNotZero
- 09AD8 4C 00 C0 JMP RESET ;; game over.
- 09ADB ;;;; also could warp to game over screen here instead.
- 09ADB myLivesNotZero:
- 09ADB
- 09ADB AD D5 06 LDA continueMap
- 09ADE 8D A4 06 STA warpMap
- 09AE1
- 09AE1 AD D2 06 LDA continueScreen
- 09AE4 8D 74 06 STA currentNametable
- 09AE7 29 0F AND #%00001111
- 09AE9 8D 86 06 STA camX_hi
- 09AEC
- 09AEC AE 6D 06 LDX player1_object
- 09AEF 9D 27 04 STA Object_screen,x
- 09AF2
- 09AF2 A9 02 LDA #$02 ;; this is continue type warp.
- 09AF4 8D A5 06 STA screenTransitionType ;; is of warp type
- 09AF7
- 09AF7
- 09AF7 A9 00 LDA #$00
- 09AF9 8D 85 06 STA camX
- 09AFC 8D 84 06 sta camX_lo
- 09AFF
- 09AFF
- 09AFF
- 09AFF
- 09AFF AD 24 06 LDA updateScreenData
- 09B02 29 FB AND #%11111011
- 09B04 8D 24 06 STA updateScreenData
- 09B07 AD 8C 06 LDA scrollByte
- 09B0A 29 3E AND #%00111110
- 09B0C 09 02 ORA #%00000010
- 09B0E 8D 8C 06 STA scrollByte
- 09B11 A9 00 LDA #$00
- 09B13 8D 8A 06 STA scrollOffsetCounter
- 09B16
- 09B16 AD AB 06 LDA gameHandler
- 09B19 09 80 ORA #%10000000
- 09B1B 8D AB 06 STA gameHandler ;; this will set the next game loop to update the screen.
- 09B1E
- 09B1E A9 05 LDA #$05
- 09B20 85 A8 STA bossHealth ;; resets boss health for this level.
- 09B22
- 09B22 +skipHurt09B22 60 RTS
- 09B23 doHandleHurtMonster:
- 09B23 .include "Routines\BASE_4_5\Game\MOD_shooter\Common\doHandleHurtMonster_Shooter_CountMonsters.asm"
- 09B23
- 09B23 BD 00 04 29 3F 9D 00 04 DestroyObject
- 09B2B A9 01 8D CB 06 AD CD 06.. PlaySound #sfx_monsterdeath
- 09B38 A9 08 85 07 8A 48 98 48.. CountObjects #%00001000
- 09B61 D0 08 BNE +notZeroCount
- 09B63 ;;; if there are no more monsters left, we want to disable
- 09B63 ;;; the edge check for scrolling.
- 09B63 AD 9F 06 LDA ScreenFlags00
- 09B66 29 EF AND #%11101111
- 09B68 8D 9F 06 STA ScreenFlags00
- 09B6B
- 09B6B +notZeroCount:09B6B 60 RTS
- 09B6C
- 09B6C
- 09B6C
- 09B6C
- 09B6C ObjectLoSpriteAddressLo:
- 09B6C 60 70 80 90 A0 B0 C0 D0 .db #<GameItem0_Lo, #<GameItem1_Lo, #<GameItem2_Lo, #<GameItem3_Lo, #<GameItem4_Lo, #<GameItem5_Lo, #<GameItem6_Lo, #<GameItem7_Lo
- 09B74 E0 F0 00 10 20 30 40 50 .db #<GameItem8_Lo, #<GameItem9_Lo,#<GameItem10_Lo,#<GameItem11_Lo,#<GameItem12_Lo,#<GameItem13_Lo,#<GameItem14_Lo,#<GameItem15_Lo
- 09B7C
- 09B7C 60 70 80 80 80 80 80 80 .db #<Object0_Lo,#<Object1_Lo,#<Object2_Lo,#<Object3_Lo,#<Object4_Lo,#<Object5_Lo,#<Object6_Lo,#<Object7_Lo
- 09B84 80 80 80 80 80 80 80 80 .db #<Object8_Lo,#<Object9_Lo,#<Object10_Lo,#<Object11_Lo,#<Object12_Lo,#<Object13_Lo,#<Object14_Lo,#<Object15_Lo
- 09B8C 80 80 80 80 80 80 80 80 .db #<Object16_Lo,#<Object17_Lo,#<Object18_Lo,#<Object19_Lo,#<Object20_Lo,#<Object21_Lo,#<Object22_Lo,#<Object23_Lo
- 09B94 80 80 80 80 80 80 80 80 .db #<Object24_Lo,#<Object25_Lo,#<Object26_Lo,#<Object27_Lo,#<Object28_Lo,#<Object29_Lo,#<Object30_Lo,#<Object31_Lo
- 09B9C 80 80 80 80 80 80 80 80 .db #<Object32_Lo,#<Object33_Lo,#<Object34_Lo,#<Object35_Lo,#<Object36_Lo,#<Object37_Lo,#<Object38_Lo,#<Object39_Lo
- 09BA4 80 80 80 80 80 80 80 80 .db #<Object40_Lo,#<Object41_Lo,#<Object42_Lo,#<Object43_Lo,#<Object44_Lo,#<Object45_Lo,#<Object46_Lo,#<Object47_Lo
- 09BAC 80 80 80 80 80 80 80 80 .db #<Object48_Lo,#<Object49_Lo,#<Object50_Lo,#<Object51_Lo,#<Object52_Lo,#<Object53_Lo,#<Object54_Lo,#<Object55_Lo
- 09BB4 80 80 80 80 80 80 80 80 .db #<Object56_Lo,#<Object57_Lo,#<Object58_Lo,#<Object59_Lo,#<Object60_Lo,#<Object61_Lo,#<Object62_Lo,#<Object63_Lo
- 09BBC
- 09BBC ObjectLoSpriteAddressHi:
- 09BBC 80 80 80 80 80 80 80 80 .db #>GameItem0_Lo, #>GameItem1_Lo, #>GameItem2_Lo, #>GameItem3_Lo, #>GameItem4_Lo, #>GameItem5_Lo, #>GameItem6_Lo, #>GameItem7_Lo
- 09BC4 80 80 81 81 81 81 81 81 .db #>GameItem8_Lo, #>GameItem9_Lo,#>GameItem10_Lo,#>GameItem11_Lo,#>GameItem12_Lo,#>GameItem13_Lo,#>GameItem14_Lo,#>GameItem15_Lo
- 09BCC
- 09BCC 81 81 81 81 81 81 81 81 .db #>Object0_Lo,#>Object1_Lo,#>Object2_Lo,#>Object3_Lo,#>Object4_Lo,#>Object5_Lo,#>Object6_Lo,#>Object7_Lo
- 09BD4 81 81 81 81 81 81 81 81 .db #>Object8_Lo,#>Object9_Lo,#>Object10_Lo,#>Object11_Lo,#>Object12_Lo,#>Object13_Lo,#>Object14_Lo,#>Object15_Lo
- 09BDC 81 81 81 81 81 81 81 81 .db #>Object16_Lo,#>Object17_Lo,#>Object18_Lo,#>Object19_Lo,#>Object20_Lo,#>Object21_Lo,#>Object22_Lo,#>Object23_Lo
- 09BE4 81 81 81 81 81 81 81 81 .db #>Object24_Lo,#>Object25_Lo,#>Object26_Lo,#>Object27_Lo,#>Object28_Lo,#>Object29_Lo,#>Object30_Lo,#>Object31_Lo
- 09BEC 81 81 81 81 81 81 81 81 .db #>Object32_Lo,#>Object33_Lo,#>Object34_Lo,#>Object35_Lo,#>Object36_Lo,#>Object37_Lo,#>Object38_Lo,#>Object39_Lo
- 09BF4 81 81 81 81 81 81 81 81 .db #>Object40_Lo,#>Object41_Lo,#>Object42_Lo,#>Object43_Lo,#>Object44_Lo,#>Object45_Lo,#>Object46_Lo,#>Object47_Lo
- 09BFC 81 81 81 81 81 81 81 81 .db #>Object48_Lo,#>Object49_Lo,#>Object50_Lo,#>Object51_Lo,#>Object52_Lo,#>Object53_Lo,#>Object54_Lo,#>Object55_Lo
- 09C04 81 81 81 81 81 81 81 81 .db #>Object56_Lo,#>Object57_Lo,#>Object58_Lo,#>Object59_Lo,#>Object60_Lo,#>Object61_Lo,#>Object62_Lo,#>Object63_Lo
- 09C0C
- 09C0C
- 09C0C ObjectHiSpriteAddressLo:
- 09C0C 68 78 88 98 A8 B8 C8 D8 .db #<GameItem0_Hi, #<GameItem1_Hi, #<GameItem2_Hi, #<GameItem3_Hi, #<GameItem4_Hi, #<GameItem5_Hi, #<GameItem6_Hi, #<GameItem7_Hi
- 09C14 E8 F8 08 18 28 38 48 58 .db #<GameItem8_Hi, #<GameItem9_Hi,#<GameItem10_Hi,#<GameItem11_Hi,#<GameItem12_Hi,#<GameItem13_Hi,#<GameItem14_Hi,#<GameItem15_Hi
- 09C1C
- 09C1C 68 78 80 80 80 80 80 80 .db #<Object0_Hi,#<Object1_Hi,#<Object2_Hi,#<Object3_Hi,#<Object4_Hi,#<Object5_Hi,#<Object6_Hi,#<Object7_Hi
- 09C24 80 80 80 80 80 80 80 80 .db #<Object8_Hi,#<Object9_Hi,#<Object10_Hi,#<Object11_Hi,#<Object12_Hi,#<Object13_Hi,#<Object14_Hi,#<Object15_Hi
- 09C2C 80 80 80 80 80 80 80 80 .db #<Object16_Hi,#<Object17_Hi,#<Object18_Hi,#<Object19_Hi,#<Object20_Hi,#<Object21_Hi,#<Object22_Hi,#<Object23_Hi
- 09C34 80 80 80 80 80 80 80 80 .db #<Object24_Hi,#<Object25_Hi,#<Object26_Hi,#<Object27_Hi,#<Object28_Hi,#<Object29_Hi,#<Object30_Hi,#<Object31_Hi
- 09C3C 80 80 80 80 80 80 80 80 .db #<Object32_Hi,#<Object33_Hi,#<Object34_Hi,#<Object35_Hi,#<Object36_Hi,#<Object37_Hi,#<Object38_Hi,#<Object39_Hi
- 09C44 80 80 80 80 80 80 80 80 .db #<Object40_Hi,#<Object41_Hi,#<Object42_Hi,#<Object43_Hi,#<Object44_Hi,#<Object45_Hi,#<Object46_Hi,#<Object47_Hi
- 09C4C 80 80 80 80 80 80 80 80 .db #<Object48_Hi,#<Object49_Hi,#<Object50_Hi,#<Object51_Hi,#<Object52_Hi,#<Object53_Hi,#<Object54_Hi,#<Object55_Hi
- 09C54 80 80 80 80 80 80 80 80 .db #<Object56_Hi,#<Object57_Hi,#<Object58_Hi,#<Object59_Hi,#<Object60_Hi,#<Object61_Hi,#<Object62_Hi,#<Object63_Hi
- 09C5C
- 09C5C ObjectHiSpriteAddressHi:
- 09C5C 80 80 80 80 80 80 80 80 .db #>GameItem0_Hi, #>GameItem1_Hi, #>GameItem2_Hi, #>GameItem3_Hi, #>GameItem4_Hi, #>GameItem5_Hi, #>GameItem6_Hi, #>GameItem7_Hi
- 09C64 80 80 81 81 81 81 81 81 .db #>GameItem8_Hi, #>GameItem9_Hi,#>GameItem10_Hi,#>GameItem11_Hi,#>GameItem12_Hi,#>GameItem13_Hi,#>GameItem14_Hi,#>GameItem15_Hi
- 09C6C
- 09C6C 81 81 81 81 81 81 81 81 .db #>Object0_Hi,#>Object1_Hi,#>Object2_Hi,#>Object3_Hi,#>Object4_Hi,#>Object5_Hi,#>Object6_Hi,#>Object7_Hi
- 09C74 81 81 81 81 81 81 81 81 .db #>Object8_Hi,#>Object9_Hi,#>Object10_Hi,#>Object11_Hi,#>Object12_Hi,#>Object13_Hi,#>Object14_Hi,#>Object15_Hi
- 09C7C 81 81 81 81 81 81 81 81 .db #>Object16_Hi,#>Object17_Hi,#>Object18_Hi,#>Object19_Hi,#>Object20_Hi,#>Object21_Hi,#>Object22_Hi,#>Object23_Hi
- 09C84 81 81 81 81 81 81 81 81 .db #>Object24_Hi,#>Object25_Hi,#>Object26_Hi,#>Object27_Hi,#>Object28_Hi,#>Object29_Hi,#>Object30_Hi,#>Object31_Hi
- 09C8C 81 81 81 81 81 81 81 81 .db #>Object32_Hi,#>Object33_Hi,#>Object34_Hi,#>Object35_Hi,#>Object36_Hi,#>Object37_Hi,#>Object38_Hi,#>Object39_Hi
- 09C94 81 81 81 81 81 81 81 81 .db #>Object40_Hi,#>Object41_Hi,#>Object42_Hi,#>Object43_Hi,#>Object44_Hi,#>Object45_Hi,#>Object46_Hi,#>Object47_Hi
- 09C9C 81 81 81 81 81 81 81 81 .db #>Object48_Hi,#>Object49_Hi,#>Object50_Hi,#>Object51_Hi,#>Object52_Hi,#>Object53_Hi,#>Object54_Hi,#>Object55_Hi
- 09CA4 81 81 81 81 81 81 81 81 .db #>Object56_Hi,#>Object57_Hi,#>Object58_Hi,#>Object59_Hi,#>Object60_Hi,#>Object61_Hi,#>Object62_Hi,#>Object63_Hi
- 09CAC 09CAC 00 00 00 00 00 00 00 00.. .pad $c000
- 0C000
- 0C000
- 0C000 ;bank 30 (1d)
- 0C000 .base $8000
- 08000 .include "Routines\BASE_4_5\System\BankData\Bank1D.asm"
- 08000 00 00 00 00 00 00 00 00.. .pad $c000
- 0C000
- 0C000 ;bank 31 (1e)
- 0C000 .base $8000
- 08000 .include "Routines\BASE_4_5\System\BankData\Bank1E.asm"
- 08000
- 08000
- 08000
- 08000
- 08000 HudTiles:
- 08000 00 00 00 00 00 00 00 00.. .incbin "Graphics\Backgrounds\CHR_HudTiles.chr"08400 00 00 00 00 00 00 00 00.. .pad $c000
- 0C000
- 0C000
- 0C000 ;bank fixed, 1F
- 0C000
- 0C000 .org $c000 ; because c000 is the last 16kb of memory. The first 16 starts at 8000, so
- 0C000 ; the swappable banks will go from 8000-bfff
- 0C000 ; everything here will be in the static bank.
- 0C000 ; everything moved into 8000 will be in the swappable 16k bank.0C000 ;4 The Reset
- 0C000 .include "Routines\BASE_4_5\System\Reset.asm"
- 0C000
- 0C000 RESET:
- 0C000 78 SEI ;ignore interrupts for the reset
- 0C001 A9 00 LDA #$00 ; load the number 00
- 0C003 8D 00 20 STA $2000 ; disables NMI
- 0C006 8D 01 20 STA $2001 ; disables rendering
- 0C009 8D 10 40 STA $4010 ; disables DMC IRQ
- 0C00C 8D 15 40 STA $4015 ; disables APU sound
- 0C00F A9 40 LDA #$40 ; Loads the number 64
- 0C011 8D 17 40 STA $4017 ; disables the APU IRQ
- 0C014 D8 CLD ; disables decimal mode
- 0C015 A2 FF LDX #$FF
- 0C017 9A TXS ; initializes the stack
- 0C018
- 0C018 ;5. First vblank wait
- 0C018 ; what is vblank?
- 0C018 ; NES draws scan lines from top to bottom. During the time it takes
- 0C018 ; for the light beam to move back up to the top is a waiting period
- 0C018 ; called vblank...it gives us time to update what is drawn to the screen.
- 0C018 2C 02 20 bit $2002
- 0C01B vBlankWait1:
- 0C01B 2C 02 20 bit $2002
- 0C01E 10 FB BPL vBlankWait1
- 0C020
- 0C020 ;6. Clear all ram
- 0C020 ;LDA #$00
- 0C020 A2 00 LDX #$00
- 0C022 clrMemLoop:
- 0C022 A9 00 LDA #$00
- 0C024 95 00 STA $0000,x
- 0C026 9D 00 01 STA $0100,x
- 0C029 ;; skip 200, this is where the sprites are drawn
- 0C029 ;; we'll set them to $FE to draw them off screen
- 0C029 9D 00 03 STA $0300,x
- 0C02C 9D 00 04 STA $0400,x
- 0C02F 9D 00 05 STA $0500,x
- 0C032 9D 00 06 STA $0600,x
- 0C035 9D 00 07 STA $0700,x
- 0C038 A9 FE LDA #$FE ; instead of zero, write #$FE to 0200,x
- 0C03A 9D 00 02 STA $0200,x ; to place sprites off screen
- 0C03D E8 INX
- 0C03E D0 E2 BNE clrMemLoop
- 0C040
- 0C040 ;7. Second vblank
- 0C040 vBlankWait2:
- 0C040 2C 02 20 bit $2002
- 0C043 10 FB BPL vBlankWait2
- 0C045
- 0C045 ;8 Enable NMI
- 0C045 A9 90 LDA #%10010000 ; turn on NMI, set sprites $0000, bkg to $1000
- 0C047 8D 00 20 STA $2000
- 0C04A A9 1E LDA #%00011110
- 0C04C 8D 01 20 STA $2001
- 0C04F 85 17 STA soft2001
- 0C051
- 0C051 A9 00 LDA #$00
- 0C053 8D 05 20 sTA $2005
- 0C056 8D 05 20 STA $2005
- 0C059 ;;DON'T TURN ON RENDERING UNTIL FIRST GRAPHICS ARE DRAWN.0C059 ;5 Initialization of things.
- 0C059 .include "Routines\BASE_4_5\Game\Space Birds\Game\Initialization_shooter.asm"
- 0C059 ;;initialization
- 0C059 ;;; on a game to game basis, what data needs to be initialized will change.
- 0C059 .include "ScreenData\init.ini"
- 0C059 ;; INI data export. Saturday, March 6, 2021 6:48:11 PM
- 0C059
- 0C059 START_LEVEL = 1
- 0C059 START_SCREEN_X = 1
- 0C059 START_SCREEN_Y = 14
- 0C059 START_ON_SCREEN = #$e1
- 0C059 START_POSITION_TILE_X = 0
- 0C059 START_POSITION_TILE_Y = 0
- 0C059 START_POSITION_PIX_X = #$00
- 0C059 START_POSITION_PIX_Y = #$00
- 0C059 BOSSES_DEFEATED = #$00
- 0C059 RELIC_GROUP1 = #$00
- 0C059 RELIC_GROUP2 = #$00
- 0C059 SONG_LEARNED = #$00
- 0C059 DayNightSpeed = #$00
- 0C059
- 0C059 INIT_ITEM_00 = #$00
- 0C059 INIT_ITEM_01 = #$00
- 0C059 INIT_ITEM_02 = #$00
- 0C059 INIT_ITEM_03 = #$00
- 0C059 INIT_ITEM_04 = #$00
- 0C059 INIT_ITEM_05 = #$00
- 0C059 INIT_ITEM_06 = #$00
- 0C059 INIT_ITEM_07 = #$00
- 0C059
- 0C059 INIT_TRIG_00 = #%00000000
- 0C059 INIT_TRIG_01 = #%00000000
- 0C059 INIT_TRIG_02 = #%00000000
- 0C059 INIT_TRIG_03 = #%00000000
- 0C059 INIT_TRIG_04 = #%00000000
- 0C059 INIT_TRIG_05 = #%00000000
- 0C059 INIT_TRIG_06 = #%00000000
- 0C059 INIT_TRIG_07 = #%00000000
- 0C059 INIT_TRIG_08 = #%00000000
- 0C059 INIT_TRIG_09 = #%00000000
- 0C059 INIT_TRIG_0a = #%00000000
- 0C059 INIT_TRIG_0b = #%00000000
- 0C059 INIT_TRIG_0c = #%00000000
- 0C059 INIT_TRIG_0d = #%00000000
- 0C059 INIT_TRIG_0e = #%00000000
- 0C059 INIT_TRIG_0f = #%00000000
- 0C059 INIT_TRIG_10 = #%00000000
- 0C059 INIT_TRIG_11 = #%00000000
- 0C059 INIT_TRIG_12 = #%00000000
- 0C059 INIT_TRIG_13 = #%00000000
- 0C059 INIT_TRIG_14 = #%00000000
- 0C059 INIT_TRIG_15 = #%00000000
- 0C059 INIT_TRIG_16 = #%00000000
- 0C059 INIT_TRIG_17 = #%00000000
- 0C059 INIT_TRIG_18 = #%00000000
- 0C059 INIT_TRIG_19 = #%00000000
- 0C059 INIT_TRIG_1a = #%00000000
- 0C059 INIT_TRIG_1b = #%00000000
- 0C059 INIT_TRIG_1c = #%00000000
- 0C059 INIT_TRIG_1d = #%00000000
- 0C059 INIT_TRIG_1e = #%00000000
- 0C059 INIT_TRIG_1f = #%00000000
- 0C059 SKIP_START_SCREEN = 1
- 0C059
- 0C059
- 0C059 DATABANK1 = #$14
- 0C059
- 0C059 PRESSED_INPUTS = 5
- 0C059 RELEASED_INPUTS = 8
- 0C059 HELD_INPUTS = 8
- 0C059
- 0C059
- 0C059 PAL_GO_1 = #$00
- 0C059 PAL_GO_2 = #$00
- 0C059
- 0C059
- 0C059 ;;; this contains CONSTANTS information, like the starting screen and the game object palettes.
- 0C059
- 0C059 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C059 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C059
- 0C059 A9 00 LDA #$00
- 0C05B 85 17 STA soft2001
- 0C05D 20 FB C8 JSR doWaitFrame
- 0C060 ;;; turn off rendering to load graphics.
- 0C060
- 0C060 A9 FF LDA #$FF
- 0C062 8D CC 06 STA songToPlay ;;; this will force "none" to play.
- 0C065 ;; which means that the first screen with a song that is not none
- 0C065 ;; will not be seen as the "Same songToPlay value", so it will play.
- 0C065 ;;; do this BEFORE screen loads.
- 0C065
- 0C065 A9 E1 LDA #START_ON_SCREEN
- 0C067 8D D2 06 STA continueScreen
- 0C06A 8D 74 06 STA currentNametable
- 0C06D 8D 8D 06 STA camScreen
- 0C070
- 0C070 29 0F AND #%00001111
- 0C072 8D 86 06 STA camX_hi
- 0C075 A9 E1 LDA #START_ON_SCREEN
- 0C077 4A LSR
- 0C078 4A LSR
- 0C079 4A LSR
- 0C07A 4A LSR
- 0C07B 8D 89 06 STA camY_hi
- 0C07E
- 0C07E A9 00 LDA #$00
- 0C080 8D 85 06 STA camX
- 0C083 8D 84 06 STA camX_lo
- 0C086
- 0C086 ; LDA #START_ON_SCREEN
- 0C086 ; AND #%00000001
- 0C086 ; BNE gameStartsInRightNametable
- 0C086 ; ;; game starts in left nametable
- 0C086 ; LDA #$20
- 0C086 ; STA updateNametable
- 0C086 ; LDA #$23
- 0C086 ; STA updateAttributeTable
- 0C086 ; JMP gotNameAndAttributeTableStart
- 0C086 ; gameStartsInRightNametable:
- 0C086 ; LDA #$24
- 0C086 ; STA updateNametable
- 0C086 ; LDA #$27
- 0C086 ; STA updateAttributeTable
- 0C086 ; gotNameAndAttributeTableStart:
- 0C086
- 0C086
- 0C086 A9 01 LDA #START_LEVEL ;; right now, this is set up backwards, where 0 is underground.
- 0C088 49 01 EOR #%00000001
- 0C08A 8D A4 06 STA warpMap
- 0C08D
- 0C08D
- 0C08D ;JSR doLoadScreen2 ;; loads the second screen to the second nametable.
- 0C08D ;JSR doLoadScreen
- 0C08D AD AB 06 LDA gameHandler
- 0C090 09 80 ORA #%10000000
- 0C092 8D AB 06 STA gameHandler
- 0C095
- 0C095 A2 00 LDX #$00
- 0C097 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C097 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C097 20 BA F1 E0 FF D0 03 4C.. CreateObject #START_POSITION_PIX_X, #START_POSITION_PIX_Y, #$00, #$00
- 0C0BE 8A TXA
- 0C0BF 8D 6D 06 STA player1_object
- 0C0C2 8D 81 06 STA camObject
- 0C0C5 AD 74 06 LDA currentNametable
- 0C0C8 9D 27 04 STA Object_screen,x
- 0C0CB 8A TXA
- 0C0CC 85 00 STA temp
- 0C0CE 8A 48 A5 00 85 0C A9 02.. ChangeFacingDirection temp, #FACE_RIGHT
- 0C0DD
- 0C0DD A9 00 LDA #START_POSITION_PIX_X
- 0C0DF 8D 75 06 STA newX
- 0C0E2 8D D3 06 STA continueX
- 0C0E5 A9 00 LDA #START_POSITION_PIX_Y
- 0C0E7 8D 76 06 STA newY
- 0C0EA 8D D4 06 STA continueY
- 0C0ED
- 0C0ED E8 INX
- 0C0EE 8A TXA
- 0C0EF 8D 6E 06 STA player2_object
- 0C0F2 85 00 STA temp
- 0C0F4 8A 48 A5 00 85 0C A9 02.. ChangeFacingDirection temp, #FACE_RIGHT
- 0C103 ;LDA #%11110000
- 0C103
- 0C103 ;LDA #%00110000
- 0C103 A2 00 LDX #$00
- 0C105 A9 00 LDA #$00
- 0C107 8D 92 06 STA scrollTrigger
- 0C10A ;;;;; this sets up to ignore "screen edge" behavior
- 0C10A ;;;;; for scrolling games.
- 0C10A ;;Bit 7 = up
- 0C10A ;;Bit 6 = Down
- 0C10A ;;Bit 5 = left
- 0C10A ;;Bit 4 = right
- 0C10A
- 0C10A A9 C2 LDA #%11000010
- 0C10C 8D 8C 06 STA scrollByte
- 0C10F
- 0C10F
- 0C10F 98 48 AD 20 06 8D 21 06.. SwitchBank #$1B ;; switch to the music bank
- 0C11E ;; which contains the initializtion scripts.
- 0C11E
- 0C11E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C11E ;;;; THIS SETS UP THE MUSIC ENGINE.
- 0C11E ;;;; IF YOU USE A DIFFERENT MUSIC ENGINE
- 0C11E ;;;; CHANGE THIS TO FIT YOUR NEEDS OF INITIALIZING YOUR MUSIC ENGINE.
- 0C11E A9 00 lda #SOUND_REGION_NTSC ;or #SOUND_REGION_PAL, or #SOUND_REGION_DENDY
- 0C120 85 50 sta sound_param_byte_0
- 0C122 A9 15 lda #<(song_list)
- 0C124 85 53 sta sound_param_word_0
- 0C126 A9 8B lda #>(song_list)
- 0C128 85 54 sta sound_param_word_0+1
- 0C12A A9 27 lda #<(sfx_list)
- 0C12C 85 55 sta sound_param_word_1
- 0C12E A9 8B lda #>(sfx_list)
- 0C130 85 56 sta sound_param_word_1+1
- 0C132 A9 53 lda #<(instrument_list)
- 0C134 85 57 sta sound_param_word_2
- 0C136 A9 8B lda #>(instrument_list)
- 0C138 85 58 sta sound_param_word_2+1
- 0C13A ;lda #<dpcm_list
- 0C13A ;sta sound_param_word_3
- 0C13A ;lda #>dpcm_list
- 0C13A ;sta sound_param_word_3+1
- 0C13A 20 50 80 jsr sound_initialize
- 0C13D
- 0C13D
- 0C13D 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C147
- 0C147
- 0C147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C147 ;;; Triggers
- 0C147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C147 A9 00 LDA #INIT_TRIG_00
- 0C149 8D 00 06 STA screenTriggers+0
- 0C14C A9 00 LDA #INIT_TRIG_01
- 0C14E 8D 01 06 STA screenTriggers+1
- 0C151 A9 00 LDA #INIT_TRIG_02
- 0C153 8D 02 06 STA screenTriggers+2
- 0C156 A9 00 LDA #INIT_TRIG_03
- 0C158 8D 03 06 STA screenTriggers+3
- 0C15B A9 00 LDA #INIT_TRIG_04
- 0C15D 8D 04 06 STA screenTriggers+4
- 0C160 A9 00 LDA #INIT_TRIG_05
- 0C162 8D 05 06 STA screenTriggers+5
- 0C165 A9 00 LDA #INIT_TRIG_06
- 0C167 8D 06 06 STA screenTriggers+6
- 0C16A A9 00 LDA #INIT_TRIG_07
- 0C16C 8D 07 06 STA screenTriggers+7
- 0C16F A9 00 LDA #INIT_TRIG_08
- 0C171 8D 08 06 STA screenTriggers+8
- 0C174 A9 00 LDA #INIT_TRIG_09
- 0C176 8D 09 06 STA screenTriggers+9
- 0C179 A9 00 LDA #INIT_TRIG_0a
- 0C17B 8D 0A 06 STA screenTriggers+10
- 0C17E A9 00 LDA #INIT_TRIG_0b
- 0C180 8D 0B 06 STA screenTriggers+11
- 0C183 A9 00 LDA #INIT_TRIG_0c
- 0C185 8D 0C 06 STA screenTriggers+12
- 0C188 A9 00 LDA #INIT_TRIG_0d
- 0C18A 8D 0D 06 STA screenTriggers+13
- 0C18D A9 00 LDA #INIT_TRIG_0e
- 0C18F 8D 0E 06 STA screenTriggers+14
- 0C192 A9 00 LDA #INIT_TRIG_0f
- 0C194 8D 0F 06 STA screenTriggers+15
- 0C197 A9 00 LDA #INIT_TRIG_10
- 0C199 8D 10 06 STA screenTriggers+16
- 0C19C A9 00 LDA #INIT_TRIG_11
- 0C19E 8D 11 06 STA screenTriggers+17
- 0C1A1 A9 00 LDA #INIT_TRIG_12
- 0C1A3 8D 12 06 STA screenTriggers+18
- 0C1A6 A9 00 LDA #INIT_TRIG_13
- 0C1A8 8D 13 06 STA screenTriggers+19
- 0C1AB A9 00 LDA #INIT_TRIG_14
- 0C1AD 8D 14 06 STA screenTriggers+20
- 0C1B0 A9 00 LDA #INIT_TRIG_15
- 0C1B2 8D 15 06 STA screenTriggers+21
- 0C1B5 A9 00 LDA #INIT_TRIG_16
- 0C1B7 8D 16 06 STA screenTriggers+22
- 0C1BA A9 00 LDA #INIT_TRIG_17
- 0C1BC 8D 17 06 STA screenTriggers+23
- 0C1BF A9 00 LDA #INIT_TRIG_18
- 0C1C1 8D 18 06 STA screenTriggers+24
- 0C1C4 A9 00 LDA #INIT_TRIG_19
- 0C1C6 8D 19 06 STA screenTriggers+25
- 0C1C9 A9 00 LDA #INIT_TRIG_1a
- 0C1CB 8D 1A 06 STA screenTriggers+26
- 0C1CE A9 00 LDA #INIT_TRIG_1b
- 0C1D0 8D 1B 06 STA screenTriggers+27
- 0C1D3 A9 00 LDA #INIT_TRIG_1c
- 0C1D5 8D 1C 06 STA screenTriggers+28
- 0C1D8 A9 00 LDA #INIT_TRIG_1d
- 0C1DA 8D 1D 06 STA screenTriggers+29
- 0C1DD A9 00 LDA #INIT_TRIG_1e
- 0C1DF 8D 1E 06 STA screenTriggers+30
- 0C1E2 A9 00 LDA #INIT_TRIG_1f
- 0C1E4 8D 1F 06 STA screenTriggers+31
- 0C1E7
- 0C1E7
- 0C1E7 ;;;;;;;;;;;;;;DELETE ME
- 0C1E7 .include "GameData\InitializationScripts\hudVarInits.asm"
- 0C1E7
- 0C1E7 ;; UserDefined var init export. Saturday, March 6, 2021 6:48:13 PM
- 0C1E7
- 0C1E7 A9 03 LDA #3 ; User Defined Var 0
- 0C1E9 85 A4 STA myLives
- 0C1EB A9 05 LDA #5 ; User Defined Var 1
- 0C1ED 85 A5 STA myAmmo
- 0C1EF A9 00 LDA #0 ; User Defined Var 2
- 0C1F1 85 A6 STA myKeys
- 0C1F3 A9 00 LDA #0 ; User Defined Var 3
- 0C1F5 85 A7 STA bulletTimer
- 0C1F7 A9 05 LDA #5 ; User Defined Var 4
- 0C1F9 85 A8 STA bossHealth
- 0C1FB A9 00 LDA #0 ; User Defined Var 5
- 0C1FD 85 A9 STA bulletTimer2
- 0C1FF A9 03 LDA #3 ; User Defined Var 6
- 0C201 85 AA STA player2Lives
- 0C203
- 0C203 A9 1E LDA #%00011110 ;;
- 0C205 85 17 STA soft20010C207 4C 0E C4 JMP StartMainGameLoop
- 0C20A ;6 NMI
- 0C20A .include "Routines\BASE_4_5\System\NMI.asm"
- 0C20A NMI:
- 0C20A ;first push whatever is in the accumulator to the stack
- 0C20A
- 0C20A 48 PHA
- 0C20B A5 16 LDA doNMI
- 0C20D F0 03 BEQ dontSkipNMI
- 0C20F 4C 07 C4 JMP skipWholeNMI
- 0C212 dontSkipNMI:
- 0C212
- 0C212 A9 01 LDA #$01
- 0C214 85 16 STA doNMI
- 0C216 8A TXA
- 0C217 48 PHA
- 0C218 98 TYA
- 0C219 48 PHA
- 0C21A 08 PHP
- 0C21B
- 0C21B A5 00 LDA temp
- 0C21D 48 PHA
- 0C21E A5 01 LDA temp1
- 0C220 48 PHA
- 0C221 A5 02 LDA temp2
- 0C223 48 PHA
- 0C224 A5 03 LDA temp3
- 0C226 48 PHA
- 0C227 A5 04 LDA tempx
- 0C229 48 PHA
- 0C22A A5 05 LDA tempy
- 0C22C 48 PHA
- 0C22D A5 06 LDA tempz
- 0C22F 48 PHA
- 0C230
- 0C230 A5 07 LDA tempA
- 0C232 48 PHA
- 0C233 A5 08 LDA tempB
- 0C235 48 PHA
- 0C236 A5 09 LDA tempC
- 0C238 48 PHA
- 0C239 A5 0A LDA tempD
- 0C23B 48 PHA
- 0C23C
- 0C23C
- 0C23C A5 0C LDA arg0_hold
- 0C23E 48 PHA
- 0C23F A5 0D LDA arg1_hold
- 0C241 48 PHA
- 0C242 A5 0E LDA arg2_hold
- 0C244 48 PHA
- 0C245 A5 0F LDA arg3_hold
- 0C247 48 PHA
- 0C248 A5 10 LDA arg4_hold
- 0C24A 48 PHA
- 0C24B A5 11 LDA arg5_hold
- 0C24D 48 PHA
- 0C24E A5 12 LDA arg6_hold
- 0C250 48 PHA
- 0C251 A5 13 LDA arg7_hold
- 0C253 48 PHA
- 0C254
- 0C254
- 0C254 A5 14 LDA temp16
- 0C256 48 PHA
- 0C257 A5 15 LDA temp16+1
- 0C259 48 PHA
- 0C25A
- 0C25A A5 1B LDA pointer
- 0C25C 48 PHA
- 0C25D A5 1C LDA pointer+1
- 0C25F 48 PHA
- 0C260
- 0C260 A5 1D LDA pointer2
- 0C262 48 PHA
- 0C263 A5 1E LDA pointer2+1
- 0C265 48 PHA
- 0C266
- 0C266 A5 1F LDA pointer3
- 0C268 48 PHA
- 0C269 A5 20 LDA pointer3+1
- 0C26B 48 PHA
- 0C26C
- 0C26C A5 33 LDA pointer6
- 0C26E 48 PHA
- 0C26F A5 34 LDA pointer6+1
- 0C271 48 PHA
- 0C272
- 0C272 AD 20 06 LDA currentBank
- 0C275 48 PHA
- 0C276 AD 21 06 LDA prevBank
- 0C279 48 PHA
- 0C27A AD 22 06 LDA tempBank
- 0C27D 48 PHA
- 0C27E AD 23 06 LDA chrRamBank
- 0C281 48 PHA
- 0C282
- 0C282
- 0C282
- 0C282 A5 1A LDA skipNMI
- 0C284 F0 03 BEQ dontSkipNMI2
- 0C286 4C 77 C3 JMP skipNMIstuff
- 0C289 dontSkipNMI2:
- 0C289
- 0C289
- 0C289
- 0C289 A9 00 LDA #$00
- 0C28B 8D 00 20 STA $2000
- 0C28E A5 17 LDA soft2001
- 0C290 8D 01 20 STA $2001
- 0C293
- 0C293 ;;;Set OAL DMA
- 0C293 A9 00 LDA #$00
- 0C295 8D 03 20 STA $2003
- 0C298 A9 02 LDA #$02
- 0C29A 8D 14 40 STA $4014
- 0C29D ;; Load the Palette
- 0C29D
- 0C29D A5 17 LDA soft2001
- 0C29F D0 03 BNE doScreenUpdates
- 0C2A1 4C 56 C3 JMP skipScreenUpdates
- 0C2A4 doScreenUpdates:
- 0C2A4
- 0C2A4 2C 02 20 bit $2002
- 0C2A7 AD 24 06 LDA updateScreenData
- 0C2AA 29 01 AND #%00000001
- 0C2AC D0 03 BNE doPaletteUpdates
- 0C2AE 4C D6 C2 JMP +
- 0C2B1 doPaletteUpdates:
- 0C2B1 .include "Routines\BASE_4_5\Game\DataLoadScripts\LoadBackgroundPalettes_NMI.asm"
- 0C2B1 ;;Load background palettes
- 0C2B1
- 0C2B1 AD 02 20 LDA $2002
- 0C2B4 A9 3F LDA #$3F
- 0C2B6 8D 06 20 STA $2006
- 0C2B9 A9 00 LDA #$00
- 0C2BB 8D 06 20 STA $2006
- 0C2BE A2 00 LDX #$00
- 0C2C0 LoadBackgroundPal_NMI:
- 0C2C0 BD 25 06 LDA bckPal,x
- 0C2C3 8D 07 20 STA $2007
- 0C2C6 E8 INX
- 0C2C7 E0 10 CPX #$10
- 0C2C9 D0 F5 BNE LoadBackgroundPal_NMI
- 0C2CB
- 0C2CB AD 24 06 LDA updateScreenData
- 0C2CE 29 FE AND #%11111110
- 0C2D0 8D 24 06 STA updateScreenData
- 0C2D3
- 0C2D3 ;;; this script runs in-line.0C2D3 4C 56 C3 JMP skipScreenUpdates
- 0C2D6 +
- 0C2D6 AD 24 06 LDA updateScreenData
- 0C2D9 29 02 AND #%00000010
- 0C2DB D0 03 BNE doSpritePaletteUpdates:
- 0C2DD 4C 05 C3 JMP +
- 0C2E0 doSpritePaletteUpdates:
- 0C2E0 .include "Routines\BASE_4_5\Game\DataLoadScripts\LoadSpritePalettes_NMI.asm"
- 0C2E0 ;;Load background palettes
- 0C2E0
- 0C2E0 AD 02 20 LDA $2002
- 0C2E3 A9 3F LDA #$3F
- 0C2E5 8D 06 20 STA $2006
- 0C2E8 A9 10 LDA #$10
- 0C2EA 8D 06 20 STA $2006
- 0C2ED A2 00 LDX #$00
- 0C2EF LoadSpritePal_NMI:
- 0C2EF BD 35 06 LDA sprPal,x
- 0C2F2 8D 07 20 STA $2007
- 0C2F5 E8 INX
- 0C2F6 E0 10 CPX #$10
- 0C2F8 D0 F5 BNE LoadSpritePal_NMI
- 0C2FA
- 0C2FA AD 24 06 LDA updateScreenData
- 0C2FD 29 FD AND #%11111101
- 0C2FF 8D 24 06 STA updateScreenData
- 0C302
- 0C302 ;;; this script runs in-line.0C302 4C 56 C3 JMP skipScreenUpdates
- 0C305 +
- 0C305 AD 24 06 LDA updateScreenData
- 0C308 29 04 AND #%00000100
- 0C30A D0 03 BNE doColumnUpdate
- 0C30C 4C 56 C3 JMP +
- 0C30F doColumnUpdate:
- 0C30F .include "Routines\BASE_4_5\Game\Subroutines\doUpdateScrollColumn.asm"
- 0C30F ;;; This routine will spread over two frames.
- 0C30F ;; The offset for where in the column is being drawn will be held in scrollOffsetCounter.
- 0C30F ;; It will load 32 (#$20) tiles per frame, but not quite, because the screen is only
- 0C30F ;; 240 px high. So there are 3 reads per tile, 12 per metatile...12x15 rows = 180.
- 0C30F
- 0C30F AC 8A 06 LDY scrollOffsetCounter
- 0C312 A2 10 LDX #$10
- 0C314 loop_LoadScrollColumn:
- 0C314 B9 00 07 LDA scrollUpdateRam,y
- 0C317 8D 06 20 STA $2006
- 0C31A 8D FE 07 STA $07FE
- 0C31D C8 INY
- 0C31E
- 0C31E B9 00 07 LDA scrollUpdateRam,y
- 0C321 8D 06 20 STA $2006
- 0C324 8D FF 07 STA $07FF
- 0C327 C8 INY
- 0C328
- 0C328 B9 00 07 LDA scrollUpdateRam,y
- 0C32B 8D 07 20 STA $2007
- 0C32E C8 INY
- 0C32F 98 TYA
- 0C330 8D 8A 06 STA scrollOffsetCounter
- 0C333 CD 8B 06 CMP maxScrollOffsetCounter ;; this should probably be variable.
- 0C336 F0 06 BEQ doneUpdatingColumn
- 0C338
- 0C338 CA DEX
- 0C339 D0 D9 BNE loop_LoadScrollColumn
- 0C33B 4C 53 C3 JMP notDoneUpdatingColumn
- 0C33E doneUpdatingColumn:
- 0C33E AD 24 06 LDA updateScreenData
- 0C341 29 FB AND #%11111011
- 0C343 8D 24 06 STA updateScreenData
- 0C346 AD 8C 06 LDA scrollByte
- 0C349 29 FE AND #%11111110
- 0C34B 8D 8C 06 STA scrollByte
- 0C34E A9 00 LDA #$00
- 0C350 8D 8A 06 STA scrollOffsetCounter
- 0C353 notDoneUpdatingColumn:
- 0C353
- 0C353 0C353 4C 56 C3 JMP skipScreenUpdates
- 0C356 +
- 0C356
- 0C356 skipScreenUpdates:
- 0C356 ;; always do hud update, otherwise
- 0C356 ;; it's possible that updates to tiles, attributes, or palettes
- 0C356 ;; will cause a skip in hud update.
- 0C356 ;.include ROOT\DataLoadScripts\LoadHudData.asm
- 0C356
- 0C356 AD 89 06 LDA camY_hi
- 0C359 0A ASL
- 0C35A 0A ASL
- 0C35B 0A ASL
- 0C35C 0A ASL
- 0C35D 18 CLC
- 0C35E 6D 86 06 ADC camX_hi
- 0C361 8D 8D 06 STA camScreen
- 0C364 ;LDA camScreen ;; bit 0, determines which nametable we are looking at.
- 0C364
- 0C364
- 0C364
- 0C364 29 01 AND #%00000001
- 0C366 09 90 ORA #%10010000
- 0C368
- 0C368 8D 00 20 STA $2000
- 0C36B
- 0C36B
- 0C36B AD 85 06 LDA camX
- 0C36E 8D 05 20 STA $2005 ;reset scroll values to zero
- 0C371 AD 88 06 LDA camY
- 0C374 8D 05 20 STA $2005 ;reset scroll values to zero
- 0C377
- 0C377
- 0C377 skipNMIstuff:
- 0C377
- 0C377
- 0C377
- 0C377 E6 18 INC vBlankTimer
- 0C379 E6 19 INC randomSeed
- 0C37B
- 0C37B ;; music player things
- 0C37B
- 0C37B
- 0C37B 98 48 AD 20 06 8D 21 06.. SwitchBank #$1B ;; music bank
- 0C38A 20 45 80 JSR doSoundEngineUpdate
- 0C38D 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C397
- 0C397
- 0C397 68 PLA
- 0C398 8D 23 06 STA chrRamBank
- 0C39B 68 PLA
- 0C39C 8D 22 06 STA tempBank
- 0C39F 68 PLA
- 0C3A0 8D 21 06 STA prevBank
- 0C3A3 68 PLA
- 0C3A4 8D 20 06 STA currentBank
- 0C3A7
- 0C3A7 68 PLA
- 0C3A8 85 34 STA pointer6+1
- 0C3AA 68 PLA
- 0C3AB 85 33 STA pointer6
- 0C3AD 68 PLA
- 0C3AE 85 20 STA pointer3+1
- 0C3B0 68 PLA
- 0C3B1 85 1F STA pointer3
- 0C3B3
- 0C3B3 68 PLA
- 0C3B4 85 1E STA pointer2+1
- 0C3B6 68 PLA
- 0C3B7 85 1D STA pointer2
- 0C3B9
- 0C3B9 68 PLA
- 0C3BA 85 1C STA pointer+1
- 0C3BC 68 PLA
- 0C3BD 85 1B STA pointer
- 0C3BF
- 0C3BF 68 PLA
- 0C3C0 85 15 STA temp16+1
- 0C3C2 68 PLA
- 0C3C3 85 14 STA temp16
- 0C3C5
- 0C3C5 68 PLA
- 0C3C6 85 13 STA arg7_hold
- 0C3C8 68 PLA
- 0C3C9 85 12 STA arg6_hold
- 0C3CB 68 PLA
- 0C3CC 85 11 STA arg5_hold
- 0C3CE 68 PLA
- 0C3CF 85 10 STA arg4_hold
- 0C3D1 68 PLA
- 0C3D2 85 0F STA arg3_hold
- 0C3D4 68 PLA
- 0C3D5 85 0E STA arg2_hold
- 0C3D7 68 PLA
- 0C3D8 85 0D STA arg1_hold
- 0C3DA 68 PLA
- 0C3DB 85 0C STA arg0_hold
- 0C3DD
- 0C3DD 68 PLA
- 0C3DE 85 0A STA tempD
- 0C3E0 68 PLA
- 0C3E1 85 09 STA tempC
- 0C3E3 68 PLA
- 0C3E4 85 08 STA tempB
- 0C3E6 68 PLA
- 0C3E7 85 07 STA tempA
- 0C3E9
- 0C3E9 68 PLA
- 0C3EA 85 06 STA tempz
- 0C3EC 68 PLA
- 0C3ED 85 05 STA tempy
- 0C3EF 68 PLA
- 0C3F0 85 04 STA tempx
- 0C3F2 68 PLA
- 0C3F3 85 03 STA temp3
- 0C3F5 68 PLA
- 0C3F6 85 02 STA temp2
- 0C3F8 68 PLA
- 0C3F9 85 01 STA temp1
- 0C3FB 68 PLA
- 0C3FC 85 00 STA temp
- 0C3FE
- 0C3FE A9 00 LDA #$00
- 0C400 85 16 STA doNMI
- 0C402
- 0C402 28 PLP
- 0C403 68 PLA
- 0C404 A8 TAY
- 0C405 68 PLA
- 0C406 AA TAX
- 0C407 skipWholeNMI:
- 0C407 A9 00 LDA #$00
- 0C409 8D 45 06 STA waiting
- 0C40C 68 PLA
- 0C40D
- 0C40D
- 0C40D 40 RTI0C40E ;7. main game loop
- 0C40E StartMainGameLoop:
- 0C40E .include "Routines\BASE_4_5\Game\MainGameLoop.asm"
- 0C40E ;;; main game loop.
- 0C40E
- 0C40E MainGameLoop:
- 0C40E A5 18 LDA vBlankTimer
- 0C410 vBlankTimerLoop:
- 0C410 C5 18 CMP vBlankTimer
- 0C412 F0 FC BEQ vBlankTimerLoop
- 0C414
- 0C414
- 0C414 AD AB 06 LDA gameHandler
- 0C417 29 80 AND #%10000000
- 0C419 F0 03 BEQ dontSkipNormalGameLoop
- 0C41B 4C 8F C4 JMP skipNormalGameLoop
- 0C41E dontSkipNormalGameLoop:
- 0C41E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C41E ;; Handles box updates that need to be carried over a frame.
- 0C41E AD B5 06 LDA queueFlags
- 0C421 29 05 AND #%00000101
- 0C423 D0 03 BNE doBoxUpdate
- 0C425 4C 33 C4 JMP dontDoBoxUpdate
- 0C428 doBoxUpdate:
- 0C428 8A TXA
- 0C429 48 PHA
- 0C42A 98 TYA
- 0C42B 48 PHA
- 0C42C 20 CC E4 JSR doDrawBox
- 0C42F 68 PLA
- 0C430 A8 TAY
- 0C431 68 PLA
- 0C432 AA TAX
- 0C433
- 0C433 dontDoBoxUpdate
- 0C433
- 0C433 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C433 ;; handles text updates that need to be carried over a frame.
- 0C433 AD C0 06 LDA textHandler
- 0C436 F0 03 BEQ noTextUpdates
- 0C438 20 37 DE JSR doDrawText
- 0C43B noTextUpdates:
- 0C43B ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C43B ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C43B 20 09 EF JSR doHandleInputReads
- 0C43E A9 00 LDA #$00
- 0C440 85 2C STA spriteRamPointer
- 0C442 98 48 AD 20 06 8D 21 06.. SwitchBank #$18
- 0C451 20 50 80 JSR doScreenPreDraw
- 0C454 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C45E
- 0C45E 20 BC E9 JSR doHandleObjects
- 0C461 20 05 F3 JSR doCamera
- 0C464 ;;;;;;;;;;;;;;;;;; SET GAME SCREEN
- 0C464 ;;;;;; IN THE EVENT THERE IS NO ATTATCHED CAM SCRIPT TO DO IT
- 0C464
- 0C464 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C464 98 48 AD 20 06 8D 21 06.. SwitchBank #$18
- 0C473 20 FD 80 JSR doScreenPostDraw
- 0C476 .include "Routines\BASE_4_5\Game\Space Birds\Game\handleGameTimer_shooter.asm"
- 0C476 A5 A7 LDA bulletTimer
- 0C478 F0 02 BEQ +skip
- 0C47A C6 A7 DEC bulletTimer
- 0C47C +skip
- 0C47C
- 0C47C A5 A9 LDA bulletTimer2
- 0C47E F0 02 BEQ +skip
- 0C480 C6 A9 DEC bulletTimer2
- 0C482 +skip
- 0C482 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C48C 20 ED C8 JSR doCleanUpSpriteRam
- 0C48F ;JSR doHandleUpdateCamera
- 0C48F skipNormalGameLoop:
- 0C48F 20 6B E3 JSR doHandleUpdateScreen
- 0C492 98 48 AD 20 06 8D 21 06.. SwitchBank #$1B
- 0C4A1 20 00 80 JSR doHandleUpdateMusic
- 0C4A4
- 0C4A4
- 0C4A4 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C4AE 4C 0E C4 JMP MainGameLoop0C4B1 ;8. subroutines
- 0C4B1 .include "GameData\ScriptTables.asm"
- 0C4B1 ;; *************** ScriptTables.asm ***************
- 0C4B1 ;; Script link export. Saturday, March 6, 2021 6:48:13 PM
- 0C4B1 ScriptAddressLo:
- 0C4B1 6C 90 B4 D8 FC 0F 83 F7.. .db #<Script00, #<Script01, #<Script02, #<Script03, #<Script04, #<Script05, #<Script06, #<Script07, #<Script08, #<Script09
- 0C4BB ScriptAddressHi:
- 0C4BB F7 F7 F7 F7 F7 F8 F8 F8.. .db #>Script00, #>Script01, #>Script02, #>Script03, #>Script04, #>Script05, #>Script06, #>Script07, #>Script08, #>Script09
- 0C4C5
- 0C4C5 TargetScriptBank:
- 0C4C5 14 14 14 14 14 14 14 14.. .db #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1, #DATABANK1
- 0C4CF
- 0C4CF ;;=======================PRESSED=======================
- 0C4CF DefinedInputs_Pressed:
- 0C4CF 01 01 08 08 04 .db #%00000001, #%00000001, #%00001000, #%00001000, #%00000100
- 0C4D4
- 0C4D4 DefinedScriptGameStates_Pressed:
- 0C4D4 00 00 01 02 00 .db #$00, #$00, #$01, #$02, #$00
- 0C4D9
- 0C4D9 DefinedTargetObjects_Pressed:
- 0C4D9 00 01 00 00 00 .db #$00, #$01, #$00, #$00, #$00
- 0C4DE
- 0C4DE DefinedTargetController_Pressed:
- 0C4DE 00 01 00 00 00 .db #$00, #$01, #$00, #$00, #$00
- 0C4E3
- 0C4E3 TargetState_Pressed:
- 0C4E3 00 00 00 00 00 .db #$00, #$00, #$00, #$00, #$00
- 0C4E8
- 0C4E8 DefinedTargetScripts_Pressed:
- 0C4E8 06 07 08 08 09 .db #$06, #$07, #$08, #$08, #$09
- 0C4ED
- 0C4ED ;;=======================RELEASE=======================
- 0C4ED DefinedInputs_Released:
- 0C4ED 80 20 40 10 80 20 40 10 .db #%10000000, #%00100000, #%01000000, #%00010000, #%10000000, #%00100000, #%01000000, #%00010000
- 0C4F5
- 0C4F5 DefinedScriptGameStates_Released:
- 0C4F5 00 00 00 00 00 00 00 00 .db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00
- 0C4FD
- 0C4FD DefinedTargetObjects_Released:
- 0C4FD 00 00 00 00 01 01 01 01 .db #$00, #$00, #$00, #$00, #$01, #$01, #$01, #$01
- 0C505
- 0C505 DefinedTargetController_Released:
- 0C505 00 00 00 00 01 01 01 01 .db #$00, #$00, #$00, #$00, #$01, #$01, #$01, #$01
- 0C50D
- 0C50D TargetState_Released:
- 0C50D 00 00 00 00 00 00 00 00 .db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00
- 0C515
- 0C515 DefinedTargetScripts_Released:
- 0C515 04 04 04 04 04 04 04 04 .db #$04, #$04, #$04, #$04, #$04, #$04, #$04, #$04
- 0C51D
- 0C51D ;;=======================HOLD=======================
- 0C51D DefinedInputs_Held:
- 0C51D 80 20 40 10 80 20 40 10 .db #%10000000, #%00100000, #%01000000, #%00010000, #%10000000, #%00100000, #%01000000, #%00010000
- 0C525
- 0C525 DefinedScriptGameStates_Held:
- 0C525 00 00 00 00 00 00 00 00 .db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00
- 0C52D
- 0C52D DefinedTargetObjects_Held:
- 0C52D 00 00 00 00 01 01 01 01 .db #$00, #$00, #$00, #$00, #$01, #$01, #$01, #$01
- 0C535
- 0C535 DefinedTargetController_Held:
- 0C535 00 00 00 00 01 01 01 01 .db #$00, #$00, #$00, #$00, #$01, #$01, #$01, #$01
- 0C53D
- 0C53D TargetState_Held:
- 0C53D 00 00 00 00 00 00 00 00 .db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00
- 0C545
- 0C545 DefinedTargetScripts_Held:
- 0C545 00 01 02 03 00 01 02 03 .db #$00, #$01, #$02, #$03, #$00, #$01, #$02, #$03
- 0C54D
- 0C54D .include "Routines\BASE_4_5\System\simpleMath.asm"
- 0C54D
- 0C54D
- 0C54D
- 0C54D
- 0C54D valueAddLoop:
- 0C54D ;; the accumulator holds how much to add by.
- 0C54D ;; x holds what place is being added to.
- 0C54D 18 clc
- 0C54E 75 83 adc value,x
- 0C550 C9 0A cmp #$0A
- 0C552 90 0F bcc skipCarryDecValue
- 0C554 38 sec
- 0C555 E9 0A sbc #$0A
- 0C557 95 83 sta value,x
- 0C559 E8 inx
- 0C55A E0 08 cpx #$08 ;; how many 'places' the value has
- 0C55C B0 07 bcs overflowThisNumber
- 0C55E A9 01 lda #$01
- 0C560 4C 4D C5 jmp valueAddLoop
- 0C563 skipCarryDecValue:
- 0C563 95 83 sta value,x
- 0C565 overflowThisNumber:
- 0C565 60 rts
- 0C566
- 0C566
- 0C566 valueSubLoop:
- 0C566 ;; temp holds the value to subtract.
- 0C566 B5 83 lda value,x
- 0C568 38 sec
- 0C569 E5 00 sbc temp
- 0C56B C9 00 cmp #$00
- 0C56D 10 11 bpl skipCarryDecValue2
- 0C56F 18 clc
- 0C570 69 0A adc #$0A
- 0C572 95 83 sta value,x
- 0C574 E8 inx
- 0C575 E0 08 cpx #$08 ;; how many 'places' the value has
- 0C577 B0 09 bcs underflowThisNumber
- 0C579 A9 01 lda #$01
- 0C57B 85 00 STA temp
- 0C57D 4C 66 C5 jmp valueSubLoop
- 0C580 skipCarryDecValue2:
- 0C580 95 83 sta value,x
- 0C582 underflowThisNumber:
- 0C582 60 rts0C583 .include "Routines\BASE_4_5\Game\Space Birds\LoadAllSubroutines.asm"
- 0C583 .include Routines\BASE_4_5\\Game\Subroutines\doBankswitchY.asm
- 0C583 doBankswitchY:
- 0C583 ;STY currentBank
- 0C583 8C 20 06 STY currentBank
- 0C586 bankswitchNoSave:
- 0C586 ;LDA #$00
- 0C586 ;ORA banktable, y
- 0C586 ;STA banktable,y
- 0C586 AD 20 06 LDA currentBank
- 0C589 29 1F AND #%00011111
- 0C58B 0D 23 06 ORA chrRamBank
- 0C58E
- 0C58E
- 0C58E 8D 00 C0 STA $c000
- 0C591
- 0C591 60 RTS 0C592 .include Routines\BASE_4_5\\Game\Subroutines\doLoadBackgroundPalette.asm
- 0C592 doLoadBackgroundPalettes:
- 0C592 ;; This is tied to the macro LoadBackgroundPalettes.
- 0C592 ;; It uses bank and 16 bit label.
- 0C592 8A TXA
- 0C593 48 PHA
- 0C594 98 TYA
- 0C595 48 PHA
- 0C596 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C596 ;Get Palette Label based on INDEX
- 0C596 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0C5A5 A4 0C LDY arg0_hold
- 0C5A7 B9 00 84 LDA GameBckPalLo,y
- 0C5AA 85 14 STA temp16
- 0C5AC B9 40 84 LDA GameBckPalHi,y
- 0C5AF 85 15 STA temp16+1
- 0C5B1
- 0C5B1
- 0C5B1 A0 00 LDY #$00
- 0C5B3 loop_LoadBackgroundPalette:
- 0C5B3 B1 14 LDA (temp16),y
- 0C5B5 99 25 06 STA bckPal,y
- 0C5B8 C8 INY
- 0C5B9 C0 10 CPY #$10
- 0C5BB D0 F6 BNE loop_LoadBackgroundPalette
- 0C5BD ;;;; end of loop.
- 0C5BD AD 24 06 LDA updateScreenData
- 0C5C0 09 01 ORA #%00000001 ;; palette
- 0C5C2 8D 24 06 STA updateScreenData
- 0C5C5
- 0C5C5
- 0C5C5 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C5CF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C5CF
- 0C5CF 68 PLA
- 0C5D0 A8 TAY
- 0C5D1 68 PLA
- 0C5D2 AA TAX
- 0C5D3 60 RTS0C5D4 .include Routines\BASE_4_5\\Game\Subroutines\doLoadObjectPalette.asm
- 0C5D4 doLoadObjectPalettes:
- 0C5D4 ;; This is tied to the macro LoadObjectPalettes.
- 0C5D4 ;; It uses bank and 16 bit label.
- 0C5D4 8A TXA
- 0C5D5 48 PHA
- 0C5D6 98 TYA
- 0C5D7 48 PHA
- 0C5D8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C5D8 ;Get Palette Label based on INDEX
- 0C5D8 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0C5E7 A4 0C LDY arg0_hold
- 0C5E9 B9 80 84 LDA ObjectPaletteDataLo,y
- 0C5EC 85 14 STA temp16
- 0C5EE B9 C0 84 LDA ObjectPaletteDataHi,y
- 0C5F1 85 15 STA temp16+1
- 0C5F3
- 0C5F3
- 0C5F3 A0 00 LDY #$00
- 0C5F5 loop_LoadSpritePalette:
- 0C5F5 B1 14 LDA (temp16),y
- 0C5F7 99 35 06 STA sprPal,y
- 0C5FA C8 INY
- 0C5FB C0 10 CPY #$10
- 0C5FD D0 F6 BNE loop_LoadSpritePalette
- 0C5FF ;;;; end of loop.
- 0C5FF AD 24 06 LDA updateScreenData
- 0C602 09 02 ORA #%00000010 ;; sprite palette
- 0C604 8D 24 06 STA updateScreenData
- 0C607
- 0C607
- 0C607 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C611 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C611
- 0C611 68 PLA
- 0C612 A8 TAY
- 0C613 68 PLA
- 0C614 AA TAX
- 0C615 60 RTS0C616 .include Routines\BASE_4_5\\Game\Subroutines\doLoadObjectSubPalette.asm
- 0C616 doLoadObjectSubPalettes:
- 0C616 ;; This is tied to the macro LoadObjectPalettes.
- 0C616 ;; It uses bank and 16 bit label.
- 0C616 8A TXA
- 0C617 48 PHA
- 0C618 98 TYA
- 0C619 48 PHA
- 0C61A ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C61A ;Get Palette Label based on INDEX
- 0C61A 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0C629 A4 0C LDY arg0_hold
- 0C62B B9 80 84 LDA ObjectPaletteDataLo,y
- 0C62E 85 14 STA temp16
- 0C630 B9 C0 84 LDA ObjectPaletteDataHi,y
- 0C633 85 15 STA temp16+1
- 0C635
- 0C635 A6 0D LDX arg1_hold
- 0C637 A0 00 LDY #$00
- 0C639 loop_LoadSpriteSubPalette:
- 0C639 B1 14 LDA (temp16),y
- 0C63B 9D 35 06 STA sprPal,x
- 0C63E C8 INY
- 0C63F E8 INx
- 0C640 C0 04 CPY #$04
- 0C642 D0 F5 BNE loop_LoadSpriteSubPalette
- 0C644 ;;;; end of loop.
- 0C644 AD 24 06 LDA updateScreenData
- 0C647 09 02 ORA #%00000010 ;; sprite palette
- 0C649 8D 24 06 STA updateScreenData
- 0C64C
- 0C64C
- 0C64C 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C656 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C656
- 0C656 68 PLA
- 0C657 A8 TAY
- 0C658 68 PLA
- 0C659 AA TAX
- 0C65A 60 RTS0C65B .include Routines\BASE_4_5\\Game\Subroutines\doLoadChrRam.asm
- 0C65B doLoadChrRam:
- 0C65B ;;; this uses the LoadChrData macro
- 0C65B 98 48 AD 20 06 8D 21 06.. SwitchBank tempBank
- 0C66B 2C 02 20 bit $2002
- 0C66E A5 0D LDA arg1_hold
- 0C670 8D 06 20 STA $2006
- 0C673 A5 0E LDA arg2_hold
- 0C675 8D 06 20 STA $2006
- 0C678 ;arg3_hold holds the number of tiles to be drawn.
- 0C678 LoadTilesOuterLoop
- 0C678 A9 10 LDA #$10
- 0C67A 85 01 STA temp1 ;; tile counter.
- 0C67C A0 00 LDY #$00
- 0C67E LoadTilesLoop:
- 0C67E A2 10 LDX #$10
- 0C680 LoadChrRamLoop:
- 0C680 B1 14 LDA (temp16),y
- 0C682 8D 07 20 STA $2007
- 0C685 C8 INY
- 0C686 CA DEX
- 0C687 D0 F7 BNE LoadChrRamLoop
- 0C689 C6 01 DEC temp1
- 0C68B D0 09 BNE keepLoading
- 0C68D ;;; now a full tile has been loaded.
- 0C68D C6 0F DEC arg3_hold
- 0C68F F0 09 BEQ doneLoadingTiles
- 0C691 E6 15 INC temp16+1
- 0C693 4C 78 C6 JMP LoadTilesOuterLoop
- 0C696 keepLoading:
- 0C696 C6 0F DEC arg3_hold
- 0C698 D0 E4 BNE LoadTilesLoop
- 0C69A doneLoadingTiles:
- 0C69A 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C6A4 60 RTS
- 0C6A5
- 0C6A5
- 0C6A5 .include Routines\BASE_4_5\\Game\Subroutines\doLoadNametableData.asm
- 0C6A5 doLoadNametableData:
- 0C6A5 ;;; currently, arg0_hold has the bank data
- 0C6A5 ;;; arg1_hold has the screen index, if it is needed.
- 0C6A5 ;;; arg2_hold has screen bits.
- 0C6A5 ;;; bit 0 = overworld (0) underworld (1)
- 0C6A5 ;;; bit 1 = metaTable (0) 8x8 table (1)
- 0C6A5 ;arg0 = screen bank
- 0C6A5 ;arg3_hold = columns to load
- 0C6A5 ;arg4_hold = rows to load
- 0C6A5 ;arg5_hold = start position hi
- 0C6A5 ;arg6_hold = start position lo
- 0C6A5 ;arg7_hold = start column
- 0C6A5
- 0C6A5 ;;; decreasing arg3_holder / arg4_holder will track if there are more columns/rows to load. If zero, that part is done.
- 0C6A5 A5 12 LDA arg6_hold
- 0C6A7 85 1B STA pointer
- 0C6A9 A5 11 LDA arg5_hold
- 0C6AB 85 1C STA pointer+1
- 0C6AD
- 0C6AD A5 0F LDA arg3_hold
- 0C6AF 85 08 STA tempB ; we will use tempB to hold the number of columns
- 0C6B1 ; so when we start a new row, we can return to the proper number of columns.
- 0C6B1 ;;; now we can use the (pointer) to know the PPU address to write the nametable.
- 0C6B1 ;;; whilte (temp16) denotes where the nametable data is being pulled from.
- 0C6B1
- 0C6B1 98 48 AD 20 06 8D 21 06.. SwitchBank arg0_hold;temp
- 0C6C0
- 0C6C0 A4 13 LDY arg7_hold ;;; in what column should the nametable begin?
- 0C6C2 loop_LoadNametableMeta:
- 0C6C2 A5 1C LDA pointer+1
- 0C6C4 8D 06 20 STA $2006
- 0C6C7 A5 1B LDA pointer
- 0C6C9 8D 06 20 STA $2006
- 0C6CC B1 14 LDA (temp16),y
- 0C6CE 85 00 STA temp
- 0C6D0 ;;; now we have to do an evaluation, to compare this to potential "blank" values and paths.
- 0C6D0 20 24 C7 JSR doGetSingleMetaTileValues
- 0C6D3 20 A2 C7 JSR doDrawSingleMetatile
- 0C6D6 doneDrawingThisMetatile:
- 0C6D6 C8 INY
- 0C6D7 C6 08 DEC tempB ;; is a surrogate for columns
- 0C6D9 A5 08 LDA tempB
- 0C6DB F0 0A BEQ doneWithMetaTileColumn
- 0C6DD A5 1B LDA pointer
- 0C6DF 18 CLC
- 0C6E0 69 02 ADC #$02
- 0C6E2 85 1B STA pointer
- 0C6E4 4C C2 C6 JMP loop_LoadNametableMeta
- 0C6E7 doneWithMetaTileColumn:
- 0C6E7 C6 10 DEC arg4_hold
- 0C6E9 A5 10 LDA arg4_hold
- 0C6EB F0 2C BEQ noMoreMetaTilesToLoad
- 0C6ED C9 08 CMP #$08
- 0C6EF D0 03 BNE +dontWaitFrame
- 0C6F1 20 FB C8 JSR doWaitFrame
- 0C6F4 +dontWaitFrame
- 0C6F4 A5 0F LDA arg3_hold
- 0C6F6 85 08 STA tempB ;; resets the amount of columns.
- 0C6F8 ;;;;; calculate based on the number of columns drawn
- 0C6F8 ;;;;; where the "beginning of the column" should be,
- 0C6F8 ;;;;; and skip down to the next free line.
- 0C6F8 0A ASL
- 0C6F9 85 09 STA tempC ;
- 0C6FB ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C6FB A5 1B LDA pointer
- 0C6FD 18 CLC
- 0C6FE 69 02 ADC #$02
- 0C700 38 SEC
- 0C701 E5 09 SBC tempC
- 0C703 18 clc
- 0C704 69 40 adc #$40
- 0C706 85 1B STA pointer
- 0C708 A5 1C LDA pointer+1
- 0C70A 69 00 ADC #$00
- 0C70C 85 1C STA pointer+1
- 0C70E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C70E ;;; now, calculate where y should read from
- 0C70E ;;; based on the number of columns being drawn.
- 0C70E 98 TYA
- 0C70F 18 CLC
- 0C710 69 10 ADC #$10
- 0C712 38 SEC
- 0C713 E5 0F SBC arg3_hold
- 0C715 A8 TAY
- 0C716 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C716 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C716 4C C2 C6 JMP loop_LoadNametableMeta
- 0C719
- 0C719
- 0C719 noMoreMetaTilesToLoad:
- 0C719
- 0C719 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C723 60 RTS
- 0C724
- 0C724
- 0C724
- 0C724
- 0C724 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C724 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C724
- 0C724 doGetSingleMetaTileValues:
- 0C724 85 00 STA temp
- 0C726
- 0C726 AD 96 06 LDA screenLoadTemps
- 0C729 29 80 AND #%10000000
- 0C72B D0 59 BNE notPath
- 0C72D A5 00 LDA temp
- 0C72F ; CMP #BLANK_TILE ;; solid BLACK translate.
- 0C72F C9 F5 CMP #$f5
- 0C731 F0 0F BEQ isBlankTile
- 0C733 C9 FD CMP #$FD
- 0C735 F0 0B BEQ isBlankTile ;isFDtile ;; solid "RED" translate
- 0C737 C9 FE CMP #$FE
- 0C739 F0 07 BEQ isBlankTile ;isFEtile ;; solid "GREEN" translate
- 0C73B C9 FF CMP #$FF
- 0C73D F0 03 BEQ isBlankTile ;isFFtile ;; solid "BLACK" translate
- 0C73F 4C 4F C7 JMP notBlankTile
- 0C742 isBlankTile:
- 0C742 ;;; it was a blank tile. They are all now blank tiles
- 0C742 8D 53 06 STA updateTile_00
- 0C745 8D 54 06 STA updateTile_01
- 0C748 8D 55 06 STA updateTile_02
- 0C74B 8D 56 06 STA updateTile_03
- 0C74E 60 RTS
- 0C74F
- 0C74F notBlankTile:
- 0C74F
- 0C74F ;;;; check for screen modes.
- 0C74F AD 46 06 LDA tileLayout
- 0C752 C9 40 CMP #%01000000
- 0C754 F0 17 BEQ checkForPathUpdates
- 0C756 C9 60 CMP #%01100000
- 0C758 F0 06 BEQ checkForPathUpdates1
- 0C75A ;;;; THIS DOES NOT USE PATHS!!!
- 0C75A ;;;; so just restore the temp value and proceed with metaTiles as if it wasn't a path value.
- 0C75A A5 00 LDA temp
- 0C75C 4C 86 C7 JMP notPath
- 0C75F 60 RTS
- 0C760
- 0C760 checkForPathUpdates1:
- 0C760 ;;;;; THIS MODE USES ONLY THE FIRST TWO "paths" AS PATHS.
- 0C760 A5 00 LDA temp
- 0C762 C9 A0 CMP #$A0
- 0C764 F0 1C BEQ doPathUpdate
- 0C766 C9 B0 CMP #$B0
- 0C768 F0 18 BEQ doPathUpdate
- 0C76A 4C 86 C7 JMP notPath
- 0C76D
- 0C76D checkForPathUpdates:
- 0C76D ;;;;;; THIS MODE USES ALL FOUR "paths" AS PATHS.
- 0C76D
- 0C76D A5 00 LDA temp
- 0C76F C9 80 CMP #$80
- 0C771 F0 0F BEQ doPathUpdate
- 0C773 C9 90 CMP #$90
- 0C775 F0 0B BEQ doPathUpdate
- 0C777 C9 A0 CMP #$A0
- 0C779 F0 07 BEQ doPathUpdate
- 0C77B C9 B0 CMP #$B0
- 0C77D F0 03 BEQ doPathUpdate
- 0C77F 4C 86 C7 JMP notPath
- 0C782
- 0C782 doPathUpdate:
- 0C782
- 0C782 ;; now we have to do evaluations of other tiles around us to know
- 0C782 ;; exactly what to draw here.
- 0C782 20 D2 C7 JSR handlePath
- 0C785 60 RTS
- 0C786 notPath:
- 0C786 8D 53 06 STA updateTile_00
- 0C789 E6 00 INC temp
- 0C78B A5 00 LDA temp
- 0C78D 8D 54 06 STA updateTile_01
- 0C790 ;;; now, what we need is a row down from our current position...updateNT_pointer
- 0C790 ;;; and temp, increased to its next row.
- 0C790 18 CLC
- 0C791 69 0F ADC #$0f
- 0C793 85 00 STA temp
- 0C795 A5 00 LDA temp
- 0C797 8D 55 06 STA updateTile_02
- 0C79A E6 00 INC temp
- 0C79C A5 00 LDA temp
- 0C79E 8D 56 06 STA updateTile_03
- 0C7A1 60 RTS
- 0C7A2
- 0C7A2 doDrawSingleMetatile:
- 0C7A2 A5 1C LDA pointer+1
- 0C7A4 8D 06 20 STA $2006
- 0C7A7 A5 1B LDA pointer
- 0C7A9 8D 06 20 STA $2006
- 0C7AC
- 0C7AC AD 53 06 LDA updateTile_00
- 0C7AF 8D 07 20 STA $2007 ;write 1
- 0C7B2 AD 54 06 LDA updateTile_01
- 0C7B5 8D 07 20 STA $2007 ;; write 2
- 0C7B8
- 0C7B8 ;;; now, what we need is a row down from our current position...pointer
- 0C7B8 ;;; and temp, increased to its next row.
- 0C7B8 A5 1C LDA pointer+1
- 0C7BA 8D 06 20 STA $2006
- 0C7BD
- 0C7BD A5 1B LDA pointer
- 0C7BF 18 CLC
- 0C7C0 69 20 ADC #$20 ;; dont store it into pointer
- 0C7C2 ;; because then it will be easy to just add 2 to
- 0C7C2 ;; for the next place to write.
- 0C7C2 8D 06 20 STA $2006
- 0C7C5
- 0C7C5 ;; now get the tile
- 0C7C5 AD 55 06 LDA updateTile_02
- 0C7C8 8D 07 20 STA $2007 ; write 3
- 0C7CB AD 56 06 LDA updateTile_03
- 0C7CE 8D 07 20 STA $2007 ; write 4
- 0C7D1 60 RTS
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2
- 0C7D2 handlePath:
- 0C7D2 8A TXA
- 0C7D3 48 PHA
- 0C7D4 98 TYA
- 0C7D5 48 PHA
- 0C7D6
- 0C7D6 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0C7D6 ;blank0C7D6
- 0C7D6
- 0C7D6 68 PLA
- 0C7D7 A8 TAY
- 0C7D8 68 PLA
- 0C7D9 AA TAX
- 0C7DA
- 0C7DA 60 RTS
- 0C7DB 0C7DB .include Routines\BASE_4_5\\Game\Subroutines\doLoadAttributeData.asm
- 0C7DB doLoadAttributeData:
- 0C7DB
- 0C7DB ;;; attributes have 8 columns per screen and 7 1/2 rows per screen.
- 0C7DB ;;;
- 0C7DB
- 0C7DB ;;; currently, arg0_hold has the bank data
- 0C7DB ;;; arg1_hold has the screen index, if it is needed.
- 0C7DB ;;; arg2_hold has screen bits.
- 0C7DB ;;; bit 0 = overworld (0) underworld (1)
- 0C7DB ;;; bit 1 = metaTable (0) 8x8 table (1)
- 0C7DB ;arg0 = screen bank
- 0C7DB ;arg3_hold = columns to load
- 0C7DB ;arg4_hold = rows to load
- 0C7DB ;arg5_hold = start position hi
- 0C7DB ;arg6_hold = start position lo
- 0C7DB ;arg7_hold = start column
- 0C7DB
- 0C7DB ;;; decreasing arg3_holder / arg4_holder will track if there are more columns/rows to load. If zero, that part is done.
- 0C7DB
- 0C7DB A5 12 LDA arg6_hold
- 0C7DD 85 1B STA pointer
- 0C7DF A5 11 LDA arg5_hold
- 0C7E1 85 1C STA pointer+1
- 0C7E3
- 0C7E3 A5 0F LDA arg3_hold
- 0C7E5 85 08 STA tempB ; we will use tempB to hold the number of columns
- 0C7E7 ; so when we start a new row, we can return to the proper number of columns.
- 0C7E7 ;;; now we can use the (pointer) to know the PPU address to write the nametable.
- 0C7E7 ;;; whilte (temp16) denotes where the nametable data is being pulled from.
- 0C7E7 98 48 AD 20 06 8D 21 06.. SwitchBank arg0_hold
- 0C7F6 A4 13 LDY arg7_hold ;;; in what column should the column begin?
- 0C7F8 loop_LoadAttTable:
- 0C7F8 A5 1C LDA pointer+1
- 0C7FA 8D 06 20 STA $2006
- 0C7FD A5 1B LDA pointer
- 0C7FF 8D 06 20 STA $2006
- 0C802 B1 14 LDA (temp16),y
- 0C804 8D 07 20 STA $2007
- 0C807
- 0C807 doneDrawingThisAttributeTile:
- 0C807 C8 INY
- 0C808 C6 08 DEC tempB ;; is a surrogate for columns
- 0C80A A5 08 LDA tempB
- 0C80C F0 0A BEQ doneWithAttributeColumn
- 0C80E
- 0C80E A5 1B LDA pointer
- 0C810 18 CLC
- 0C811 69 01 ADC #$01
- 0C813 85 1B STA pointer
- 0C815 4C F8 C7 JMP loop_LoadAttTable
- 0C818 doneWithAttributeColumn:
- 0C818 C6 10 DEC arg4_hold
- 0C81A A5 10 LDA arg4_hold
- 0C81C F0 1C BEQ noMoreAttributeTilesToLoad
- 0C81E A5 0F LDA arg3_hold
- 0C820 85 08 STA tempB
- 0C822 A5 1B LDA pointer
- 0C824 38 SEC
- 0C825 E5 08 SBC tempB
- 0C827 18 CLC
- 0C828 69 08 ADC #$08 ;; skip down to next attribute row.
- 0C82A 18 CLC
- 0C82B 69 01 ADC #$01
- 0C82D 85 1B STA pointer
- 0C82F
- 0C82F 98 TYA
- 0C830 38 SEC
- 0C831 E5 08 SBC tempB
- 0C833 18 CLC
- 0C834 69 08 ADC #$08
- 0C836 A8 TAY
- 0C837 4C F8 C7 JMP loop_LoadAttTable
- 0C83A noMoreAttributeTilesToLoad:
- 0C83A 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C844 60 RTS0C845 .include Routines\BASE_4_5\\Game\Subroutines\doLoadCollisionTable.asm
- 0C845 doLoadCollisionTable:
- 0C845 ;;; currently, arg0_hold has the bank data
- 0C845 ;;; arg1_hold has the screen index, if it is needed.
- 0C845 ;;; arg2_hold has screen bits.
- 0C845 ;;; bit 0 = overworld (0) underworld (1)
- 0C845 ;;; bit 1 = metaTable (0) 8x8 table (1)
- 0C845 ;arg0 = screen bank
- 0C845 ;arg3_hold = columns to load
- 0C845 ;arg4_hold = rows to load
- 0C845 ;arg5_hold = start row
- 0C845 ;arg6_hold = start column
- 0C845 ;arg7_hold = which nametable.
- 0C845
- 0C845
- 0C845
- 0C845 A5 12 LDA arg6_hold
- 0C847 AA TAX ;; starting collision table write
- 0C848 4A LSR
- 0C849 A8 TAY ;; starting rom read.
- 0C84A
- 0C84A A5 0F LDA arg3_hold
- 0C84C 85 08 STA tempB ; we will use tempB to hold the number of columns
- 0C84E ; so when we start a new row, we can return to the proper number of columns.
- 0C84E ;;; now we can use the (pointer) to know the PPU address to write the nametable.
- 0C84E ;;; whilte (temp16) denotes where the nametable data is being pulled from.
- 0C84E 98 48 AD 20 06 8D 21 06.. SwitchBank arg0_hold
- 0C85D loop_LoadCollisionTable:
- 0C85D 8A TxA
- 0C85E 29 01 AND #%00000001
- 0C860 loop_LoadColTable_inner:
- 0C860 D0 2A BNE thisColTileIsOdd
- 0C862 ;; this col tile is even
- 0C862 B1 14 LDA (temp16),y
- 0C864 4A LSR
- 0C865 4A LSR
- 0C866 4A LSR
- 0C867 4A LSR
- 0C868 85 09 STA tempC
- 0C86A A5 13 LDA arg7_hold
- 0C86C D0 0F BNE loadColToSecondCt_a
- 0C86E AD 74 06 LDA currentNametable
- 0C871 29 01 AND #%00000001
- 0C873 D0 0F BNE loadColFlip2 ;; flip it
- 0C875 loadColFlip:
- 0C875 A5 09 LDA tempC
- 0C877 9D 00 03 STA collisionTable,x
- 0C87A 4C B6 C8 JMP checkColColumnCount
- 0C87D loadColToSecondCt_a:
- 0C87D AD 74 06 LDA currentNametable
- 0C880 29 01 AND #%00000001
- 0C882 D0 F1 BNE loadColFlip;; flip it
- 0C884 loadColFlip2:
- 0C884 A5 09 LDA tempC
- 0C886 9D 00 05 STA collisionTable2,x
- 0C889 4C B6 C8 JMP checkColColumnCount
- 0C88C
- 0C88C thisColTileIsOdd:
- 0C88C ;;; this col tile is odd
- 0C88C B1 14 LDA (temp16),y
- 0C88E 29 0F AND #%00001111
- 0C890 85 09 STA tempC
- 0C892 A5 13 LDA arg7_hold
- 0C894 D0 10 BNE loadColToSecondCt_b
- 0C896 AD 74 06 LDA currentNametable
- 0C899 29 01 AND #%00000001
- 0C89B D0 10 BNE loadColFlip3
- 0C89D loadColFlip4:
- 0C89D A5 09 LDA tempC
- 0C89F 9D 00 03 STA collisionTable,x
- 0C8A2 C8 INY ;; y is only going to increase after odd is checked
- 0C8A3 4C B6 C8 JMP checkColColumnCount
- 0C8A6 loadColToSecondCt_b:
- 0C8A6 AD 74 06 LDA currentNametable
- 0C8A9 29 01 AND #%00000001
- 0C8AB D0 F0 BNE loadColFlip4
- 0C8AD loadColFlip3:
- 0C8AD A5 09 LDA tempC
- 0C8AF 9D 00 05 STA collisionTable2,x
- 0C8B2 C8 INY
- 0C8B3 4C B6 C8 JMP checkColColumnCount
- 0C8B6
- 0C8B6
- 0C8B6 checkColColumnCount:
- 0C8B6
- 0C8B6 E8 INX
- 0C8B7 C6 08 DEC tempB
- 0C8B9 A5 08 LDA tempB
- 0C8BB F0 03 BEQ doneWithColColumn
- 0C8BD
- 0C8BD 4C 5D C8 JMP loop_LoadCollisionTable
- 0C8C0 doneWithColColumn:
- 0C8C0 A5 0F LDA arg3_hold
- 0C8C2 85 08 STA tempB ;; reset column counter.
- 0C8C4
- 0C8C4 C6 10 DEC arg4_hold
- 0C8C6 A5 10 LDA arg4_hold
- 0C8C8 F0 18 BEQ doneWithLoadingCOllisions
- 0C8CA ;; now, the end of the column is reached.
- 0C8CA ;; that means that subtracting the "columns to load"
- 0C8CA ;; from x + 16 and columns to load/2 from y +8
- 0C8CA ;; gives the new position for the new row.
- 0C8CA 8A TxA
- 0C8CB 38 SEC
- 0C8CC E5 0F SBC arg3_hold
- 0C8CE 18 CLC
- 0C8CF 69 10 ADC #$10
- 0C8D1 AA TAX
- 0C8D2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end get x offset one row down.
- 0C8D2 A5 0F LDA arg3_hold
- 0C8D4 4A LSR
- 0C8D5 85 00 STA temp
- 0C8D7 98 TYA
- 0C8D8 38 SEC
- 0C8D9 E5 00 SBC temp
- 0C8DB 18 CLC
- 0C8DC 69 08 ADC #$08
- 0C8DE A8 TAY
- 0C8DF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end get y offset one row down
- 0C8DF 4C 5D C8 JMP loop_LoadCollisionTable
- 0C8E2
- 0C8E2 doneWithLoadingCOllisions:
- 0C8E2
- 0C8E2 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C8EC 60 RTS
- 0C8ED
- 0C8ED
- 0C8ED 0C8ED .include Routines\BASE_4_5\\Game\Subroutines\doCleanUpSpriteRam.asm
- 0C8ED ;; do clean up sprite ram
- 0C8ED doCleanUpSpriteRam:
- 0C8ED A4 2C LDY spriteRamPointer
- 0C8EF clearSpriteRamLoop:
- 0C8EF A9 FE LDA #$FE
- 0C8F1 99 00 02 STA SpriteRam,y
- 0C8F4 C8 INY
- 0C8F5 C8 INY
- 0C8F6 C8 INY
- 0C8F7 C8 INY
- 0C8F8 D0 F5 BNE clearSpriteRamLoop
- 0C8FA 60 RTS0C8FB .include Routines\BASE_4_5\\Game\Subroutines\doWaitFrame.asm
- 0C8FB doWaitFrame:
- 0C8FB EE 45 06 inc waiting
- 0C8FE waitLoop:
- 0C8FE AD 45 06 lda waiting
- 0C901 D0 FB BNE waitLoop
- 0C903
- 0C903 60 RTS0C904 .include Routines\BASE_4_5\\Game\Subroutines\doHandleBounds.asm
- 0C904 doHandleBounds:
- 0C904 98 48 AD 20 06 8D 21 06.. SwitchBank #$18
- 0C913 20 4D 8A JSR doHandleBounds_bank18
- 0C916 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0C920
- 0C920 60 RTS0C921 .include Routines\BASE_4_5\\Game\Subroutines\doLoadScreen.asm
- 0C921 doLoadScreen:
- 0C921
- 0C921 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C921 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C921 ;; zero out objects
- 0C921 20 01 DE JSR doClearAllMonsters
- 0C924 ; JSR doWaitFrame
- 0C924
- 0C924
- 0C924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C924
- 0C924
- 0C924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0C924 AD 74 06 LDA currentNametable
- 0C927 29 01 AND #%00000001
- 0C929 F0 0D BEQ isEvenNtForcamFocus_tiles
- 0C92B A9 24 LDA #$24
- 0C92D 8D BE 06 STA camFocus_tiles
- 0C930 A9 27 LDA #$27
- 0C932 8D BF 06 STA camFocus_att
- 0C935 4C 42 C9 JMP gotcamFocus_tiles_forScreenLoad
- 0C938 isEvenNtForcamFocus_tiles
- 0C938 A9 20 LDA #$20
- 0C93A 8D BE 06 STA camFocus_tiles
- 0C93D A9 23 LDA #$23
- 0C93F 8D BF 06 STA camFocus_att
- 0C942 gotcamFocus_tiles_forScreenLoad:
- 0C942
- 0C942
- 0C942 AD 74 06 LDA currentNametable
- 0C945 4A LSR
- 0C946 4A LSR
- 0C947 4A LSR
- 0C948 4A LSR
- 0C949 4A LSR
- 0C94A 85 00 STA temp ;; this is the screen bank.
- 0C94C AD A4 06 LDA warpMap
- 0C94F ;;; and other screen bytes needed - warp map is either 0 or 1
- 0C94F 85 02 STA temp2
- 0C951 A5 00 85 0C AD 74 06 85.. LoadScreenTableData temp, currentNametable, temp2
- 0C99D ;; loads from the collision table, all of the screen info that needs to be loaded.
- 0C99D ;; this needs to be BEFORE nametable, because it will determine if we're loading
- 0C99D ;; a meta table or a full table.
- 0C99D
- 0C99D
- 0C99D .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0C99D ;blank0C99D
- 0C99D A0 04 AD 9D 06 85 0C 20.. LoadBackgroundPalettes newPal
- 0C9A7 20 FB C8 JSR doWaitFrame
- 0C9AA ;; We wait this frame because the LoadBackgroundPalettes routine
- 0C9AA ;; sets bckpal variables and activates the update palette.
- 0C9AA ;; waiting this frame holds up on the next routine until the
- 0C9AA ;; background palettes are loaded into the PPU.
- 0C9AA ;LoadObjectPalettes #$00
- 0C9AA
- 0C9AA AD AD 06 85 0C A9 00 85.. LoadObjectSubPalettes spriteSubPal1, #$00
- 0C9B6 AD AE 06 85 0C A9 04 85.. LoadObjectSubPalettes spriteSubPal2, #$04
- 0C9C2 AD AF 06 85 0C A9 08 85.. LoadObjectSubPalettes spriteSubPal3, #$08
- 0C9CE AD B0 06 85 0C A9 0C 85.. LoadObjectSubPalettes spriteSubPal4, #$0C
- 0C9DA
- 0C9DA
- 0C9DA
- 0C9DA 20 FB C8 JSR doWaitFrame
- 0C9DD
- 0C9DD
- 0C9DD
- 0C9DD AD 46 06 LDA tileLayout
- 0C9E0 C9 40 CMP #%01000000
- 0C9E2 F0 03 BEQ LOAD_MSP
- 0C9E4 4C 75 CB JMP notMSP
- 0C9E7 LOAD_MSP:
- 0C9E7 AD 97 06 LDA backgroundTilesToLoad
- 0C9EA 4A LSR
- 0C9EB 4A LSR
- 0C9EC 4A LSR
- 0C9ED 4A LSR
- 0C9EE 18 CLC
- 0C9EF 69 0F ADC #$0F
- 0C9F1 85 07 STA tempA
- 0C9F3 AD 97 06 LDA backgroundTilesToLoad
- 0C9F6 29 0F AND #%00001111
- 0C9F8 85 08 STA tempB
- 0C9FA A5 07 8D 22 06 A9 10 85.. LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0CA4D ;arg0 - bank where graphics live
- 0CA4D ;arg1 - row
- 0CA4D ;arg2 - column (by 10s...must end in zero)
- 0CA4D ;arg3 - how many tiles to load. If 00, will load whole sheet.
- 0CA4D ;arg4 - Label in bank 16 table, low.
- 0CA4D ;arg5 - Label in bank 16 table, hi.
- 0CA4D ;arg6 - Bank 16 table offset
- 0CA4D
- 0CA4D 20 FB C8 JSR doWaitFrame
- 0CA50 AD 98 06 LDA backgroundTilesToLoad+1
- 0CA53 4A LSR
- 0CA54 4A LSR
- 0CA55 4A LSR
- 0CA56 4A LSR
- 0CA57 18 CLC
- 0CA58 69 0F ADC #$0F
- 0CA5A 85 07 STA tempA
- 0CA5C AD 98 06 LDA backgroundTilesToLoad+1
- 0CA5F 29 0F AND #%00001111
- 0CA61 85 08 STA tempB
- 0CA63 A5 07 8D 22 06 A9 16 85.. LoadChrData tempA, #$16, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0CAB6 ;;; load paths.
- 0CAB6 20 FB C8 JSR doWaitFrame
- 0CAB9 AD 99 06 LDA backgroundTilesToLoad+2
- 0CABC 4A LSR
- 0CABD 4A LSR
- 0CABE 4A LSR
- 0CABF 4A LSR
- 0CAC0 18 CLC
- 0CAC1 69 0F ADC #$0F
- 0CAC3 85 07 STA tempA
- 0CAC5 AD 99 06 LDA backgroundTilesToLoad+2
- 0CAC8 29 0F AND #%00001111
- 0CACA 85 08 STA tempB
- 0CACC
- 0CACC A5 07 8D 22 06 A9 18 85.. LoadChrData tempA, #$18, #$00, #$40, PathCHRAddLo, PathCHRAddHi, tempB
- 0CB1F
- 0CB1F
- 0CB1F ;; Load Hud
- 0CB1F A9 1E 8D 22 06 A9 1C 85.. LoadChrData #$1E, #$1C, #$00, #$40, OtherChrTiles_Lo, OtherChrTiles_Hi, #$00
- 0CB72
- 0CB72 4C C1 D2 JMP doneLoadingChrs
- 0CB75 notMSP:
- 0CB75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0CB75 ;;;DOUBLE MAIN;;;;;;;;;;;;;;;;;;;;;;;
- 0CB75
- 0CB75 C9 00 CMP #%00000000
- 0CB77 F0 03 BEQ Load_MM
- 0CB79 4C 9E CC JMP notMM
- 0CB7C Load_MM:
- 0CB7C AD 97 06 LDA backgroundTilesToLoad
- 0CB7F 4A LSR
- 0CB80 4A LSR
- 0CB81 4A LSR
- 0CB82 4A LSR
- 0CB83 18 CLC
- 0CB84 69 0F ADC #$0F
- 0CB86 85 07 STA tempA
- 0CB88 AD 97 06 LDA backgroundTilesToLoad
- 0CB8B 29 0F AND #%00001111
- 0CB8D 85 08 STA tempB
- 0CB8F A5 07 8D 22 06 A9 10 85.. LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0CBE2
- 0CBE2 AD 98 06 LDA backgroundTilesToLoad+1
- 0CBE5 4A LSR
- 0CBE6 4A LSR
- 0CBE7 4A LSR
- 0CBE8 4A LSR
- 0CBE9 18 CLC
- 0CBEA 69 0F ADC #$0F
- 0CBEC 85 07 STA tempA
- 0CBEE AD 98 06 LDA backgroundTilesToLoad+1
- 0CBF1 29 0F AND #%00001111
- 0CBF3 85 08 STA tempB
- 0CBF5 A5 07 8D 22 06 A9 16 85.. LoadChrData tempA, #$16, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0CC48
- 0CC48 ;; Load Hud
- 0CC48 A9 1E 8D 22 06 A9 1C 85.. LoadChrData #$1E, #$1C, #$00, #$40, OtherChrTiles_Lo, OtherChrTiles_Hi, #$00
- 0CC9B
- 0CC9B
- 0CC9B 4C C1 D2 JMP doneLoadingChrs
- 0CC9E notMM:
- 0CC9E C9 70 CMP #%01110000
- 0CCA0 F0 03 BEQ LOAD_MSSS
- 0CCA2 4C 9C CE JMP notMSSS
- 0CCA5 LOAD_MSSS:
- 0CCA5 AD 97 06 LDA backgroundTilesToLoad
- 0CCA8 4A LSR
- 0CCA9 4A LSR
- 0CCAA 4A LSR
- 0CCAB 4A LSR
- 0CCAC 18 CLC
- 0CCAD 69 0F ADC #$0F
- 0CCAF 85 07 STA tempA
- 0CCB1 AD 97 06 LDA backgroundTilesToLoad
- 0CCB4 29 0F AND #%00001111
- 0CCB6 85 08 STA tempB
- 0CCB8 A5 07 8D 22 06 A9 10 85.. LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0CD0B
- 0CD0B 20 FB C8 JSR doWaitFrame
- 0CD0E AD 98 06 LDA backgroundTilesToLoad+1
- 0CD11 4A LSR
- 0CD12 4A LSR
- 0CD13 4A LSR
- 0CD14 4A LSR
- 0CD15 18 CLC
- 0CD16 69 0F ADC #$0F
- 0CD18 85 07 STA tempA
- 0CD1A AD 98 06 LDA backgroundTilesToLoad+1
- 0CD1D 29 0F AND #%00001111
- 0CD1F 85 08 STA tempB
- 0CD21 A5 07 8D 22 06 A9 16 85.. LoadChrData tempA, #$16, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0CD74
- 0CD74 20 FB C8 JSR doWaitFrame
- 0CD77 AD 99 06 LDA backgroundTilesToLoad+2
- 0CD7A 4A LSR
- 0CD7B 4A LSR
- 0CD7C 4A LSR
- 0CD7D 4A LSR
- 0CD7E 18 CLC
- 0CD7F 69 0F ADC #$0F
- 0CD81 85 07 STA tempA
- 0CD83 AD 99 06 LDA backgroundTilesToLoad+2
- 0CD86 29 0F AND #%00001111
- 0CD88 85 08 STA tempB
- 0CD8A A5 07 8D 22 06 A9 18 85.. LoadChrData tempA, #$18, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0CDDD
- 0CDDD 20 FB C8 JSR doWaitFrame
- 0CDE0 AD 9A 06 LDA backgroundTilesToLoad+3
- 0CDE3 4A LSR
- 0CDE4 4A LSR
- 0CDE5 4A LSR
- 0CDE6 4A LSR
- 0CDE7 18 CLC
- 0CDE8 69 0F ADC #$0F
- 0CDEA 85 07 STA tempA
- 0CDEC AD 9A 06 LDA backgroundTilesToLoad+3
- 0CDEF 29 0F AND #%00001111
- 0CDF1 85 08 STA tempB
- 0CDF3 A5 07 8D 22 06 A9 1A 85.. LoadChrData tempA, #$1A, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0CE46
- 0CE46
- 0CE46 ;; Load Hud
- 0CE46 A9 1E 8D 22 06 A9 1C 85.. LoadChrData #$1E, #$1C, #$00, #$40, OtherChrTiles_Lo, OtherChrTiles_Hi, #$00
- 0CE99
- 0CE99
- 0CE99 4C C1 D2 JMP doneLoadingChrs
- 0CE9C notMSSS:
- 0CE9C C9 7C CMP #%01111100
- 0CE9E F0 03 BEQ doMSSSSS
- 0CEA0 4C 19 D1 JMP notMSSSSS
- 0CEA3 doMSSSSS
- 0CEA3 AD 97 06 LDA backgroundTilesToLoad
- 0CEA6 4A LSR
- 0CEA7 4A LSR
- 0CEA8 4A LSR
- 0CEA9 4A LSR
- 0CEAA 18 CLC
- 0CEAB 69 0F ADC #$0F
- 0CEAD 85 07 STA tempA
- 0CEAF AD 97 06 LDA backgroundTilesToLoad
- 0CEB2 29 0F AND #%00001111
- 0CEB4 85 08 STA tempB
- 0CEB6 A5 07 8D 22 06 A9 10 85.. LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0CF09
- 0CF09 20 FB C8 JSR doWaitFrame
- 0CF0C AD 98 06 LDA backgroundTilesToLoad+1
- 0CF0F 4A LSR
- 0CF10 4A LSR
- 0CF11 4A LSR
- 0CF12 4A LSR
- 0CF13 18 CLC
- 0CF14 69 0F ADC #$0F
- 0CF16 85 07 STA tempA
- 0CF18 AD 98 06 LDA backgroundTilesToLoad+1
- 0CF1B 29 0F AND #%00001111
- 0CF1D 85 08 STA tempB
- 0CF1F A5 07 8D 22 06 A9 16 85.. LoadChrData tempA, #$16, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0CF72
- 0CF72 20 FB C8 JSR doWaitFrame
- 0CF75 AD 99 06 LDA backgroundTilesToLoad+2
- 0CF78 4A LSR
- 0CF79 4A LSR
- 0CF7A 4A LSR
- 0CF7B 4A LSR
- 0CF7C 18 CLC
- 0CF7D 69 0F ADC #$0F
- 0CF7F 85 07 STA tempA
- 0CF81 AD 99 06 LDA backgroundTilesToLoad+2
- 0CF84 29 0F AND #%00001111
- 0CF86 85 08 STA tempB
- 0CF88 A5 07 8D 22 06 A9 18 85.. LoadChrData tempA, #$18, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0CFDB
- 0CFDB 20 FB C8 JSR doWaitFrame
- 0CFDE AD 9A 06 LDA backgroundTilesToLoad+3
- 0CFE1 4A LSR
- 0CFE2 4A LSR
- 0CFE3 4A LSR
- 0CFE4 4A LSR
- 0CFE5 18 CLC
- 0CFE6 69 0F ADC #$0F
- 0CFE8 85 07 STA tempA
- 0CFEA AD 9A 06 LDA backgroundTilesToLoad+3
- 0CFED 29 0F AND #%00001111
- 0CFEF 85 08 STA tempB
- 0CFF1 A5 07 8D 22 06 A9 1A 85.. LoadChrData tempA, #$1A, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0D044
- 0D044 20 FB C8 JSR doWaitFrame
- 0D047 AD 9B 06 LDA backgroundTilesToLoad+4
- 0D04A 4A LSR
- 0D04B 4A LSR
- 0D04C 4A LSR
- 0D04D 4A LSR
- 0D04E 18 CLC
- 0D04F 69 0F ADC #$0F
- 0D051 85 07 STA tempA
- 0D053 AD 9B 06 LDA backgroundTilesToLoad+4
- 0D056 29 0F AND #%00001111
- 0D058 85 08 STA tempB
- 0D05A A5 07 8D 22 06 A9 1C 85.. LoadChrData tempA, #$1C, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0D0AD
- 0D0AD 20 FB C8 JSR doWaitFrame
- 0D0B0 AD 9C 06 LDA backgroundTilesToLoad+5
- 0D0B3 4A LSR
- 0D0B4 4A LSR
- 0D0B5 4A LSR
- 0D0B6 4A LSR
- 0D0B7 18 CLC
- 0D0B8 69 0F ADC #$0F
- 0D0BA 85 07 STA tempA
- 0D0BC AD 9C 06 LDA backgroundTilesToLoad+5
- 0D0BF 29 0F AND #%00001111
- 0D0C1 85 08 STA tempB
- 0D0C3 A5 07 8D 22 06 A9 1E 85.. LoadChrData tempA, #$1E, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0D116 4C C1 D2 JMP doneLoadingChrs
- 0D119 notMSSSSS
- 0D119 C9 0C CMP #%00001100
- 0D11B F0 03 BEQ doMMSS
- 0D11D 4C C1 D2 JMP notMMSS
- 0D120 doMMSS:
- 0D120 AD 97 06 LDA backgroundTilesToLoad
- 0D123 4A LSR
- 0D124 4A LSR
- 0D125 4A LSR
- 0D126 4A LSR
- 0D127 18 CLC
- 0D128 69 0F ADC #$0F
- 0D12A 85 07 STA tempA
- 0D12C AD 97 06 LDA backgroundTilesToLoad
- 0D12F 29 0F AND #%00001111
- 0D131 85 08 STA tempB
- 0D133 A5 07 8D 22 06 A9 10 85.. LoadChrData tempA, #$10, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0D186
- 0D186 AD 98 06 LDA backgroundTilesToLoad+1
- 0D189 4A LSR
- 0D18A 4A LSR
- 0D18B 4A LSR
- 0D18C 4A LSR
- 0D18D 18 CLC
- 0D18E 69 0F ADC #$0F
- 0D190 85 07 STA tempA
- 0D192 AD 98 06 LDA backgroundTilesToLoad+1
- 0D195 29 0F AND #%00001111
- 0D197 85 08 STA tempB
- 0D199 A5 07 8D 22 06 A9 16 85.. LoadChrData tempA, #$16, #$00, #$60, BckCHRAddLo, BckCHRAddHi, tempB
- 0D1EC 20 FB C8 JSR doWaitFrame
- 0D1EF AD 99 06 LDA backgroundTilesToLoad+2
- 0D1F2 4A LSR
- 0D1F3 4A LSR
- 0D1F4 4A LSR
- 0D1F5 4A LSR
- 0D1F6 18 CLC
- 0D1F7 69 0F ADC #$0F
- 0D1F9 85 07 STA tempA
- 0D1FB AD 99 06 LDA backgroundTilesToLoad+2
- 0D1FE 29 0F AND #%00001111
- 0D200 85 08 STA tempB
- 0D202 A5 07 8D 22 06 A9 1C 85.. LoadChrData tempA, #$1C, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0D255
- 0D255 20 FB C8 JSR doWaitFrame
- 0D258 AD 9A 06 LDA backgroundTilesToLoad+3
- 0D25B 4A LSR
- 0D25C 4A LSR
- 0D25D 4A LSR
- 0D25E 4A LSR
- 0D25F 18 CLC
- 0D260 69 0F ADC #$0F
- 0D262 85 07 STA tempA
- 0D264 AD 9A 06 LDA backgroundTilesToLoad+3
- 0D267 29 0F AND #%00001111
- 0D269 85 08 STA tempB
- 0D26B A5 07 8D 22 06 A9 1E 85.. LoadChrData tempA, #$1E, #$00, #$20, BckSSChrAddLo, BckSSChrAddHi, tempB
- 0D2BE
- 0D2BE 4C C1 D2 JMP doneLoadingChrs
- 0D2C1 notMMSS:
- 0D2C1 doneLoadingChrs:
- 0D2C1
- 0D2C1
- 0D2C1
- 0D2C1
- 0D2C1 A9 15 8D 22 06 A9 00 85.. LoadChrData #$15, #$00, #$00, #$80, GameObjectCHRAddLo, GameObjectCHRAddHi, #$00
- 0D314 ;arg0 - bank where graphics live
- 0D314 ;arg1 - row
- 0D314 ;arg2 - column (by 10s...must end in zero)
- 0D314 ;arg3 - how many tiles to load. If 00, will load whole sheet.
- 0D314 ;arg4 - Label in bank 16 table, low.
- 0D314 ;arg5 - Label in bank 16 table, hi.
- 0D314 ;arg6 - Bank 16 table offset
- 0D314
- 0D314 AD AC 06 LDA monsterTableOffset
- 0D317 C9 08 CMP #$08
- 0D319 90 05 BCC inMonsterBank0
- 0D31B ;; in monster bank 1
- 0D31B A9 14 LDA #$14
- 0D31D 4C 22 D3 JMP gotMonsterBank
- 0D320 inMonsterBank0
- 0D320 A9 13 LDA #$13
- 0D322 gotMonsterBank:
- 0D322 85 00 STA temp
- 0D324
- 0D324 A5 00 8D 22 06 A9 08 85.. LoadChrData temp, #$08, #$00, #$80, MonsterAddressLo, MonsterAddressHi, monsterTableOffset
- 0D379 ;arg0 - bank where graphics live
- 0D379 ;arg1 - row
- 0D379 ;arg2 - column (by 10s...must end in zero)
- 0D379 ;arg3 - how many tiles to load. If 00, will load whole sheet.
- 0D379 ;arg4 - Label in bank 16 table, low.
- 0D379 ;arg5 - Label in bank 16 table, hi.
- 0D379 ;arg6 - Bank 16 table offset
- 0D379 20 FB C8 JSR doWaitFrame
- 0D37C
- 0D37C
- 0D37C
- 0D37C AD 74 06 LDA currentNametable
- 0D37F 29 01 AND #%00000001
- 0D381 D0 0B BNE isOddNametable_loadToRightNT
- 0D383 ;;is even nametable. 20/23
- 0D383 A9 20 LDA #$20
- 0D385 85 04 STA tempx
- 0D387 A9 23 LDA #$23
- 0D389 85 05 STA tempy
- 0D38B 4C 96 D3 JMP gotStartingNT
- 0D38E isOddNametable_loadToRightNT:
- 0D38E A9 24 LDA #$24
- 0D390 85 04 STA tempx
- 0D392 A9 27 LDA #$27
- 0D394 85 05 STA tempy
- 0D396
- 0D396 gotStartingNT:
- 0D396 ;;; check if load full or meta nametable
- 0D396 AD 96 06 LDA screenLoadTemps
- 0D399 29 80 AND #%10000000
- 0D39B F0 66 BEQ loadMetaNametable
- 0D39D
- 0D39D ;;; load 8x8 nametable.
- 0D39D AD 74 06 LDA currentNametable
- 0D3A0 4A LSR
- 0D3A1 4A LSR
- 0D3A2 4A LSR
- 0D3A3 4A LSR
- 0D3A4 4A LSR
- 0D3A5 85 00 STA temp ;; this is the screen bank.
- 0D3A7
- 0D3A7 AD A4 06 LDA warpMap
- 0D3AA ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D3AA 85 02 STA temp2
- 0D3AC
- 0D3AC A5 00 85 0C AD 74 06 85.. LoadNametableDataFull temp, currentNametable, temp2, tempx
- 0D400 4C 76 D4 Jmp DoneLoadingNametable_metaOr8x8x
- 0D403 loadMetaNametable:
- 0D403 AD 74 06 LDA currentNametable
- 0D406 4A LSR
- 0D407 4A LSR
- 0D408 4A LSR
- 0D409 4A LSR
- 0D40A 4A LSR
- 0D40B 85 00 STA temp ;; this is the screen bank.
- 0D40D AD A4 06 LDA warpMap
- 0D410 ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D410 85 02 STA temp2
- 0D412
- 0D412 A5 00 85 0C AD 74 06 85.. LoadNametableData temp, currentNametable, temp2, #$10, #$0f, tempx, #$00, #$00
- 0D476
- 0D476 DoneLoadingNametable_metaOr8x8x:
- 0D476 20 FB C8 JSR doWaitFrame
- 0D479 AD 74 06 LDA currentNametable
- 0D47C 4A LSR
- 0D47D 4A LSR
- 0D47E 4A LSR
- 0D47F 4A LSR
- 0D480 4A LSR
- 0D481 85 00 STA temp ;; this is the screen bank.
- 0D483 AD A4 06 LDA warpMap
- 0D486 ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D486 85 02 STA temp2
- 0D488
- 0D488 A5 00 85 0C AD 74 06 85.. LoadAttributeData temp, currentNametable, temp2, #$08, #$08, tempy, #$C0, #$00
- 0D4EC 20 FB C8 JSR doWaitFrame
- 0D4EF AD 74 06 LDA currentNametable
- 0D4F2 4A LSR
- 0D4F3 4A LSR
- 0D4F4 4A LSR
- 0D4F5 4A LSR
- 0D4F6 4A LSR
- 0D4F7 85 00 STA temp ;; this is the screen bank.
- 0D4F9 AD A4 06 LDA warpMap
- 0D4FC ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D4FC 85 02 STA temp2
- 0D4FE
- 0D4FE A5 00 85 0C AD 74 06 85.. LoadCollisionData temp, currentNametable, temp2, #$10, #$0F, #$00, #$00, #$00
- 0D562 20 FB C8 JSR doWaitFrame
- 0D565
- 0D565 AE 6D 06 LDX player1_object
- 0D568 AD 75 06 LDA newX
- 0D56B 9D 1A 04 STA Object_x_hi,x
- 0D56E AD 76 06 LDA newY
- 0D571 9D 41 04 STA Object_y_hi,x
- 0D574
- 0D574 AD B4 06 LDA screenUpdateByte
- 0D577 29 04 AND #%00000100
- 0D579 F0 20 BEQ nevermindSettingNewContinueByte
- 0D57B AD A4 06 LDA warpMap
- 0D57E 8D D5 06 STA continueMap
- 0D581 AD 74 06 LDA currentNametable
- 0D584 8D D2 06 STA continueScreen
- 0D587 AD 75 06 LDA newX
- 0D58A 8D D3 06 STA continueX
- 0D58D AD 76 06 LDA newY
- 0D590 8D D4 06 STA continueY
- 0D593 AD B4 06 LDA screenUpdateByte
- 0D596 29 FB AND #%11111011
- 0D598 8D B4 06 STA screenUpdateByte
- 0D59B nevermindSettingNewContinueByte:
- 0D59B 20 FB C8 JSR doWaitFrame
- 0D59E 20 6B F7 DrawHud
- 0D5A1
- 0D5A1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0D5A1 ;;; DO SOMETHING - CUSTOM
- 0D5A1 ;;; I want to check all collisions. If they are type 6, set them to 0 and draw ground tiles over them.
- 0D5A1 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0D5A1 ;blank0D5A1
- 0D5A1 A9 1E LDA #%00011110 ;;
- 0D5A3 85 17 STA soft2001
- 0D5A5 20 FB C8 JSR doWaitFrame
- 0D5A8
- 0D5A8 dontTurnOnScreenYet:
- 0D5A8
- 0D5A8 60 RTS0D5A9 .include Routines\BASE_4_5\\Game\Subroutines\doLoadScreen2.asm
- 0D5A9 doLoadScreen2:
- 0D5A9 AD 74 06 LDA currentNametable
- 0D5AC 29 01 AND #%00000001
- 0D5AE F0 0B BEQ secondNametableIsIn24
- 0D5B0 A9 20 LDA #$20
- 0D5B2 85 04 STA tempx
- 0D5B4 A9 23 LDA #$23
- 0D5B6 85 05 STA tempy
- 0D5B8 4C C3 D5 JMP gotSecondNtStart
- 0D5BB secondNametableIsIn24
- 0D5BB
- 0D5BB A9 24 LDA #$24
- 0D5BD 85 04 STA tempx
- 0D5BF A9 27 LDA #$27
- 0D5C1 85 05 STA tempy
- 0D5C3 gotSecondNtStart:
- 0D5C3
- 0D5C3
- 0D5C3 AD 74 06 LDA currentNametable
- 0D5C6 4A LSR
- 0D5C7 4A LSR
- 0D5C8 4A LSR
- 0D5C9 4A LSR
- 0D5CA 4A LSR
- 0D5CB 85 00 STA temp ;; this is the screen bank.
- 0D5CD
- 0D5CD AD 74 06 LDA currentNametable
- 0D5D0 18 CLC
- 0D5D1 69 01 ADC #$01
- 0D5D3 85 01 STA temp1
- 0D5D5 4A LSR
- 0D5D6 4A LSR
- 0D5D7 4A LSR
- 0D5D8 4A LSR
- 0D5D9 4A LSR
- 0D5DA 85 00 STA temp ;; this is the screen bank.
- 0D5DC AD A4 06 LDA warpMap
- 0D5DF ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D5DF 85 02 STA temp2
- 0D5E1
- 0D5E1 A5 00 85 0C A5 01 85 0D.. LoadNametableData temp, temp1, temp2, #$08, #$0F, tempx, #$00, #$00
- 0D643 20 FB C8 JSR doWaitFrame
- 0D646 AD 74 06 LDA currentNametable
- 0D649 4A LSR
- 0D64A 4A LSR
- 0D64B 4A LSR
- 0D64C 4A LSR
- 0D64D 4A LSR
- 0D64E 85 00 STA temp ;; this is the screen bank.
- 0D650 AD A4 06 LDA warpMap
- 0D653 ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D653 85 02 STA temp2
- 0D655
- 0D655 A5 00 85 0C A5 01 85 0D.. LoadAttributeData temp, temp1, temp2, #$04, #$08, tempy, #$C0, #$00
- 0D6B7 20 FB C8 JSR doWaitFrame
- 0D6BA
- 0D6BA
- 0D6BA
- 0D6BA AD 74 06 LDA currentNametable
- 0D6BD 38 sec
- 0D6BE E9 01 sbc #$01
- 0D6C0 85 01 STA temp1
- 0D6C2 4A LSR
- 0D6C3 4A LSR
- 0D6C4 4A LSR
- 0D6C5 4A LSR
- 0D6C6 4A LSR
- 0D6C7 85 00 STA temp ;; this is the screen bank.
- 0D6C9 AD A4 06 LDA warpMap
- 0D6CC ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D6CC 85 02 STA temp2
- 0D6CE
- 0D6CE A5 00 85 0C A5 01 85 0D.. LoadNametableData temp, temp1, temp2, #$08, #$0F, tempx, #$10, #$08
- 0D730 20 FB C8 JSR doWaitFrame
- 0D733 AD 74 06 LDA currentNametable
- 0D736 38 sec
- 0D737 E9 01 sbc #$01
- 0D739 85 01 STA temp1
- 0D73B 4A LSR
- 0D73C 4A LSR
- 0D73D 4A LSR
- 0D73E 4A LSR
- 0D73F 4A LSR
- 0D740 85 00 STA temp ;; this is the screen bank.
- 0D742 AD A4 06 LDA warpMap
- 0D745 ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D745 85 02 STA temp2
- 0D747
- 0D747 A5 00 85 0C A5 01 85 0D.. LoadAttributeData temp, temp1, temp2, #$04, #$08, tempy, #$C4, #$04
- 0D7A9 20 FB C8 JSR doWaitFrame
- 0D7AC
- 0D7AC AD 74 06 LDA currentNametable
- 0D7AF 18 CLC
- 0D7B0 69 01 ADC #$01
- 0D7B2 85 01 STA temp1
- 0D7B4 4A LSR
- 0D7B5 4A LSR
- 0D7B6 4A LSR
- 0D7B7 4A LSR
- 0D7B8 4A LSR
- 0D7B9 85 00 STA temp ;; this is the screen bank.
- 0D7BB AD A4 06 LDA warpMap
- 0D7BE ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D7BE 85 02 STA temp2
- 0D7C0
- 0D7C0 A5 00 85 0C A5 01 85 0D.. LoadCollisionData temp, temp1, temp2, #$08, #$0F, #$00, #$00, #$01
- 0D822 20 FB C8 JSR doWaitFrame
- 0D825
- 0D825 AD 74 06 LDA currentNametable
- 0D828 38 sec
- 0D829 E9 01 sbc #$01
- 0D82B 85 01 STA temp1
- 0D82D 4A LSR
- 0D82E 4A LSR
- 0D82F 4A LSR
- 0D830 4A LSR
- 0D831 4A LSR
- 0D832 85 00 STA temp ;; this is the screen bank.
- 0D834 AD A4 06 LDA warpMap
- 0D837 ;;; and other screen bytes needed - warp map is either 0 or 1
- 0D837 85 02 STA temp2
- 0D839
- 0D839 A5 00 85 0C A5 01 85 0D.. LoadCollisionData temp, temp1, temp2, #$08, #$0F, #$00, #$08, #$01
- 0D89B 20 FB C8 JSR doWaitFrame
- 0D89E
- 0D89E
- 0D89E
- 0D89E 60 RTS
- 0D89F
- 0D89F
- 0D89F monsterPositionOffsetTable: ;; normal state monster.
- 0D89F 83 84 85 9E .db #131, #132, #133, #1580D8A3
- 0D8A3 .include Routines\BASE_4_5\\Game\Subroutines\ToggleTables.asm
- 0D8A3 ToggleNametable
- 0D8A3 AD 8E 06 LDA updateNametable
- 0D8A6 C9 20 CMP #$20
- 0D8A8 D0 05 BNE switchToLeftNametable
- 0D8AA ;; switch to right nametable
- 0D8AA A9 24 LDA #$24
- 0D8AC 4C B1 D8 JMP gotNametableToView
- 0D8AF switchToLeftNametable:
- 0D8AF A9 20 LDA #$20
- 0D8B1 gotNametableToView:
- 0D8B1 8D 8E 06 STA updateNametable
- 0D8B4 60 RTS
- 0D8B5
- 0D8B5 ToggleAttributeTable
- 0D8B5 AD 8F 06 LDA updateAttributeTable
- 0D8B8 C9 23 CMP #$23
- 0D8BA D0 05 BNE switchToLeftAtttable
- 0D8BC ;; switch to right nametable
- 0D8BC A9 27 LDA #$27
- 0D8BE 4C C3 D8 JMP gotAttToView
- 0D8C1 switchToLeftAtttable:
- 0D8C1 A9 23 LDA #$23
- 0D8C3 gotAttToView:
- 0D8C3 8D 8F 06 STA updateAttributeTable
- 0D8C6 60 RTS
- 0D8C7
- 0D8C7
- 0D8C7 FactorSecondAttributeTable:
- 0D8C7 ;; based on camera
- 0D8C7 AD 86 06 LDA camX_hi
- 0D8CA 29 01 AND #%00000001
- 0D8CC F0 05 BEQ secondAttTableIs27
- 0D8CE A9 23 LDA #$23
- 0D8D0 4C D5 D8 JMP gotSecondAttTable
- 0D8D3 secondAttTableIs27
- 0D8D3 A9 27 LDA #$27
- 0D8D5 gotSecondAttTable
- 0D8D5 8D 8F 06 STA updateAttributeTable
- 0D8D8
- 0D8D8 60 RTS
- 0D8D9
- 0D8D9
- 0D8D9
- 0D8D9 ValToBitTable:
- 0D8D9 80 40 20 10 08 04 02 01 .db #%10000000, #%01000000, #%00100000, #%00010000, #%00001000, #%00000100, #%00000010, #%00000001
- 0D8E1
- 0D8E1 ValToBitTable_inverse:
- 0D8E1 01 02 04 08 10 20 40 80 .db #%00000001, #%00000010, #%000000100, #%00001000, #%00010000, #%00100000, #%01000000, #%10000000
- 0D8E9
- 0D8E9
- 0D8E9 DirectionTable:
- 0D8E9 30 20 80 C0 F0 E0 A0 B0 .db #DOWN, #UP, #LEFT, #RIGHT, #DOWNRIGHT, #UPRIGHT, #UPLEFT, #DOWNLEFT
- 0D8F1
- 0D8F1 FacingTable
- 0D8F1 00 04 06 02 01 03 05 07 .db #FACE_DOWN, #FACE_UP, #FACE_LEFT, #FACE_RIGHT, #FACE_DOWNRIGHT, #FACE_UPRIGHT, #FACE_UPLEFT, #FACE_DOWNLEFT
- 0D8F9
- 0D8F9 DirectionTableOrdered:
- 0D8F9 30 F0 C0 E0 20 A0 80 B0 .db #DOWN, #DOWNRIGHT, #RIGHT, #UPRIGHT, #UP, #UPLEFT, #LEFT, #DOWNLEFT
- 0D901 FacingTableOrdered:
- 0D901 00 01 02 03 04 05 06 07 .db #FACE_DOWN, #FACE_DOWNRIGHT, #FACE_RIGHT, #FACE_UPRIGHT, #FACE_UP, #FACE_UPLEFT, #FACE_LEFT, #FACE_DOWNLEFT
- 0D909
- 0D909
- 0D909
- 0D909 .include GameData\HUD_DEFINES.dat ;; because of tables created, this is a better place for this than constants.
- 0D909 ;; *************** HUD_DEFINES.dat ***************
- 0D909 ;; HUD defines export. Saturday, March 6, 2021 6:48:13 PM
- 0D909
- 0D909 CHECK_SPRITE_ZERO = $00
- 0D909 SPRITE_ZERO_INDEX = $00
- 0D909 SPRITE_ZERO_HBLANK = $00
- 0D909 SPRITE_ZERO_X = $00
- 0D909 SPRITE_ZERO_Y = $00
- 0D909
- 0D909 HUD_LOAD = $00
- 0D909
- 0D909
- 0D909 HudAssetType_Table:
- 0D909 FF FF FF FF .db #BOX_0_ASSET_0_TYPE, #BOX_0_ASSET_1_TYPE, #BOX_0_ASSET_2_TYPE, #BOX_0_ASSET_3_TYPE
- 0D90D FF FF FF FF .db #BOX_0_ASSET_4_TYPE, #BOX_0_ASSET_5_TYPE, #BOX_0_ASSET_6_TYPE, #BOX_0_ASSET_7_TYPE
- 0D911
- 0D911 HudOffsetX_Table:
- 0D911 00 00 00 00 .db #BOX_0_ASSET_0_X, #BOX_0_ASSET_1_X, #BOX_0_ASSET_2_X, #BOX_0_ASSET_3_X
- 0D915 00 00 00 00 .db #BOX_0_ASSET_4_X, #BOX_0_ASSET_5_X, #BOX_0_ASSET_6_X, #BOX_0_ASSET_7_X
- 0D919
- 0D919 HudOffsetY_Table:
- 0D919 00 00 00 00 .db #BOX_0_ASSET_0_Y, #BOX_0_ASSET_1_Y, #BOX_0_ASSET_2_Y, #BOX_0_ASSET_3_Y
- 0D91D 00 00 00 00 .db #BOX_0_ASSET_4_Y, #BOX_0_ASSET_5_Y, #BOX_0_ASSET_6_Y, #BOX_0_ASSET_7_Y
- 0D921
- 0D921
- 0D921 HudMaxValue:
- 0D921 00 00 00 00 .db #BOX_0_ASSET_0_MAX_VALUE, #BOX_0_ASSET_1_MAX_VALUE, #BOX_0_ASSET_2_MAX_VALUE, #BOX_0_ASSET_3_MAX_VALUE
- 0D925 00 00 00 00 .db #BOX_0_ASSET_4_MAX_VALUE, #BOX_0_ASSET_5_MAX_VALUE, #BOX_0_ASSET_6_MAX_VALUE, #BOX_0_ASSET_7_MAX_VALUE
- 0D929
- 0D929 HudFullImage: ;; really, only used for var tiles, but we can waste 8 bytes to save on more lost to complex rom data
- 0D929 00 00 00 00 .db #$00, #$00, #$00, #$00
- 0D92D 00 00 00 00 .db #$00, #$00, #$00, #$00
- 0D931
- 0D931 HudBlankImage: ;;;; really, only used for var tiles, but we can waste 8 bytes to save on more lost to complex rom data
- 0D931 00 00 00 00 .db #BOX_0_ASSET_0_BLANK, #BOX_0_ASSET_1_BLANK, #BOX_0_ASSET_2_BLANK, #BOX_0_ASSET_3_BLANK
- 0D935 00 00 00 00 .db #BOX_0_ASSET_4_BLANK, #BOX_0_ASSET_5_BLANK, #BOX_0_ASSET_6_BLANK, #BOX_0_ASSET_7_BLANK
- 0D939
- 0D939
- 0D939 NumberBaseTable:
- 0D939 00 01 02 03 04 05 06 07.. .db #$00, #$01, #$02, #$03, #$04, #$05, #$06, #$07, #$08, #$09
- 0D943
- 0D943
- 0D943 ;; use this defined script for any extraneous tables.
- 0D943 .include "Routines\BASE_4_5\Game\Space Birds\Game\SPACEBIRDS_ExtraTables.asm"
- 0D943
- 0D943 ;;;
- 0D943 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0D943 ;; here, we load in <label and >label for each library value we might want.
- 0D943 TextLibrary_lo:
- 0D943 00 .db #$00
- 0D944 TextLibrary_hi:
- 0D944 00 .db #$00
- 0D945 CheatCodeTable1:
- 0D945 02 02 02 01 01 01 02 01 .db #$02, #$02, #$02, #$01, #$01, #$01, #$02, #$01
- 0D94D DrawSprite_opcode_table:
- 0D94D FA 95 .word DrawPlayer1-1
- 0D94F 9D 96 .word DrawPlayer2-1
- 0D951 40 97 .word DrawMonsterBullet-1
- 0D953 94 97 .word DrawMissile1-1
- 0D955 BA 97 .word DrawMissile2-1
- 0D957 E0 97 .word DrawObject5-1
- 0D959 E1 97 .word DrawObject6-1
- 0D95B E2 97 .word DrawObject7-1
- 0D95D E3 97 .word DrawObject8-1
- 0D95F E4 97 .word DrawObject9-1
- 0D961 E5 97 .word DrawObjectA-1
- 0D963 E6 97 .word DrawObjectB-1
- 0D965 E7 97 .word DrawObjectC-1
- 0D967 E8 97 .word DrawObjectD-1
- 0D969 E9 97 .word DrawObjectE-1
- 0D96B EA 97 .word DrawObjectF-1
- 0D96D EB 97 .word DrawAlien-1
- 0D96F 8E 98 .word DrawAlienShooter-10D971 .include Routines\BASE_4_5\\Game\Subroutines\ejectionSubroutines.asm
- 0D971
- 0D971 doEjectLeft:
- 0D971
- 0D971 BD 1A 04 LDA Object_x_hi,x
- 0D974 18 CLC
- 0D975 69 10 ADC #$10; self_right
- 0D977 29 F0 AND #%11110000
- 0D979 38 SEC
- 0D97A E9 10 SBC #$10
- 0D97C 9D 1A 04 STA Object_x_hi,x
- 0D97F A9 00 LDA #$00
- 0D981 9D 0D 04 STA Object_x_lo,x
- 0D984 9D 5B 04 STA Object_h_speed_hi,x
- 0D987 9D 4E 04 STA Object_h_speed_lo,x
- 0D98A 60 rts
- 0D98B doEjectRight:
- 0D98B
- 0D98B BD 1A 04 LDA Object_x_hi,x
- 0D98E 18 clc
- 0D98F 6D 59 06 adc self_left
- 0D992 29 F0 AND #%11110000
- 0D994 18 CLC
- 0D995 69 10 ADC #$10
- 0D997 18 clc
- 0D998 6D 59 06 adc self_left
- 0D99B 9D 1A 04 STA Object_x_hi,x
- 0D99E A9 00 LDA #$00
- 0D9A0 9D 0D 04 STA Object_x_lo,x
- 0D9A3 9D 5B 04 STA Object_h_speed_hi,x
- 0D9A6 9D 4E 04 STA Object_h_speed_lo,x
- 0D9A9 60 RTS
- 0D9AA
- 0D9AA
- 0D9AA doEjectUp:
- 0D9AA
- 0D9AA BD 41 04 LDA Object_y_hi,x
- 0D9AD 18 CLC
- 0D9AE 6D 5C 06 ADC self_bottom
- 0D9B1 29 F0 AND #%11110000
- 0D9B3 38 SEC
- 0D9B4 E9 10 SBC #$10
- 0D9B6
- 0D9B6 9D 41 04 STA Object_y_hi,x
- 0D9B9 A9 00 LDA #$00
- 0D9BB 9D 34 04 STA Object_y_lo,x
- 0D9BE 9D 75 04 STA Object_v_speed_hi,x
- 0D9C1 9D 68 04 STA Object_v_speed_lo,x
- 0D9C4 60 RTS
- 0D9C5
- 0D9C5 doEjectDown:
- 0D9C5
- 0D9C5 BD 41 04 LDA Object_y_hi,x
- 0D9C8 18 clc
- 0D9C9 6D 5A 06 adc self_top
- 0D9CC 29 F0 AND #%11110000
- 0D9CE 18 CLC
- 0D9CF 69 10 ADC #$10
- 0D9D1 18 clc
- 0D9D2 6D 5A 06 adc self_top
- 0D9D5 9D 41 04 STA Object_y_hi,x
- 0D9D8 A9 00 LDA #$00
- 0D9DA 9D 34 04 STA Object_y_lo,x
- 0D9DD 9D 75 04 STA Object_v_speed_hi,x
- 0D9E0 9D 68 04 STA Object_v_speed_lo,x
- 0D9E3 60 Rts
- 0D9E4
- 0D9E4 .include Routines\BASE_4_5\\Game\Subroutines\doLoadScreenData.asm
- 0D9E4 doLoadScreenData:
- 0D9E4
- 0D9E4 ; JSR doClearAllMonsters
- 0D9E4
- 0D9E4 A9 00 LDA #$00
- 0D9E6 85 2C STA spriteRamPointer
- 0D9E8 20 ED C8 JSR doCleanUpSpriteRam
- 0D9EB
- 0D9EB
- 0D9EB
- 0D9EB 98 48 AD 20 06 8D 21 06.. SwitchBank arg0_hold
- 0D9FA
- 0D9FA ;;;;;;;;;;;;;;;;;;;;;
- 0D9FA ;;; By default, screen data begins
- 0D9FA ;;; 120 (dec) beyond the collision table label,
- 0D9FA ;;; which is currently stored to collisionPointer.
- 0D9FA A0 78 LDY #120
- 0D9FC ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0D9FC ;=======================================
- 0D9FC ;SET SCREEN TYPE
- 0D9FC ;#120
- 0D9FC B1 3F LDA (collisionPointer),y
- 0D9FE 8D 9E 06 STA screenType
- 0DA01 ;=======================================
- 0DA01 C8 INY
- 0DA02 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DA02 ;; #121 Legacied - was GraphicsBank - now screen bank is handled via logic.
- 0DA02 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DA02 C8 INY
- 0DA03 ;========================================
- 0DA03 ;SET SCREEN PALETTE
- 0DA03 ;#122
- 0DA03 B1 3F LDA (collisionPointer),y ;; this is the palette data
- 0DA05 8D 9D 06 STA newPal
- 0DA08 ;=======================================
- 0DA08 C8 INY
- 0DA09 ;=======================================
- 0DA09 ;; #123 Legacied - was MaineTileID / ScreenTileID, now handled in bytes below
- 0DA09 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DA09 C8 INY
- 0DA0A ;=======================================
- 0DA0A ;; #124 - Screen Byte 00
- 0DA0A B1 3F LDA (collisionPointer),y
- 0DA0C 8D 9F 06 STA ScreenFlags00
- 0DA0F ;;; ScreenByte00 hold the screen flags.
- 0DA0F ;=======================================
- 0DA0F C8 INY
- 0DA10 ;=======================================
- 0DA10 ;; #125 - ScreenByte01 stuff.
- 0DA10 ;first, load screenSpeed
- 0DA10 B1 3F LDA (collisionPointer),y
- 0DA12 8D A1 06 STA ScreenByte01
- 0DA15 29 03 AND #%00000011
- 0DA17 8D A2 06 STA screenSpeed
- 0DA1A ; ;;;;;;;;;;;;;;;;;;;;;;
- 0DA1A ; ;;; DO OTHER SCREEN BYTE 1 THINGS HERE!
- 0DA1A ;=========================================
- 0DA1A C8 INY
- 0DA1B ;=========================================
- 0DA1B
- 0DA1B ;; #126 - Load paths, through a loop to figure out path choices
- 0DA1B B1 3F LDA (collisionPointer),y
- 0DA1D 85 00 STA temp
- 0DA1F
- 0DA1F 98 TYA
- 0DA20 48 PHA
- 0DA21
- 0DA21 A0 00 LDY #$00
- 0DA23 A2 00 LDX #$00
- 0DA25 loadPathTilesLoop:
- 0DA25 A5 00 LDA temp
- 0DA27 39 D9 D8 AND ValToBitTable,y
- 0DA2A F0 0D BEQ notFirstPath
- 0DA2C 98 TYA
- 0DA2D 9D A6 06 STA pathTile00,x
- 0DA30 E8 INX
- 0DA31 E0 04 CPX #$04
- 0DA33 F0 08 BEQ doneGettingPaths
- 0DA35 C8 INY
- 0DA36 4C 25 DA JMP loadPathTilesLoop
- 0DA39 notFirstPath:
- 0DA39 C8 INY
- 0DA3A
- 0DA3A 4C 25 DA JMP loadPathTilesLoop
- 0DA3D doneGettingPaths:
- 0DA3D A4 05 LDY tempy
- 0DA3F
- 0DA3F 68 PLA
- 0DA40 A8 TAY
- 0DA41 ;========================================
- 0DA41 C8 INY
- 0DA42 ;========================================
- 0DA42 ;; 127 - Warp out screen
- 0DA42 B1 3F LDA (collisionPointer),y
- 0DA44 8D A3 06 STA warpToScreen
- 0DA47 ;=======================================
- 0DA47 C8 INY
- 0DA48 ;=======================================
- 0DA48 ;; 128 - Warp In Position
- 0DA48 ;; This might need to be skipped under certain warp conditions
- 0DA48 ;; and should only be observed if the transition is of warp type.
- 0DA48 AD A5 06 LDA screenTransitionType
- 0DA4B F0 29 BEQ skipSettingWarpInXY
- 0DA4D C9 01 CMP #$01
- 0DA4F F0 13 BEQ setToStartValue
- 0DA51 C9 02 CMP #$02
- 0DA53 F0 00 BEQ setToContinueValue
- 0DA55 ;;; other cases go here
- 0DA55 setToContinueValue
- 0DA55 AD D3 06 LDA continueX
- 0DA58 8D 75 06 STA newX
- 0DA5B AD D4 06 LDA continueY
- 0DA5E 8D 76 06 STA newY
- 0DA61 4C 76 DA JMP skipSettingWarpInXY
- 0DA64 setToStartValue:
- 0DA64
- 0DA64 B1 3F LDA (collisionPointer),y
- 0DA66 29 F0 AND #%11110000
- 0DA68 8D 76 06 STA newY
- 0DA6B
- 0DA6B B1 3F LDA (collisionPointer),y
- 0DA6D 29 0F AND #%00001111
- 0DA6F 0A ASL
- 0DA70 0A ASL
- 0DA71 0A ASL
- 0DA72 0A ASL
- 0DA73 8D 75 06 STA newX
- 0DA76
- 0DA76
- 0DA76 skipSettingWarpInXY:
- 0DA76 A9 00 LDA #$00
- 0DA78 8D A5 06 STA screenTransitionType ;; reset screen transition type
- 0DA7B ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DA7B ;==========================================
- 0DA7B C8 INY
- 0DA7C ;==========================================
- 0DA7C ;; 129 - Legacied - used to be screen type and song number.
- 0DA7C ;; Also, may have handled banks for monsters based on state.
- 0DA7C ;==========================================
- 0DA7C C8 INY
- 0DA7D ;;=========================================
- 0DA7D ;; 130 - needed bits
- 0DA7D
- 0DA7D B1 3F LDA (collisionPointer),y
- 0DA7F 8D 96 06 STA screenLoadTemps ;; this is whether screen should load 8x8 or 16x16.
- 0DA82 ; LDA (collisionPointer),y
- 0DA82 29 01 AND #%00000001 ;; is this overworld or underworld map?
- 0DA84 8D C8 06 STA warpToMap
- 0DA87
- 0DA87 AD 96 06 LDA screenLoadTemps
- 0DA8A 29 70 AND #%01110000
- 0DA8C 4A LSR
- 0DA8D 4A LSR
- 0DA8E 4A LSR
- 0DA8F 4A LSR
- 0DA90 29 07 AND #%00000111
- 0DA92 85 2B STA gameState
- 0DA94 ;;;;;========================================================
- 0DA94 ;;;;;========================================================
- 0DA94
- 0DA94 ; ;; THIS is where we jump to load state specific data.
- 0DA94 ; ;***********************
- 0DA94 ;JSR GetScreenTriggerInfo
- 0DA94 ; ;***********************
- 0DA94 ; ;=====================================================
- 0DA94 ;============================================
- 0DA94 ;; 131
- 0DA94
- 0DA94 A0 B6 LDY #182
- 0DA96 B1 3F LDA (collisionPointer),y
- 0DA98 8D A0 06 STA ScreenFlags01
- 0DA9B
- 0DA9B
- 0DA9B
- 0DA9B A0 C4 LDY #196
- 0DA9D B1 3F LDA (collisionPointer),y
- 0DA9F
- 0DA9F 8D 46 06 STA tileLayout
- 0DAA2 C8 INY
- 0DAA3 B1 3F LDA (collisionPointer),y
- 0DAA5 8D 97 06 STA backgroundTilesToLoad
- 0DAA8 C8 INY
- 0DAA9 B1 3F LDA (collisionPointer),y
- 0DAAB 8D 98 06 STA backgroundTilesToLoad+1
- 0DAAE C8 INY
- 0DAAF B1 3F LDA (collisionPointer),y
- 0DAB1 8D 99 06 STA backgroundTilesToLoad+2
- 0DAB4 C8 INY
- 0DAB5 B1 3F LDA (collisionPointer),y
- 0DAB7 8D 9A 06 STA backgroundTilesToLoad+3
- 0DABA C8 INY
- 0DABB B1 3F LDA (collisionPointer),y
- 0DABD 8D 9B 06 STA backgroundTilesToLoad+4
- 0DAC0 C8 INY
- 0DAC1 B1 3F LDA (collisionPointer),y
- 0DAC3 8D 9C 06 STA backgroundTilesToLoad+5
- 0DAC6
- 0DAC6
- 0DAC6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DAC6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DAC6 ;;;;;; Handle state based data.
- 0DAC6 8A TXA
- 0DAC7 48 PHA
- 0DAC8 20 13 DB JSR GetScreenTriggerInfo
- 0DACB
- 0DACB
- 0DACB
- 0DACB 68 PLA
- 0DACC AA TAX
- 0DACD
- 0DACD
- 0DACD ;;;;;;;;;;;;;;;; THERE WILL BE BYTES
- 0DACD ;;;;;;;;;;;;;;;; That will contian this information on a screen by screen basis.
- 0DACD ;;;;;;;;;;;;;;;; 00 = pacman
- 0DACD ;;;;;;;;;;;;;;;; 01 = zelda screen
- 0DACD ;;;;;;;;;;;;;;;; 02 = scroll (which updates the Object_screen,x
- 0DACD ;;;;;;;;;;;;;;;; 03 = acts as a solid edge.
- 0DACD
- 0DACD ;;;;;;;;;;;;;;;; Right now, this is being hard coded.
- 0DACD A9 00 LDA #%00000000
- 0DACF 8D AA 06 STA screenEdgeBehavior
- 0DAD2
- 0DAD2 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0DADC
- 0DADC getTextForScreen:
- 0DADC 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0DAEB
- 0DAEB A5 8C LDA stringGroupPointer ;; this is the group of the string.
- 0DAED 0A ASL
- 0DAEE 0A ASL
- 0DAEF A8 TAY
- 0DAF0 B9 00 80 LDA AllTextGroups,y
- 0DAF3 85 8D STA screenText
- 0DAF5 C8 INY
- 0DAF6 B9 00 80 LDA AllTextGroups,y
- 0DAF9 85 8E STA screenText+1
- 0DAFB C8 INY
- 0DAFC B9 00 80 LDA AllTextGroups,y
- 0DAFF 85 8F STA screenText+2
- 0DB01 C8 INY
- 0DB02 B9 00 80 LDA AllTextGroups,y
- 0DB05 85 90 STA screenText+3
- 0DB07
- 0DB07 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0DB11 60 RTS
- 0DB12
- 0DB12
- 0DB12
- 0DB12
- 0DB12 60 RTS
- 0DB13
- 0DB13
- 0DB13
- 0DB13
- 0DB13
- 0DB13
- 0DB13
- 0DB13 GetScreenTriggerInfo:
- 0DB13 20 01 DE JSR doClearAllMonsters
- 0DB16 ;;;;; MONSTERS
- 0DB16 ;;; constants for banks
- 0DB16
- 0DB16
- 0DB16 8A 48 98 48 AD 9E 06 29.. GetTrigger
- 0DB39
- 0DB39 ;; result of screenType trigger stored in temp3 and also in accum
- 0DB39 ;; x and y restored.
- 0DB39 F0 2B BEQ thisScreenIsNotTriggered
- 0DB3B ;; this screen IS triggered
- 0DB3B AD AB 06 LDA gameHandler
- 0DB3E 29 01 AND #%00000001 ;; one = night
- 0DB40 F0 13 BEQ isTriggeredDay
- 0DB42 ;; triggered and night
- 0DB42 A9 03 LDA #$03
- 0DB44 85 98 STA screenState
- 0DB46 AA TAX
- 0DB47 A0 98 LDY #152
- 0DB49 B1 3F LDA (collisionPointer),y
- 0DB4B 4A LSR
- 0DB4C 4A LSR
- 0DB4D 4A LSR
- 0DB4E 4A LSR
- 0DB4F ; LDA #$03
- 0DB4F 8D AC 06 STA monsterTableOffset
- 0DB52 4C 91 DB JMP triggeredStateInfoIsLoaded
- 0DB55 isTriggeredDay
- 0DB55
- 0DB55 ;; triggered and day
- 0DB55 A9 02 LDA #$02
- 0DB57 85 98 STA screenState
- 0DB59 AA TAX
- 0DB5A A0 99 LDY #153
- 0DB5C B1 3F LDA (collisionPointer),y
- 0DB5E 29 0F AND #%00001111
- 0DB60 ; LDA #$02
- 0DB60 8D AC 06 STA monsterTableOffset
- 0DB63
- 0DB63 4C 91 DB JMP triggeredStateInfoIsLoaded
- 0DB66 ;;=================================
- 0DB66 thisScreenIsNotTriggered
- 0DB66 4C 83 DB JMP isNormalDay
- 0DB69 AD AB 06 LDA gameHandler
- 0DB6C 29 01 AND #%00000001 ;; one = night
- 0DB6E F0 13 BEQ isNormalDay
- 0DB70
- 0DB70 ;; normal and night
- 0DB70 A9 01 LDA #$01
- 0DB72 85 98 STA screenState
- 0DB74 AA TAX
- 0DB75 A0 98 LDY #152
- 0DB77 B1 3F LDA (collisionPointer),y
- 0DB79 4A LSR
- 0DB7A 4A LSR
- 0DB7B 4A LSR
- 0DB7C 4A LSR
- 0DB7D ; LDA #$01
- 0DB7D 8D AC 06 STA monsterTableOffset
- 0DB80 4C 91 DB JMP triggeredStateInfoIsLoaded
- 0DB83 isNormalDay:
- 0DB83
- 0DB83 ;; normal and day
- 0DB83 A9 00 LDA #$00
- 0DB85 85 98 STA screenState
- 0DB87 AA TAX
- 0DB88 ;;;;;;;;;;;
- 0DB88 ;Load correspnding monster tileset.
- 0DB88 A0 98 LDY #152
- 0DB8A B1 3F LDA (collisionPointer),y
- 0DB8C 29 0F AND #%00001111
- 0DB8E ; LDA #$00
- 0DB8E 8D AC 06 STA monsterTableOffset
- 0DB91 triggeredStateInfoIsLoaded:
- 0DB91
- 0DB91 ;;=================================
- 0DB91 ;Now, here, load all of the state specific stuff.
- 0DB91 ;This will use X as an offset for small tables in ZeroOutAssets file.
- 0DB91 ; We'll have to use the stack for any part of these routines that might need X.
- 0DB91 ; ;;;;; considerations for the states.
- 0DB91 ; ;1: Get Object Graphics Bank
- 0DB91 ; ;2: String Data
- 0DB91 ; ;3: Monster Spawn positions
- 0DB91 ; ;4: Monster group (this is more complicated than a single digit)
- 0DB91 ; ;5: Object palettes (also more complicated than a single digit)
- 0DB91 ; ;6: Object tiles to load.
- 0DB91 ; ;7: Object IDs
- 0DB91 ; ;8: Song to play
- 0DB91 ;;=============================================================
- 0DB91 ;;=============================================================
- 0DB91 BD CD F1 LDA StringDataChoice,x
- 0DB94 A8 TAY ;; now y holds the byte offset value for the text string group.
- 0DB95 B1 3F LDA (collisionPointer),y
- 0DB97 85 8C STA stringGroupPointer
- 0DB99
- 0DB99
- 0DB99 8A TXA
- 0DB9A 48 PHA
- 0DB9B ; LDX monsterTableOffset
- 0DB9B ;;; Handle monster 1
- 0DB9B
- 0DB9B 20 36 F2 JSR LoadMonster_1
- 0DB9E ; LDY Mon1SpawnLocation,x
- 0DB9E ; LDA (collisionPointer),y
- 0DB9E ; STA temp
- 0DB9E ; AND #%11110000
- 0DB9E ; CMP #%11110000
- 0DB9E ; BNE loadMon1toPosition
- 0DB9E ; LDA temp
- 0DB9E ; AND #%00001111
- 0DB9E ; CMP #%00000011
- 0DB9E ; BEQ skipLoadingMonster1
- 0DB9E ; ;;; Random / Edge cases here
- 0DB9E
- 0DB9E ; loadMon1toPosition:
- 0DB9E ; ;;;;;;; Load monster 1.
- 0DB9E ; LDY Monster1ID,x
- 0DB9E ; LDA (collisionPointer),y
- 0DB9E ; STA mon1_type
- 0DB9E ; LDY Mon1SpawnLocation,x
- 0DB9E ; LDA (collisionPointer),y
- 0DB9E ; ASL
- 0DB9E ; ASL
- 0DB9E ; ASL
- 0DB9E ; ASL
- 0DB9E ; STA tempB ;; x value in tempB
- 0DB9E ; LDY Mon1SpawnLocation,x
- 0DB9E ; LDA (collisionPointer),y
- 0DB9E ; AND #%11110000
- 0DB9E ; STA tempC ;; y value in tempC
- 0DB9E ; TXA
- 0DB9E ; PHA
- 0DB9E ; CreateObject tempB, tempC, mon1_type, #$00
- 0DB9E
- 0DB9E ; PLA
- 0DB9E ; TAX
- 0DB9E
- 0DB9E
- 0DB9E BC D5 F1 LDY Mon2SpawnLocation,x
- 0DBA1 B1 3F LDA (collisionPointer),y
- 0DBA3 85 00 STA temp
- 0DBA5 29 F0 AND #%11110000
- 0DBA7 C9 F0 CMP #%11110000
- 0DBA9 D0 08 BNE loadMon2toPosition
- 0DBAB A5 00 LDA temp
- 0DBAD 29 0F AND #%00001111
- 0DBAF C9 03 CMP #%00000011
- 0DBB1 F0 4D BEQ skipLoadingMonster2
- 0DBB3 ;;; Random / Edge cases here
- 0DBB3 loadMon2toPosition
- 0DBB3 ;;;;;;;; Load monster 1.
- 0DBB3 BC F9 F1 LDY Monster2ID,x
- 0DBB6 B1 3F LDA (collisionPointer),y
- 0DBB8 8D D7 06 STA mon2_type ;; type of monster loaded into tempA
- 0DBBB BC D5 F1 LDY Mon2SpawnLocation,x
- 0DBBE B1 3F LDA (collisionPointer),y
- 0DBC0 0A ASL
- 0DBC1 0A ASL
- 0DBC2 0A ASL
- 0DBC3 0A ASL
- 0DBC4 85 08 STA tempB ;; x value in tempB
- 0DBC6 BC D5 F1 LDY Mon2SpawnLocation,x
- 0DBC9 B1 3F LDA (collisionPointer),y
- 0DBCB 29 F0 AND #%11110000
- 0DBCD 85 09 STA tempC ;; y value in tempC
- 0DBCF 8A TXA
- 0DBD0 48 PHA
- 0DBD1 20 BA F1 E0 FF D0 03 4C.. CreateObject tempB, tempC, mon2_type, #$00
- 0DBF9 A9 01 LDA #$01
- 0DBFB 9D 82 04 STA Object_id,x
- 0DBFE 68 PLA
- 0DBFF AA TAX
- 0DC00 skipLoadingMonster2:
- 0DC00 ;;; Handle monster 3
- 0DC00
- 0DC00 BC D9 F1 LDY Mon3SpawnLocation,x
- 0DC03 B1 3F LDA (collisionPointer),y
- 0DC05 85 00 STA temp
- 0DC07 29 F0 AND #%11110000
- 0DC09 C9 F0 CMP #%11110000
- 0DC0B D0 08 BNE loadMon3toPosition
- 0DC0D A5 00 LDA temp
- 0DC0F 29 0F AND #%00001111
- 0DC11 C9 03 CMP #%00000011
- 0DC13 F0 4D BEQ skipLoadingMonster3
- 0DC15 ;;; Random / Edge cases here
- 0DC15 loadMon3toPosition
- 0DC15 BC FD F1 LDY Monster3ID,x
- 0DC18 B1 3F LDA (collisionPointer),y
- 0DC1A 8D D8 06 STA mon3_type ;; type of monster loaded into tempA
- 0DC1D BC D9 F1 LDY Mon3SpawnLocation,x
- 0DC20 B1 3F LDA (collisionPointer),y
- 0DC22 0A ASL
- 0DC23 0A ASL
- 0DC24 0A ASL
- 0DC25 0A ASL
- 0DC26 85 08 STA tempB ;; x value in tempB
- 0DC28 BC D9 F1 LDY Mon3SpawnLocation,x
- 0DC2B B1 3F LDA (collisionPointer),y
- 0DC2D 29 F0 AND #%11110000
- 0DC2F 85 09 STA tempC ;; y value in tempC
- 0DC31 8A TXA
- 0DC32 48 PHA
- 0DC33 20 BA F1 E0 FF D0 03 4C.. CreateObject tempB, tempC, mon3_type, #$00
- 0DC5B A9 02 LDA #$02
- 0DC5D 9D 82 04 STA Object_id,x
- 0DC60 68 PLA
- 0DC61 AA TAX
- 0DC62 skipLoadingMonster3:
- 0DC62
- 0DC62 ;;; Handle monster 4
- 0DC62
- 0DC62 BC DD F1 LDY Mon4SpawnLocation,x
- 0DC65 B1 3F LDA (collisionPointer),y
- 0DC67 85 00 STA temp
- 0DC69 29 F0 AND #%11110000
- 0DC6B C9 F0 CMP #%11110000
- 0DC6D D0 08 BNE loadMon4toPosition
- 0DC6F A5 00 LDA temp
- 0DC71 29 0F AND #%00001111
- 0DC73 C9 03 CMP #%00000011
- 0DC75 F0 4D BEQ skipLoadingMonster4
- 0DC77 ;;; Random / Edge cases here
- 0DC77 loadMon4toPosition
- 0DC77 ;;;;;;;; Load monster 1.
- 0DC77 BC 01 F2 LDY Monster4ID,x
- 0DC7A B1 3F LDA (collisionPointer),y
- 0DC7C 8D D9 06 STA mon4_type ;; type of monster loaded into tempA
- 0DC7F BC DD F1 LDY Mon4SpawnLocation,x
- 0DC82 B1 3F LDA (collisionPointer),y
- 0DC84 0A ASL
- 0DC85 0A ASL
- 0DC86 0A ASL
- 0DC87 0A ASL
- 0DC88 85 08 STA tempB ;; x value in tempB
- 0DC8A BC DD F1 LDY Mon4SpawnLocation,x
- 0DC8D B1 3F LDA (collisionPointer),y
- 0DC8F 29 F0 AND #%11110000
- 0DC91 85 09 STA tempC ;; y value in tempC
- 0DC93 8A TXA
- 0DC94 48 PHA
- 0DC95 20 BA F1 E0 FF D0 03 4C.. CreateObject tempB, tempC, mon4_type, #$00
- 0DCBD A9 03 LDA #$03
- 0DCBF 9D 82 04 STA Object_id,x
- 0DCC2 68 PLA
- 0DCC3 AA TAX
- 0DCC4 skipLoadingMonster4:
- 0DCC4 68 PLA
- 0DCC5 AA TAX
- 0DCC6 ;PLA
- 0DCC6 ;TAX
- 0DCC6
- 0DCC6
- 0DCC6 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DCC6 ;;============================================================
- 0DCC6 ;;============================================================
- 0DCC6 ;; Load subpalettes
- 0DCC6 ;; HERE is where you could define game object sub palettes by reading a specific byte
- 0DCC6 8A TXA
- 0DCC7 48 PHA
- 0DCC8 A6 98 LDX screenState
- 0DCCA
- 0DCCA BC ED F1 LDY GoPal1Choice,x
- 0DCCD B1 3F LDA (collisionPointer),y
- 0DCCF
- 0DCCF 8D AF 06 STA spriteSubPal3;spriteSubPal1
- 0DCD2 ;LDX screenState
- 0DCD2 BC F1 F1 LDY GoPal2Choice,x
- 0DCD5
- 0DCD5 B1 3F LDA (collisionPointer),y
- 0DCD7
- 0DCD7 8D B0 06 STA spriteSubPal4;spriteSubPal2
- 0DCDA ;LDX screenState
- 0DCDA BC E5 F1 LDY MonPal1Choice,x
- 0DCDD B1 3F LDA (collisionPointer),y
- 0DCDF
- 0DCDF 8D AD 06 STA spriteSubPal1
- 0DCE2 BC E9 F1 LDY MonPal2Choice,x
- 0DCE5 B1 3F LDA (collisionPointer),y
- 0DCE7
- 0DCE7 8D AE 06 STA spriteSubPal2
- 0DCEA 68 PLA
- 0DCEB AA TAX
- 0DCEC
- 0DCEC 98 TYA
- 0DCED 48 PHA
- 0DCEE
- 0DCEE A0 B2 LDY #178
- 0DCF0 B1 3F LDA (collisionPointer),y
- 0DCF2 85 00 STA temp
- 0DCF4 C9 FF CMP #$FF
- 0DCF6 D0 13 BNE notStopSong
- 0DCF8 8D CC 06 STA songToPlay
- 0DCFB A9 FF 8D CC 06 AD CD 06.. StopSound
- 0DD08 4C 1D DD JMP skipSongToPlay
- 0DD0B notStopSong:
- 0DD0B
- 0DD0B CD CC 06 CMP songToPlay
- 0DD0E F0 0D BEQ skipSongToPlay ;; already playing this song
- 0DD10 A5 00 8D CC 06 AD CD 06.. PlaySong temp
- 0DD1D skipSongToPlay:
- 0DD1D
- 0DD1D 68 PLA
- 0DD1E A8 TAY
- 0DD1F
- 0DD1F 60 RTS
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20
- 0DD20 0DD20 .include Routines\BASE_4_5\\Game\Subroutines\doLoadNametableDataFull.asm
- 0DD20 doLoadNametableDataFull:
- 0DD20 8A TXA
- 0DD21 48 PHA
- 0DD22 98 TYA
- 0DD23 48 PHA
- 0DD24
- 0DD24 98 48 AD 20 06 8D 21 06.. SwitchBank arg0_hold
- 0DD33
- 0DD33 A5 0F LDA arg3_hold
- 0DD35 8D 06 20 STA $2006
- 0DD38 A9 00 LDA #$00
- 0DD3A 8D 06 20 STA $2006
- 0DD3D
- 0DD3D A2 04 LDX #$04
- 0DD3F A0 00 LDY #$00
- 0DD41 LoadNametableLoop:
- 0DD41
- 0DD41 B1 14 LDA (temp16),y
- 0DD43 8D 07 20 STA $2007
- 0DD46 C8 INY
- 0DD47 D0 F8 BNE LoadNametableLoop
- 0DD49 E6 15 INC temp16+1
- 0DD4B CA DEX
- 0DD4C D0 F3 BNE LoadNametableLoop
- 0DD4E
- 0DD4E 68 PLA
- 0DD4F A8 TAY
- 0DD50 68 PLA
- 0DD51 AA TAX
- 0DD52
- 0DD52 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0DD5C
- 0DD5C 60 RTS0DD5D .include Routines\BASE_4_5\\Game\Subroutines\doHandleCreateState.asm
- 0DD5D ;;;;; read the first behavior and do the thing.
- 0DD5D doHandleCreateState:
- 0DD5D
- 0DD5D BD 9C 04 LDA Object_frame,x
- 0DD60 4A LSR
- 0DD61 4A LSR
- 0DD62 4A LSR
- 0DD63 29 07 AND #%00000111
- 0DD65 85 08 STA tempB
- 0DD67 ; LDA #$00
- 0DD67 ; STA tempD
- 0DD67 ; SwitchBank #$1C
- 0DD67 ; ;;; Then, get the behavior for that object on that frame number.
- 0DD67 ; LDY Object_type,x
- 0DD67 ; LDY #$10
- 0DD67 ; LDA ObjectBehaviorTableLo,y
- 0DD67 ; LDA #<Object0_ActionTypes
- 0DD67 ; STA pointer
- 0DD67
- 0DD67 ; LDA ObjectBehaviorTableHi,y
- 0DD67 ; LDA #>Object0_ActionTypes
- 0DD67 ; STA pointer+1
- 0DD67 ; LDY tempD
- 0DD67 ; LDY #$00
- 0DD67 ; LDA (pointer),y
- 0DD67 ; AND #%00001111
- 0DD67 ; STA tempB
- 0DD67 ; ReturnBank
- 0DD67 ;;;; object behavior tables are with the lut table.
- 0DD67 ;;;; the lut table is in bank 1C.
- 0DD67
- 0DD67 8A TXA
- 0DD68 85 07 STA tempA
- 0DD6A
- 0DD6A
- 0DD6A 8A 48 A5 07 85 0C A5 08.. DoObjectAction tempA, tempB
- 0DD92 ; ;arg0 = what object?
- 0DD92 ;arg1 = what step for the behavior?
- 0DD92
- 0DD92
- 0DD92 BD 00 04 LDA Object_status,x
- 0DD95 29 3F AND #%00111111
- 0DD97 09 80 ORA #%10000000
- 0DD99 9D 00 04 STA Object_status,x ;; kick it to active
- 0DD9C 60 RTS0DD9D .include Routines\BASE_4_5\\Game\Subroutines\doChangeActionStep.asm
- 0DD9D doChangeActionStep:
- 0DD9D 8A TXA
- 0DD9E 48 PHA
- 0DD9F A6 0C LDX arg0_hold
- 0DDA1 A5 0D LDA arg1_hold
- 0DDA3 0A ASL
- 0DDA4 0A ASL
- 0DDA5 0A ASL
- 0DDA6 85 00 STA temp
- 0DDA8 BD 9C 04 LDA Object_frame,x
- 0DDAB 29 C7 AND #%11000111
- 0DDAD 05 00 ORA temp
- 0DDAF 9D 9C 04 STA Object_frame,x
- 0DDB2
- 0DDB2 8A 48 A5 0C 85 0C A5 0D.. DoObjectAction arg0_hold, arg1_hold
- 0DDDA
- 0DDDA 68 PLA
- 0DDDB AA TAX
- 0DDDC 60 RTS0DDDD .include Routines\BASE_4_5\\Game\Subroutines\doGetRandomNumber.asm
- 0DDDD doGetRandomNumber:
- 0DDDD AD B3 06 LDA randomSeed1
- 0DDE0 0A ASL A
- 0DDE1 0A ASL A
- 0DDE2 18 CLC
- 0DDE3 65 02 ADC temp2
- 0DDE5 38 SEC
- 0DDE6 E5 04 SBC tempx
- 0DDE8 69 11 ADC #$11
- 0DDEA E5 27 SBC gamepad
- 0DDEC 69 36 ADC #$36
- 0DDEE 65 32 ADC tileY
- 0DDF0 E5 14 SBC temp16
- 0DDF2 65 1B ADC pointer
- 0DDF4 65 07 ADC tempA
- 0DDF6 8D B3 06 STA randomSeed1
- 0DDF9 69 03 ADC #$03
- 0DDFB E5 18 SBC vBlankTimer
- 0DDFD E5 18 SBC vBlankTimer
- 0DDFF 60 RTS0DE00 .include Routines\BASE_4_5\\Game\Subroutines\updateAction.asm
- 0DE00 updateAction:
- 0DE00
- 0DE00 60 RTS0DE01 .include Routines\BASE_4_5\\Game\Subroutines\doClearAllMonsters.asm
- 0DE01 doClearAllMonsters:
- 0DE01
- 0DE01
- 0DE01 98 48 AD 20 06 8D 21 06.. SwitchBank #$1C
- 0DE10 A2 00 LDX #$00
- 0DE12 doClearObjectsLoop:
- 0DE12 BC 8F 04 LDY Object_type,x
- 0DE15 B9 20 91 LDA ObjectFlags,y
- 0DE18 29 01 AND #%00000001 ;; is it persistent?
- 0DE1A D0 0B BNE doneClearingObject
- 0DE1C A9 00 LDA #$00
- 0DE1E 9D 00 04 STA Object_status,x
- 0DE21 9D 9C 04 STA Object_frame,x
- 0DE24 9D A9 04 STA Object_direction,x
- 0DE27 doneClearingObject:
- 0DE27 E8 INX
- 0DE28 E0 0D CPX #TOTAL_MAX_OBJECTS
- 0DE2A D0 E6 BNE doClearObjectsLoop
- 0DE2C 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0DE36
- 0DE36
- 0DE36
- 0DE36
- 0DE36 60 RTS
- 0DE37
- 0DE37 ;.include ROOT\Game\Subroutines\doDrawBox.asm
- 0DE37 .include Routines\BASE_4_5\\Game\Subroutines\doDrawText.asm
- 0DE37 doDrawText:
- 0DE37 8A TXA
- 0DE38 48 PHA
- 0DE39 98 TYA
- 0DE3A 48 PHA
- 0DE3B
- 0DE3B AD C0 06 LDA textHandler
- 0DE3E D0 29 BNE alreadyDrawingText
- 0DE40 ;; setting up text.
- 0DE40
- 0DE40 A5 0E LDA arg2_hold ;; the x value, in metatiles, of the box draw.
- 0DE42 0A ASL ;; multiplied by two, since metatiles are 16x16, but PPU addresses are 8x8.
- 0DE43 85 00 STA temp
- 0DE45 A5 0F LDA arg3_hold ;; the y value, in metatiles, of the box draw.
- 0DE47 0A ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0DE48 85 01 STA temp1
- 0DE4A 0A ASL
- 0DE4B 0A ASL
- 0DE4C 0A ASL
- 0DE4D 0A ASL
- 0DE4E 0A ASL
- 0DE4F 18 CLC
- 0DE50 65 00 ADC temp
- 0DE52 85 41 STA textOffset_lo
- 0DE54
- 0DE54
- 0DE54 A5 01 LDA temp1
- 0DE56 4A LSR
- 0DE57 4A LSR
- 0DE58 4A LSR
- 0DE59 18 CLC
- 0DE5A 6D BE 06 ADC camFocus_tiles
- 0DE5D 85 42 STA textOffset_hi
- 0DE5F
- 0DE5F
- 0DE5F A9 01 LDA #$01
- 0DE61 8D C0 06 STA textHandler
- 0DE64 A9 00 LDA #$00
- 0DE66 8D BC 06 STA counter
- 0DE69
- 0DE69 alreadyDrawingText:
- 0DE69 A9 00 LDA #$00
- 0DE6B 8D 8A 06 STA scrollOffsetCounter
- 0DE6E 98 48 AD 20 06 8D 21 06.. SwitchBank textBank
- 0DE7E A0 00 LDY #$00
- 0DE80 A5 42 LDA textOffset_hi
- 0DE82 99 00 07 STA scrollUpdateRam,y
- 0DE85 C8 INY
- 0DE86 A5 41 LDA textOffset_lo
- 0DE88 99 00 07 STA scrollUpdateRam,y
- 0DE8B C8 INY
- 0DE8C 98 TYA
- 0DE8D 48 PHA
- 0DE8E A0 00 LDY #$00
- 0DE90 B1 43 LDA (textPointer),y
- 0DE92 85 00 STA temp
- 0DE94 68 PLA
- 0DE95 A8 TAY
- 0DE96
- 0DE96
- 0DE96 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DE96 ;; HERE, we will check for "end string" values.
- 0DE96 ;; These are set up by default from the GUI.
- 0DE96 ;; Mostly, they add a value from HUD_CONSANTS.dat
- 0DE96 ;; that act as an opcode rather than a string value.
- 0DE96 ;; Since there are 256 values, there are many at the end that
- 0DE96 ;; will never be used.
- 0DE96
- 0DE96 ;; These are the ones that are default:
- 0DE96 ;_BREAK = $FE
- 0DE96 ;_END = $FF
- 0DE96 ;_MORE = $FD
- 0DE96 ;_ENDWIN = $FA
- 0DE96 ;_ENDITEM = $FB
- 0DE96 ;_ENDSHOP = $FC
- 0DE96 ;_ENDTRIGGER = $F9
- 0DE96
- 0DE96 ;;FOR MANUAL USE:
- 0DE96 ;; Drawing from a library of values based on a numeric offset can be invoked by using F8.
- 0DE96 A5 00 LDA temp
- 0DE98 C9 F8 CMP #$F8
- 0DE9A D0 49 BNE +notDrawingFromLibrary
- 0DE9C 98 TYA
- 0DE9D 48 PHA
- 0DE9E ;;; the library can have 256 values.
- 0DE9E ;;; conceivably, you could make multiple libraries, and assignem them to different end of text reads.
- 0DE9E ;;; So here is what this does.
- 0DE9E ;;; 1) Reads an #$F8, so it knows to read from the library.
- 0DE9E ;;; 2) Increases position. Gets the low value of var address to read
- 0DE9E ;;; 3) Increases position. Gets the high value of var address to read. Puts the result of var into Y.
- 0DE9E ;;; 3) Increases position and SAVES that program counter position.
- 0DE9E ;;; 4) Reads the y offest of library table. That position becomes the new textPointer location.
- 0DE9E ;;; 5) Writes as normal from that position.
- 0DE9E ;;; 6) If it reads #$F7, it turns off library draw (so every library read should end in #$F7.
- 0DE9E ;;; 7) Saved program counter position gets restored to textPointer, and draw text continues on
- 0DE9E ;;; as normal.
- 0DE9E A5 43 LDA textPointer
- 0DEA0 18 CLC
- 0DEA1 69 01 ADC #$01
- 0DEA3 85 43 STA textPointer
- 0DEA5 A5 44 LDA textPointer+1
- 0DEA7 69 00 ADC #$00
- 0DEA9 85 44 STA textPointer+1
- 0DEAB A0 00 LDY #$00
- 0DEAD B1 43 LDA (textPointer),y
- 0DEAF 85 1B STA pointer
- 0DEB1
- 0DEB1 A5 43 LDA textPointer
- 0DEB3 18 CLC
- 0DEB4 69 01 ADC #$01
- 0DEB6 85 43 STA textPointer
- 0DEB8 A5 44 LDA textPointer+1
- 0DEBA 69 00 ADC #$00
- 0DEBC 85 44 STA textPointer+1
- 0DEBE A0 00 LDY #$00
- 0DEC0 B1 43 LDA (textPointer),y
- 0DEC2 85 1C STA pointer+1
- 0DEC4
- 0DEC4 A0 00 LDY #$00
- 0DEC6 B1 1B LDA (pointer),y
- 0DEC8 A8 TAY ;; tempA now represents the offset value from the Library pointer table.
- 0DEC9
- 0DEC9 ;; store next offset position for a return point.
- 0DEC9 A5 43 LDA textPointer
- 0DECB 18 CLC
- 0DECC 69 01 ADC #$01
- 0DECE 85 A0 STA textPosHold
- 0DED0 A5 44 LDA textPointer+1
- 0DED2 69 00 ADC #$00
- 0DED4 85 A1 STA textPosHold+1
- 0DED6
- 0DED6 ;; get the library table value
- 0DED6 B9 43 D9 LDA TextLibrary_lo,y
- 0DED9 85 43 STA textPointer
- 0DEDB B9 44 D9 LDA TextLibrary_hi,y
- 0DEDE 85 44 STA textPointer+1
- 0DEE0 68 PLA
- 0DEE1 A8 TAY
- 0DEE2 4C 40 DF JMP +continueRoutine;doneWithText
- 0DEE5
- 0DEE5
- 0DEE5 +notDrawingFromLibrary:
- 0DEE5 C9 F7 CMP #$F7
- 0DEE7 D0 15 BNE +notRestoringFromLibrary
- 0DEE9 98 TYA
- 0DEEA 48 PHA
- 0DEEB ;; restorying from library.
- 0DEEB A5 A0 LDA textPosHold
- 0DEED 85 43 STA textPointer
- 0DEEF A5 A1 LDA textPosHold+1
- 0DEF1 85 44 STA textPointer+1
- 0DEF3 A0 00 LDY #$00
- 0DEF5 B1 43 LDA (textPointer),y
- 0DEF7 85 00 STA temp ;; flow into the rest of the text routine.
- 0DEF9 68 PLA
- 0DEFA A8 TAY
- 0DEFB 4C 40 DF JMP +continueRoutine
- 0DEFE +notRestoringFromLibrary
- 0DEFE ;;; a value of F6 is an opcode that lets the game know to draw the value of a variable in a given position
- 0DEFE ;;; within a manual string.
- 0DEFE ;;; 1) First, we see it is an F6 opcode.
- 0DEFE ;;; 2) The next two bytes are the address of the variable that we want to read.
- 0DEFE ;;; 3) It pushes that to y as an offset to NumberBaseTable, and then continues on to the routine.
- 0DEFE C9 F6 CMP #$F6
- 0DF00 D0 3E BNE +notDrawingVariableNumber
- 0DF02 98 TYA
- 0DF03 48 PHA
- 0DF04 A5 43 LDA textPointer
- 0DF06 18 CLC
- 0DF07 69 01 ADC #$01
- 0DF09 85 43 STA textPointer
- 0DF0B A5 44 LDA textPointer+1
- 0DF0D 69 00 ADC #$00
- 0DF0F 85 44 STA textPointer+1
- 0DF11 A0 00 LDY #$00
- 0DF13 B1 43 LDA (textPointer),y
- 0DF15 85 1B STA pointer
- 0DF17
- 0DF17 A5 43 LDA textPointer
- 0DF19 18 CLC
- 0DF1A 69 01 ADC #$01
- 0DF1C 85 43 STA textPointer
- 0DF1E A5 44 LDA textPointer+1
- 0DF20 69 00 ADC #$00
- 0DF22 85 44 STA textPointer+1
- 0DF24 A0 00 LDY #$00
- 0DF26 B1 43 LDA (textPointer),y
- 0DF28 85 1C STA pointer+1
- 0DF2A
- 0DF2A A0 00 LDY #$00
- 0DF2C B1 1B LDA (pointer),y
- 0DF2E A8 TAY
- 0DF2F
- 0DF2F A9 39 LDA #<NumberBaseTable
- 0DF31 85 1B STA pointer
- 0DF33 A9 D9 LDA #>NumberBaseTable
- 0DF35 85 1C STA pointer+1
- 0DF37 B1 1B LDA (pointer),y
- 0DF39 85 00 STA temp
- 0DF3B 68 PLA
- 0DF3C A8 TAY
- 0DF3D 4C 40 DF JMP +continueRoutine
- 0DF40
- 0DF40 +notDrawingVariableNumber
- 0DF40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DF40 +continueRoutine
- 0DF40 A5 00 LDA temp
- 0DF42 C9 FF CMP #$FF
- 0DF44 D0 16 BNE notEndOfText
- 0DF46 endOfText:
- 0DF46 ;; end of text
- 0DF46 A9 00 LDA #$00
- 0DF48 8D C0 06 STA textHandler
- 0DF4B ;;;;;;;;; cue turn off.
- 0DF4B AD C2 06 LDA textQueued
- 0DF4E 09 02 ORA #%00000010
- 0DF50 8D C2 06 STA textQueued ;; this will push a *turn off* notification.
- 0DF53
- 0DF53 A5 9B LDA gameStatusByte
- 0DF55 29 FD AND #%11111101
- 0DF57 85 9B STA gameStatusByte
- 0DF59
- 0DF59 4C 8B E0 JMP doneWithText
- 0DF5C notEndOfText:
- 0DF5C C9 FE CMP #$FE
- 0DF5E D0 26 BNE notNewLineOfText
- 0DF60
- 0DF60 ;; new line of text
- 0DF60 ;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DF60 ;; return to the leftmost side of the text string
- 0DF60 ;; by subtracting "counter"
- 0DF60 ;; then add #$20 (32), which jumps it to the next line.
- 0DF60
- 0DF60 A5 41 LDA textOffset_lo
- 0DF62 38 SEC
- 0DF63 ED BC 06 SBC counter
- 0DF66 18 CLC
- 0DF67 69 20 ADC #$20
- 0DF69 85 41 STA textOffset_lo
- 0DF6B A5 42 LDA textOffset_hi
- 0DF6D 69 00 ADC #$00
- 0DF6F 85 42 STA textOffset_hi
- 0DF71
- 0DF71 ;; start 'counter' over again for the length of the current line
- 0DF71 A9 00 LDA #$00
- 0DF73 8D BC 06 STA counter
- 0DF76
- 0DF76 ;; increase the position of the text pointer to get the next offset
- 0DF76 ;; value in the string.
- 0DF76 A5 43 LDA textPointer
- 0DF78 18 CLC
- 0DF79 69 01 ADC #$01
- 0DF7B 85 43 STA textPointer
- 0DF7D A5 44 LDA textPointer+1
- 0DF7F 69 00 ADC #$00
- 0DF81 85 44 STA textPointer+1
- 0DF83
- 0DF83 4C 8B E0 JMP doneWithText
- 0DF86 notNewLineOfText:
- 0DF86 C9 F9 CMP #_ENDTRIGGER
- 0DF88 D0 41 BNE notEndTrigger
- 0DF8A A5 43 LDA textPointer
- 0DF8C 18 CLC
- 0DF8D 69 01 ADC #$01
- 0DF8F 85 43 STA textPointer
- 0DF91 A5 44 LDA textPointer+1
- 0DF93 69 00 ADC #$00
- 0DF95 85 44 STA textPointer+1
- 0DF97 ;;; NOW, get the modifier
- 0DF97 98 TYA
- 0DF98 48 PHA
- 0DF99 A0 00 LDY #$00
- 0DF9B B1 43 LDA (textPointer),y
- 0DF9D ;;; accumulators now contains the trigger type
- 0DF9D 85 00 STA temp
- 0DF9F 8A 85 04 98 85 05 A5 00.. TriggerScreen temp
- 0DFC1 68 PLA
- 0DFC2 A8 TAY
- 0DFC3 A9 00 LDA #$00
- 0DFC5 8D C0 06 STA textHandler
- 0DFC8 4C 46 DF JMP endOfText
- 0DFCB notEndTrigger:
- 0DFCB C9 FD CMP #_MORE
- 0DFCD D0 44 BNE notMoreText
- 0DFCF ;; There is more text.
- 0DFCF ;; so first, we need to clear the text field.
- 0DFCF ;; We will set up a queue for drawing a new black box and then more text.
- 0DFCF AD C2 06 LDA textQueued
- 0DFD2 09 01 ORA #%00000001
- 0DFD4 8D C2 06 STA textQueued
- 0DFD7 ;;; now, increase the text value so that it will read from the very next value
- 0DFD7 ;;; when a new box is created.
- 0DFD7
- 0DFD7 A5 41 LDA textOffset_lo
- 0DFD9 18 CLC
- 0DFDA 69 02 ADC #$02
- 0DFDC 85 41 STA textOffset_lo
- 0DFDE A5 42 LDA textOffset_hi
- 0DFE0 69 00 ADC #$00
- 0DFE2 85 42 STA textOffset_hi
- 0DFE4
- 0DFE4
- 0DFE4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0DFE4 ;;; Also, add a "MORE" indicator after finished text.
- 0DFE4 ;;;
- 0DFE4 A5 43 LDA textPointer
- 0DFE6 18 CLC
- 0DFE7 69 01 ADC #$01
- 0DFE9 85 43 STA textPointer
- 0DFEB A5 44 LDA textPointer+1
- 0DFED 69 00 ADC #$00
- 0DFEF 85 44 STA textPointer+1
- 0DFF1 A9 00 LDA #$00
- 0DFF3 8D C0 06 STA textHandler
- 0DFF6
- 0DFF6 A9 00 LDA #TEXT_MORE_INDICATOR
- 0DFF8 85 00 STA temp
- 0DFFA
- 0DFFA A5 00 LDA temp
- 0DFFC 18 CLC
- 0DFFD 69 C0 ADC #HUD_OFFSET
- 0DFFF 99 00 07 STA scrollUpdateRam,y
- 0E002 C8 INY
- 0E003 98 TYA
- 0E004 8D 8B 06 STA maxScrollOffsetCounter
- 0E007
- 0E007 EE BC 06 inc counter ;; we will use counter for "length" of the current line.
- 0E00A
- 0E00A
- 0E00A A5 9B LDA gameStatusByte
- 0E00C 29 FD AND #%11111101
- 0E00E 85 9B STA gameStatusByte
- 0E010 4C 83 E0 JMP JustUpdateNewCharacter
- 0E013
- 0E013
- 0E013 notMoreText:
- 0E013 C9 FB CMP #_ENDITEM
- 0E015 D0 42 BNE notEndItem
- 0E017 ;; is end item.
- 0E017 A5 43 LDA textPointer
- 0E019 18 CLC
- 0E01A 69 01 ADC #$01
- 0E01C 85 43 STA textPointer
- 0E01E A5 44 LDA textPointer+1
- 0E020 69 00 ADC #$00
- 0E022 85 44 STA textPointer+1
- 0E024 A0 00 LDY #$00
- 0E026 B1 43 LDA (textPointer),y
- 0E028 ;; now A holds the "item to get".
- 0E028 A8 TAY
- 0E029 B9 E1 D8 LDA ValToBitTable_inverse,y
- 0E02C 0D DF 06 ORA weaponsUnlocked
- 0E02F 8D DF 06 STA weaponsUnlocked
- 0E032 8A 85 04 98 85 05 AD 74.. TriggerScreen currentNametable
- 0E056 4C 46 DF JMP endOfText
- 0E059 notEndItem:
- 0E059
- 0E059
- 0E059
- 0E059 updateNormalTextCharacter:
- 0E059 A5 00 LDA temp
- 0E05B 18 CLC
- 0E05C 69 C0 ADC #HUD_OFFSET
- 0E05E 99 00 07 STA scrollUpdateRam,y
- 0E061 C8 INY
- 0E062 98 TYA
- 0E063 8D 8B 06 STA maxScrollOffsetCounter
- 0E066
- 0E066 EE BC 06 inc counter ;; we will use counter for "length" of the current line.
- 0E069
- 0E069 A5 41 LDA textOffset_lo
- 0E06B 18 CLC
- 0E06C 69 01 ADC #$01
- 0E06E 85 41 STA textOffset_lo
- 0E070 A5 42 LDA textOffset_hi
- 0E072 69 00 ADC #$00
- 0E074 85 42 STA textOffset_hi
- 0E076
- 0E076 A5 43 LDA textPointer
- 0E078 18 CLC
- 0E079 69 01 ADC #$01
- 0E07B 85 43 STA textPointer
- 0E07D A5 44 LDA textPointer+1
- 0E07F 69 00 ADC #$00
- 0E081 85 44 STA textPointer+1
- 0E083 JustUpdateNewCharacter:
- 0E083 AD 24 06 LDA updateScreenData
- 0E086 09 04 ORA #%00000100
- 0E088 8D 24 06 STA updateScreenData
- 0E08B doneWithText:
- 0E08B 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0E095 68 PLA
- 0E096 A8 TAY
- 0E097 68 PLA
- 0E098 AA TAX
- 0E099 60 RTS0E09A .include Routines\BASE_4_5\\Game\Subroutines\doDrawTilesDirect.asm
- 0E09A doDrawTilesDirect:
- 0E09A ; ;;; draw hud box
- 0E09A ; LDA #BOX_0_WIDTH
- 0E09A ; ASL
- 0E09A ; STA tempA
- 0E09A ; LDA #BOX_0_HEIGHT
- 0E09A ; ASL
- 0E09A ; STA tempB
- 0E09A ; LDA #BOX_0_ORIGIN_X ;; the x value, in metatiles, of the box draw.
- 0E09A ; ASL ;; multiplied by two, since metatiles are 16x16, but PPU addresses are 8x8.
- 0E09A ; CLC
- 0E09A ;ADC arg2_hold
- 0E09A A5 0E LDA arg2_hold
- 0E09C 85 00 STA temp
- 0E09E ; LDA #BOX_0_ORIGIN_Y ;; the y value, in metatiles, of the box draw.
- 0E09E ; ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0E09E ; CLC
- 0E09E ; ADC
- 0E09E A5 0F LDA arg3_hold
- 0E0A0 85 01 STA temp1
- 0E0A2 0A ASL
- 0E0A3 0A ASL
- 0E0A4 0A ASL
- 0E0A5 0A ASL
- 0E0A6 0A ASL
- 0E0A7 18 CLC
- 0E0A8 65 00 ADC temp
- 0E0AA 85 03 STA temp3 ;; low byte.
- 0E0AC
- 0E0AC
- 0E0AC A5 01 LDA temp1
- 0E0AE 4A LSR
- 0E0AF 4A LSR
- 0E0B0 4A LSR
- 0E0B1 18 CLC
- 0E0B2 6D BE 06 ADC camFocus_tiles
- 0E0B5 85 02 STA temp2 ;; high byte
- 0E0B7 ;;; draw text direct does not need to wait for frame updates.
- 0E0B7 ;;; it happens when the scren is turned off.
- 0E0B7 98 48 AD 20 06 8D 21 06.. SwitchBank textBank
- 0E0C7 A9 00 LDA #$00
- 0E0C9 85 07 STA tempA ;; used for width.
- 0E0CB loop_drawTextDirect:
- 0E0CB A0 00 LDY #$00
- 0E0CD A5 02 LDA temp2
- 0E0CF 8D 06 20 STA $2006
- 0E0D2 A5 03 LDA temp3
- 0E0D4 8D 06 20 STA $2006
- 0E0D7 B1 43 LDA (textPointer),y
- 0E0D9 C9 FF CMP #$FF
- 0E0DB F0 4D BEQ doneWithThisString
- 0E0DD C9 FE CMP #$FE
- 0E0DF F0 25 BEQ newLineForDrawTextDirect
- 0E0E1 18 CLC
- 0E0E2 65 10 ADC arg4_hold
- 0E0E4 8D 07 20 STA $2007
- 0E0E7
- 0E0E7 A5 03 LDA temp3
- 0E0E9 18 CLC
- 0E0EA 69 01 ADC #$01
- 0E0EC 85 03 STA temp3
- 0E0EE A5 02 LDA temp2
- 0E0F0 69 00 ADC #$00
- 0E0F2 85 02 STA temp2
- 0E0F4 E6 07 INC tempA
- 0E0F6 A5 43 LDA textPointer
- 0E0F8 18 CLC
- 0E0F9 69 01 ADC #$01
- 0E0FB 85 43 STA textPointer
- 0E0FD A5 44 LDA textPointer+1
- 0E0FF 69 00 ADC #$00
- 0E101 85 44 STA textPointer+1
- 0E103 4C CB E0 JMP loop_drawTextDirect
- 0E106 newLineForDrawTextDirect:
- 0E106 A5 03 LDA temp3
- 0E108 38 SEC
- 0E109 E5 07 SBC tempA
- 0E10B 18 CLC
- 0E10C 69 20 ADC #$20
- 0E10E 85 03 STA temp3
- 0E110 A5 02 LDA temp2
- 0E112 69 00 ADC #$00
- 0E114 85 02 STA temp2
- 0E116 A9 00 LDA #$00
- 0E118 85 07 STA tempA
- 0E11A A5 43 LDA textPointer
- 0E11C 18 CLC
- 0E11D 69 01 ADC #$01
- 0E11F 85 43 STA textPointer
- 0E121 A5 44 LDA textPointer+1
- 0E123 69 00 ADC #$00
- 0E125 85 44 STA textPointer+1
- 0E127
- 0E127 4C CB E0 JMP loop_drawTextDirect
- 0E12A doneWithThisString:
- 0E12A 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0E134
- 0E134 60 RTS0E135 .include Routines\BASE_4_5\\Game\Subroutines\doDrawVariableTiles.asm
- 0E135 doDrawVariableTiles:
- 0E135 A5 0C LDA arg0_hold
- 0E137 85 00 STA temp
- 0E139 ; LDA #BOX_0_ORIGIN_Y ;; the y value, in metatiles, of the box draw.
- 0E139 ; ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0E139 ; CLC
- 0E139 ; ADC
- 0E139 A5 0D LDA arg1_hold
- 0E13B 85 01 STA temp1
- 0E13D 0A ASL
- 0E13E 0A ASL
- 0E13F 0A ASL
- 0E140 0A ASL
- 0E141 0A ASL
- 0E142 18 CLC
- 0E143 65 00 ADC temp
- 0E145 85 03 STA temp3 ;; low byte.
- 0E147
- 0E147
- 0E147 A5 01 LDA temp1
- 0E149 4A LSR
- 0E14A 4A LSR
- 0E14B 4A LSR
- 0E14C 18 CLC
- 0E14D 6D BE 06 ADC camFocus_tiles
- 0E150 85 02 STA temp2 ;; high byte
- 0E152
- 0E152
- 0E152 A2 00 LDX #$00;arg2_hold ; this is the FULL length of the tile thing.
- 0E154
- 0E154 A5 11 LDA arg5_hold ;; the tile to draw
- 0E156 85 00 STA temp
- 0E158
- 0E158 loop_doDrawVar
- 0E158 A5 10 LDA arg4_hold
- 0E15A F0 04 BEQ changeToEmpty ;; if it's zero, change to empty.
- 0E15C E4 10 CPX arg4_hold
- 0E15E 90 04 BCC dontChangeToEmpty
- 0E160 changeToEmpty
- 0E160 A5 0F LDA arg3_hold
- 0E162 85 00 STA temp
- 0E164 dontChangeToEmpty
- 0E164
- 0E164 A5 02 LDA temp2
- 0E166 8D 06 20 STA $2006
- 0E169 A5 03 LDA temp3
- 0E16B 8D 06 20 STA $2006
- 0E16E A5 00 LDA temp
- 0E170 18 CLC
- 0E171 69 C0 ADC #HUD_OFFSET
- 0E173 8D 07 20 STA $2007
- 0E176 E6 03 INC temp3
- 0E178 E8 INX
- 0E179 E4 0E CPX arg2_hold
- 0E17B F0 03 BEQ done_loop_doDrawVar
- 0E17D
- 0E17D 4C 58 E1 JMP loop_doDrawVar
- 0E180 done_loop_doDrawVar:
- 0E180
- 0E180 60 RTS
- 0E181
- 0E181
- 0E181 doDrawVariableTiles_update:
- 0E181 A5 0C LDA arg0_hold
- 0E183 85 00 STA temp
- 0E185 ; LDA #BOX_0_ORIGIN_Y ;; the y value, in metatiles, of the box draw.
- 0E185 ; ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0E185 ; CLC
- 0E185 ; ADC
- 0E185 A5 0D LDA arg1_hold
- 0E187 85 01 STA temp1
- 0E189 0A ASL
- 0E18A 0A ASL
- 0E18B 0A ASL
- 0E18C 0A ASL
- 0E18D 0A ASL
- 0E18E 18 CLC
- 0E18F 65 00 ADC temp
- 0E191 85 03 STA temp3 ;; low byte.
- 0E193
- 0E193
- 0E193 A5 01 LDA temp1
- 0E195 4A LSR
- 0E196 4A LSR
- 0E197 4A LSR
- 0E198 18 CLC
- 0E199 6D BE 06 ADC camFocus_tiles
- 0E19C 85 02 STA temp2 ;; high byte
- 0E19E
- 0E19E
- 0E19E A2 00 LDX #$00;arg2_hold ; this is the FULL length of the tile thing.
- 0E1A0 A0 00 LDY #$00
- 0E1A2 A5 11 LDA arg5_hold ;; the tile to draw
- 0E1A4 85 00 STA temp
- 0E1A6
- 0E1A6 A9 00 LDA #$00
- 0E1A8 8D 8A 06 STA scrollOffsetCounter
- 0E1AB
- 0E1AB loop_doDrawVar_update:
- 0E1AB A5 10 LDA arg4_hold
- 0E1AD F0 04 BEQ changeToEmpty_update ;; if it's zero, change to empty.
- 0E1AF E4 10 CPX arg4_hold
- 0E1B1 90 04 BCC dontChangeToEmpty_update
- 0E1B3 changeToEmpty_update
- 0E1B3 A5 0F LDA arg3_hold
- 0E1B5 85 00 STA temp
- 0E1B7 dontChangeToEmpty_update
- 0E1B7
- 0E1B7 A5 02 LDA temp2
- 0E1B9 99 00 07 STA scrollUpdateRam,y
- 0E1BC C8 INy
- 0E1BD A5 03 LDA temp3
- 0E1BF 99 00 07 STA scrollUpdateRam,y
- 0E1C2 C8 INy
- 0E1C3 A5 00 LDA temp
- 0E1C5 18 CLC
- 0E1C6 69 C0 ADC #HUD_OFFSET
- 0E1C8 99 00 07 STA scrollUpdateRam,y
- 0E1CB C8 INY
- 0E1CC E6 03 INC temp3
- 0E1CE E8 INX
- 0E1CF E4 0E CPX arg2_hold
- 0E1D1 F0 03 BEQ done_loop_doDrawVar_update
- 0E1D3
- 0E1D3 4C AB E1 JMP loop_doDrawVar_update
- 0E1D6 done_loop_doDrawVar_update:
- 0E1D6 98 TYA
- 0E1D7 8D 8B 06 STA maxScrollOffsetCounter
- 0E1DA
- 0E1DA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E1DA ;;; Turn on update screen on next frame.
- 0E1DA AD 24 06 LDA updateScreenData
- 0E1DD 09 04 ORA #%0000100
- 0E1DF 8D 24 06 STA updateScreenData
- 0E1E2 60 RTS0E1E3 .include Routines\BASE_4_5\\Game\Subroutines\doDrawNumbers.asm
- 0E1E3 doDrawNumbers:
- 0E1E3 A5 0C LDA arg0_hold
- 0E1E5 18 CLC
- 0E1E6 65 0F ADC arg3_hold
- 0E1E8 38 SEC
- 0E1E9 E9 01 SBC #$01
- 0E1EB 85 00 STA temp
- 0E1ED
- 0E1ED ; LDA #BOX_0_ORIGIN_Y ;; the y value, in metatiles, of the box draw.
- 0E1ED ; ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0E1ED ; CLC
- 0E1ED ; ADC
- 0E1ED A5 0D LDA arg1_hold
- 0E1EF 85 01 STA temp1
- 0E1F1 0A ASL
- 0E1F2 0A ASL
- 0E1F3 0A ASL
- 0E1F4 0A ASL
- 0E1F5 0A ASL
- 0E1F6 18 CLC
- 0E1F7 65 00 ADC temp
- 0E1F9 85 03 STA temp3 ;; low byte.
- 0E1FB
- 0E1FB
- 0E1FB A5 01 LDA temp1
- 0E1FD 4A LSR
- 0E1FE 4A LSR
- 0E1FF 4A LSR
- 0E200 18 CLC
- 0E201 6D BE 06 ADC camFocus_tiles
- 0E204 85 02 STA temp2 ;; high byte
- 0E206 A0 00 LDY #$00
- 0E208 doDrawNumbersLoop:
- 0E208 A5 02 LDA temp2
- 0E20A 8D 06 20 STA $2006
- 0E20D A5 03 LDA temp3
- 0E20F 8D 06 20 STA $2006
- 0E212 B1 1B LDA (pointer),y
- 0E214 18 CLC
- 0E215 69 D0 ADC #$d0 ;; number start
- 0E217 8D 07 20 STA $2007
- 0E21A C8 INY
- 0E21B C6 03 DEC temp3
- 0E21D C6 0F DEC arg3_hold
- 0E21F A5 0F LDA arg3_hold
- 0E221 D0 E5 BNE doDrawNumbersLoop
- 0E223
- 0E223 60 RTS
- 0E224
- 0E224
- 0E224 doDrawNumbers_update:
- 0E224
- 0E224 A9 00 LDA #$00
- 0E226 8D 8A 06 STA scrollOffsetCounter
- 0E229
- 0E229 A5 0C LDA arg0_hold
- 0E22B 18 CLC
- 0E22C 65 0F ADC arg3_hold
- 0E22E 38 SEC
- 0E22F E9 01 SBC #$01
- 0E231 85 00 STA temp
- 0E233
- 0E233 ; LDA #BOX_0_ORIGIN_Y ;; the y value, in metatiles, of the box draw.
- 0E233 ; ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0E233 ; CLC
- 0E233 ; ADC
- 0E233 A5 0D LDA arg1_hold
- 0E235 85 01 STA temp1
- 0E237 0A ASL
- 0E238 0A ASL
- 0E239 0A ASL
- 0E23A 0A ASL
- 0E23B 0A ASL
- 0E23C 18 CLC
- 0E23D 65 00 ADC temp
- 0E23F 85 03 STA temp3 ;; low byte.
- 0E241
- 0E241
- 0E241 A5 01 LDA temp1
- 0E243 4A LSR
- 0E244 4A LSR
- 0E245 4A LSR
- 0E246 18 CLC
- 0E247 6D BE 06 ADC camFocus_tiles
- 0E24A 85 02 STA temp2 ;; high byte
- 0E24C A2 00 LDX #$00
- 0E24E A0 00 LDY #$00
- 0E250 doDrawNumbersLoop_update:
- 0E250 A5 02 LDA temp2
- 0E252 9D 00 07 STA scrollUpdateRam,x
- 0E255 E8 INX
- 0E256 A5 03 LDA temp3
- 0E258 9D 00 07 STA scrollUpdateRam,x
- 0E25B E8 INX
- 0E25C B1 1B LDA (pointer),y
- 0E25E 18 CLC
- 0E25F 69 D0 ADC #$d0 ;; number start
- 0E261 9D 00 07 STA scrollUpdateRam,x
- 0E264 E8 INX
- 0E265 C8 INY
- 0E266 C6 03 DEC temp3
- 0E268 C6 0F DEC arg3_hold
- 0E26A A5 0F LDA arg3_hold
- 0E26C D0 E2 BNE doDrawNumbersLoop_update
- 0E26E 8A TXA
- 0E26F 8D 8B 06 STA maxScrollOffsetCounter
- 0E272
- 0E272 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E272 ;;; Turn on update screen on next frame.
- 0E272 AD 24 06 LDA updateScreenData
- 0E275 09 04 ORA #%0000100
- 0E277 8D 24 06 STA updateScreenData
- 0E27A
- 0E27A 60 RTS
- 0E27B
- 0E27B
- 0E27B
- 0E27B ;.include ROOT\Game\Subroutines\doUpdateHudElement.asm
- 0E27B .include Routines\BASE_4_5\\Game\Subroutines\doUpdateHudTiles.asm
- 0E27B doUpdateHudTiles:
- 0E27B ;;; prevent this from happening if there are any other updates that should have priority.
- 0E27B ;;;;;;
- 0E27B ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E27B
- 0E27B A5 05 LDA tempy
- 0E27D 85 01 STA temp1
- 0E27F 0A ASL
- 0E280 0A ASL
- 0E281 0A ASL
- 0E282 0A ASL
- 0E283 0A ASL
- 0E284 18 CLC
- 0E285 65 04 ADC tempx
- 0E287 85 03 STA temp3 ;; low byte
- 0E289
- 0E289
- 0E289 A5 01 LDA temp1
- 0E28B 4A LSR
- 0E28C 4A LSR
- 0E28D 4A LSR
- 0E28E 18 CLC
- 0E28F 6D BE 06 ADC camFocus_tiles
- 0E292 85 02 STA temp2 ;; high byte
- 0E294
- 0E294 A9 00 LDA #$00
- 0E296 8D 8A 06 STA scrollOffsetCounter
- 0E299 A8 TAY
- 0E29A doLoadUpdateHudQueueLoop:
- 0E29A A5 02 LDA temp2
- 0E29C 99 00 07 STA scrollUpdateRam,y
- 0E29F C8 INY
- 0E2A0 A5 03 LDA temp3
- 0E2A2 99 00 07 STA scrollUpdateRam,y
- 0E2A5 C8 INY
- 0E2A6 A9 E0 LDA #$E0
- 0E2A8 99 00 07 STA scrollUpdateRam,y
- 0E2AB C8 INY
- 0E2AC
- 0E2AC 98 TYA
- 0E2AD 8D 8B 06 STA maxScrollOffsetCounter
- 0E2B0
- 0E2B0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E2B0 ;;; Turn on update screen on next frame.
- 0E2B0 AD 24 06 LDA updateScreenData
- 0E2B3 09 04 ORA #%0000100
- 0E2B5 8D 24 06 STA updateScreenData
- 0E2B8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E2B8
- 0E2B8
- 0E2B8 60 RTS0E2B9 .include Routines\BASE_4_5\\Game\Subroutines\doUpdateHudVarTiles.asm
- 0E2B9 doUpdateHudVarTiles:
- 0E2B9 ;;; prevent this from happening if there are any other updates that should have priority.
- 0E2B9 ;;;;;;
- 0E2B9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E2B9 ;; tempA holds max container number.
- 0E2B9 ;; tempB hold "full" containers.
- 0E2B9 ;; tempC holds blank image value
- 0E2B9 ;; tempD holds full image value
- 0E2B9
- 0E2B9 A5 05 LDA tempy
- 0E2BB 0A ASL
- 0E2BC 0A ASL
- 0E2BD 0A ASL
- 0E2BE 0A ASL
- 0E2BF 0A ASL
- 0E2C0 18 CLC
- 0E2C1 65 04 ADC tempx
- 0E2C3 85 02 STA temp2
- 0E2C5
- 0E2C5
- 0E2C5 A5 01 LDA temp1
- 0E2C7 4A LSR
- 0E2C8 4A LSR
- 0E2C9 4A LSR
- 0E2CA 18 CLC
- 0E2CB 6D BE 06 ADC camFocus_tiles
- 0E2CE 85 03 STA temp3
- 0E2D0
- 0E2D0 A9 00 LDA #$00
- 0E2D2 8D 8A 06 STA scrollOffsetCounter
- 0E2D5 85 01 STA temp1
- 0E2D7 A8 TAY
- 0E2D8
- 0E2D8
- 0E2D8 doLoadUpdateHudVarQueueLoop:
- 0E2D8 A5 01 LDA temp1 ;; offset
- 0E2DA C5 08 CMP tempB ;; full value
- 0E2DC 90 05 BCC drawFullValue
- 0E2DE ;; draw container value
- 0E2DE A5 09 LDA tempC
- 0E2E0 4C E5 E2 JMP gotDrawValue
- 0E2E3 drawFullValue
- 0E2E3 A5 0A LDA tempD
- 0E2E5 gotDrawValue
- 0E2E5 85 06 STA tempz
- 0E2E7 A5 03 LDA temp3
- 0E2E9 99 00 07 STA scrollUpdateRam,y
- 0E2EC C8 INY
- 0E2ED A5 02 LDA temp2
- 0E2EF 18 CLC
- 0E2F0 65 01 ADC temp1
- 0E2F2 99 00 07 STA scrollUpdateRam,y
- 0E2F5 C8 INY
- 0E2F6 A5 06 LDA tempz
- 0E2F8 99 00 07 STA scrollUpdateRam,y
- 0E2FB C8 INY
- 0E2FC E6 01 INC temp1
- 0E2FE A5 01 LDA temp1
- 0E300 C5 07 CMP tempA
- 0E302 D0 D4 BNE doLoadUpdateHudVarQueueLoop
- 0E304
- 0E304
- 0E304
- 0E304
- 0E304 98 TYA
- 0E305 8D 8B 06 STA maxScrollOffsetCounter
- 0E308
- 0E308 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E308 ;;; Turn on update screen on next frame.
- 0E308 AD 24 06 LDA updateScreenData
- 0E30B 09 04 ORA #%0000100
- 0E30D 8D 24 06 STA updateScreenData
- 0E310 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E310
- 0E310
- 0E310 60 RTS0E311 .include Routines\BASE_4_5\\Game\Subroutines\doUpdateHudNumber.asm
- 0E311 doUpdateHudNumber:
- 0E311 ;;; prevent this from happening if there are any other updates that should have priority.
- 0E311 ;;;;;;
- 0E311 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E311 ;;
- 0E311 ;;
- 0E311 ;;
- 0E311 ;;
- 0E311
- 0E311 A5 05 LDA tempy
- 0E313 0A ASL
- 0E314 0A ASL
- 0E315 0A ASL
- 0E316 0A ASL
- 0E317 0A ASL
- 0E318 18 CLC
- 0E319 65 04 ADC tempx
- 0E31B 18 CLC
- 0E31C 65 07 ADC tempA ;; the width
- 0E31E ;;; so that as it draws places backwards
- 0E31E ;;; it ends at the proper x,y
- 0E31E 85 02 STA temp2
- 0E320
- 0E320
- 0E320 A5 01 LDA temp1
- 0E322 4A LSR
- 0E323 4A LSR
- 0E324 4A LSR
- 0E325 18 CLC
- 0E326 6D BE 06 ADC camFocus_tiles
- 0E329 85 03 STA temp3
- 0E32B
- 0E32B A9 00 LDA #$00
- 0E32D 8D 8A 06 STA scrollOffsetCounter
- 0E330 85 01 STA temp1
- 0E332 A8 TAY
- 0E333
- 0E333
- 0E333 doLoadUpdateHudNumberQueueLoop:
- 0E333 ;LDA temp1 ;; offset
- 0E333 A5 03 LDA temp3
- 0E335 99 00 07 STA scrollUpdateRam,y
- 0E338 C8 INY
- 0E339 A5 02 LDA temp2
- 0E33B 18 CLC
- 0E33C 65 07 ADC tempA
- 0E33E 99 00 07 STA scrollUpdateRam,y
- 0E341 C8 INY
- 0E342 98 TYA
- 0E343 48 PHA
- 0E344 A4 01 LDY temp1
- 0E346 B1 1B LDA (pointer),y
- 0E348 18 CLC
- 0E349 69 C0 ADC #HUD_OFFSET
- 0E34B 18 CLC
- 0E34C 69 10 ADC #$10 ;; numbers
- 0E34E 85 00 STA temp
- 0E350 68 PLA
- 0E351 A8 TAY
- 0E352 A5 00 LDA temp
- 0E354 99 00 07 STA scrollUpdateRam,y
- 0E357 C8 INY
- 0E358 E6 01 INC temp1
- 0E35A C6 07 DEC tempA
- 0E35C D0 D5 BNE doLoadUpdateHudNumberQueueLoop
- 0E35E
- 0E35E
- 0E35E
- 0E35E
- 0E35E 98 TYA
- 0E35F 8D 8B 06 STA maxScrollOffsetCounter
- 0E362
- 0E362 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E362 ;;; Turn on update screen on next frame.
- 0E362 AD 24 06 LDA updateScreenData
- 0E365 09 04 ORA #%0000100
- 0E367 8D 24 06 STA updateScreenData
- 0E36A ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E36A
- 0E36A
- 0E36A 60 RTS0E36B
- 0E36B
- 0E36B
- 0E36B .include "Routines\BASE_4_5\Game\Space Birds\Subroutines\doHandleUpdateScreen_bossDeath.asm"
- 0E36B doHandleUpdateScreen:
- 0E36B
- 0E36B
- 0E36B
- 0E36B ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E36B ;; Set focus variables to know which nametable is the one to update.
- 0E36B AE 6D 06 LDX player1_object
- 0E36E BD 27 04 LDA Object_screen,x
- 0E371 29 01 AND #%00000001
- 0E373 F0 0D BEQ updatesToEvenNametable
- 0E375 ;;updates to odd nametable
- 0E375 A9 24 LDA #$24
- 0E377 8D BE 06 STA camFocus_tiles
- 0E37A A9 27 LDA #$27
- 0E37C 8D BF 06 STA camFocus_att
- 0E37F 4C 8C E3 JMP gotScreenFocus
- 0E382 updatesToEvenNametable:
- 0E382 A9 20 LDA #$20
- 0E384 8D BE 06 STA camFocus_tiles
- 0E387 A9 23 LDA #$23
- 0E389 8D BF 06 STA camFocus_att
- 0E38C gotScreenFocus:
- 0E38C
- 0E38C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E38C ;; Boss byte has been flipped.
- 0E38C ;; go through collision by collision to get rid of potential boss tiles.
- 0E38C ;; held in bossTile_hold over frames.
- 0E38C ;; assumes boss block is in tile 4
- 0E38C A5 A2 LDA bossByte
- 0E38E D0 03 BNE +doCheckForBossByteTiles
- 0E390 ;;;skip boss byte tiles. Byte was not flipped
- 0E390 4C 93 E4 JMP +skipBossByte
- 0E393 +doCheckForBossByteTiles
- 0E393 A4 A3 LDY bossTile_hold
- 0E395 AD BE 06 LDA camFocus_tiles
- 0E398 C9 20 CMP #$20
- 0E39A D0 16 BNE +isSecondScreen
- 0E39C B9 00 03 LDA collisionTable,y
- 0E39F C9 04 CMP #$04 ;; value of boss block tile.
- 0E3A1 F0 07 BEQ +dontSkipThisTile
- 0E3A3 C9 05 CMP #$05 ;; value of boss block tile w/o collision
- 0E3A5 F0 03 BEQ +dontSkipThisTile
- 0E3A7 4C 5F E4 JMP +skipThisTile
- 0E3AA +dontSkipThisTile
- 0E3AA A9 00 LDA #$00
- 0E3AC 99 00 03 STA collisionTable,y
- 0E3AF 4C C1 E3 JMP +updateTile
- 0E3B2 +isSecondScreen
- 0E3B2 B9 00 05 LDA collisionTable2,y
- 0E3B5 C9 04 CMP #$04
- 0E3B7 F0 03 BEQ +dontSkipThisTile
- 0E3B9 4C 5F E4 JMP +skipThisTile
- 0E3BC +dontSkipThisTile
- 0E3BC A9 00 LDA #$00
- 0E3BE 99 00 05 STA collisionTable2,y
- 0E3C1
- 0E3C1 +updateTile
- 0E3C1 AD BE 06 LDA camFocus_tiles
- 0E3C4 85 01 STA temp1
- 0E3C6
- 0E3C6 98 TYA
- 0E3C7 85 00 STA temp
- 0E3C9 4A LSR
- 0E3CA 4A LSR
- 0E3CB 4A LSR
- 0E3CC 4A LSR
- 0E3CD 4A LSR
- 0E3CE 4A LSR
- 0E3CF 18 clc
- 0E3D0 65 01 ADC temp1
- 0E3D2 85 02 STA temp2 ;;;temp16+1
- 0E3D4 98 TYA
- 0E3D5 29 F0 AND #%11110000
- 0E3D7 0A ASL
- 0E3D8 0A ASL
- 0E3D9 85 06 STA tempz
- 0E3DB 98 TYA
- 0E3DC 29 0F AND #%00001111
- 0E3DE 0A ASL
- 0E3DF 05 06 ORA tempz
- 0E3E1 85 03 STA temp3 ;temp16
- 0E3E3
- 0E3E3 ;;; SET THE TILE NUMBER TO CHANGE TO.
- 0E3E3 A9 00 LDA #$00 ;; the tile to change.
- 0E3E5 ;;; this is in tiles, so if you wanted the second "metatile",
- 0E3E5 ;;; use 2, not 1. If you wanted the tile in the next row,
- 0E3E5 ;;; use #$20, not #$10. Etc.
- 0E3E5 85 07 STA tempA
- 0E3E7 18 CLC
- 0E3E8 69 01 ADC #$01
- 0E3EA 85 08 STA tempB
- 0E3EC 18 CLC
- 0E3ED 69 0F ADC #$0F ;;this was done instead of specifying a static number so that we can alter this code to use a variable instead of LDA #$00.
- 0E3EF 85 09 STA tempC
- 0E3F1 18 CLC
- 0E3F2 69 01 ADC #$01
- 0E3F4 85 0A STA tempD
- 0E3F6
- 0E3F6
- 0E3F6 A0 00 LDY #$00
- 0E3F8 A5 02 LDA temp2
- 0E3FA 99 00 07 STA scrollUpdateRam,y
- 0E3FD C8 INY
- 0E3FE A5 03 LDA temp3
- 0E400 99 00 07 STA scrollUpdateRam,y
- 0E403 C8 INY
- 0E404 A5 07 LDA tempA
- 0E406 99 00 07 STA scrollUpdateRam,y
- 0E409 C8 INY
- 0E40A
- 0E40A A5 02 LDA temp2
- 0E40C 99 00 07 STA scrollUpdateRam,y
- 0E40F C8 INY
- 0E410 A5 03 LDA temp3
- 0E412 18 CLC
- 0E413 69 01 ADC #$01
- 0E415 99 00 07 STA scrollUpdateRam,y
- 0E418 C8 INY
- 0E419 A5 08 LDA tempB
- 0E41B 99 00 07 STA scrollUpdateRam,y
- 0E41E C8 INY
- 0E41F
- 0E41F A5 03 LDA temp3
- 0E421 18 CLC
- 0E422 69 20 ADC #$20
- 0E424 85 03 STA temp3
- 0E426 A5 02 LDA temp2
- 0E428 69 00 ADC #$00
- 0E42A 85 02 STA temp2
- 0E42C
- 0E42C A5 02 LDA temp2
- 0E42E 99 00 07 STA scrollUpdateRam,y
- 0E431 C8 INY
- 0E432 A5 03 LDA temp3
- 0E434 99 00 07 STA scrollUpdateRam,y
- 0E437 C8 INY
- 0E438 A5 09 LDA tempC
- 0E43A 99 00 07 STA scrollUpdateRam,y
- 0E43D C8 INY
- 0E43E
- 0E43E A5 02 LDA temp2
- 0E440 99 00 07 STA scrollUpdateRam,y
- 0E443 C8 INY
- 0E444 A5 03 LDA temp3
- 0E446 18 CLC
- 0E447 69 01 ADC #$01
- 0E449 99 00 07 STA scrollUpdateRam,y
- 0E44C C8 INY
- 0E44D A5 0A LDA tempD
- 0E44F 99 00 07 STA scrollUpdateRam,y
- 0E452 C8 INY
- 0E453
- 0E453 98 TYA
- 0E454 8D 8B 06 STA maxScrollOffsetCounter
- 0E457
- 0E457
- 0E457
- 0E457
- 0E457 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E457 ;;; Turn on update screen on next frame.
- 0E457 AD 24 06 LDA updateScreenData
- 0E45A 09 04 ORA #%0000100
- 0E45C 8D 24 06 STA updateScreenData
- 0E45F ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E45F
- 0E45F +skipThisTile
- 0E45F A4 A3 LDY bossTile_hold
- 0E461 C8 INY
- 0E462 C0 F0 CPY #240
- 0E464 F0 06 BEQ +doneWithScreenCheck
- 0E466 ;;;not done yet.
- 0E466 ;;;prepare to loop on next frame
- 0E466
- 0E466 98 TYA
- 0E467 85 A3 STA bossTile_hold
- 0E469 4C 93 E4 JMP +skipBossByte
- 0E46C +doneWithScreenCheck
- 0E46C A9 00 LDA #$00
- 0E46E 85 A3 STA bossTile_hold
- 0E470 85 A2 STA bossByte
- 0E472 AD 9F 06 LDA ScreenFlags00
- 0E475 29 E7 AND #%11100111
- 0E477 8D 9F 06 STA ScreenFlags00
- 0E47A AD 85 06 LDA camX
- 0E47D 18 CLC
- 0E47E 69 01 ADC #$01
- 0E480 8D 85 06 STA camX
- 0E483 AD 86 06 LDA camX_hi
- 0E486 69 00 ADC #$00
- 0E488 8D 86 06 STA camX_hi
- 0E48B
- 0E48B AD 8C 06 LDA scrollByte
- 0E48E 09 02 ORA #%00000010
- 0E490 8D 8C 06 STA scrollByte
- 0E493 +skipBossByte
- 0E493
- 0E493
- 0E493 AD AB 06 LDA gameHandler
- 0E496 29 80 AND #%10000000
- 0E498 D0 03 BNE doUpdateToNewScreen
- 0E49A 4C CB E4 JMP dontUpdateToNewScreen
- 0E49D doUpdateToNewScreen:
- 0E49D A9 00 LDA #$00
- 0E49F 85 17 STA soft2001
- 0E4A1 20 FB C8 JSR doWaitFrame
- 0E4A4
- 0E4A4
- 0E4A4
- 0E4A4 AD 74 06 LDA currentNametable
- 0E4A7 AE 6D 06 LDX player1_object
- 0E4AA 9D 27 04 STA Object_screen,x
- 0E4AD
- 0E4AD 4A LSR
- 0E4AE 4A LSR
- 0E4AF 4A LSR
- 0E4B0 4A LSR
- 0E4B1 8D 89 06 STA camY_hi
- 0E4B4 AD 74 06 LDA currentNametable
- 0E4B7 29 0F AND #%00001111
- 0E4B9 8D 86 06 STA camX_hi
- 0E4BC
- 0E4BC
- 0E4BC 20 A9 D5 JSR doLoadScreen2
- 0E4BF 20 21 C9 JSR doLoadScreen
- 0E4C2 AD AB 06 LDA gameHandler
- 0E4C5 29 7F AND #%01111111
- 0E4C7 8D AB 06 STA gameHandler
- 0E4CA 60 RTS
- 0E4CB dontUpdateToNewScreen:
- 0E4CB ;
- 0E4CB
- 0E4CB 60 RTS0E4CC .include "Routines\BASE_4_5\Game\Subroutines\doDrawBox.asm"
- 0E4CC doDrawBox:
- 0E4CC A5 9B LDA gameStatusByte
- 0E4CE 29 02 AND #%00000010
- 0E4D0 D0 06 BNE +skipNpcText
- 0E4D2 A5 9B LDA gameStatusByte
- 0E4D4 09 02 ORA #%00000010
- 0E4D6 85 9B STA gameStatusByte
- 0E4D8 +skipNpcText
- 0E4D8
- 0E4D8
- 0E4D8 AD 24 06 LDA updateScreenData
- 0E4DB 29 05 AND #%00000101 ;; if queued to push tiles or attributes
- 0E4DD F0 01 BEQ +doTextBox
- 0E4DF 60 RTS
- 0E4E0 +doTextBox
- 0E4E0
- 0E4E0
- 0E4E0 ; LDA updateScreenData
- 0E4E0 ; AND #%00000101 ;; if queued to push tiles or attributes
- 0E4E0 ; BEQ checkQueueFlags
- 0E4E0
- 0E4E0
- 0E4E0 ; RTS
- 0E4E0 checkQueueFlags:
- 0E4E0
- 0E4E0 AD B5 06 LDA queueFlags
- 0E4E3 29 80 AND #%10000000
- 0E4E5 F0 2C BEQ skipSettingUpBox
- 0E4E7
- 0E4E7 A5 9B LDA gameStatusByte
- 0E4E9 09 01 ORA #%00000001 ;;; this will skip object handling.
- 0E4EB 85 9B STA gameStatusByte
- 0E4ED
- 0E4ED ; LDA arg0_hold
- 0E4ED ; STA Box_x_origin
- 0E4ED AD B6 06 LDA Box_x_origin
- 0E4F0 8D C4 06 STA temp_boxX
- 0E4F3
- 0E4F3 AD B7 06 LDA Box_y_origin
- 0E4F6 8D BB 06 STA Box_y_hold
- 0E4F9 8D C5 06 STA temp_boxY
- 0E4FC
- 0E4FC AD B8 06 LDA Box_width
- 0E4FF 8D C6 06 STA temp_boxWidth
- 0E502
- 0E502 AD B9 06 LDA Box_height
- 0E505 8D BA 06 STA Box_height_hold
- 0E508 8D C7 06 STA temp_boxHeight
- 0E50B ;;; legacied method:
- 0E50B ; STA temp_boxX
- 0E50B ; LDA arg1_hold
- 0E50B ; STA Box_y_origin
- 0E50B ; STA Box_y_hold
- 0E50B ; STA temp_boxY
- 0E50B ; LDA arg2_hold
- 0E50B ; STA Box_width
- 0E50B ; STA temp_boxWidth
- 0E50B ; LDA arg3_hold
- 0E50B ; STA Box_height
- 0E50B ; STA Box_height_hold
- 0E50B ; STA temp_boxHeight
- 0E50B ;;;;;;;;;;;;;;;;
- 0E50B AD B5 06 LDA queueFlags
- 0E50E 29 7F AND #%01111111
- 0E510 8D B5 06 STA queueFlags
- 0E513
- 0E513
- 0E513 skipSettingUpBox:
- 0E513 AD B5 06 LDA queueFlags
- 0E516 29 04 AND #%00000100
- 0E518 F0 03 BEQ notCurrentlyUpdatingQueuedAttributes
- 0E51A 4C CF E6 JMP currentlyUpdatingQueuedAttribtues
- 0E51D notCurrentlyUpdatingQueuedAttributes:
- 0E51D ;;; draw box will update one metatile row at a time,
- 0E51D ;;; so at max, it will be updating 16x4 tiles (64) x 3 bytes per tile (192).
- 0E51D ;;; This makes multple frames of updates easy.
- 0E51D ;;; If the queue flag bit 0 is activated, that means that we have moved on to another row, but are not done yet.
- 0E51D
- 0E51D AD B5 06 LDA queueFlags
- 0E520 29 01 AND #%00000001
- 0E522 F0 03 BEQ notCurrentlyUpdatingQueuedTiles
- 0E524 ;; currently updating queued tiles
- 0E524
- 0E524 4C 2F E5 JMP currentlyUpdatingQueuedTiles
- 0E527 notCurrentlyUpdatingQueuedTiles:
- 0E527 ;;;;; We are JUST starting a box update.
- 0E527 ; arg0_hold = X value, in metatiles
- 0E527 ; arg1_hold = y value, in metatiles
- 0E527 ; arg2_hold = width, in metatiles
- 0E527 ; arg3_hold = height, in metatiles
- 0E527
- 0E527 AD B5 06 LDA queueFlags
- 0E52A 09 01 ORA #%00000001
- 0E52C 8D B5 06 STA queueFlags
- 0E52F
- 0E52F
- 0E52F currentlyUpdatingQueuedTiles:
- 0E52F
- 0E52F AD B6 06 LDA Box_x_origin ;; the x value, in metatiles, of the box draw.
- 0E532 0A ASL ;; multiplied by two, since metatiles are 16x16, but PPU addresses are 8x8.
- 0E533 85 00 STA temp
- 0E535 AD B7 06 LDA Box_y_origin ;; the y value, in metatiles, of the box draw.
- 0E538 0A ASL ;; multiplied by two, since metatiles are 16x16, but ppu addresses are 8x8.
- 0E539 85 01 STA temp1
- 0E53B 0A ASL
- 0E53C 0A ASL
- 0E53D 0A ASL
- 0E53E 0A ASL
- 0E53F 0A ASL
- 0E540 18 CLC
- 0E541 65 00 ADC temp
- 0E543 85 03 STA temp3
- 0E545
- 0E545
- 0E545 A5 01 LDA temp1
- 0E547 4A LSR
- 0E548 4A LSR
- 0E549 4A LSR
- 0E54A 18 CLC
- 0E54B 6D BE 06 ADC camFocus_tiles
- 0E54E 85 02 STA temp2
- 0E550
- 0E550
- 0E550
- 0E550 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E550 ;;; LOAD THE BYTES INTO SCRATCH RAM:
- 0E550 ;;; High, Low, Tile.
- 0E550 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E550
- 0E550
- 0E550 A9 00 LDA #$00
- 0E552
- 0E552 8D 8A 06 STA scrollOffsetCounter
- 0E555 A8 TAY
- 0E556
- 0E556 doDrawBoxLoop:
- 0E556 A9 00 LDA #$00
- 0E558 85 04 STA tempx
- 0E55A AE B8 06 LDX Box_width ;; load the width into x.
- 0E55D
- 0E55D doDrawBoxLoop_inner:
- 0E55D 98 TYA
- 0E55E 85 05 STA tempy
- 0E560 ;;;;;;;;;;;;; What do we draw?
- 0E560 ;;;;;;;;;;;;; If we are creating a box, we just draw a blank tile.
- 0E560 ;;;;;;;;;;;;; If we are erasing a box, we will get the tile data of the
- 0E560 ;;;;;;;;;;;;; current screen, and push the updateTile variables into
- 0E560 ;;;;;;;;;;;;; tempA-tempD.
- 0E560 AD B5 06 LDA queueFlags
- 0E563 29 02 AND #%00000010
- 0E565 D0 03 BNE isRestoringBox
- 0E567 4C 0D E6 JMP isJustDrawingBox
- 0E56A isRestoringBox:
- 0E56A AD B5 06 LDA queueFlags
- 0E56D 09 40 ORA #%01000000
- 0E56F 8D B5 06 STA queueFlags
- 0E572 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0E581
- 0E581 AC 74 06 LDY currentNametable
- 0E584
- 0E584 AD A4 06 LDA warpMap
- 0E587 F0 0D BEQ +loadFromMap1table
- 0E589 ; ;;;load from map 2 table
- 0E589 B9 00 87 LDA NameTablePointers_Map2_lo,y
- 0E58C 85 14 STA temp16
- 0E58E B9 00 88 LDA NameTablePointers_Map2_hi,y
- 0E591 85 15 STA temp16+1
- 0E593 4C A0 E5 JMP +GotNametableLoadPointer
- 0E596 +loadFromMap1table:
- 0E596 B9 00 85 LDA NameTablePointers_Map1_lo,y
- 0E599 85 14 STA temp16
- 0E59B B9 00 86 LDA NameTablePointers_Map1_hi,y
- 0E59E 85 15 STA temp16+1
- 0E5A0 +GotNametableLoadPointer:
- 0E5A0 ;;now (temp16) holds the address of the nametable to be loaded.
- 0E5A0 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0E5AA
- 0E5AA
- 0E5AA ;; is restoring the nametable.
- 0E5AA ;; Find nametable value for this position.
- 0E5AA ;; First, we have to jump to the proper bank.
- 0E5AA AD 74 06 LDA currentNametable
- 0E5AD 4A LSR
- 0E5AE 4A LSR
- 0E5AF 4A LSR
- 0E5B0 4A LSR
- 0E5B1 4A LSR
- 0E5B2 85 00 STA temp
- 0E5B4
- 0E5B4 AD A4 06 LDA warpMap
- 0E5B7 F0 0A BEQ +dontAdd8toScreenBank
- 0E5B9 ;; ad 8 to screen bank
- 0E5B9 A5 00 LDA temp
- 0E5BB 18 CLC
- 0E5BC 69 08 ADC #$08
- 0E5BE 85 00 STA temp
- 0E5C0 4C C5 E5 JMP +gotScreenBank
- 0E5C3 +dontAdd8toScreenBank
- 0E5C3 A5 00 LDA temp
- 0E5C5 +gotScreenBank:
- 0E5C5 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0E5D4 ;;; now we can load from temp16, with y as our offset.
- 0E5D4 AD B7 06 LDA Box_y_origin
- 0E5D7 0A ASL
- 0E5D8 0A ASL
- 0E5D9 0A ASL
- 0E5DA 0A ASL
- 0E5DB 18 CLC
- 0E5DC 6D B6 06 ADC Box_x_origin
- 0E5DF 18 CLC
- 0E5E0 65 04 ADC tempx
- 0E5E2 A8 TAY
- 0E5E3 B1 14 LDA (temp16),y
- 0E5E5 85 00 STA temp ;; it is this value that doGetSingleMetaTileValues uses.
- 0E5E7
- 0E5E7
- 0E5E7 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0E5F1
- 0E5F1 A5 00 LDA temp
- 0E5F3 20 24 C7 JSR doGetSingleMetaTileValues
- 0E5F6 AD 53 06 LDA updateTile_00
- 0E5F9 85 07 STA tempA
- 0E5FB AD 54 06 LDA updateTile_01
- 0E5FE 85 08 STA tempB
- 0E600 AD 55 06 LDA updateTile_02
- 0E603 85 09 STA tempC
- 0E605 AD 56 06 LDA updateTile_03
- 0E608 85 0A STA tempD
- 0E60A
- 0E60A
- 0E60A
- 0E60A 4C 17 E6 JMP gotBoxFill
- 0E60D isJustDrawingBox:
- 0E60D
- 0E60D A9 F5 LDA #$f5
- 0E60F 85 07 STA tempA
- 0E611 85 08 STA tempB
- 0E613 85 09 STA tempC
- 0E615 85 0A STA tempD
- 0E617 gotBoxFill:
- 0E617
- 0E617 A4 05 LDY tempy
- 0E619
- 0E619 A5 02 LDA temp2
- 0E61B 99 00 07 STA scrollUpdateRam,y
- 0E61E C8 INY
- 0E61F A5 03 LDA temp3
- 0E621 99 00 07 STA scrollUpdateRam,y
- 0E624 C8 INY
- 0E625 A5 07 LDA tempA
- 0E627 99 00 07 STA scrollUpdateRam,y
- 0E62A C8 INY
- 0E62B
- 0E62B A5 02 LDA temp2
- 0E62D 99 00 07 STA scrollUpdateRam,y
- 0E630 C8 INY
- 0E631 A5 03 LDA temp3
- 0E633 18 CLC
- 0E634 69 01 ADC #$01
- 0E636 99 00 07 STA scrollUpdateRam,y
- 0E639 C8 INY
- 0E63A A5 08 LDA tempB
- 0E63C 99 00 07 STA scrollUpdateRam,y
- 0E63F C8 INY
- 0E640
- 0E640 A5 03 LDA temp3
- 0E642 18 CLC
- 0E643 69 20 ADC #$20
- 0E645 85 03 STA temp3
- 0E647 A5 02 LDA temp2
- 0E649 69 00 ADC #$00
- 0E64B 85 02 STA temp2
- 0E64D
- 0E64D A5 02 LDA temp2
- 0E64F 99 00 07 STA scrollUpdateRam,y
- 0E652 C8 INY
- 0E653 A5 03 LDA temp3
- 0E655 99 00 07 STA scrollUpdateRam,y
- 0E658 C8 INY
- 0E659 A5 09 LDA tempC
- 0E65B 99 00 07 STA scrollUpdateRam,y
- 0E65E C8 INY
- 0E65F
- 0E65F A5 02 LDA temp2
- 0E661 99 00 07 STA scrollUpdateRam,y
- 0E664 C8 INY
- 0E665 A5 03 LDA temp3
- 0E667 18 CLC
- 0E668 69 01 ADC #$01
- 0E66A 99 00 07 STA scrollUpdateRam,y
- 0E66D C8 INY
- 0E66E A5 0A LDA tempD
- 0E670 99 00 07 STA scrollUpdateRam,y
- 0E673 C8 INY
- 0E674 E6 04 INC tempx ;; temp x is the TILE offset, where as y / scrollOffsetCounter represents
- 0E676 ;;; the ram offset, which consists of high byte, low byte, AND tile.
- 0E676 CA DEX
- 0E677 F0 10 BEQ doneWithDrawBoxRow
- 0E679 ;;; more box row to draw.
- 0E679 A5 03 LDA temp3
- 0E67B 38 SEC
- 0E67C E9 1E SBC #$1E
- 0E67E 85 03 STA temp3
- 0E680 A5 02 LDA temp2
- 0E682 E9 00 SBC #$00
- 0E684 85 02 STA temp2
- 0E686 4C 5D E5 JMP doDrawBoxLoop_inner
- 0E689 doneWithDrawBoxRow:
- 0E689 CE BA 06 DEC Box_height_hold
- 0E68C AD BA 06 LDA Box_height_hold
- 0E68F F0 0C BEQ doneWithBoxDrawOutterLoop
- 0E691
- 0E691 AD B7 06 LDA Box_y_origin
- 0E694 18 CLC
- 0E695 69 01 ADC #$01
- 0E697 8D B7 06 STA Box_y_origin
- 0E69A 4C C2 E6 JMP notDoneWithBoxDrawOutterLoop
- 0E69D doneWithBoxDrawOutterLoop:
- 0E69D AD B5 06 LDA queueFlags
- 0E6A0 29 40 AND #%01000000
- 0E6A2 F0 0E BEQ isCreatingBoxTiles
- 0E6A4 ;; is restoring box tiles
- 0E6A4 ;;; COMPLETLY DONE WITH BOX.
- 0E6A4 A9 00 LDA #$00
- 0E6A6 8D B5 06 STA queueFlags
- 0E6A9 A5 9B LDA gameStatusByte
- 0E6AB 29 FC AND #%11111100 ;;; this will skip object handling.
- 0E6AD 85 9B STA gameStatusByte
- 0E6AF 4C C2 E6 JMP notDoneWithBoxDrawOutterLoop
- 0E6B2 isCreatingBoxTiles:
- 0E6B2 AD B5 06 LDA queueFlags
- 0E6B5 0A ASL
- 0E6B6 0A ASL
- 0E6B7 ;;; this shifts these bits to the left two places.
- 0E6B7 ;;; 0001 will become 0100, meaning that we are driving all attributes to box attributes.
- 0E6B7 ;;; 0011 will become 1100, meaning we are restoring the screen's attributes.
- 0E6B7 29 0C AND #%00001100 ;; this will scrape off the bits if we have passed attribute queue.
- 0E6B9 8D B5 06 STA queueFlags
- 0E6BC AD C5 06 LDA temp_boxY
- 0E6BF 8D B7 06 STA Box_y_origin
- 0E6C2
- 0E6C2
- 0E6C2 notDoneWithBoxDrawOutterLoop:
- 0E6C2
- 0E6C2
- 0E6C2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E6C2 ;;; Push the offset so we know how many tiles to update.
- 0E6C2 ;;; max would be 85 tiles.
- 0E6C2 ;;; could make this metatiles to get more out of this.
- 0E6C2 98 TYA
- 0E6C3 8D 8B 06 STA maxScrollOffsetCounter
- 0E6C6
- 0E6C6
- 0E6C6
- 0E6C6
- 0E6C6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E6C6 ;;; Turn on update screen on next frame.
- 0E6C6 AD 24 06 LDA updateScreenData
- 0E6C9 09 04 ORA #%0000100
- 0E6CB 8D 24 06 STA updateScreenData
- 0E6CE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E6CE
- 0E6CE
- 0E6CE
- 0E6CE 60 RTS
- 0E6CF
- 0E6CF
- 0E6CF
- 0E6CF currentlyUpdatingQueuedAttribtues:
- 0E6CF
- 0E6CF ;;; the max amount of attributes to be updated on a screen is 64.
- 0E6CF ;;; There are three bytes needed to be pushed into the scrollUpdateRam to update in the next refresh.
- 0E6CF ;;; All attributes, then, can be updated within 256 bytes, so there is no reason to go row by row as we do with
- 0E6CF ;;; metatiles, which need 4 tile definitions x hi and low bytes for each.
- 0E6CF
- 0E6CF AD B5 06 LDA queueFlags
- 0E6D2 29 10 AND #%00010000
- 0E6D4 F0 03 BEQ doSetupAttributeQueue
- 0E6D6 4C E7 E6 JMP alreadySetupAttributeQueue
- 0E6D9 doSetupAttributeQueue:
- 0E6D9
- 0E6D9
- 0E6D9 AD B9 06 LDA Box_height
- 0E6DC ;; allow for odd starts, if on odd, will need to add 1
- 0E6DC 8D BA 06 STA Box_height_hold
- 0E6DF
- 0E6DF AD B5 06 LDA queueFlags
- 0E6E2 09 10 ORA #%00010000
- 0E6E4 8D B5 06 STA queueFlags
- 0E6E7 alreadySetupAttributeQueue
- 0E6E7
- 0E6E7
- 0E6E7 ; LDA queueFlags
- 0E6E7 ; AND #%00001000
- 0E6E7 ; BEQ doBlankBoxAttributes
- 0E6E7 ; JMP doRestoreScreenAttributes
- 0E6E7 ; doBlankBoxAttributes:
- 0E6E7
- 0E6E7
- 0E6E7 ;; is writing 11 to all attributes that are within "the box".
- 0E6E7 AD B6 06 LDA Box_x_origin
- 0E6EA 4A LSR
- 0E6EB 85 07 STA tempA
- 0E6ED AD BB 06 LDA Box_y_hold
- 0E6F0 4A LSR
- 0E6F1 85 08 STA tempB
- 0E6F3
- 0E6F3 AD B8 06 LDA Box_width
- 0E6F6 4A LSR
- 0E6F7 ;; allow for odd starts, if on odd, will need to add 1
- 0E6F7 85 09 STA tempC
- 0E6F9 85 06 STA tempz
- 0E6FB
- 0E6FB ;; now, tempA*8+tempB gives us the starting position for the box's attributes.
- 0E6FB
- 0E6FB A9 00 LDA #$00
- 0E6FD 8D 8A 06 STA scrollOffsetCounter
- 0E700 A8 TAY
- 0E701
- 0E701 doDrawBoxAttributesLoop:
- 0E701 98 TYA
- 0E702 85 05 STA tempy
- 0E704
- 0E704 A5 08 LDA tempB
- 0E706 0A ASL
- 0E707 0A ASL
- 0E708 0A ASL
- 0E709 18 CLC
- 0E70A 65 07 ADC tempA
- 0E70C 85 04 sta tempx ;; tempx is our offset for the Attribute table.
- 0E70E
- 0E70E
- 0E70E AD BF 06 LDA camFocus_att ;; high byte, have to change based on which nametable we are in.
- 0E711 85 01 STA temp1
- 0E713 A9 C0 LDA #$C0
- 0E715 18 CLC
- 0E716 65 04 ADC tempx
- 0E718 85 02 STA temp2
- 0E71A
- 0E71A
- 0E71A
- 0E71A AD B5 06 LDA queueFlags
- 0E71D 29 08 AND #%00001000
- 0E71F D0 07 BNE isRestoringBoxAttributes
- 0E721 A9 FF LDA #$FF ;; what attribute do you want to fill the box with?
- 0E723 85 03 STA temp3
- 0E725 4C A2 E7 JMP gotBoxAttributeFill
- 0E728
- 0E728 isRestoringBoxAttributes:
- 0E728 AD B5 06 LDA queueFlags
- 0E72B 09 40 ORA #%01000000
- 0E72D 8D B5 06 STA queueFlags
- 0E730 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0E73F AC 74 06 LDY currentNametable
- 0E742 AD A4 06 LDA warpMap
- 0E745 F0 0D BEQ +loadAttFromTable1
- 0E747 B9 00 8B LDA AttributeTables_Map2_Lo,y
- 0E74A 85 14 STA temp16
- 0E74C B9 00 8C LDA AttributeTables_Map2_Hi,y
- 0E74F 85 15 STA temp16+1
- 0E751 4C 5E E7 JMP +gotAttFromTable
- 0E754 +loadAttFromTable1:
- 0E754 B9 00 89 LDA AttributeTables_Map1_Lo,y
- 0E757 85 14 STA temp16
- 0E759 B9 00 8A LDA AttributeTables_Map1_Hi,y
- 0E75C 85 15 STA temp16+1
- 0E75E +gotAttFromTable
- 0E75E 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0E768
- 0E768 AD 74 06 LDA currentNametable
- 0E76B 4A LSR
- 0E76C 4A LSR
- 0E76D 4A LSR
- 0E76E 4A LSR
- 0E76F 4A LSR
- 0E770 85 00 STA temp
- 0E772 AD A4 06 LDA warpMap
- 0E775 F0 0A BEQ +dontAdd8toscreenBankforAtt
- 0E777 ;; add 8 to screen bank
- 0E777 A5 00 LDA temp
- 0E779 18 CLC
- 0E77A 69 08 ADC #$08
- 0E77C 85 00 STA temp
- 0E77E 4C 83 E7 JMP +gotScreenBankForAtt
- 0E781 +dontAdd8toscreenBankforAtt
- 0E781 A5 00 LDA temp
- 0E783 +gotScreenBankForAtt
- 0E783 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0E792 A4 04 LDY tempx
- 0E794 B1 14 LDA (temp16),y
- 0E796 85 03 STA temp3
- 0E798 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0E7A2
- 0E7A2 gotBoxAttributeFill:
- 0E7A2 A4 05 LDY tempy
- 0E7A4 A5 01 LDA temp1
- 0E7A6 99 00 07 STA scrollUpdateRam,y
- 0E7A9 C8 INY
- 0E7AA A5 02 LDA temp2
- 0E7AC 99 00 07 STA scrollUpdateRam,y
- 0E7AF C8 INY
- 0E7B0 A5 03 LDA temp3
- 0E7B2 99 00 07 STA scrollUpdateRam,y
- 0E7B5 C8 INY
- 0E7B6 E6 07 INC tempA
- 0E7B8 C6 06 DEC tempz
- 0E7BA A5 06 LDA tempz
- 0E7BC F0 03 BEQ doneWithDrawBoxAttributeRow
- 0E7BE 4C 01 E7 JMP doDrawBoxAttributesLoop
- 0E7C1 doneWithDrawBoxAttributeRow:
- 0E7C1 CE BA 06 DEC Box_height_hold
- 0E7C4 AD BA 06 LDA Box_height_hold
- 0E7C7 F0 06 BEQ doneWithDrawBoxAttributes
- 0E7C9 EE BB 06 INC Box_y_hold
- 0E7CC 4C AE E9 JMP moreBoxAttributes
- 0E7CF
- 0E7CF
- 0E7CF doneWithDrawBoxAttributes:
- 0E7CF AD B5 06 LDA queueFlags
- 0E7D2 29 40 AND #%01000000
- 0E7D4 F0 08 BEQ isCreatingBoxAttributes
- 0E7D6 ;; is restoring box attributes
- 0E7D6 A9 83 LDA #%10000011
- 0E7D8 8D B5 06 STA queueFlags
- 0E7DB 4C AE E9 JMP moreBoxAttributes
- 0E7DE isCreatingBoxAttributes
- 0E7DE A9 00 LDA #$00
- 0E7E0 8D B5 06 STA queueFlags
- 0E7E3 AD C2 06 LDA textQueued
- 0E7E6 29 02 AND #%00000010
- 0E7E8 F0 0B BEQ notTurningOffTextbox
- 0E7EA
- 0E7EA ;; turning off textbox
- 0E7EA AD C2 06 LDA textQueued
- 0E7ED 29 FD AND #%11111101
- 0E7EF 8D C2 06 STA textQueued
- 0E7F2 4C BC E8 JMP do02endBoxAction
- 0E7F5 notTurningOffTextbox:
- 0E7F5 AD C3 06 LDA endDrawBoxAction
- 0E7F8 D0 03 BNE notZeroEndBoxAction
- 0E7FA 4C AE E9 JMP moreBoxAttributes ;; there is no text to draw in this box
- 0E7FD notZeroEndBoxAction:
- 0E7FD C9 01 CMP #$01
- 0E7FF F0 03 BEQ do01endBoxAction ;; do erase box
- 0E801 4C B5 E8 JMP notDo01endBoxAction
- 0E804 do01endBoxAction:
- 0E804 ;; this means direct text is queued.
- 0E804 98 48 8A 48 A9 19 85 0C.. QueueText #$19, Text2, Box_x_origin, Box_y_origin, Text2
- 0E8B2 4C AE E9 JMP moreBoxAttributes
- 0E8B5 notDo01endBoxAction:
- 0E8B5 C9 02 CMP #$02
- 0E8B7 F0 03 BEQ do02endBoxAction
- 0E8B9 4C EB E8 JMP notDo02endBoxAction
- 0E8BC do02endBoxAction:
- 0E8BC 8A 48 98 48 AD C4 06 85.. EraseBox temp_boxX, temp_boxY, temp_boxWidth, temp_boxHeight
- 0E8E8 4C AE E9 jmp moreBoxAttributes
- 0E8EB notDo02endBoxAction
- 0E8EB C9 03 CMP #$03
- 0E8ED F0 03 BEQ do03endBoxAction
- 0E8EF 4C FA E8 JMP notDo03endBoxAction
- 0E8F2 do03endBoxAction:
- 0E8F2 ;;; 03 type box means that this was a HUD box
- 0E8F2 A9 00 LDA #$00
- 0E8F4 8D C9 06 STA updateHud
- 0E8F7 4C AE E9 JMP moreBoxAttributes
- 0E8FA notDo03endBoxAction
- 0E8FA C9 04 CMP #$04
- 0E8FC F0 03 BEQ do04endBoxAction
- 0E8FE 4C AE E9 JMP notDo04EndBoxAction
- 0E901 do04endBoxAction:
- 0E901 ;; ok this means that this is an NPC box.
- 0E901 98 48 8A 48 A9 19 85 0C.. QueueText #$19, textToWrite, Box_x_origin, Box_y_origin, #$01
- 0E9AE notDo04EndBoxAction:
- 0E9AE moreBoxAttributes:
- 0E9AE 98 TYA
- 0E9AF 8D 8B 06 STA maxScrollOffsetCounter
- 0E9B2 justUpdateScreenData:
- 0E9B2
- 0E9B2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E9B2 ;;; Turn on update screen on next frame.
- 0E9B2 AD 24 06 LDA updateScreenData
- 0E9B5 09 04 ORA #%0000100
- 0E9B7 8D 24 06 STA updateScreenData
- 0E9BA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E9BA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E9BA 60 RTS
- 0E9BB
- 0E9BB doRestoreScreenAttributes:
- 0E9BB
- 0E9BB
- 0E9BB 60 RTS 0E9BC
- 0E9BC
- 0E9BC
- 0E9BC
- 0E9BC .include "Routines\BASE_4_5\Game\Subroutines\doHandleObjects_withinCamera.asm"
- 0E9BC doHandleObjects:
- 0E9BC A5 9B LDA gameStatusByte
- 0E9BE 29 01 AND #%00000001 ;;; this will skip object handling.
- 0E9C0 F0 01 BEQ dontSkipObjectHandling
- 0E9C2 60 RTS
- 0E9C3 dontSkipObjectHandling:
- 0E9C3 AD AB 06 LDA gameHandler
- 0E9C6 29 80 AND #%10000000
- 0E9C8 F0 01 BEQ dontSkipObjectHandling2
- 0E9CA ;;; this was in the middle of a screen transition
- 0E9CA 60 RTS
- 0E9CB dontSkipObjectHandling2
- 0E9CB
- 0E9CB ;;;; RESET ANY VARIABLES THAT NEED RESET BEFORE EVALUATION
- 0E9CB AD DA 06 LDA npcTrigger
- 0E9CE 29 FE AND #%11111110
- 0E9D0 8D DA 06 STA npcTrigger
- 0E9D3 ;;;; Create state
- 0E9D3 A2 00 LDX #$00
- 0E9D5
- 0E9D5 loop_doHandleObjectsLoop:
- 0E9D5
- 0E9D5 BD 00 04 LDA Object_status,x
- 0E9D8 29 C0 AND #%11000000
- 0E9DA D0 03 BNE objectHasActivity
- 0E9DC ;;;; this object is not being created
- 0E9DC ;;;; and is not active.
- 0E9DC 4C 00 EF JMP doObjectIsInactive
- 0E9DF
- 0E9DF objectHasActivity:
- 0E9DF BD 00 04 LDA Object_status,x
- 0E9E2 29 01 AND #OBJECT_QUEUED_FOR_DESTRUCTION
- 0E9E4 F0 08 BEQ doNotDestroyThisObject
- 0E9E6 ;;;; Destroy
- 0E9E6 .include "Routines\BASE_4_5\Game\Subroutines\doDestroyState.asm"
- 0E9E6 ;do object destroy state0E9E6 A9 00 LDA #$00
- 0E9E8 9D 00 04 STA Object_status,x
- 0E9EB 4C 00 EF JMP doObjectIsInactive ;; destroying will automatically set this object to inactive.
- 0E9EE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E9EE ;;;;;;;;END OF THE LINE FOR THIS OBJECT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0E9EE
- 0E9EE doNotDestroyThisObject:
- 0E9EE
- 0E9EE BD 00 04 LDA Object_status,x
- 0E9F1 29 80 AND #OBJECT_IS_ACTIVE
- 0E9F3 F0 03 BEQ checkForObjectActivation
- 0E9F5 4C 4C EA JMP doActiveObject
- 0E9F8 checkForObjectActivation:
- 0E9F8
- 0E9F8 BD 00 04 LDA Object_status,x
- 0E9FB 29 40 AND #OBJECT_QUEUED_FOR_ACTIVATION
- 0E9FD D0 03 BNE doCreateThisNewObjectd
- 0E9FF 4C 00 EF JMP doObjectIsInactive
- 0EA02 doCreateThisNewObjectd:
- 0EA02 ;;; create the new object.
- 0EA02 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EA02 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EA02 ;; Here, we create a new object. It will exist upon the next frame.
- 0EA02 .include "Routines\BASE_4_5\Game\MOD_AdventureBase\Subroutines\doCreateState_addExtraVariables_AdventureBase.asm"
- 0EA02 98 48 AD 20 06 8D 21 06.. SwitchBank #$1C
- 0EA11 BC 8F 04 LDY Object_type,x
- 0EA14 B9 D0 90 LDA ObjectHealth,y
- 0EA17 9D DD 04 STA Object_health,x
- 0EA1A
- 0EA1A
- 0EA1A
- 0EA1A
- 0EA1A
- 0EA1A
- 0EA1A 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EA24 0EA24
- 0EA24 20 5D DD JSR doHandleCreateState
- 0EA27 98 48 AD 20 06 8D 21 06.. SwitchBank #$1C
- 0EA36 BC 8F 04 LDY Object_type,x
- 0EA39 B9 20 91 LDA ObjectFlags,y
- 0EA3C 9D D0 04 STA Object_flags,x
- 0EA3F 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EA49
- 0EA49 4C 00 EF JMP doObjectIsInactive
- 0EA4C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EA4C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EA4C ;; Below is everything that happens for an active object.
- 0EA4C doActiveObject:
- 0EA4C
- 0EA4C ;;;; EVALUATE THE CAMERA POSITION
- 0EA4C
- 0EA4C BD 1A 04 LDA Object_x_hi,x
- 0EA4F 85 1B STA pointer
- 0EA51 BD 27 04 LDA Object_screen,x
- 0EA54 29 0F AND #%00001111
- 0EA56 85 1C STA pointer+1
- 0EA58
- 0EA58 A5 1C CD 86 06 D0 0A A5.. Compare16 pointer+1, pointer, camX_hi, camX
- 0EA7C ; arg0 = high byte of first value
- 0EA7C ; arg1 = low byte of first value
- 0EA7C ; arg2 = high byte of second value
- 0EA7C ; arg3 = low byte of second value
- 0EA7C
- 0EA7C +
- 0EA7C 4C 82 EA JMP +checkRightForDrawingOffCamera
- 0EA7F
- 0EA7F ++
- 0EA7F ;;; object is outside camera
- 0EA7F ;;; so skip updating this object.
- 0EA7F 4C 00 EF JMP doObjectIsInactive
- 0EA82
- 0EA82 +checkRightForDrawingOffCamera
- 0EA82 BD 1A 04 LDA Object_x_hi,x
- 0EA85 ;CLC
- 0EA85 ;ADC #$10 ;; arbitrary - approximate width of objects
- 0EA85 85 1B STA pointer
- 0EA87 BD 27 04 LDA Object_screen,x
- 0EA8A ;ADC #$00
- 0EA8A 29 0F AND #%00001111
- 0EA8C 85 1C STA pointer+1
- 0EA8E
- 0EA8E AD 85 06 LDA camX
- 0EA91 85 23 STA pointer5
- 0EA93 AD 86 06 LDA camX+1
- 0EA96 18 clc
- 0EA97 69 01 ADC #$01
- 0EA99 85 00 STA temp
- 0EA9B A5 1C C5 00 D0 09 A5 1B.. Compare16 pointer+1, pointer, temp, pointer5; camX
- 0EABB +
- 0EABB ;; this camera is out of camera range.
- 0EABB 4C 00 EF JMP doObjectIsInactive
- 0EABE ++
- 0EABE ;;; this object is in camera range.
- 0EABE ;;; cotninue evaluating this object.
- 0EABE
- 0EABE
- 0EABE ;; ORDER OF OPERATIONS
- 0EABE ; 1) Check to see if this object reads input (status byte). If not (0), skip input read.
- 0EABE ; 2) We have the states from each button (8 buttons, two controllers) from input management.
- 0EABE ; So now we compare it to this object, and whether or not it should
- 0EABE ; have any behaviors associated with it's pressed, down, released, or up states.
- 0EABE ; 3) Switch banks to the one that contains our LUTs for object data (sizes and whatnot)
- 0EABE ; 4) Check to see if this object observes physics (status byte). If not (0), skip physics.
- 0EABE
- 0EABE ; 5) Do a basic physics update for this object.
- 0EABE ; 6) Check to see if this object observes tile collisions. If not (0), skip tile collisions.
- 0EABE ; 7) Check tile collisions.
- 0EABE ; 8) Check to see if this object observes object collisions. If not (0), skip object collisions.
- 0EABE ; 9) Check object collisions.
- 0EABE ; 10) Check bounds.
- 0EABE ; 11) Update the object's position and behavior based on above.
- 0EABE ; 12) Check to see if this object should be drawn. If not (0), skip drawing.
- 0EABE ; 13) Draw this object.
- 0EABE ; 14) Return to main bank.
- 0EABE
- 0EABE ;; So status byte would be:
- 0EABE ;; #% 7 6 5 4 3 2 1 0
- 0EABE ;; | | | | | | | + - Queued for deactivation (?)
- 0EABE ;; | | | | | | + --- Observes drawing
- 0EABE ;; | | | | | + ----- Observes Object Collisions
- 0EABE ;; | | | | + ------- Observes Tile Collisions
- 0EABE ;; | | | + --------- Observes Physics
- 0EABE ;; | | + ----------- Observes Input
- 0EABE ;; | + ------------- Queued for activation
- 0EABE ;; + --------------- Active
- 0EABE
- 0EABE BD 8F 04 LDA Object_type,x
- 0EAC1 8D CA 06 STA tempObjType ;; not corrupted by any other routines
- 0EAC4 ;; used in timer handlings so no reference to bank1c is needed.
- 0EAC4 98 48 AD 20 06 8D 21 06.. SwitchBank #$18
- 0EAD3 BC 8F 04 LDY Object_type,x
- 0EAD6 B9 00 80 LDA ObjectReaction,y
- 0EAD9 8D 6B 06 STA EdgeSolidReaction ;; temporarily holds this data.
- 0EADC
- 0EADC 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EAE6
- 0EAE6 BD 00 04 LDA Object_status,x
- 0EAE9 29 20 AND #OBJECT_OBSERVES_INPUT
- 0EAEB D0 03 BNE ObjectReceivesInput
- 0EAED 4C F0 EA JMP ObjectDoesNotRecieveInput
- 0EAF0 ObjectReceivesInput:
- 0EAF0 ;;;; Input state
- 0EAF0 .include "Routines\BASE_4_5\Game\Subroutines\doInputState.asm"
- 0EAF0 ;;;input state0EAF0
- 0EAF0
- 0EAF0
- 0EAF0
- 0EAF0
- 0EAF0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EAF0 ObjectDoesNotRecieveInput:
- 0EAF0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EAF0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EAF0
- 0EAF0 BD 00 04 LDA Object_status,x
- 0EAF3 29 10 AND #OBJECT_OBSERVES_PHYSICS
- 0EAF5 D0 03 BNE ObjectDoesObservePhysics
- 0EAF7 4C 66 EE JMP ObjectDoesNotObservePhysics
- 0EAFA ObjectDoesObservePhysics:
- 0EAFA ;;;;; SYSTEM PHYSICS
- 0EAFA ;; we will use bank #$1C for physics since it has our lut tables in it.
- 0EAFA 98 48 AD 20 06 8D 21 06.. SwitchBank #$1C
- 0EB09 8A TXA
- 0EB0A 48 PHA
- 0EB0B .include "Routines\BASE_4_5\Game\MOD_shooter\Subroutines\doHandlePhysics_shooter2.asm"
- 0EB0B ;; do handle physics.
- 0EB0B
- 0EB0B
- 0EB0B BD 0D 04 LDA Object_x_lo,x
- 0EB0E 8D 78 06 STA xHold_lo
- 0EB11 BD 1A 04 LDA Object_x_hi,x
- 0EB14 8D 79 06 STA xHold_hi
- 0EB17 8D 7F 06 STA xPrev
- 0EB1A
- 0EB1A BD 27 04 LDA Object_screen,x
- 0EB1D 8D 7A 06 STA xHold_screen
- 0EB20 85 9F sta screenPrev
- 0EB22
- 0EB22 BD 34 04 LDA Object_y_lo,x
- 0EB25 8D 7B 06 STA yHold_lo
- 0EB28 BD 41 04 LDA Object_y_hi,x
- 0EB2B 8D 7C 06 STA yHold_hi
- 0EB2E 8D 80 06 STA yPrev
- 0EB31
- 0EB31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EB31 ;;; Set up speeds and collision variables
- 0EB31 BC 8F 04 LDY Object_type,x
- 0EB34 B9 00 8E LDA ObjectMaxSpeed,y
- 0EB37 0A ASL
- 0EB38 0A ASL
- 0EB39 0A ASL
- 0EB3A 0A ASL
- 0EB3B ;AND #%00001111
- 0EB3B 8D 69 06 STA myMaxSpeed
- 0EB3E B9 00 8E LDA ObjectMaxSpeed,y
- 0EB41 4A LSR
- 0EB42 4A LSR
- 0EB43 4A LSR
- 0EB44 4A LSR
- 0EB45 8D 6A 06 STA myMaxSpeed+1
- 0EB48 ;;; now high max speed byte is the actual high byte of speed
- 0EB48 ;;; low max speed byte is the low byte of speed
- 0EB48 A9 00 LDA #$00
- 0EB4A 8D 68 06 STA myAcc+1
- 0EB4D B9 70 91 LDA ObjectAccAmount,y
- 0EB50 8D 67 06 STA myAcc
- 0EB53
- 0EB53
- 0EB53 B9 A0 8E LDA ObjectBboxLeft,y
- 0EB56 8D 59 06 STA self_left
- 0EB59 18 CLC
- 0EB5A 79 F0 8E ADC ObjectWidth,y
- 0EB5D 8D 5B 06 STA self_right
- 0EB60 38 SEC
- 0EB61 ED 59 06 SBC self_left
- 0EB64 4A LSR
- 0EB65 8D 5D 06 STA self_center_x
- 0EB68
- 0EB68 B9 40 8F LDA ObjectBboxTop,y
- 0EB6B 8D 5A 06 STA self_top
- 0EB6E 18 CLC
- 0EB6F 79 90 8F ADC ObjectHeight,y
- 0EB72 8D 5C 06 STA self_bottom
- 0EB75 38 SEC
- 0EB76 ED 5A 06 SBC self_top
- 0EB79 4A LSR
- 0EB7A 8D 5E 06 STA self_center_y ;; self center in the vertical direction.
- 0EB7D
- 0EB7D ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EB7D ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EB7D
- 0EB7D
- 0EB7D
- 0EB7D BD 00 04 LDA Object_status,x
- 0EB80 29 04 AND #%00000100
- 0EB82 D0 03 BNE doHandlePhysics
- 0EB84 4C 33 EE JMP skipPhysics
- 0EB87 doHandlePhysics:
- 0EB87 A9 00 LDA #$00
- 0EB89 8D 6C 06 STA collisionsToCheck ;; blank out collisions to check.
- 0EB8C
- 0EB8C ;;; check to see if we are using aiming physics.
- 0EB8C ;;; if we are using aim physics, Object_direction will have it's 3rd bit flipped. xxxxXxxx
- 0EB8C BD A9 04 LDA Object_direction,x
- 0EB8F 29 08 AND #%00001000
- 0EB91 D0 03 BNE +useAimedPhysics
- 0EB93 4C 9A EC JMP useNormalDirectionalPhysics
- 0EB96 +useAimedPhysics
- 0EB96
- 0EB96 A9 0F LDA #%00001111
- 0EB98 8D 6C 06 STA collisionsToCheck
- 0EB9B BC 8F 04 LDY Object_type,x
- 0EB9E B9 00 8E LDA ObjectMaxSpeed,y
- 0EBA1 4A LSR
- 0EBA2 4A LSR
- 0EBA3 4A LSR
- 0EBA4 4A LSR
- 0EBA5 85 07 STA tempA ;; high byte of "speed" will determine how many times we should update move towards speed.
- 0EBA7 ;; use aimed physics.
- 0EBA7 ;; Aimed physics doesn't need to update speed.
- 0EBA7 BD 0D 04 LDA Object_x_lo,x
- 0EBAA 8D 78 06 STA xHold_lo
- 0EBAD BD 1A 04 LDA Object_x_hi,x
- 0EBB0 8D 79 06 STA xHold_hi
- 0EBB3
- 0EBB3 BD 34 04 LDA Object_y_lo,x
- 0EBB6 8D 7B 06 STA yHold_lo
- 0EBB9 BD 41 04 LDA Object_y_hi,x
- 0EBBC 8D 7C 06 STA yHold_hi
- 0EBBF
- 0EBBF BD 4E 04 LDA Object_h_speed_lo,x
- 0EBC2 10 21 BPL AddHspeedToAimedX
- 0EBC4 ;; subtract h speed to aimed x
- 0EBC4 BD 4E 04 LDA Object_h_speed_lo,x
- 0EBC7 49 FF EOR #$FF
- 0EBC9 85 00 STA temp
- 0EBCB A4 07 LDY tempA
- 0EBCD doAimLoop1:
- 0EBCD AD 78 06 LDA xHold_lo
- 0EBD0 38 sec
- 0EBD1 E5 00 sbc temp
- 0EBD3 8D 78 06 STA xHold_lo
- 0EBD6 AD 79 06 LDA xHold_hi
- 0EBD9 FD 5B 04 sbc Object_h_speed_hi,x
- 0EBDC 8D 79 06 STA xHold_hi
- 0EBDF 88 DEY
- 0EBE0 10 EB BPL doAimLoop1
- 0EBE2
- 0EBE2
- 0EBE2
- 0EBE2 4C FD EB JMP figureAimedVspeed
- 0EBE5 AddHspeedToAimedX:
- 0EBE5 A4 07 LDY tempA
- 0EBE7 doAimLoop2:
- 0EBE7 AD 78 06 LDA xHold_lo
- 0EBEA 18 CLC
- 0EBEB 7D 4E 04 ADC Object_h_speed_lo,x
- 0EBEE 8D 78 06 STA xHold_lo
- 0EBF1 AD 79 06 LDA xHold_hi
- 0EBF4 7D 5B 04 ADC Object_h_speed_hi,x
- 0EBF7 8D 79 06 STA xHold_hi
- 0EBFA 88 DEY
- 0EBFB 10 EA BPL doAimLoop2
- 0EBFD
- 0EBFD figureAimedVspeed:
- 0EBFD
- 0EBFD BD 68 04 LDA Object_v_speed_lo,x
- 0EC00 10 21 BPL AddVSpeedToAimedY
- 0EC02 ;; subtract v speed to aimed y
- 0EC02 BD 68 04 LDA Object_v_speed_lo,x
- 0EC05 49 FF EOR #$FF
- 0EC07 85 00 STA temp
- 0EC09 A4 07 LDY tempA
- 0EC0B doAimLoop3:
- 0EC0B AD 7B 06 LDA yHold_lo
- 0EC0E 18 clc
- 0EC0F 65 00 adc temp
- 0EC11 8D 7B 06 STA yHold_lo
- 0EC14 AD 7C 06 LDA yHold_hi
- 0EC17 7D 75 04 adc Object_v_speed_hi,x
- 0EC1A 8D 7C 06 STA yHold_hi
- 0EC1D 88 DEY
- 0EC1E 10 EB BPL doAimLoop3
- 0EC20
- 0EC20 4C 3B EC JMP doneWithAimedV
- 0EC23 AddVSpeedToAimedY:
- 0EC23 A4 07 LDY tempA
- 0EC25 doAimLoop4:
- 0EC25 AD 7B 06 LDA yHold_lo
- 0EC28 38 sec
- 0EC29 FD 68 04 sbc Object_v_speed_lo,x
- 0EC2C 8D 7B 06 STA yHold_lo
- 0EC2F AD 7C 06 LDA yHold_hi
- 0EC32 FD 75 04 sbc Object_v_speed_hi,x
- 0EC35 8D 7C 06 STA yHold_hi
- 0EC38 88 DEY
- 0EC39 10 EA BPL doAimLoop4
- 0EC3B doneWithAimedV:
- 0EC3B
- 0EC3B ;;;;;;;;;;;;; check xHold_hi and yHold_hi against bounds.
- 0EC3B
- 0EC3B AD 7C 06 LDA yHold_hi
- 0EC3E C9 00 CMP #BOUNDS_TOP
- 0EC40 F0 05 BEQ +doTopBounds
- 0EC42 90 03 BCC +doTopBounds
- 0EC44 4C 52 EC JMP +doneWithTop
- 0EC47 +doTopBounds
- 0EC47
- 0EC47 A9 02 LDA #$02
- 0EC49 8D B4 06 STA screenUpdateByte
- 0EC4C
- 0EC4C 20 04 C9 JSR doHandleBounds
- 0EC4F 4C 33 EE JMP skipPhysics
- 0EC52
- 0EC52 +doneWithTop
- 0EC52
- 0EC52 8D 7C 06 STA yHold_hi
- 0EC55 18 CLC
- 0EC56 6D 5C 06 ADC self_bottom
- 0EC59 C9 F0 CMP #BOUNDS_BOTTOM ;#240
- 0EC5B ; BEQ doBottomBounds
- 0EC5B B0 03 BCS +doBottomBounds
- 0EC5D 4C 69 EC JMP +doneWithBottom
- 0EC60 +doBottomBounds:
- 0EC60 8D B4 06 STA screenUpdateByte
- 0EC63 20 04 C9 JSR doHandleBounds
- 0EC66 4C 33 EE JMP skipPhysics
- 0EC69
- 0EC69 +doneWithBottom
- 0EC69
- 0EC69
- 0EC69
- 0EC69 AD 79 06 LDA xHold_hi
- 0EC6C 18 clc
- 0EC6D 6D 5B 06 ADC self_right
- 0EC70 B0 03 BCS +doRightBounds
- 0EC72 4C 80 EC JMP +doneWithRight
- 0EC75 +doRightBounds:
- 0EC75
- 0EC75 A9 01 LDA #$01
- 0EC77 8D B4 06 STA screenUpdateByte
- 0EC7A 20 04 C9 JSR doHandleBounds
- 0EC7D 4C 33 EE JMP skipPhysics
- 0EC80
- 0EC80 +doneWithRight
- 0EC80 AD 79 06 LDA xHold_hi
- 0EC83 C9 00 CMP #BOUNDS_LEFT
- 0EC85 F0 05 BEQ +doLeftBounds
- 0EC87 90 03 BCC +doLeftBounds
- 0EC89 4C 97 EC JMP +doneWithLeft
- 0EC8C +doLeftBounds
- 0EC8C
- 0EC8C A9 03 LDA #$03
- 0EC8E 8D B4 06 STA screenUpdateByte
- 0EC91 20 04 C9 JSR doHandleBounds
- 0EC94 4C 33 EE JMP skipPhysics
- 0EC97 +doneWithLeft
- 0EC97 4C 33 EE JMP skipPhysics ;; skips all the acc/dec stuff and goes right to movement based on speed
- 0EC9A ;; which was figured out in the directional macro.
- 0EC9A
- 0EC9A useNormalDirectionalPhysics:
- 0EC9A
- 0EC9A A9 00 LDA #$00
- 0EC9C 8D 6C 06 STA collisionsToCheck ;; blank out collisions to check.
- 0EC9F
- 0EC9F BD A9 04 LDA Object_direction,x
- 0ECA2 29 80 AND #%10000000
- 0ECA4 D0 03 BNE +isHorMovement
- 0ECA6 4C B1 ED JMP +noHorMovement
- 0ECA9 +isHorMovement
- 0ECA9 ;; there is vertical movement
- 0ECA9 BD A9 04 LDA Object_direction,x
- 0ECAC 29 40 AND #%01000000
- 0ECAE D0 03 BNE +isNotLeftMovement
- 0ECB0 4C 3D ED JMP +isLeftMovement
- 0ECB3 +isNotLeftMovement
- 0ECB3 ;; is right movement
- 0ECB3 BD 0D 04 LDA Object_x_lo,x
- 0ECB6 18 CLC
- 0ECB7 6D 69 06 ADC myMaxSpeed;Object_v_speed_lo,x
- 0ECBA 8D 78 06 STA xHold_lo
- 0ECBD BD 1A 04 LDA Object_x_hi,x
- 0ECC0 6D 6A 06 ADC myMaxSpeed+1;Object_v_speed_hi,x
- 0ECC3 8D 79 06 STA xHold_hi
- 0ECC6 BD 27 04 LDA Object_screen,x
- 0ECC9 69 00 ADC #$00
- 0ECCB 8D 7A 06 STA xHold_screen
- 0ECCE
- 0ECCE AD 79 06 LDA xHold_hi
- 0ECD1 18 clc
- 0ECD2 69 10 adc #$10
- 0ECD4 85 02 STA temp2
- 0ECD6
- 0ECD6 BD 27 04 LDA Object_screen,x
- 0ECD9 69 00 ADC #$00
- 0ECDB 29 0F AND #%00001111
- 0ECDD 85 00 STA temp
- 0ECDF
- 0ECDF AD 85 06 LDA camX
- 0ECE2 18 CLC
- 0ECE3 69 FE ADC #$FE
- 0ECE5 85 07 STA tempA
- 0ECE7 AD 86 06 LDA camX_hi
- 0ECEA 69 00 ADC #$00
- 0ECEC 85 01 STA temp1
- 0ECEE
- 0ECEE
- 0ECEE
- 0ECEE A5 01 C5 00 D0 09 A5 07.. Compare16 temp1, tempA, temp, temp2
- 0ED0E +
- 0ED0E 4C B1 ED JMP +noHorMovement
- 0ED11 ++
- 0ED11 EC 6D 06 CPX player1_object
- 0ED14 F0 0B BEQ +isPlayer
- 0ED16 BD 00 04 29 3F 9D 00 04 DestroyObject
- 0ED1E 4C 33 EE JMP skipPhysics
- 0ED21 +isPlayer
- 0ED21 A9 00 LDA #$00
- 0ED23 9D 4E 04 STA Object_h_speed_lo,x
- 0ED26 9D 5B 04 STA Object_h_speed_hi,x
- 0ED29 8D 78 06 STA xHold_lo
- 0ED2C AD 7F 06 LDA xPrev
- 0ED2F 8D 79 06 STA xHold_hi
- 0ED32 A5 9F LDA screenPrev
- 0ED34 8D 7A 06 STA xHold_screen
- 0ED37 4C 33 EE JMP skipPhysics
- 0ED3A 4C B1 ED JMP +noHorMovement
- 0ED3D +isLeftMovement
- 0ED3D
- 0ED3D BD 0D 04 LDA Object_x_lo,x
- 0ED40 38 SEC
- 0ED41 ED 69 06 SBC myMaxSpeed;Object_v_speed_lo,x
- 0ED44 8D 78 06 STA xHold_lo
- 0ED47 BD 1A 04 LDA Object_x_hi,x
- 0ED4A ED 6A 06 SBC myMaxSpeed+1;Object_v_speed_hi,x
- 0ED4D 8D 79 06 STA xHold_hi
- 0ED50 BD 27 04 LDA Object_screen,x
- 0ED53 E9 00 SBC #$00
- 0ED55 8D 7A 06 STA xHold_screen
- 0ED58
- 0ED58
- 0ED58 AD 7A 06 LDA xHold_screen
- 0ED5B 29 0F AND #%00001111
- 0ED5D 85 00 STA temp
- 0ED5F
- 0ED5F AD 86 06 C5 00 D0 0B AD.. Compare16 camX_hi, camX, temp, xHold_hi
- 0ED85
- 0ED85 +
- 0ED85 EC 6D 06 CPX player1_object
- 0ED88 F0 0B BEQ +isPlayer
- 0ED8A BD 00 04 29 3F 9D 00 04 DestroyObject
- 0ED92 4C 33 EE JMP skipPhysics
- 0ED95 +isPlayer
- 0ED95 A9 00 LDA #$00
- 0ED97 8D 78 06 STA xHold_lo
- 0ED9A AD 7F 06 LDA xPrev
- 0ED9D 8D 79 06 STA xHold_hi
- 0EDA0 BD 27 04 LDA Object_screen,x
- 0EDA3 8D 7A 06 STA xHold_screen
- 0EDA6 4C 33 EE JMP skipPhysics
- 0EDA9 BD 00 04 29 3F 9D 00 04 DestroyObject
- 0EDB1 ++
- 0EDB1
- 0EDB1 +noHorMovement
- 0EDB1
- 0EDB1 BD A9 04 LDA Object_direction,x
- 0EDB4 29 20 AND #%00100000
- 0EDB6 F0 7B BEQ +noVertMovement
- 0EDB8 ;; there is vertical movement
- 0EDB8 BD A9 04 LDA Object_direction,x
- 0EDBB 29 10 AND #%00010000
- 0EDBD F0 3A BEQ +isUpMovement
- 0EDBF ;; is down movement
- 0EDBF BD 34 04 LDA Object_y_lo,x
- 0EDC2 18 CLC
- 0EDC3 6D 69 06 ADC myMaxSpeed;Object_v_speed_lo,x
- 0EDC6 8D 7B 06 STA yHold_lo
- 0EDC9 BD 41 04 LDA Object_y_hi,x
- 0EDCC 6D 6A 06 ADC myMaxSpeed+1;Object_v_speed_hi,x
- 0EDCF 8D 7C 06 STA yHold_hi
- 0EDD2 18 CLC
- 0EDD3 6D 5C 06 ADC self_bottom
- 0EDD6 C9 F0 CMP #BOUNDS_BOTTOM ;#240
- 0EDD8
- 0EDD8 B0 03 BCS doBottomBounds
- 0EDDA 4C 33 EE JMP +noVertMovement
- 0EDDD doBottomBounds:
- 0EDDD EC 6D 06 CPX player1_object
- 0EDE0 F0 0B BEQ +isPlayer
- 0EDE2 BD 00 04 29 3F 9D 00 04 DestroyObject
- 0EDEA 4C 33 EE JMP skipPhysics
- 0EDED +isPlayer
- 0EDED AD 80 06 LDA yPrev
- 0EDF0 8D 7C 06 STA yHold_hi
- 0EDF3 9D 41 04 STA Object_y_hi,x
- 0EDF6 ; LDA #$00
- 0EDF6 ; STA Object_v_speed_hi,x
- 0EDF6 ; STA Object_v_speed_lo,x
- 0EDF6 ; LDA #$00
- 0EDF6 ; STA screenUpdateByte
- 0EDF6 ; JSR doHandleBounds
- 0EDF6 4C 33 EE JMP skipPhysics
- 0EDF9 +isUpMovement
- 0EDF9 BD 34 04 LDA Object_y_lo,x
- 0EDFC 38 SEC
- 0EDFD ED 69 06 SBC myMaxSpeed;Object_v_speed_lo,x
- 0EE00 8D 7B 06 STA yHold_lo
- 0EE03 BD 41 04 LDA Object_y_hi,x
- 0EE06 ED 6A 06 SBC myMaxSpeed+1;Object_v_speed_hi,x
- 0EE09 90 0C BCC +doTopBounds ;; helps if top bounds is zero.
- 0EE0B 8D 7C 06 STA yHold_hi
- 0EE0E C9 00 CMP #BOUNDS_TOP
- 0EE10 F0 05 BEQ +doTopBounds
- 0EE12 90 03 BCC +doTopBounds
- 0EE14 4C 33 EE JMP +noVertMovement
- 0EE17 +doTopBounds
- 0EE17 EC 6D 06 CPX player1_object
- 0EE1A F0 0B BEQ +isPlayer
- 0EE1C BD 00 04 29 3F 9D 00 04 DestroyObject
- 0EE24 4C 33 EE JMP skipPhysics
- 0EE27 +isPlayer
- 0EE27
- 0EE27 AD 80 06 LDA yPrev
- 0EE2A 8D 7C 06 STA yHold_hi
- 0EE2D 9D 41 04 STA Object_y_hi,x
- 0EE30 ; LDA #$00
- 0EE30 ; STA Object_v_speed_hi,x
- 0EE30 ; STA Object_v_speed_lo,x
- 0EE30 ; LDA #$02
- 0EE30 ; STA screenUpdateByte
- 0EE30 ; JSR doHandleBounds
- 0EE30 4C 33 EE JMP skipPhysics
- 0EE33 +noVertMovement
- 0EE33
- 0EE33
- 0EE33 skipPhysics:
- 0EE33
- 0EE33 AD 9F 06 LDA ScreenFlags00
- 0EE36 29 10 AND #%00010000
- 0EE38 D0 20 BNE +skipCamMovement
- 0EE3A BD EA 04 LDA Object_vulnerability,x
- 0EE3D 29 01 AND #%00000001 ;; set this to "static object"
- 0EE3F D0 19 BNE +skipCamMovement
- 0EE41 AD 78 06 LDA xHold_lo
- 0EE44 18 CLC
- 0EE45 69 00 ADC #$00
- 0EE47 8D 78 06 STA xHold_lo
- 0EE4A AD 79 06 LDA xHold_hi
- 0EE4D 69 01 ADC #$01;; this becomes the "SCROLL SPEED" - it is the offset at which the player moves.
- 0EE4F ;; in conjunction with camera speed update, this could make it scroll faster.
- 0EE4F 8D 79 06 STA xHold_hi
- 0EE52 AD 7A 06 LDA xHold_screen
- 0EE55 69 00 ADC #$00
- 0EE57 8D 7A 06 STA xHold_screen
- 0EE5A
- 0EE5A
- 0EE5A +skipCamMovement0EE5A 68 PLA
- 0EE5B AA TAX
- 0EE5C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEMO PHYSICS
- 0EE5C 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EE66
- 0EE66 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EE66 ObjectDoesNotObservePhysics:
- 0EE66
- 0EE66 98 48 AD 20 06 8D 21 06.. SwitchBank #$18
- 0EE75 20 FE 80 JSR doTileObservationLogic
- 0EE78 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EE82
- 0EE82 BD 00 04 LDA Object_status,x
- 0EE85 29 04 AND #OBJECT_OBSERVES_OBJECTS
- 0EE87 D0 03 BNE ObjectDoesObserveObjects
- 0EE89 4C A8 EE JMP ObjectDoesNotObserveObjects
- 0EE8C ObjectDoesObserveObjects:
- 0EE8C ;; Object collisions
- 0EE8C 98 48 AD 20 06 8D 21 06.. SwitchBank #$1C
- 0EE9B 20 36 99 JSR doObjectCollisions_bank1C
- 0EE9E 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EEA8
- 0EEA8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EEA8 ObjectDoesNotObserveObjects:
- 0EEA8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EEA8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EEA8
- 0EEA8
- 0EEA8 98 48 AD 20 06 8D 21 06.. SwitchBank #$18
- 0EEB7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EEB7
- 0EEB7 ;;;: Bounds reached
- 0EEB7 ; .include SCR_BOUNDS_STATE - this would be handled inside of physics. If a potential position
- 0EEB7 ; represents the "bounds", this would be triggered.
- 0EEB7
- 0EEB7 ;;;; Update state
- 0EEB7 ;; At ths point, physics and positioning are all figured out.
- 0EEB7 ;; now we update the object. This includes pushing temp positions to new positions,
- 0EEB7 ;; handling timers, doing AI mode updates and whatnot, etc, and anything that should happen
- 0EEB7 ;; specifically for this object in the update state.
- 0EEB7 8A TXA
- 0EEB8 48 PHA
- 0EEB9 20 F3 84 JSR doUpdateState
- 0EEBC 20 F4 84 JSR doHandleObjectUpdate
- 0EEBF 68 PLA
- 0EEC0 AA TAX
- 0EEC1 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EECB
- 0EECB SkipUpdateObjectPos:
- 0EECB
- 0EECB ;;;; Timer
- 0EECB ;.include SCR_TIMER_STATE - timer's are handled inside of update state.
- 0EECB JustDrawObject:
- 0EECB 98 48 AD 20 06 8D 21 06.. SwitchBank #$1C
- 0EEDA 8A TXA
- 0EEDB 48 PHA
- 0EEDC 20 35 99 JSR doUpdateActionTimer
- 0EEDF 68 PLA
- 0EEE0 AA TAX
- 0EEE1 ;;;;;;;;;
- 0EEE1 BD 00 04 LDA Object_status,x
- 0EEE4 29 02 AND #OBJECT_OBSERVES_DRAWING
- 0EEE6 F0 0E BEQ ObjectDoesNotDraw
- 0EEE8 ;;; Lastly, we draw the sprite.
- 0EEE8 ;;; The sprite should be drawn anyway, HERE.
- 0EEE8
- 0EEE8 8A TXA
- 0EEE9 48 PHA
- 0EEEA 98 TYA
- 0EEEB 48 PHA
- 0EEEC 20 C1 95 JSR doDrawSprites
- 0EEEF 68 PLA
- 0EEF0 A8 TAY
- 0EEF1 68 PLA
- 0EEF2 AA TAX
- 0EEF3
- 0EEF3 20 34 99 JSR doUpdateSpriteTimer
- 0EEF6
- 0EEF6
- 0EEF6 ;;; And additional object specific drawing stuff would go here.
- 0EEF6
- 0EEF6 .include "Routines\BASE_4_5\Game\Subroutines\doDrawState.asm"
- 0EEF6 ;; do draw state
- 0EEF6 ;;; the new draw state will blast these off:
- 0EEF6 ;;; y (offset in pixels), tile ID, attribute, x (offset in pixels).
- 0EEF6 ;;; since the y offset can never be larger than F0, even if is taking up the whole screen,
- 0EEF6 ;;; that means we have F0 - FF as opcodes when the y offset is being read.
- 0EEF6 ;;; FF = THIS ITEM IS FINISHED.
- 0EEF6 ;;; FE = Draw this off screen (no need to keep a "blank tile" anymore).
- 0EEF6
- 0EEF6 ;;; the old draw state, the ObjectInfo.dat file puts things in the format
- 0EEF6 ;;; tile, attribute. It bases everything on a width / height tile draw.
- 0EEF6
- 0EEF6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EEF6 ObjectDoesNotDraw:
- 0EEF6 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EF00 doObjectIsInactive:
- 0EF00 ;; cycle through objects.
- 0EF00 ; CPX camObject
- 0EF00 ; BEQ isCamObjectForScrollHandle
- 0EF00 ; JMP notCamObjectForScrollHandle
- 0EF00 ; isCamObjectForScrollHandle:
- 0EF00 ; .include SCR_HANDLE_H_SCROLL
- 0EF00 ; .include SCR_HANDLE_V_SCROLL
- 0EF00 ; notCamObjectForScrollHandle:
- 0EF00 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF00 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF00 ;; End Object Update.
- 0EF00 E8 INX
- 0EF01 E0 0D CPX #TOTAL_MAX_OBJECTS ;; a number that is configured
- 0EF03 ;; in the Object Variables tab
- 0EF03 ;; of project settings.
- 0EF03
- 0EF03 ;; This space makes use of ObjectRam. By default, it is one page in size (256 bytes),
- 0EF03 ;; however, it could stretch into the scratch ram if desired allowing for 512 bytes for object use.
- 0EF03 F0 03 BEQ DoneHandlingObjects
- 0EF05 4C D5 E9 JMP loop_doHandleObjectsLoop
- 0EF08
- 0EF08 DoneHandlingObjects:
- 0EF08 ;;;;;;;;;;;;
- 0EF08
- 0EF08 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF08 60 RTS0EF09 .include Routines\BASE_4_5\\Game\Subroutines\doHandleInputReads.asm
- 0EF09 doHandleInputReads:
- 0EF09
- 0EF09 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF09 ;; DO GamePadCheck
- 0EF09 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF09
- 0EF09 GamePadCheck:
- 0EF09 A9 01 LDA #$01
- 0EF0B 8D 16 40 STA $4016
- 0EF0E ;STA gamepad2
- 0EF0E 4A LSR
- 0EF0F 8D 16 40 STA $4016
- 0EF12
- 0EF12 A9 80 LDA #$80
- 0EF14 85 27 STA gamepad
- 0EF16 85 28 STA gamepad2
- 0EF18 ReadControllerBytesLoop:
- 0EF18 AD 16 40 LDA $4016
- 0EF1B 29 03 AND #%00000011
- 0EF1D C9 01 CMP #%00000001
- 0EF1F 66 27 ROR gamepad
- 0EF21 AD 17 40 LDA $4017
- 0EF24 29 03 AND #%00000011
- 0EF26 C9 01 CMP #%00000001
- 0EF28 66 28 ROR gamepad2
- 0EF2A 90 EC BCC ReadControllerBytesLoop
- 0EF2C ;RTS
- 0EF2C ; LDA gamepad
- 0EF2C ; AND #%11000000
- 0EF2C ; CMP #%11000000
- 0EF2C ; BNE NoFilter_LR
- 0EF2C
- 0EF2C ; EOR gamepad
- 0EF2C ; STA gamepad
- 0EF2C ; NoFilter_LR:
- 0EF2C ; LDA gamepad
- 0EF2C ; AND #%00110000
- 0EF2C ; CMP #%00110000
- 0EF2C ; BNE NoFilter_UD
- 0EF2C ; EOR gamepad
- 0EF2C ; STA gamepad
- 0EF2C ; NoFilter_UD:
- 0EF2C
- 0EF2C
- 0EF2C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF2C ;;;END GamePadCheck
- 0EF2C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF2C
- 0EF2C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF2C ;;Read input definitions
- 0EF2C ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF2C
- 0EF2C 8A TXA
- 0EF2D 48 PHA
- 0EF2E 98 TYA
- 0EF2F 48 PHA
- 0EF30 AD 20 06 LDA currentBank
- 0EF33 8D 22 06 STA tempBank
- 0EF36
- 0EF36 A5 27 LDA gamepad
- 0EF38 8D D0 06 STA gamepad_hold
- 0EF3B A5 29 LDA buttonStates
- 0EF3D 8D CF 06 STA buttonStates_hold
- 0EF40 A9 00 LDA #$00
- 0EF42 8D D1 06 STA controllerNumber_hold
- 0EF45 20 7E EF JSR doCheckControllerInputStates
- 0EF48
- 0EF48 A5 28 LDA gamepad2
- 0EF4A 8D D0 06 STA gamepad_hold
- 0EF4D A5 2A LDA buttonStates2
- 0EF4F 8D CF 06 STA buttonStates_hold
- 0EF52 A9 01 LDA #$01
- 0EF54 8D D1 06 STA controllerNumber_hold
- 0EF57 20 7E EF JSR doCheckControllerInputStates
- 0EF5A
- 0EF5A AC 22 06 LDy tempBank
- 0EF5D 20 83 C5 JSR doBankswitchY
- 0EF60
- 0EF60 68 PLA
- 0EF61 A8 TAY
- 0EF62 68 PLA
- 0EF63 AA TAX
- 0EF64
- 0EF64 A5 27 LDA gamepad
- 0EF66 85 29 STA buttonStates
- 0EF68 A5 28 LDA gamepad2
- 0EF6A 85 2A STA buttonStates2
- 0EF6C 60 RTS
- 0EF6D
- 0EF6D
- 0EF6D
- 0EF6D findObjectOfType:
- 0EF6D
- 0EF6D A2 00 LDX #$00
- 0EF6F doFindObjectOfTypeLoop:
- 0EF6F BD 8F 04 LDA Object_type,x
- 0EF72 C5 08 CMP tempB
- 0EF74 F0 07 BEQ xIsNowCorrect
- 0EF76 E8 INX
- 0EF77 E0 0D CPX #TOTAL_MAX_OBJECTS
- 0EF79 D0 F4 BNE doFindObjectOfTypeLoop
- 0EF7B A2 FF LDX #$FF
- 0EF7D xIsNowCorrect:
- 0EF7D 60 RTS
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E
- 0EF7E doCheckControllerInputStates:
- 0EF7E
- 0EF7E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF7E ;;;; HANDLE HELD INPUTS ;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF7E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0EF7E
- 0EF7E A9 08 LDA #HELD_INPUTS
- 0EF80 D0 03 BNE doHeldInputs
- 0EF82 4C FB EF JMP doneWithInputLoops_Held
- 0EF85 doHeldInputs:
- 0EF85 A9 00 LDA #$00
- 0EF87 85 0B STA loopTemp
- 0EF89 GetDefinedInputsLoop_Held:
- 0EF89 A6 0B LDX loopTemp ;; set x temporarily to loopTemp variable for table reads
- 0EF8B ;; we need to check to see if this input uses current game state
- 0EF8B ;; if not, skip it.
- 0EF8B BD 25 C5 LDA DefinedScriptGameStates_Held,x
- 0EF8E C5 2B CMP gameState
- 0EF90 F0 03 BEQ inputCheckGameStateIsCorrect_Held
- 0EF92 4C F0 EF JMP skipThisInput_Held
- 0EF95 inputCheckGameStateIsCorrect_Held:
- 0EF95 BD 35 C5 LDA DefinedTargetController_Held,x
- 0EF98 CD D1 06 CMP controllerNumber_hold
- 0EF9B F0 03 BEQ inputCheckControllerIsCorrect_held
- 0EF9D 4C F0 EF JMP skipThisInput_Held
- 0EFA0 inputCheckControllerIsCorrect_held
- 0EFA0
- 0EFA0 ;;;; now check gamepad variable against the
- 0EFA0 ;;; DefinedInputs table to see if the current
- 0EFA0 ;;; gamepad state matches any of the chosen inputs.
- 0EFA0 AD CF 06 LDA buttonStates_hold
- 0EFA3 3D 1D C5 AND DefinedInputs_Held,x ;; this AND checks button states and
- 0EFA6 ;; logically only checks about those
- 0EFA6 ;; states being asked about. If we remove this,
- 0EFA6 ;; the buttons have to be in the exact input state
- 0EFA6 ;; as DefinedInputs_Pressed. With it in,
- 0EFA6 ;; left will still do left things even if b-button
- 0EFA6 ;; is pressed, for example.
- 0EFA6 DD 1D C5 CMP DefinedInputs_Held,x
- 0EFA9 D0 45 BNE skipThisInput_Held
- 0EFAB
- 0EFAB A4 0B LDY loopTemp ;;; THIS NEEDS TO EQUAL THE INDEX OF THE SCRIPT BEING CALLED
- 0EFAD ;;; from the ScriptAddress table.
- 0EFAD B9 2D C5 LDA DefinedTargetObjects_Held,y ;; this is the type of object we're looking for.
- 0EFB0 85 08 STA tempB
- 0EFB2 20 6D EF JSR findObjectOfType
- 0EFB5 E0 FF CPX #$FF
- 0EFB7 F0 37 BEQ skipThisInput_Held
- 0EFB9
- 0EFB9 ;LDX DefinedTargetObjects_Held,y
- 0EFB9 B9 C5 C4 LDA TargetScriptBank,y
- 0EFBC 85 00 STA temp
- 0EFBE ;LDA currentBank
- 0EFBE ;STA prevBank
- 0EFBE
- 0EFBE 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0EFCD
- 0EFCD A4 0B LDY loopTemp ;;; THIS NEEDS TO EQUAL THE INDEX OF THE SCRIPT BEING CALLED
- 0EFCF ;;; from the ScriptAddress table.
- 0EFCF
- 0EFCF B9 45 C5 LDA DefinedTargetScripts_Held,y
- 0EFD2 A8 TAY
- 0EFD3 B9 B1 C4 LDA ScriptAddressLo,y
- 0EFD6 85 14 STA temp16
- 0EFD8 B9 BB C4 LDA ScriptAddressHi,y
- 0EFDB 85 15 STA temp16+1
- 0EFDD 20 E3 EF JSR UseInputTrampoline_Held
- 0EFE0 4C E6 EF JMP passedInputTrampoline_Held
- 0EFE3 UseInputTrampoline_Held:
- 0EFE3 ;;; ADVANCED CONCEPT:
- 0EFE3 ;;;; since there is no such thing as an indirect JSR
- 0EFE3 ;;; we have to use an indirect jump. However, we want this
- 0EFE3 ;;; to behave as a JSR and jump back to this point in code
- 0EFE3 ;;; at the end of the eventual routine.
- 0EFE3 ;;; So we use this trampoline method, where
- 0EFE3 ;;; Our JSR above sets the *return* point to that point in code.
- 0EFE3 ;;; Then, at the end of the routine we jump to, when it hits an RTS,
- 0EFE3 ;;; that return will return to the JSR above, which will immediately
- 0EFE3 ;;; jump to the passedInputTrampoline below.
- 0EFE3 6C 14 00 JMP (temp16)
- 0EFE6
- 0EFE6 passedInputTrampoline_Held:
- 0EFE6
- 0EFE6 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0EFF0 ;;;===========================
- 0EFF0
- 0EFF0
- 0EFF0 skipThisInput_Held:
- 0EFF0 E6 0B INC loopTemp
- 0EFF2 A5 0B LDA loopTemp
- 0EFF4 C9 08 CMP #HELD_INPUTS ;;; the total number of scripts to jump through
- 0EFF6 B0 03 BCs doneWithInputLoops_Held
- 0EFF8 4C 89 EF JMP GetDefinedInputsLoop_Held
- 0EFFB doneWithInputLoops_Held:
- 0EFFB
- 0EFFB
- 0EFFB ;;;;;;;;;;;;;;;END HELD
- 0EFFB
- 0EFFB
- 0EFFB
- 0EFFB
- 0EFFB ;;;;;;;;;;;;;;;;;;;;PRESSED
- 0EFFB ;JMP AllButtonStatesChecked
- 0EFFB
- 0EFFB A9 05 LDA #PRESSED_INPUTS
- 0EFFD D0 03 BNE doPressedInputs
- 0EFFF 4C 7D F0 JMP doneWithInputLoops_Pressed
- 0F002 doPressedInputs:
- 0F002
- 0F002 A9 00 LDA #$00
- 0F004 85 0B STA loopTemp
- 0F006 GetDefinedPressedInputsLoop:
- 0F006
- 0F006 A6 0B LDX loopTemp ;; set x temporarily to loopTemp variable for table reads
- 0F008 ;; we need to check to see if this input uses current game state
- 0F008 ;; if not, skip it.
- 0F008 BD D4 C4 LDA DefinedScriptGameStates_Pressed,x
- 0F00B C5 2B CMP gameState
- 0F00D F0 03 BEQ inputCheckGameStateIsCorrect_Pressed
- 0F00F 4C 72 F0 JMP skipThisInput_Pressed
- 0F012 inputCheckGameStateIsCorrect_Pressed:
- 0F012 BD DE C4 LDA DefinedTargetController_Pressed,x
- 0F015 CD D1 06 CMP controllerNumber_hold
- 0F018 F0 03 BEQ inputCheckControllerIsCorrect_Pressed
- 0F01A 4C 72 F0 JMP skipThisInput_Pressed
- 0F01D inputCheckControllerIsCorrect_Pressed
- 0F01D AD CF 06 LDA buttonStates_hold
- 0F020 3D CF C4 AND DefinedInputs_Pressed,x
- 0F023 D0 4D BNE skipThisInput_Pressed
- 0F025
- 0F025 AD D0 06 LDA gamepad_hold
- 0F028 3D CF C4 AND DefinedInputs_Pressed,x
- 0F02B F0 45 BEQ skipThisInput_Pressed
- 0F02D
- 0F02D
- 0F02D
- 0F02D
- 0F02D DoInputActionTrampoline:
- 0F02D
- 0F02D ;LDX tempx
- 0F02D ;;;===========================
- 0F02D ;;;; TRAMPOLINE
- 0F02D
- 0F02D A4 0B LDY loopTemp ;;; THIS NEEDS TO EQUAL THE INDEX OF THE SCRIPT BEING CALLED
- 0F02F ;;; from the ScriptAddress table
- 0F02F B9 D9 C4 LDA DefinedTargetObjects_Pressed,y ;; this is the type of object we're looking for.
- 0F032 85 08 STA tempB
- 0F034 20 6D EF JSR findObjectOfType
- 0F037 E0 FF CPX #$FF
- 0F039 F0 37 BEQ skipThisInput_Pressed
- 0F03B ;LDX DefinedTargetObjects_Pressed,y
- 0F03B B9 C5 C4 LDA TargetScriptBank,y
- 0F03E 85 00 STA temp
- 0F040 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0F04F
- 0F04F A4 0B LDY loopTemp ;;; THIS NEEDS TO EQUAL THE INDEX OF THE SCRIPT BEING CALLED
- 0F051 ;;; from the ScriptAddress table.
- 0F051 B9 E8 C4 LDA DefinedTargetScripts_Pressed,y
- 0F054 A8 TAY
- 0F055 B9 B1 C4 LDA ScriptAddressLo,y
- 0F058 85 14 STA temp16
- 0F05A B9 BB C4 LDA ScriptAddressHi,y
- 0F05D 85 15 STA temp16+1
- 0F05F
- 0F05F 20 65 F0 JSR UseInputTrampoline
- 0F062 4C 68 F0 JMP passedInputTrampoline
- 0F065 UseInputTrampoline:
- 0F065 ;;; ADVANCED CONCEPT:
- 0F065 ;;;; since there is no such thing as an indirect JSR
- 0F065 ;;; we have to use an indirect jump. However, we want this
- 0F065 ;;; to behave as a JSR and jump back to this point in code
- 0F065 ;;; at the end of the eventual routine.
- 0F065 ;;; So we use this trampoline method, where
- 0F065 ;;; Our JSR above sets the *return* point to that point in code.
- 0F065 ;;; Then, at the end of the routine we jump to, when it hits an RTS,
- 0F065 ;;; that return will return to the JSR above, which will immediately
- 0F065 ;;; jump to the passedInputTrampoline below.
- 0F065 6C 14 00 JMP (temp16)
- 0F068
- 0F068 passedInputTrampoline:
- 0F068
- 0F068 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0F072 ;;;===========================
- 0F072
- 0F072
- 0F072 skipThisInput_Pressed:
- 0F072 E6 0B INC loopTemp
- 0F074 A5 0B LDA loopTemp
- 0F076 C9 05 CMP #PRESSED_INPUTS ;;; the total number of scripts to jump through
- 0F078 B0 03 BCs doneWithInputLoops_Pressed
- 0F07A 4C 06 F0 JMP GetDefinedPressedInputsLoop
- 0F07D doneWithInputLoops_Pressed:
- 0F07D
- 0F07D
- 0F07D ;;===============RELEASED
- 0F07D A9 08 LDA #RELEASED_INPUTS
- 0F07F D0 03 BNE doReleasedInputs
- 0F081 4C FF F0 JMP doneWithInputLoops_Released
- 0F084 doReleasedInputs:
- 0F084 A9 00 LDA #$00
- 0F086 85 0B STA loopTemp
- 0F088 GetDefinedInputsReleasedLoop:
- 0F088 A6 0B LDX loopTemp ;; set x temporarily to loopTemp variable for table reads
- 0F08A ;; we need to check to see if this input uses current game state
- 0F08A ;; if not, skip it.
- 0F08A BD F5 C4 LDA DefinedScriptGameStates_Released,x
- 0F08D C5 2B CMP gameState
- 0F08F F0 03 BEQ inputCheckGameStateIsCorrect_Released
- 0F091 4C F4 F0 JMP skipThisInput_Released
- 0F094 inputCheckGameStateIsCorrect_Released:
- 0F094 BD 05 C5 LDA DefinedTargetController_Released,x
- 0F097 CD D1 06 CMP controllerNumber_hold
- 0F09A F0 03 BEQ inputCheckControllerIsCorrect_released
- 0F09C 4C F4 F0 JMP skipThisInput_Released
- 0F09F inputCheckControllerIsCorrect_released
- 0F09F
- 0F09F ;;;; now check gamepad variable against the
- 0F09F ;;; DefinedInputs table to see if the current
- 0F09F ;;; gamepad state matches any of the chosen inputs.
- 0F09F
- 0F09F
- 0F09F AD CF 06 LDA buttonStates_hold
- 0F0A2 3D ED C4 AND DefinedInputs_Released,x
- 0F0A5 F0 4D BEQ skipThisInput_Released
- 0F0A7
- 0F0A7 AD D0 06 LDA gamepad_hold
- 0F0AA 3D ED C4 AND DefinedInputs_Released,x
- 0F0AD D0 45 BNE skipThisInput_Released
- 0F0AF
- 0F0AF
- 0F0AF
- 0F0AF DoInputActionTrampoline_Released:
- 0F0AF ;JMP AllButtonStatesChecked
- 0F0AF ;LDX tempx
- 0F0AF ;;;===========================
- 0F0AF ;;;; TRAMPOLINE
- 0F0AF
- 0F0AF A4 0B LDY loopTemp ;;; THIS NEEDS TO EQUAL THE INDEX OF THE SCRIPT BEING CALLED
- 0F0B1 ;;; from the ScriptAddress table.
- 0F0B1 B9 FD C4 LDA DefinedTargetObjects_Released,y ;; this is the type of object we're looking for.
- 0F0B4 85 08 STA tempB
- 0F0B6 20 6D EF JSR findObjectOfType
- 0F0B9 E0 FF CPX #$FF
- 0F0BB F0 37 BEQ skipThisInput_Released
- 0F0BD ;LDX DefinedTargetObjects_Released,y
- 0F0BD ;LDA DefinedTargetScripts_Released,y
- 0F0BD ;TAY
- 0F0BD B9 C5 C4 LDA TargetScriptBank,y
- 0F0C0 85 00 STA temp
- 0F0C2 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0F0D1
- 0F0D1 A4 0B LDY loopTemp ;;; THIS NEEDS TO EQUAL THE INDEX OF THE SCRIPT BEING CALLED
- 0F0D3 ;;; from the ScriptAddress table.
- 0F0D3 B9 15 C5 LDA DefinedTargetScripts_Released,y
- 0F0D6 A8 TAY
- 0F0D7 B9 B1 C4 LDA ScriptAddressLo,y
- 0F0DA 85 14 STA temp16
- 0F0DC B9 BB C4 LDA ScriptAddressHi,y
- 0F0DF 85 15 STA temp16+1
- 0F0E1 20 E7 F0 JSR UseInputReleasedTrampoline
- 0F0E4 4C EA F0 JMP passedInputReleasedTrampoline
- 0F0E7 UseInputReleasedTrampoline:
- 0F0E7 ;;; ADVANCED CONCEPT:
- 0F0E7 ;;;; since there is no such thing as an indirect JSR
- 0F0E7 ;;; we have to use an indirect jump. However, we want this
- 0F0E7 ;;; to behave as a JSR and jump back to this point in code
- 0F0E7 ;;; at the end of the eventual routine.
- 0F0E7 ;;; So we use this trampoline method, where
- 0F0E7 ;;; Our JSR above sets the *return* point to that point in code.
- 0F0E7 ;;; Then, at the end of the routine we jump to, when it hits an RTS,
- 0F0E7 ;;; that return will return to the JSR above, which will immediately
- 0F0E7 ;;; jump to the passedInputTrampoline below.
- 0F0E7 6C 14 00 JMP (temp16)
- 0F0EA
- 0F0EA passedInputReleasedTrampoline:
- 0F0EA
- 0F0EA 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0F0F4 ;;;===========================
- 0F0F4
- 0F0F4
- 0F0F4 skipThisInput_Released:
- 0F0F4 E6 0B INC loopTemp
- 0F0F6 A5 0B LDA loopTemp
- 0F0F8 C9 08 CMP #RELEASED_INPUTS ;;; the total number of scripts to jump through
- 0F0FA B0 03 BCs doneWithInputLoops_Released
- 0F0FC 4C 88 F0 JMP GetDefinedInputsReleasedLoop
- 0F0FF doneWithInputLoops_Released:
- 0F0FF
- 0F0FF
- 0F0FF ;=======================
- 0F0FF
- 0F0FF AllButtonStatesChecked:
- 0F0FF
- 0F0FF ; LDY #$14
- 0F0FF ; JSR bankswitchY
- 0F0FF ; JSR ExtraInputControl
- 0F0FF
- 0F0FF
- 0F0FF 60 RTS0F100 .include Routines\BASE_4_5\\Game\Subroutines\doCreateObject.asm
- 0F100 doCreateObject:
- 0F100
- 0F100 A9 7E LDA #%01111110
- 0F102 9D 00 04 STA Object_status,x
- 0F105
- 0F105 A5 0C LDA arg0_hold
- 0F107 9D 1A 04 STA Object_x_hi,x
- 0F10A A5 0D LDA arg1_hold
- 0F10C 9D 41 04 STA Object_y_hi,x
- 0F10F A5 0E LDA arg2_hold
- 0F111 9D 8F 04 STA Object_type,x
- 0F114
- 0F114 A5 0F LDA arg3_hold ;; this is the behavior step that is to be called.
- 0F116 0A ASL
- 0F117 0A ASL
- 0F118 0A ASL
- 0F119 85 00 STA temp
- 0F11B BD 9C 04 LDA Object_frame,x
- 0F11E 29 C0 AND #%11000000
- 0F120 05 00 ORA temp
- 0F122 9D 9C 04 STA Object_frame,x ;; now we have the 4th argument telling the object
- 0F125 ;; which action frame he should begin with.
- 0F125
- 0F125
- 0F125 A9 00 LDA #$00
- 0F127 9D A9 04 STA Object_direction,x
- 0F12A 9D 4E 04 STA Object_h_speed_lo,x
- 0F12D 9D 5B 04 STA Object_h_speed_hi,x
- 0F130 9D 68 04 STA Object_v_speed_lo,x
- 0F133 9D 75 04 STA Object_v_speed_hi,x
- 0F136
- 0F136 60 RTS0F137 .include Routines\BASE_4_5\\Game\Subroutines\locationFinders.asm
- 0F137 coordinatesToMetaNametableValue:
- 0F137 ;;; Let's use this as essentially a tile space to nametable translation.
- 0F137 ;; tileX is a value 0-15, tileY is a value 0-15
- 0F137 A5 32 LDA tileY
- 0F139 0A ASL
- 0F13A 0A ASL
- 0F13B 0A ASL
- 0F13C 0A ASL
- 0F13D 0A ASL
- 0F13E 0A ASL
- 0F13F 85 00 STA temp
- 0F141 A5 31 LDA tileX
- 0F143 0A ASL
- 0F144 ;STA updateNT_tableLeft
- 0F144 29 1E AND #%00011110
- 0F146 18 CLC
- 0F147 65 00 ADC temp
- 0F149 85 14 STA temp16
- 0F14B A5 32 LDA tileY
- 0F14D 4A LSR
- 0F14E 4A LSR
- 0F14F 18 CLC
- 0F150 6D BE 06 ADC camFocus_tiles
- 0F153 85 15 STA temp16+1
- 0F155 60 RTS
- 0F156
- 0F156
- 0F156
- 0F156
- 0F156
- 0F156 coordinatesToNametableValue:
- 0F156 ;;; Let's use this as essentially a tile space to nametable translation on 8x8 grid.
- 0F156 ;; tileX is a value 0-32, tileY is a value 0-30
- 0F156 A5 32 LDA tileY
- 0F158 4A LSR
- 0F159 4A LSR
- 0F15A 4A LSR
- 0F15B 85 01 STA temp1
- 0F15D
- 0F15D A5 32 LDA tileY
- 0F15F 0A ASL
- 0F160 0A ASL
- 0F161 0A ASL
- 0F162 0A ASL
- 0F163 0A ASL ;; now this represents 1 row for each value in tileY
- 0F164 85 00 STA temp
- 0F166 A5 31 LDA tileX
- 0F168 18 clc
- 0F169 65 00 ADC temp
- 0F16B 85 14 STA temp16
- 0F16D AD BE 06 LDA camFocus_tiles
- 0F170 18 CLC
- 0F171 65 01 ADC temp1
- 0F173 85 15 STA temp16+1
- 0F175 60 RTS
- 0F176
- 0F176
- 0F176 A5 32 LDA tileY
- 0F178 0A ASL
- 0F179 0A ASL
- 0F17A 0A ASL
- 0F17B 0A ASL
- 0F17C 0A ASL
- 0F17D 0A ASL
- 0F17E 0A ASL
- 0F17F 85 00 STA temp
- 0F181 A5 31 LDA tileX
- 0F183 0A ASL
- 0F184 0A ASL
- 0F185 ;STA updateNT_tableLeft
- 0F185 29 1F AND #%00011111
- 0F187 18 CLC
- 0F188 65 00 ADC temp
- 0F18A 85 14 STA temp16
- 0F18C A5 32 LDA tileY
- 0F18E 4A LSR
- 0F18F 4A LSR
- 0F190 4A LSR
- 0F191 18 CLC
- 0F192 6D BE 06 ADC camFocus_tiles
- 0F195 85 15 STA temp16+1
- 0F197 60 RTS
- 0F198
- 0F198
- 0F198
- 0F198
- 0F198
- 0F198
- 0F198 GetTileAtPosition:
- 0F198 A5 32 LDA tileY
- 0F19A 29 F0 AND #%11110000
- 0F19C 85 06 STA tempz
- 0F19E A5 31 LDA tileX
- 0F1A0 4A LSR A
- 0F1A1 4A LSR A
- 0F1A2 4A LSR A
- 0F1A3 4A LSR A
- 0F1A4 05 06 ORA tempz
- 0F1A6 A8 TAY ; stores it into Y, which will be important in checking collision.
- 0F1A7 60 RTS
- 0F1A8
- 0F1A8
- 0F1A8 GetAttributePosition:
- 0F1A8 A5 32 LDA tileY
- 0F1AA 4A LSR
- 0F1AB
- 0F1AB 0A asl
- 0F1AC 0A asl
- 0F1AD 0A asl ;; each y = one full row of offset...8 values.
- 0F1AE 85 06 STA tempz
- 0F1B0 A5 31 LDA tileX
- 0F1B2 4A LSR
- 0F1B3 18 clc
- 0F1B4 65 06 adc tempz
- 0F1B6 18 CLC
- 0F1B7 69 C0 ADC #$c0 ;; because attributes start at 23"co"
- 0F1B9 ;
- 0F1B9 60 RTS
- 0F1BA
- 0F1BA
- 0F1BA
- 0F1BA
- 0F1BA FindFreeObjectSlot:
- 0F1BA A2 00 LDX #$00
- 0F1BC doFindSlotLoop:
- 0F1BC BD 00 04 LDA Object_status,x
- 0F1BF 29 C1 AND #%11000001
- 0F1C1 F0 07 BEQ thisObjectSlotIsFree
- 0F1C3 E8 INX
- 0F1C4 E0 0D CPX #TOTAL_MAX_OBJECTS
- 0F1C6 D0 F4 BNE doFindSlotLoop
- 0F1C8 A2 FF LDX #$FF
- 0F1CA thisObjectSlotIsFree:
- 0F1CA 60 RTS
- 0F1CB
- 0F1CB
- 0F1CB MonsterBankValues:
- 0F1CB ;; by default, there are two.
- 0F1CB 13 14 .db #$13, #$14
- 0F1CD
- 0F1CD StringDataChoice:
- 0F1CD 9A 9B 9C 9D .db #154, #155, #156, #157 ;; day, night, day trig, night trig
- 0F1D1
- 0F1D1 Mon1SpawnLocation:
- 0F1D1 83 86 89 8C .db #131, #134, #137, #140
- 0F1D5 Mon2SpawnLocation:
- 0F1D5 84 87 8A 8D .db #132, #135, #138, #141
- 0F1D9 Mon3SpawnLocation:
- 0F1D9 85 88 8B 8E .db #133, #136, #139, #142
- 0F1DD Mon4SpawnLocation:
- 0F1DD 9E 9F A0 A1 .db #158, #159, #160, #161
- 0F1E1 MonGroupChoice:
- 0F1E1 8F 90 91 79 .db #143, #144, #145, #121 ;; day, night, dayT, nightT
- 0F1E5 MonPal1Choice:
- 0F1E5 92 93 94 7B .db #146, #147, #148, #123 ;; day, night, dayT, nightT
- 0F1E9 MonPal2Choice:
- 0F1E9 95 96 97 81 .db #149, #150, #151, #129
- 0F1ED
- 0F1ED GoPal1Choice:
- 0F1ED CB CC CD CE .db #203, #204, #205, #206
- 0F1F1 GoPal2Choice:
- 0F1F1 B7 B8 B9 BA .db #183, #184, #185, #186
- 0F1F5
- 0F1F5
- 0F1F5 Monster1ID:
- 0F1F5 A2 AA A6 AE .db #162, #170, #166, #174
- 0F1F9 Monster2ID:
- 0F1F9 A3 AB A7 AF .db #163, #171, #167, #175
- 0F1FD Monster3ID:
- 0F1FD A4 AC A8 B0 .db #164, #172, #168, #176
- 0F201 Monster4ID:
- 0F201 A5 AD A9 B1 .db #165, #173, #169, #177
- 0F205
- 0F205 MonsterPlacementType:
- 0F205 B7 B8 B9 BA .db #183,#184, #185, 186
- 0F209
- 0F209
- 0F209
- 0F209
- 0F209
- 0F209 getPointColTable:
- 0F209 90 15 BCC +stayInSameColTable
- 0F20B ;; check opposite col table
- 0F20B BD 27 04 LDA Object_screen,x
- 0F20E 29 01 AND #%00000001
- 0F210 D0 07 BNE +stayInLeftTable
- 0F212 A9 01 LDA #$01
- 0F214 85 07 sTA tempA
- 0F216 4C 35 F2 JMP +gotColTable
- 0F219 +stayInLeftTable
- 0F219 A9 00 LDA #$00
- 0F21B 85 07 STA tempA
- 0F21D 4C 35 F2 JMP +gotColTable
- 0F220 +stayInSameColTable:
- 0F220 BD 27 04 LDA Object_screen,x
- 0F223 29 01 AND #%00000001
- 0F225 F0 07 BEQ +stayInLeftTable
- 0F227 A9 01 LDA #$01
- 0F229 85 07 sTA tempA
- 0F22B 4C 35 F2 JMP +gotColTable
- 0F22E +stayInLeftTable
- 0F22E A9 00 LDA #$00
- 0F230 85 07 STA tempA
- 0F232 4C 35 F2 JMP +gotColTable
- 0F235 +gotColTable
- 0F235 60 RTS
- 0F236
- 0F236
- 0F236
- 0F236
- 0F236
- 0F236
- 0F236
- 0F236 LoadMonster_1:
- 0F236 BC D1 F1 LDY Mon1SpawnLocation,x
- 0F239 B1 3F LDA (collisionPointer),y
- 0F23B 85 00 STA temp
- 0F23D 29 F0 AND #%11110000
- 0F23F C9 F0 CMP #%11110000
- 0F241 D0 08 BNE loadMon1toPosition
- 0F243 A5 00 LDA temp
- 0F245 29 0F AND #%00001111
- 0F247 C9 03 CMP #%00000011
- 0F249 F0 4D BEQ skipLoadingMonster1
- 0F24B ;;; Random / Edge cases here
- 0F24B
- 0F24B loadMon1toPosition:
- 0F24B ;;;;;;; Load monster 1.
- 0F24B BC F5 F1 LDY Monster1ID,x
- 0F24E B1 3F LDA (collisionPointer),y
- 0F250 8D D6 06 STA mon1_type
- 0F253 BC D1 F1 LDY Mon1SpawnLocation,x
- 0F256 B1 3F LDA (collisionPointer),y
- 0F258 0A ASL
- 0F259 0A ASL
- 0F25A 0A ASL
- 0F25B 0A ASL
- 0F25C 85 08 STA tempB ;; x value in tempB
- 0F25E BC D1 F1 LDY Mon1SpawnLocation,x
- 0F261 B1 3F LDA (collisionPointer),y
- 0F263 29 F0 AND #%11110000
- 0F265 85 09 STA tempC ;; y value in tempC
- 0F267 8A TXA
- 0F268 48 PHA
- 0F269 20 BA F1 E0 FF D0 03 4C.. CreateObject tempB, tempC, mon1_type, #$00
- 0F291 A9 00 LDA #$00
- 0F293 9D 82 04 STA Object_id,x
- 0F296 68 PLA
- 0F297 AA TAX
- 0F298 skipLoadingMonster1:
- 0F298 60 RTS0F299 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0F299 ;blank0F299 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0F299 ;blank0F299
- 0F299
- 0F299 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F299 ;; object subroutines
- 0F299 .include "Routines\BASE_4_5\System\ObjectBehaviors\oUpdatePosition.asm"
- 0F299 oUpdatePosition:
- 0F299
- 0F299 A6 0C LDX arg0_hold
- 0F29B A5 0D LDA arg1_hold
- 0F29D 9D 1A 04 STA Object_x_hi,x
- 0F2A0 A5 0E LDA arg2_hold
- 0F2A2 9D 41 04 STA Object_y_hi,x
- 0F2A5 60 RTS
- 0F2A6
- 0F2A6 .include "Routines\BASE_4_5\System\ObjectBehaviors\oStartMovingInADirection.asm"
- 0F2A6 oStartMovingInADirection:
- 0F2A6 A5 0C LDA arg0_hold
- 0F2A8 AA TAX
- 0F2A9
- 0F2A9 ;;;;;;;;;;;;;;;;;;;;;;
- 0F2A9 BD A9 04 LDA Object_direction,x
- 0F2AC 29 0F AND #%00001111 ; these bits need to be preserved
- 0F2AE 85 01 STA temp1
- 0F2B0
- 0F2B0 A5 0D LDA arg1_hold
- 0F2B2 29 80 AND #%10000000
- 0F2B4 F0 05 BEQ notChangingDirectionH
- 0F2B6 ;; is changing direction H
- 0F2B6 A9 1F LDA #%00011111
- 0F2B8 4C BD F2 JMP gotChangDirectionBlankout
- 0F2BB notChangingDirectionH:
- 0F2BB ;; is changing direction V
- 0F2BB A9 4F LDA #%01001111
- 0F2BD gotChangDirectionBlankout:
- 0F2BD 85 00 STA temp ;; temp now blanks out the direction that the object is moving, either h or v
- 0F2BF ;; and turns off acceleration in the opposite, while preserving the "direction"
- 0F2BF ;; of inertia, so that it may still deccelerate in that direction.
- 0F2BF ;; This is important for anything that isn't an abrupt direction change, but rather
- 0F2BF ;; has acceleration / decceleration
- 0F2BF
- 0F2BF BD A9 04 LDA Object_direction,x
- 0F2C2 25 00 AND temp
- 0F2C4 05 0D ORA arg1_hold
- 0F2C6 05 01 ORA temp1
- 0F2C8 9D A9 04 STA Object_direction,x
- 0F2CB
- 0F2CB
- 0F2CB
- 0F2CB
- 0F2CB ;;; right now, speed argument is unused,
- 0F2CB ;;; as in default physics, max speed is maintained
- 0F2CB ;;; in LUTs, and acceleration to that value
- 0F2CB ;;; determines the speed.
- 0F2CB 60 RTS
- 0F2CC
- 0F2CC
- 0F2CC
- 0F2CC
- 0F2CC
- 0F2CC .include "Routines\BASE_4_5\System\ObjectBehaviors\oStopMoving.asm"
- 0F2CC oStopMoving:
- 0F2CC A6 0C LDX arg0_hold
- 0F2CE A5 0D LDA arg1_hold
- 0F2D0 C9 FF CMP #$FF ;; we;; use ff to stop in both horizontal and vertical directions.
- 0F2D2 D0 10 BNE notStopAllInertia
- 0F2D4 A5 27 LDA gamepad
- 0F2D6 29 C0 AND #%11000000
- 0F2D8 F0 01 BEQ stopAllInertia
- 0F2DA 60 RTS
- 0F2DB stopAllInertia:
- 0F2DB BD A9 04 LDA Object_direction,x
- 0F2DE 29 5F AND #%01011111
- 0F2E0 9D A9 04 STA Object_direction,x
- 0F2E3 60 RTS
- 0F2E4 notStopAllInertia
- 0F2E4 85 00 STA temp
- 0F2E6 29 5F AND #%01011111
- 0F2E8 85 02 STA temp2 ;; holds the values we want to maintain.
- 0F2EA ;; like facing direction and inertial direction.
- 0F2EA A5 00 LDA temp
- 0F2EC 49 FF EOR #$FF ;; flips the inertia bit
- 0F2EE 29 A0 AND #%10100000 ;; but we only care about the "active" bits, h and v
- 0F2F0 25 00 AND temp ;; and only the one defined by flipped bits in "direction"
- 0F2F2 05 02 ORA temp2 ;; then put back the bit status of the rest of the byte.
- 0F2F4 9D A9 04 STA Object_direction,x
- 0F2F7
- 0F2F7
- 0F2F7 60 RTS0F2F8 .include "Routines\BASE_4_5\System\ObjectBehaviors\oChangeFacingDirection.asm"
- 0F2F8 oChangeFacingDirection:
- 0F2F8 A6 0C LDX arg0_hold
- 0F2FA BD A9 04 LDA Object_direction,x
- 0F2FD 29 F8 AND #%11111000
- 0F2FF 05 0D ORA arg1_hold
- 0F301 9D A9 04 STA Object_direction,x
- 0F304 60 RTS0F305 ;.include SCR_COMPARE_BBOX
- 0F305
- 0F305
- 0F305
- 0F305 doCamera:
- 0F305 .include "Routines\BASE_4_5\Game\Space Birds\Subroutines\doUpdateCamera_shooter2.asm"
- 0F305
- 0F305 ;; THIS SCRIPT HAS NOTHING TO DO WITH THE PLAYER AUTOMATICALLY MOVING RIGHT
- 0F305 doUpdateCamera:
- 0F305
- 0F305 A5 2B LDA gameState
- 0F307 F0 09 BEQ dontSkipCamHandling ;skips camera unless we are in main game.
- 0F309 60 RTS
- 0F30A
- 0F30A AD AB 06 LDA gameHandler
- 0F30D 29 80 AND #%10000000 ;;; this will skip object handling.
- 0F30F F0 01 BEQ dontSkipCamHandling
- 0F311 60 RTS
- 0F312
- 0F312
- 0F312 dontSkipCamHandling:
- 0F312
- 0F312 AD 8C 06 LDA scrollByte
- 0F315 09 C0 ORA #%11000000 ;ensures
- 0F317 8D 8C 06 STA scrollByte
- 0F31A
- 0F31A A9 00 LDA #$00
- 0F31C 85 07 STA tempA
- 0F31E A9 01 LDA #$01
- 0F320 85 08 STA tempB
- 0F322
- 0F322 AD 85 06 LDA camX
- 0F325 29 F0 AND #%11110000
- 0F327 85 06 STA tempz
- 0F329
- 0F329 AD 8C 06 LDA scrollByte
- 0F32C 29 A2 AND #%10100010
- 0F32E D0 03 BNE +scrollEngaged
- 0F330 4C 30 F6 JMP skipScrollUpdate
- 0F333 +scrollEngaged:
- 0F333
- 0F333 AD 8C 06 LDA scrollByte
- 0F336 29 80 AND #%10000000
- 0F338 D0 03 BNE doHorizontalCameraUpdate
- 0F33A 4C 12 F4 JMP noHorizontalCameraUpdate
- 0F33D doHorizontalCameraUpdate:
- 0F33D
- 0F33D AD 8C 06 LDA scrollByte
- 0F340 29 40 AND #%01000000
- 0F342 D0 00 BNE doRightCameraUpdate
- 0F344
- 0F344 ; ;; is left camera update
- 0F344 ; LDA camX_lo
- 0F344 ; sec
- 0F344 ; sbc tempA
- 0F344 ; STA camX_lo
- 0F344 ; LDA camX
- 0F344 ; sbc tempB
- 0F344 ; STA temp
- 0F344 ; BCS +skipCheckForScrollScreenEdge
- 0F344 ; LDA ScreenFlags00
- 0F344 ; AND #%00100000
- 0F344 ; BEQ +skipCheckForScrollScreenEdge
- 0F344 ; JMP noHorizontalCameraUpdate
- 0F344 ; +skipCheckForScrollScreenEdge
- 0F344 ; LDA temp
- 0F344 ; STA camX
- 0F344
- 0F344 ; LDA camX_hi
- 0F344 ; sbc #$00
- 0F344 ; STA camX_hi
- 0F344 ; JSR getCamSeam
- 0F344 ; JMP noHorizontalCameraUpdate
- 0F344 doRightCameraUpdate
- 0F344 AD 9F 06 LDA ScreenFlags00
- 0F347 29 10 AND #%00010000 ;checks if Right Edge for Scroll is ticked. If it is not, do a normal screen update. If it is ticked, stop scrolling.
- 0F349 F0 03 BEQ +doNormalScreenUpdate
- 0F34B 4C 12 F4 JMP +noHorizontalCameraUpdate
- 0F34E +doNormalScreenUpdate
- 0F34E AD 84 06 LDA camX_lo
- 0F351 18 clc
- 0F352 65 07 adc tempA
- 0F354 ;STA camX_lo
- 0F354 AD 85 06 LDA camX
- 0F357 65 08 adc tempB
- 0F359 ;STA temp
- 0F359
- 0F359 B0 03 BCS +dontSkipCheckForScrollScreenEdge
- 0F35B 4C F6 F3 JMP +skipCheckForScrollScreenEdge
- 0F35E +dontSkipCheckForScrollScreenEdge
- 0F35E
- 0F35E ;; here we have cross the screen boundary
- 0F35E ;;; so if there is anything that needs updating for scrolling
- 0F35E ;;; update it here.
- 0F35E
- 0F35E 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0F36D AD 8D 06 LDA camScreen
- 0F370 18 CLC
- 0F371 69 01 ADC #$01
- 0F373 A8 TAY
- 0F374 B9 00 8D LDA CollisionTables_Map1_Lo,y ;(y equals the value of camScreen plus 1)
- 0F377 85 14 STA temp16
- 0F379 B9 00 8F LDA CollisionTables_Map1_Hi,y ;(y equals the value of camScreen plus 1)
- 0F37C 85 15 STA temp16+1
- 0F37E 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0F388 AD 8D 06 LDA camScreen
- 0F38B 18 CLC
- 0F38C 69 01 ADC #$01
- 0F38E 4A LSR
- 0F38F 4A LSR
- 0F390 4A LSR
- 0F391 4A LSR
- 0F392 4A LSR
- 0F393 85 00 STA temp ; bank
- 0F395 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0F3A4 A0 7C LDY #124 ;why 124?
- 0F3A6 B1 14 LDA (temp16),y
- 0F3A8 8D 9F 06 STA ScreenFlags00
- 0F3AB
- 0F3AB 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0F3B5
- 0F3B5 A9 08 85 07 8A 48 98 48.. CountObjects #%00001000
- 0F3DE D0 0F BNE +dontTurnOffMonsterChecker ;if the result is not zero, don't turn off the monster checker because monsters still remain.
- 0F3E0
- 0F3E0
- 0F3E0 ;; turn off monster checker.
- 0F3E0 ;; because you already killed the monsters
- 0F3E0 ;; before getting lined up to the screen.
- 0F3E0
- 0F3E0 ;; unless it is a boss screen
- 0F3E0 AD 9F 06 LDA ScreenFlags00
- 0F3E3 29 08 AND #%00001000 ;; is it a boss flag?
- 0F3E5 D0 08 BNE +dontTurnOffMonsterChecker
- 0F3E7 AD 9F 06 LDA ScreenFlags00
- 0F3EA 29 EF AND #%11101111
- 0F3EC 8D 9F 06 STA ScreenFlags00
- 0F3EF +dontTurnOffMonsterChecker
- 0F3EF
- 0F3EF AD 9F 06 LDA ScreenFlags00
- 0F3F2 29 10 AND #%00010000
- 0F3F4 D0 1C BNE noHorizontalCameraUpdate
- 0F3F6 +skipCheckForScrollScreenEdge
- 0F3F6
- 0F3F6
- 0F3F6 ; LDA temp
- 0F3F6 ; STA camX
- 0F3F6 ; LDA camX_hi
- 0F3F6 ; adc #$00
- 0F3F6 ; STA camX_hi
- 0F3F6
- 0F3F6 AD 84 06 LDA camX_lo
- 0F3F9 18 clc
- 0F3FA 65 07 adc tempA
- 0F3FC 8D 84 06 STA camX_lo
- 0F3FF AD 85 06 LDA camX
- 0F402 65 08 adc tempB
- 0F404 8D 85 06 STA camX
- 0F407 AD 86 06 LDA camX_hi
- 0F40A 69 00 ADC #$00
- 0F40C 8D 86 06 STA camX_hi
- 0F40F 20 3F F6 JSR getCamSeam
- 0F412 noHorizontalCameraUpdate:
- 0F412
- 0F412
- 0F412
- 0F412 +skipSettingScreenFlag
- 0F412
- 0F412
- 0F412 AD 8C 06 LDA scrollByte
- 0F415 29 01 AND #%00000001
- 0F417 F0 03 BEQ +canUpdateScrollColumn ;if bit 0 is OFF, you can update the scroll column. If bit 0 is ON, skip scroll update.
- 0F419 4C 30 F6 JMP skipScrollUpdate
- 0F41C +canUpdateScrollColumn
- 0F41C AD 8C 06 LDA scrollByte
- 0F41F 29 02 AND #%00000010
- 0F421 D0 0C BNE forceScrollColumnUpdate
- 0F423 AD 85 06 LDA camX
- 0F426 29 F0 AND #%11110000 ;is the camera at the right edge of the screen?
- 0F428 C5 06 CMP tempz
- 0F42A D0 0B BNE +canUpdateScrollColumn2
- 0F42C 4C 30 F6 JMP skipScrollUpdate
- 0F42F forceScrollColumnUpdate:
- 0F42F AD 8C 06 LDA scrollByte
- 0F432 29 FD AND #%11111101 ;bit 1 is forced to be off. All others are left as they are.
- 0F434 8D 8C 06 STA scrollByte
- 0F437 +canUpdateScrollColumn2
- 0F437
- 0F437 AD 8C 06 LDA scrollByte
- 0F43A 09 05 ORA #%00000101 ;bits 0 and 2 are forced to be ON. all others are left as they are.
- 0F43C 8D 8C 06 STA scrollByte
- 0F43F ;;;;;;;;;; DO SCROLL UPDATE.
- 0F43F 98 48 AD 20 06 8D 21 06.. SwitchBank #$16
- 0F44E A4 92 LDY scrollUpdateScreen
- 0F450 B9 00 85 LDA NameTablePointers_Map1_lo,y
- 0F453 85 14 STA temp16
- 0F455 B9 00 86 LDA NameTablePointers_Map1_hi,y
- 0F458 85 15 STA temp16+1
- 0F45A
- 0F45A
- 0F45A B9 00 89 LDA AttributeTables_Map1_Lo,y
- 0F45D 85 1B STA pointer
- 0F45F B9 00 8A LDA AttributeTables_Map1_Hi,y
- 0F462 85 1C STA pointer+1
- 0F464
- 0F464
- 0F464 B9 00 8D LDA CollisionTables_Map1_Lo,y
- 0F467 85 33 STA pointer6
- 0F469 B9 00 8F LDA CollisionTables_Map1_Hi,y
- 0F46C 85 34 STA pointer6+1
- 0F46E 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0F478 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F478 ;;; now we have pointers for the fetch.
- 0F478 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F478
- 0F478 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F478 ;;; We can read from the pointers to get metatile data.
- 0F478 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F478 ;;; jump to the bank
- 0F478 A5 92 LDA scrollUpdateScreen
- 0F47A 4A LSR
- 0F47B 4A LSR
- 0F47C 4A LSR
- 0F47D 4A LSR
- 0F47E 4A LSR
- 0F47F 85 00 STA temp ; bank
- 0F481
- 0F481 98 48 AD 20 06 8D 21 06.. SwitchBank temp
- 0F490 ; LDX screenState
- 0F490 ; LDY Mon1SpawnLocation,x
- 0F490 ; LDA (pointer6),y
- 0F490 ; STA scrollUpdateObjectLocation
- 0F490
- 0F490 ; LDY Mon2SpawnLocation,x
- 0F490 ; LDA (pointer6),y
- 0F490 ; STA scrollUpdateObjectLocation+1
- 0F490
- 0F490 ; LDY Mon3SpawnLocation,x
- 0F490 ; LDA (pointer6),y
- 0F490 ; STA scrollUpdateObjectLocation+2
- 0F490
- 0F490 ; LDY Mon4SpawnLocation,x
- 0F490 ; LDA (pointer6),y
- 0F490 ; STA scrollUpdateObjectLocation+3
- 0F490
- 0F490 A6 98 LDX screenState
- 0F492 BC D1 F1 LDY Mon1SpawnLocation,x
- 0F495 BD F5 F1 LDA Monster1ID,x
- 0F498 85 0A STA tempD
- 0F49A 20 21 F7 JSR checkSeamForMonsterPosition
- 0F49D
- 0F49D A6 98 LDX screenState
- 0F49F BC D5 F1 LDY Mon2SpawnLocation,x
- 0F4A2 BD F9 F1 LDA Monster2ID,x
- 0F4A5 85 0A STA tempD
- 0F4A7 20 21 F7 JSR checkSeamForMonsterPosition
- 0F4AA
- 0F4AA A6 98 LDX screenState
- 0F4AC BC D9 F1 LDY Mon3SpawnLocation,x
- 0F4AF BD FD F1 LDA Monster3ID,x
- 0F4B2 85 0A STA tempD
- 0F4B4 20 21 F7 JSR checkSeamForMonsterPosition
- 0F4B7
- 0F4B7 A6 98 LDX screenState
- 0F4B9 BC DD F1 LDY Mon4SpawnLocation,x
- 0F4BC BD 01 F2 LDA Monster4ID,x
- 0F4BF 85 0A STA tempD
- 0F4C1 20 21 F7 JSR checkSeamForMonsterPosition
- 0F4C4
- 0F4C4
- 0F4C4
- 0F4C4
- 0F4C4 A5 92 LDA scrollUpdateScreen
- 0F4C6 29 01 AND #%00000001
- 0F4C8 0A ASL
- 0F4C9 0A ASL
- 0F4CA 09 20 ORA #%00100000
- 0F4CC 85 01 STA temp1 ;; temp 1 now represents the high byte of the address to place
- 0F4CE
- 0F4CE A5 93 LDA scrollUpdateColumn
- 0F4D0 4A LSR
- 0F4D1 4A LSR
- 0F4D2 4A LSR
- 0F4D3 29 1F AND #%00011111
- 0F4D5 85 02 STA temp2 ;; temp 2 now represents the low byte of the pushes.
- 0F4D7
- 0F4D7 A5 93 LDA scrollUpdateColumn
- 0F4D9 4A LSR
- 0F4DA 4A LSR
- 0F4DB 4A LSR
- 0F4DC 4A LSR
- 0F4DD 85 03 STA temp3
- 0F4DF
- 0F4DF A9 00 LDA #$00
- 0F4E1 8D 8A 06 STA scrollOffsetCounter
- 0F4E4
- 0F4E4 A2 00 LDX #$00 ;; will keep track of scroll update ram.
- 0F4E6 A9 0F LDA #$0F
- 0F4E8 85 07 STA tempA ;; will keep the track of how many tiles to draw.
- 0F4EA ;; #$0f is an entire column.
- 0F4EA loop_LoadNametableMeta_column:
- 0F4EA A4 03 LDY temp3
- 0F4EC B1 14 LDA (temp16),y
- 0F4EE 85 00 STA temp
- 0F4F0 20 24 C7 JSR doGetSingleMetaTileValues
- 0F4F3
- 0F4F3 A5 01 LDA temp1
- 0F4F5 9D 00 07 STA scrollUpdateRam,x
- 0F4F8 E8 INX
- 0F4F9 A5 02 LDA temp2
- 0F4FB 9D 00 07 STA scrollUpdateRam,x
- 0F4FE E8 INX
- 0F4FF AD 53 06 LDA updateTile_00
- 0F502 9D 00 07 STA scrollUpdateRam,x
- 0F505 E8 INX
- 0F506
- 0F506 A5 01 LDA temp1
- 0F508 9D 00 07 STA scrollUpdateRam,x
- 0F50B E8 INX
- 0F50C A5 02 LDA temp2
- 0F50E 18 CLC
- 0F50F 69 01 ADC #$01
- 0F511 9D 00 07 STA scrollUpdateRam,x
- 0F514 E8 INX
- 0F515 AD 54 06 LDA updateTile_01
- 0F518 9D 00 07 STA scrollUpdateRam,x
- 0F51B E8 INX
- 0F51C
- 0F51C A5 01 LDA temp1
- 0F51E 9D 00 07 STA scrollUpdateRam,x
- 0F521 E8 INX
- 0F522 A5 02 LDA temp2
- 0F524 18 CLC
- 0F525 69 20 ADC #$20
- 0F527 9D 00 07 STA scrollUpdateRam,x
- 0F52A E8 INX
- 0F52B AD 55 06 LDA updateTile_02
- 0F52E 9D 00 07 STA scrollUpdateRam,x
- 0F531 E8 INX
- 0F532
- 0F532 A5 01 LDA temp1
- 0F534 9D 00 07 STA scrollUpdateRam,x
- 0F537 E8 INX
- 0F538 A5 02 LDA temp2
- 0F53A 18 CLC
- 0F53B 69 21 ADC #$21
- 0F53D 9D 00 07 STA scrollUpdateRam,x
- 0F540 E8 INX
- 0F541 AD 56 06 LDA updateTile_03
- 0F544 9D 00 07 STA scrollUpdateRam,x
- 0F547 E8 INX
- 0F548
- 0F548 C6 07 DEC tempA
- 0F54A A5 07 LDA tempA
- 0F54C F0 17 BEQ +doneWithNtLoad
- 0F54E ;; not done with NT load. Need more tiles.
- 0F54E ;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F54E ;; update the 16 bit position of the new place to push tiles to.
- 0F54E A5 02 LDA temp2
- 0F550 18 CLC
- 0F551 69 40 ADC #$40
- 0F553 85 02 STA temp2
- 0F555 A5 01 LDA temp1
- 0F557 69 00 ADC #$00
- 0F559 85 01 STA temp1
- 0F55B ;; update the tile read location.
- 0F55B A5 03 LDA temp3
- 0F55D 18 CLC
- 0F55E 69 10 ADC #$10
- 0F560 85 03 STA temp3
- 0F562 4C EA F4 JMP loop_LoadNametableMeta_column
- 0F565 +doneWithNtLoad
- 0F565 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F565 ;;;;;;; add attributes to the update list.
- 0F565 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F565 ;;;; 23 = 00100011
- 0F565 ;;;; 27 = 00100111
- 0F565 ;;;; so the last bit of scrollUpdateScreen and shift it twice to the left
- 0F565 ;;;; then or it with 00100000 to get the high byte of the attribute update table.
- 0F565 A5 92 LDA scrollUpdateScreen
- 0F567 29 01 AND #%00000001
- 0F569 0A ASL
- 0F56A 0A ASL
- 0F56B ;ASL
- 0F56B 09 23 ORA #%00100011
- 0F56D 85 01 STA temp1 ;; this is now the high byte of the attribute table update
- 0F56F
- 0F56F A5 93 LDA scrollUpdateColumn
- 0F571 4A LSR
- 0F572 4A LSR
- 0F573 4A LSR
- 0F574 4A LSR
- 0F575 4A LSR
- 0F576
- 0F576 85 02 STA temp2 ;; temp 2 now represents the low byte of the pushes.
- 0F578 ;; don't need a temp3 to keep track of pull position, because it will be 1 to 1.
- 0F578
- 0F578 A9 08 LDA #$08
- 0F57A 85 07 STA tempA ;; will keep the track of how many tiles to draw.
- 0F57C ;; #$0f is an entire column.
- 0F57C loop_LoadAttribute_column:
- 0F57C
- 0F57C A4 02 LDY temp2
- 0F57E B1 1B LDA (pointer),y
- 0F580 85 00 STA temp
- 0F582
- 0F582 A5 01 LDA temp1
- 0F584 9D 00 07 STA scrollUpdateRam,x
- 0F587 E8 INX
- 0F588 A5 02 LDA temp2
- 0F58A 18 CLC
- 0F58B 69 C0 ADC #$c0
- 0F58D 9D 00 07 STA scrollUpdateRam,x
- 0F590 E8 INX
- 0F591 A5 00 LDA temp
- 0F593 9D 00 07 STA scrollUpdateRam,x
- 0F596 E8 INX
- 0F597 C6 07 DEC tempA
- 0F599 A5 07 LDA tempA
- 0F59B F0 0A BEQ +doneWithAtLoad
- 0F59D A5 02 LDA temp2
- 0F59F 18 CLC
- 0F5A0 69 08 ADC #$08
- 0F5A2 85 02 STA temp2
- 0F5A4 4C 7C F5 JMP loop_LoadAttribute_column
- 0F5A7 +doneWithAtLoad
- 0F5A7
- 0F5A7
- 0F5A7 8A TXA
- 0F5A8 8D 8B 06 STA maxScrollOffsetCounter
- 0F5AB
- 0F5AB AD 24 06 LDA updateScreenData
- 0F5AE 09 04 ORA #%00000100
- 0F5B0 8D 24 06 STA updateScreenData
- 0F5B3
- 0F5B3
- 0F5B3 A5 93 LDA scrollUpdateColumn
- 0F5B5 4A LSR
- 0F5B6 4A LSR
- 0F5B7 4A LSR
- 0F5B8 4A LSR
- 0F5B9 85 01 STA temp1 ;; keeps track of where to place on the collision table.
- 0F5BB 4A LSR
- 0F5BC 85 02 STA temp2 ;; keeps track of the nubble being pulled from.
- 0F5BE A2 0F LDX #$0F ;; keep track of how many values to load are left.
- 0F5C0
- 0F5C0 A5 92 LDA scrollUpdateScreen
- 0F5C2 29 01 AND #%00000001
- 0F5C4 D0 30 BNE +doUpdateOddCt
- 0F5C6 ;; do update even CT
- 0F5C6 ;; to ct table 1
- 0F5C6 doUpdateCtLoop
- 0F5C6 A5 01 LDA temp1
- 0F5C8 29 01 AND #%00000001
- 0F5CA D0 0B BNE +oddCol
- 0F5CC A4 02 LDY temp2
- 0F5CE B1 33 LDA (pointer6),y
- 0F5D0 4A LSR
- 0F5D1 4A LSR
- 0F5D2 4A LSR
- 0F5D3 4A LSR
- 0F5D4 4C DD F5 JMP +pushToCol
- 0F5D7 +oddCol
- 0F5D7 A4 02 LDY temp2
- 0F5D9 B1 33 LDA (pointer6),y
- 0F5DB 29 0F AND #%00001111
- 0F5DD
- 0F5DD +pushToCol:
- 0F5DD A4 01 LDY temp1
- 0F5DF 99 00 03 STA collisionTable,y
- 0F5E2 A5 01 LDA temp1
- 0F5E4 18 CLC
- 0F5E5 69 10 ADC #$10
- 0F5E7 85 01 STA temp1
- 0F5E9 A5 02 LDA temp2
- 0F5EB 18 CLC
- 0F5EC 69 08 ADC #$08
- 0F5EE 85 02 STA temp2
- 0F5F0 CA DEX
- 0F5F1 D0 D3 BNE doUpdateCtLoop
- 0F5F3 4C 26 F6 JMP +doneWithCtLoad
- 0F5F6 +doUpdateOddCt
- 0F5F6 ;; do update odd ct
- 0F5F6 ;; to ct table 2
- 0F5F6 doUpdateCtLoop2
- 0F5F6 A5 01 LDA temp1
- 0F5F8 29 01 AND #%00000001
- 0F5FA D0 0B BNE +oddCol
- 0F5FC A4 02 LDY temp2
- 0F5FE B1 33 LDA (pointer6),y
- 0F600 4A LSR
- 0F601 4A LSR
- 0F602 4A LSR
- 0F603 4A LSR
- 0F604 4C 0D F6 JMP +pushToCol
- 0F607 +oddCol
- 0F607 A4 02 LDY temp2
- 0F609 B1 33 LDA (pointer6),y
- 0F60B 29 0F AND #%00001111
- 0F60D
- 0F60D +pushToCol:
- 0F60D A4 01 LDY temp1
- 0F60F 99 00 05 STA collisionTable2,y
- 0F612 A5 01 LDA temp1
- 0F614 18 CLC
- 0F615 69 10 ADC #$10
- 0F617 85 01 STA temp1
- 0F619 A5 02 LDA temp2
- 0F61B 18 CLC
- 0F61C 69 08 ADC #$08
- 0F61E 85 02 STA temp2
- 0F620 CA DEX
- 0F621 D0 D3 BNE doUpdateCtLoop2
- 0F623 4C 26 F6 JMP +doneWithCtLoad
- 0F626 +doneWithCtLoad
- 0F626
- 0F626 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F626
- 0F626 98 48 AC 21 06 20 83 C5.. ReturnBank
- 0F630
- 0F630
- 0F630 skipScrollUpdate
- 0F630 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F630 ;; Make sure we always update camScreen.
- 0F630 AD 89 06 LDA camY_hi
- 0F633 0A ASL
- 0F634 0A ASL
- 0F635 0A ASL
- 0F636 0A ASL
- 0F637 18 CLC
- 0F638 6D 86 06 ADC camX_hi
- 0F63B 8D 8D 06 STA camScreen
- 0F63E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F63E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F63E ;JSR checkForMonsterCameraClipping
- 0F63E
- 0F63E 60 RTS
- 0F63F
- 0F63F
- 0F63F
- 0F63F getCamSeam:
- 0F63F ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F63F ;;; Since we use camScreen in this subroutine, we'll have to make sure it's properly updated
- 0F63F ;;; before get our column and screen.
- 0F63F AD 89 06 LDA camY_hi
- 0F642 0A ASL
- 0F643 0A ASL
- 0F644 0A ASL
- 0F645 0A ASL
- 0F646 18 CLC
- 0F647 6D 86 06 ADC camX_hi
- 0F64A 8D 8D 06 STA camScreen
- 0F64D
- 0F64D AD 8C 06 LDA scrollByte
- 0F650 29 40 AND #%01000000
- 0F652 D0 12 BNE +getRightScrollUpdate
- 0F654 ;; get left scroll update
- 0F654 AD 85 06 LDA camX
- 0F657 29 F0 AND #%11110000
- 0F659 38 sec
- 0F65A E9 70 sbc #$70
- 0F65C 85 93 STA scrollUpdateColumn
- 0F65E AD 8D 06 LDA camScreen
- 0F661 E9 00 sbc #$00
- 0F663 85 92 STA scrollUpdateScreen
- 0F665
- 0F665 60 RTS
- 0F666 +getRightScrollUpdate
- 0F666
- 0F666 AD 85 06 LDA camX
- 0F669 29 F0 AND #%11110000
- 0F66B 18 CLC
- 0F66C 69 80 ADC #$80
- 0F66E 85 93 STA scrollUpdateColumn
- 0F670 AD 8D 06 LDA camScreen
- 0F673 69 01 ADC #$01
- 0F675 85 92 STA scrollUpdateScreen
- 0F677
- 0F677 60 RTS
- 0F678
- 0F678
- 0F678
- 0F678 checkForMonsterCameraClipping:
- 0F678
- 0F678 60 RTS
- 0F679 ;;; use temp16 to check for cam clips
- 0F679 AD 86 06 LDA camX_hi
- 0F67C 29 0F AND #%00001111
- 0F67E D0 0C BNE notOnZeroScreen
- 0F680 A9 00 LDA #$00
- 0F682 85 14 STA temp16
- 0F684 AD 86 06 LDA camX_hi
- 0F687 85 15 STA temp16+1
- 0F689 4C 98 F6 JMP +gotIt
- 0F68C notOnZeroScreen:
- 0F68C ;;; For this type of game, anything that reaches the left seam should be destroyed.
- 0F68C AD 85 06 LDA camX
- 0F68F ; SEC
- 0F68F ; SBC #$80
- 0F68F 85 14 STA temp16 ;; low left cam clip
- 0F691 AD 86 06 LDA camX_hi
- 0F694 ;AND #%00001111
- 0F694 ; SBC #$00
- 0F694 29 0F AND #%00001111
- 0F696 85 15 STA temp16+1 ;; high left cam clip
- 0F698 +gotIt:
- 0F698 AD 85 06 LDA camX
- 0F69B 18 CLC
- 0F69C 69 90 ADC #$90
- 0F69E 85 1B STA pointer ;; low right cam clip
- 0F6A0 AD 86 06 LDA camX_hi
- 0F6A3
- 0F6A3 69 01 ADC #$01
- 0F6A5 29 0F AND #%00001111
- 0F6A7 85 1C STA pointer+1 ;; high right cam clip
- 0F6A9
- 0F6A9 A2 00 LDX #$00
- 0F6AB skipCheckingThisObject_forEraseColumnLoop
- 0F6AB BD D0 04 LDA Object_flags,x
- 0F6AE 29 03 AND #%00000011
- 0F6B0 F0 69 BEQ doEraseNonPlayerObjectsInThisColumnLoop
- 0F6B2 BD 00 04 LDA Object_status,x
- 0F6B5 29 80 AND #%10000000
- 0F6B7 F0 62 BEQ doEraseNonPlayerObjectsInThisColumnLoop
- 0F6B9 ;; check this monster's position
- 0F6B9 BD 1A 04 LDA Object_x_hi,x
- 0F6BC 85 00 STA temp
- 0F6BE BD 27 04 LDA Object_screen,x
- 0F6C1 29 0F AND #%00001111
- 0F6C3 85 01 STA temp1
- 0F6C5 A5 15 C5 01 D0 09 A5 14.. Compare16 temp16+1, temp16, temp1, temp
- 0F6E5 +
- 0F6E5 BD 00 04 29 3F 9D 00 04 DestroyObject
- 0F6ED
- 0F6ED
- 0F6ED 4C 1B F7 JMP doEraseNonPlayerObjectsInThisColumnLoop
- 0F6F0 ++
- 0F6F0 ;; skip erasing from rightmost column.
- 0F6F0 skipCheckingThisObject_forEraseColumnLoop2:
- 0F6F0 A5 1C C5 01 D0 09 A5 1B.. Compare16 pointer+1, pointer, temp1, temp
- 0F710 +
- 0F710 4C 1B F7 JMP doEraseNonPlayerObjectsInThisColumnLoop
- 0F713 ++
- 0F713 BD 00 04 29 3F 9D 00 04 DestroyObject
- 0F71B
- 0F71B doEraseNonPlayerObjectsInThisColumnLoop:
- 0F71B E8 INX
- 0F71C E0 0D CPX #TOTAL_MAX_OBJECTS
- 0F71E D0 8B BNE skipCheckingThisObject_forEraseColumnLoop
- 0F720
- 0F720 60 RTS
- 0F721
- 0F721 checkSeamForMonsterPosition:
- 0F721 ;; y is loaded before subroutine.
- 0F721 B1 33 LDA (pointer6),y
- 0F723 85 00 STA temp
- 0F725 0A ASL
- 0F726 0A ASL
- 0F727 0A ASL
- 0F728 0A ASL
- 0F729 85 02 STA temp2
- 0F72B A5 93 LDA scrollUpdateColumn
- 0F72D 29 F0 AND #%11110000
- 0F72F C5 02 CMP temp2
- 0F731 D0 36 BNE +noMonsterToLoadInThisColumn
- 0F733 A5 00 LDA temp
- 0F735 29 F0 AND #%11110000
- 0F737 85 01 STA temp1
- 0F739 C9 F0 CMP #%11110000
- 0F73B F0 2C BEQ +noMonsterToLoadInThisColumn
- 0F73D A4 0A LDY tempD
- 0F73F B1 33 LDA (pointer6),y
- 0F741 85 0A STA tempD
- 0F743 20 BA F1 E0 FF D0 03 4C.. CreateObjectOnScreen temp2, temp1, tempD, #$00, scrollUpdateScreen
- 0F769 +noMonsterToLoadInThisColumn:
- 0F769 60 RTS
- 0F76A 0F76A 60 RTS
- 0F76B doDrawHud:
- 0F76B .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0F76B ;blank0F76B 60 RTS
- 0F76C
- 0F76C
- 0F76C .include "GameData\DataBank01_Includes.asm"
- 0F76C ;; *************** DataBank01_Includes.asm ***************
- 0F76C ;; Script data export. Saturday, March 6, 2021 6:48:13 PM
- 0F76C Script00:
- 0F76C .include "Routines\BASE_4_5\Game\MOD_shooter\Input\moveRight_shooter.asm"
- 0F76C ;;;;
- 0F76C 8A TXA
- 0F76D 85 00 STA temp ;; assumes the object we want to move is in x.
- 0F76F A6 00 BD 9C 04 4A 4A 4A.. GetActionStep temp
- 0F779 C9 07 CMP #$07
- 0F77B D0 03 BNE +notHurt
- 0F77D 4C 8F F7 JMP +CantMove
- 0F780 +notHurt
- 0F780 8A 48 A5 00 85 0C A9 C0.. StartMoving temp, #RIGHT
- 0F78F ; TXA
- 0F78F ; STA temp ;; assumes the object we want to move is in x.
- 0F78F ; ChangeFacingDirection temp, #FACE_RIGHT
- 0F78F +CantMove
- 0F78F 60 RTS0F790 Script01:
- 0F790 .include "Routines\BASE_4_5\Game\MOD_shooter\Input\moveDown_shooter.asm"
- 0F790 ;;;;
- 0F790
- 0F790 8A TXA
- 0F791 85 00 STA temp ;; assumes the object we want to move is in x.
- 0F793 A6 00 BD 9C 04 4A 4A 4A.. GetActionStep temp
- 0F79D C9 07 CMP #$07
- 0F79F D0 03 BNE +notHurt
- 0F7A1 4C B3 F7 JMP +CantMove
- 0F7A4 +notHurt
- 0F7A4 8A 48 A5 00 85 0C A9 30.. StartMoving temp, #DOWN
- 0F7B3 ; TXA
- 0F7B3 ; STA temp ;; assumes the object we want to move is in x.
- 0F7B3 ; ChangeFacingDirection temp, #FACE_DOWN
- 0F7B3 +CantMove
- 0F7B3 60 RTS0F7B4 Script02:
- 0F7B4 .include "Routines\BASE_4_5\Game\MOD_shooter\Input\moveLeft_shooter.asm"
- 0F7B4 ;;;;
- 0F7B4
- 0F7B4 8A TXA
- 0F7B5 85 00 STA temp ;; assumes the object we want to move is in x.
- 0F7B7 A6 00 BD 9C 04 4A 4A 4A.. GetActionStep temp
- 0F7C1 C9 07 CMP #$07
- 0F7C3 D0 03 BNE +notHurt
- 0F7C5 4C D7 F7 JMP +CantMove
- 0F7C8 +notHurt
- 0F7C8 8A 48 A5 00 85 0C A9 80.. StartMoving temp, #LEFT
- 0F7D7 ; TXA
- 0F7D7 ; STA temp ;; assumes the object we want to move is in x.
- 0F7D7 ; ChangeFacingDirection temp, #FACE_LEFT
- 0F7D7 +CantMove
- 0F7D7 60 RTS0F7D8 Script03:
- 0F7D8 .include "Routines\BASE_4_5\Game\MOD_shooter\Input\moveUp_shooter.asm"
- 0F7D8 ;;;;
- 0F7D8 8A TXA
- 0F7D9 85 00 STA temp ;; assumes the object we want to move is in x.
- 0F7DB A6 00 BD 9C 04 4A 4A 4A.. GetActionStep temp
- 0F7E5 C9 07 CMP #$07
- 0F7E7 D0 03 BNE +notHurt
- 0F7E9 4C FB F7 JMP +CantMove
- 0F7EC +notHurt
- 0F7EC 8A 48 A5 00 85 0C A9 20.. StartMoving temp, #UP
- 0F7FB ; TXA
- 0F7FB ; STA temp ;; assumes the object we want to move is in x.
- 0F7FB ; ChangeFacingDirection temp, #FACE_UP
- 0F7FB +CantMove
- 0F7FB 60 RTS0F7FC Script04:
- 0F7FC .include "Routines\BASE_4_5\Game\inputScripts\stopMoving.asm"
- 0F7FC stopMoving:
- 0F7FC ;;;;
- 0F7FC 8A TXA
- 0F7FD 85 00 STA temp ;; assumes the object we want to move is in x.
- 0F7FF 8A 48 A5 00 85 0C A9 FF.. StopMoving temp, #$FF, #$00
- 0F80E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 0F80E 60 RTS0F80F Script05:
- 0F80F .include "Routines\BASE_4_5\Game\MOD_shooter\Input\shootProjectile_timer.asm"
- 0F80F ;;; Create a Projectile.
- 0F80F ;;; Assumes that the projectile you want to create is in GameObject Slot 01.
- 0F80F A5 A7 LDA bulletTimer
- 0F811 F0 01 BEQ +canShoot
- 0F813 ;; bullet timer not reset yet.
- 0F813 ;; we will decrease bullet timer in game timer scripts.
- 0F813 ;; and if it is zero, keep it at zero.
- 0F813 60 RTS
- 0F814 +canShoot
- 0F814
- 0F814 8A TXA
- 0F815 48 PHA
- 0F816 98 TYA
- 0F817 48 PHA
- 0F818 AE 6D 06 LDX player1_object
- 0F81B BD 27 04 LDA Object_screen,x
- 0F81E
- 0F81E 85 0A STA tempD
- 0F820 BD 1A 04 LDA Object_x_hi,x
- 0F823 18 CLC
- 0F824 69 04 ADC #$04
- 0F826 85 07 STA tempA
- 0F828 BD 41 04 LDA Object_y_hi,x
- 0F82B 18 CLC
- 0F82C 69 04 ADC #$04
- 0F82E 85 08 STA tempB
- 0F830 BD A9 04 LDA Object_direction,x
- 0F833 29 07 AND #%00000111
- 0F835 85 09 STA tempC
- 0F837 20 BA F1 E0 FF D0 03 4C.. CreateObjectOnScreen tempA, tempB, #$01, #$00, tempD
- 0F85D ;;; x, y, object, starting action.
- 0F85D ;;; and now with that object, copy the player's
- 0F85D ;;; direction and start it moving that way.
- 0F85D A5 09 LDA tempC
- 0F85F 9D A9 04 STA Object_direction,x
- 0F862 A8 TAY
- 0F863 B9 F9 D8 LDA DirectionTableOrdered,y
- 0F866 85 01 STA temp1
- 0F868 8A TXA
- 0F869 85 00 STA temp
- 0F86B 8A 48 A5 00 85 0C A5 01.. StartMoving temp, temp1
- 0F87A
- 0F87A A9 10 LDA #$10
- 0F87C 85 A7 STA bulletTimer
- 0F87E 68 PLA
- 0F87F A8 TAY
- 0F880 68 PLA
- 0F881 AA TAX
- 0F882
- 0F882 60 RTS0F883 Script06:
- 0F883 .include "Routines\BASE_4_5\Game\Space Birds\Input\shootProjectile.asm"
- 0F883 ;;; Create a Projectile.
- 0F883 ;;; Assumes that the projectile you want to create is in GameObject Slot 03.
- 0F883 A5 A7 LDA bulletTimer
- 0F885 F0 01 BEQ +canShoot
- 0F887 ;; bullet timer not reset yet.
- 0F887 ;; we will decrease bullet timer in game timer scripts.
- 0F887 ;; and if it is zero, keep it at zero.
- 0F887 60 RTS
- 0F888 +canShoot
- 0F888
- 0F888 8A TXA
- 0F889 48 PHA
- 0F88A 98 TYA
- 0F88B 48 PHA
- 0F88C AE 6D 06 LDX player1_object
- 0F88F BD 27 04 LDA Object_screen,x
- 0F892
- 0F892 85 0A STA tempD
- 0F894 BD 1A 04 LDA Object_x_hi,x
- 0F897 18 CLC
- 0F898 69 04 ADC #$04
- 0F89A 85 07 STA tempA
- 0F89C BD 41 04 LDA Object_y_hi,x
- 0F89F 18 CLC
- 0F8A0 69 04 ADC #$04
- 0F8A2 85 08 STA tempB
- 0F8A4 BD A9 04 LDA Object_direction,x
- 0F8A7 29 07 AND #%00000111
- 0F8A9 85 09 STA tempC
- 0F8AB 20 BA F1 E0 FF D0 03 4C.. CreateObjectOnScreen tempA, tempB, #$03, #$00, tempD
- 0F8D1 ;;; x, y, object, starting action.
- 0F8D1 ;;; and now with that object, copy the player's
- 0F8D1 ;;; direction and start it moving that way.
- 0F8D1 A5 09 LDA tempC
- 0F8D3 9D A9 04 STA Object_direction,x
- 0F8D6 A8 TAY
- 0F8D7 B9 F9 D8 LDA DirectionTableOrdered,y
- 0F8DA 85 01 STA temp1
- 0F8DC 8A TXA
- 0F8DD 85 00 STA temp
- 0F8DF 8A 48 A5 00 85 0C A5 01.. StartMoving temp, temp1
- 0F8EE
- 0F8EE A9 10 LDA #$10
- 0F8F0 85 A7 STA bulletTimer
- 0F8F2 68 PLA
- 0F8F3 A8 TAY
- 0F8F4 68 PLA
- 0F8F5 AA TAX
- 0F8F6
- 0F8F6 60 RTS0F8F7 Script07:
- 0F8F7 .include "Routines\BASE_4_5\Game\Space Birds\Input\shootProjectile_Player2.asm"
- 0F8F7 ;;; Create a Projectile.
- 0F8F7 ;;; Assumes that the projectile you want to create is in GameObject Slot 04.
- 0F8F7 A5 A9 LDA bulletTimer2
- 0F8F9 F0 01 BEQ +canShoot
- 0F8FB ;; bullet timer not reset yet.
- 0F8FB ;; we will decrease bullet timer in game timer scripts.
- 0F8FB ;; and if it is zero, keep it at zero.
- 0F8FB 60 RTS
- 0F8FC +canShoot
- 0F8FC
- 0F8FC 8A TXA
- 0F8FD 48 PHA
- 0F8FE 98 TYA
- 0F8FF 48 PHA
- 0F900 AE 6E 06 LDX player2_object
- 0F903 BD 27 04 LDA Object_screen,x
- 0F906
- 0F906 85 0A STA tempD
- 0F908 BD 1A 04 LDA Object_x_hi,x
- 0F90B 18 CLC
- 0F90C 69 04 ADC #$04
- 0F90E 85 07 STA tempA
- 0F910 BD 41 04 LDA Object_y_hi,x
- 0F913 18 CLC
- 0F914 69 04 ADC #$04
- 0F916 85 08 STA tempB
- 0F918 A9 02 LDA #FACE_RIGHT ;not the preferred fix but it will do for now.
- 0F91A 29 07 AND #%00000111
- 0F91C 85 09 STA tempC
- 0F91E 20 BA F1 E0 FF D0 03 4C.. CreateObjectOnScreen tempA, tempB, #$04, #$00, tempD
- 0F944 ;;; x, y, object, starting action.
- 0F944 ;;; and now with that object, copy the player's
- 0F944 ;;; direction and start it moving that way.
- 0F944 A5 09 LDA tempC
- 0F946 9D A9 04 STA Object_direction,x
- 0F949 A8 TAY
- 0F94A B9 F9 D8 LDA DirectionTableOrdered,y
- 0F94D 85 01 STA temp1
- 0F94F 8A TXA
- 0F950 85 00 STA temp
- 0F952 8A 48 A5 00 85 0C A5 01.. StartMoving temp, temp1
- 0F961
- 0F961 A9 10 LDA #$10
- 0F963 85 A9 STA bulletTimer2
- 0F965 68 PLA
- 0F966 A8 TAY
- 0F967 68 PLA
- 0F968 AA TAX
- 0F969
- 0F969 60 RTS0F96A Script08:
- 0F96A .include "Routines\BASE_4_5\Game\Space Birds\Input\startGameWithNewContinuePoints.asm"
- 0F96A ;;; This script can be used as a start game input script.
- 0F96A ;;; It will take you to the first screen and set up new continue points based on
- 0F96A ;;; that screen's info.
- 0F96A startGameWithNewContinuePoints:
- 0F96A
- 0F96A AD E0 06 LDA isTwoPlayerGame
- 0F96D F0 66 BEQ +onePlayerGame
- 0F96F ;; two player game
- 0F96F AD B4 06 LDA screenUpdateByte
- 0F972 09 04 ORA #%00000100
- 0F974 8D B4 06 STA screenUpdateByte
- 0F977
- 0F977 AD C8 06 LDA warpToMap
- 0F97A
- 0F97A 8D A4 06 STA warpMap
- 0F97D
- 0F97D AD A3 06 LDA warpToScreen
- 0F980 8D 74 06 STA currentNametable
- 0F983
- 0F983 AE 6D 06 LDX player1_object
- 0F986 9D 27 04 STA Object_screen,x
- 0F989
- 0F989 BD 1A 04 LDA Object_x_hi,x
- 0F98C 85 04 STA tempx
- 0F98E BD 41 04 LDA Object_y_hi,x
- 0F991 18 CLC
- 0F992 69 80 ADC #$80
- 0F994 85 05 STA tempy
- 0F996
- 0F996 AE 6E 06 LDX player2_object
- 0F999 20 BA F1 E0 FF D0 03 4C.. CreateObject tempx, tempy, player2_object, #$00
- 0F9C1
- 0F9C1 A9 03 LDA #3
- 0F9C3 85 A4 STA myLives
- 0F9C5 85 AA STA player2Lives
- 0F9C7
- 0F9C7 A9 01 LDA #$01
- 0F9C9 8D A5 06 STA screenTransitionType ;; is of warp type
- 0F9CC
- 0F9CC
- 0F9CC AD AB 06 LDA gameHandler
- 0F9CF 09 80 ORA #%10000000
- 0F9D1 8D AB 06 STA gameHandler ;; this will set the next game loop to update the screen.
- 0F9D4 60 RTS
- 0F9D5
- 0F9D5 +onePlayerGame
- 0F9D5 AD C8 06 LDA warpToMap
- 0F9D8
- 0F9D8 8D A4 06 STA warpMap
- 0F9DB
- 0F9DB AD A3 06 LDA warpToScreen
- 0F9DE 8D 74 06 STA currentNametable
- 0F9E1
- 0F9E1 AE 6D 06 LDX player1_object
- 0F9E4 9D 27 04 STA Object_screen,x
- 0F9E7
- 0F9E7 A9 01 LDA #$01
- 0F9E9 8D A5 06 STA screenTransitionType ;; is of warp type
- 0F9EC
- 0F9EC
- 0F9EC AD AB 06 LDA gameHandler
- 0F9EF 09 80 ORA #%10000000
- 0F9F1 8D AB 06 STA gameHandler ;; this will set the next game loop to update the screen.
- 0F9F4 60 RTS0F9F5 Script09:
- 0F9F5 .include "Routines\BASE_4_5\test.asm"
- 0F9F5 A9 02 lda #%00000010
- 0F9F7 8D 8C 06 sta scrollByte
- 0F9FA 60 rts0F9FB
- 0F9FB ;; AI routines
- 0F9FB AI_0:
- 0F9FB .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0F9FB ;blank0F9FB 60 RTS
- 0F9FC AI_1:
- 0F9FC .include "Routines\BASE_4_5\Game\AI_Scripts\MoveRandom_8Dir.asm"
- 0F9FC ;;;; Choose out of 4 directions, UDLR.
- 0F9FC 8A TXA
- 0F9FD 85 07 STA tempA
- 0F9FF 20 DD DD JSR doGetRandomNumber
- 0FA02 29 07 AND #%00000111
- 0FA04 A8 TAY
- 0FA05 B9 E9 D8 LDA DirectionTable,y
- 0FA08 85 08 STA tempB
- 0FA0A B9 F1 D8 LDA FacingTable,y
- 0FA0D 85 09 STA tempC
- 0FA0F 8A 48 A5 07 85 0C A5 08.. StartMoving tempA, tempB, #$00
- 0FA1E 8A 48 A5 07 85 0C A5 09.. ChangeFacingDirection tempA, tempC
- 0FA2D 60 RTS
- 0FA2E AI_2:
- 0FA2E .include "Routines\BASE_4_5\Game\AI_Scripts\StopMoving.asm"
- 0FA2E ;;; stop moving.
- 0FA2E BD A9 04 LDA Object_direction,x
- 0FA31 29 07 AND #%00000111
- 0FA33 9D A9 04 STA Object_direction,x
- 0FA36
- 0FA36 60 RTS
- 0FA37 AI_3:
- 0FA37 .include "Routines\BASE_4_5\Game\MOD_PlatformerBase\AI\MoveLeft.asm"
- 0FA37 ;;;; Choose out of 4 directions, UDLR.
- 0FA37 8A TXA
- 0FA38 85 07 STA tempA
- 0FA3A A9 06 LDA #%00000110 ;; "left"
- 0FA3C A8 TAY
- 0FA3D B9 F9 D8 LDA DirectionTableOrdered,y
- 0FA40 85 08 STA tempB
- 0FA42 B9 01 D9 LDA FacingTableOrdered,y
- 0FA45 85 09 STA tempC
- 0FA47 8A 48 A5 07 85 0C A5 08.. StartMoving tempA, tempB, #$00
- 0FA56 8A 48 A5 07 85 0C A5 09.. ChangeFacingDirection tempA, tempC0FA65 60 RTS
- 0FA66 AI_4:
- 0FA66 .include "Routines\BASE_4_5\Game\AI_Scripts\MoveTowardsPlayer.asm"
- 0FA66 ;;; aim towards player.
- 0FA66 98 TYA
- 0FA67 48 PHA
- 0FA68 8A TXA
- 0FA69 48 PHA
- 0FA6A 85 04 STA tempx
- 0FA6C
- 0FA6C BD 1A 04 LDA Object_x_hi,x
- 0FA6F 85 07 STA tempA
- 0FA71 BD 41 04 LDA Object_y_hi,x
- 0FA74 85 08 STA tempB
- 0FA76 AE 6D 06 LDX player1_object
- 0FA79 BD 1A 04 LDA Object_x_hi,x
- 0FA7C 85 09 STA tempC
- 0FA7E BD 41 04 LDA Object_y_hi,x
- 0FA81 85 0A STA tempD
- 0FA83
- 0FA83 A6 04 LDX tempx
- 0FA85
- 0FA85 8A 48 98 48 A5 07 85 0C.. MoveTowardsPoint tempA, tempC, tempB, tempD
- 0FAD2 BD A9 04 LDA Object_direction,x
- 0FAD5 29 07 AND #%00000111
- 0FAD7 09 08 ORA #%00001000
- 0FAD9 9D A9 04 STA Object_direction,x
- 0FADC
- 0FADC 68 PLA
- 0FADD AA TAX
- 0FADE 68 PLA
- 0FADF A8 TAY0FAE0 60 RTS
- 0FAE1 AI_5:
- 0FAE1 .include "Routines\BASE_4_5\Game\MOD_shooter\AI\ShootAtPlayer.asm"
- 0FAE1 BD 1A 04 LDA Object_x_hi,x
- 0FAE4 ;; plus x offset
- 0FAE4 85 07 STA tempA
- 0FAE6 BD 41 04 LDA Object_y_hi,x
- 0FAE9 ;; plus y offset
- 0FAE9 85 08 STA tempB
- 0FAEB A9 02 LDA #$02 ;; game object to create.
- 0FAED 85 09 STA tempC
- 0FAEF A9 00 LDA #$00 ;; action step for that object
- 0FAF1 85 0A STA tempD
- 0FAF3 BD 27 04 LDA Object_screen,x
- 0FAF6 85 06 STA tempz
- 0FAF8
- 0FAF8 20 BA F1 E0 FF D0 03 4C.. CreateObjectOnScreen tempA, tempB, tempC, tempD, tempz
- 0FB1E 0FB1E 60 RTS
- 0FB1F AI_6:
- 0FB1F .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB1F ;blank0FB1F 60 RTS
- 0FB20 AI_7:
- 0FB20 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB20 ;blank0FB20 60 RTS
- 0FB21 AI_8:
- 0FB21 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB21 ;blank0FB21 60 RTS
- 0FB22 AI_9:
- 0FB22 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB22 ;blank0FB22 60 RTS
- 0FB23 AI_A:
- 0FB23 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB23 ;blank0FB23 60 RTS
- 0FB24 AI_B:
- 0FB24 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB24 ;blank0FB24 60 RTS
- 0FB25 AI_C:
- 0FB25 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB25 ;blank0FB25 60 RTS
- 0FB26 AI_D:
- 0FB26 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB26 ;blank0FB26 60 RTS
- 0FB27 AI_E:
- 0FB27 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB27 ;blank0FB27 60 RTS
- 0FB28 AI_F:
- 0FB28 .include "Routines\BASE_4_5\Game\Subroutines\blank.asm"
- 0FB28 ;blank0FB28 60 RTS
- 0FB29
- 0FB29
- 0FB29 AI_table_lo:
- 0FB29 FB FC 2E 37 66 E1 1F 20 .db #<AI_0, #<AI_1, #<AI_2, #<AI_3, #<AI_4, #<AI_5, #<AI_6, #<AI_7
- 0FB31 21 22 23 24 25 26 27 28 .db #<AI_8, #<AI_9, #<AI_A, #<AI_B, #<AI_C, #<AI_D, #<AI_E, #<AI_F
- 0FB39
- 0FB39 AI_table_hi:
- 0FB39 F9 F9 FA FA FA FA FB FB .db #>AI_0, #>AI_1, #>AI_2, #>AI_3, #>AI_4, #>AI_5, #>AI_6, #>AI_7
- 0FB41 FB FB FB FB FB FB FB FB .db #>AI_8, #>AI_9, #>AI_A, #>AI_B, #>AI_C, #>AI_D, #>AI_E, #>AI_F
- 0FB49
- 0FB49
- 0FB49 DATABANK1 = #$18
- 0FB49 ;9. Vectors
- 0FB49 .include "Routines\BASE_4_5\System\Vectors.asm"
- 0FB49 00 00 00 00 00 00 00 00.. .org $fff0
- 0FFF0 E7 DE EC E6 DA E4 DE EB.. .db #$e7, #$De, #$ec, #$e6, #$da, #$e4, #$de, #$eb, #$05, #$00
- 0FFFA ;.org $fffa
- 0FFFA 0A C2 .dw NMI
- 0FFFC 00 C0 .dw RESET
- 0FFFE 00 00 .dw 00
- 10000 10000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement