Hello to everyone, I'm working on my NES game every weekend, and everytime I discover a new limit on this machine . This time the compiler ( NESASM ) give me this error "Bank overflow, offset > $1FFF!". I supposed it depend on how many code I write in a single bank. So my question is, how can I organize my files to continue to write code for my game? What's the code limit that I can write? And, if I get the Bank Overflow error, how can I add more bank for my code?
This code show how I organized my code ( I take it from another opensource project ), but I can't understard how to add more banks and if I can add more banks to my code.
Thanks a lot!
This code show how I organized my code ( I take it from another opensource project ), but I can't understard how to add more banks and if I can add more banks to my code.
Thanks a lot!
Code:
;; NES HEADERS
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
;; Constants and Variables
.include "Macros.asm"
.include "MacrosPlayer.asm"
.include "EnemiesManager2.asm"
.include "Variables.asm"
.include "Constants.asm"
;; Code starting point
.bank 0
.org $C000
;; RESET Routine. Initialize Title, clear NMI ready flag
.include "Reset.asm"
;; MAIN LOOP
MainLoop:
.include "ReadControllers.asm"
.include "GameEngine.asm"
lda #READY ;frameready is now set to 1. This will Allow NMI to Draw To Screen
sta FRAME_READY
WaitForNMI: ;Allow NMI to complete one pass before Starting Main Loop again. This ensure no game logic will happen during NMI while its writing.
lda FRAME_READY ;01
cmp #READY ;01
beq WaitForNMI ;Since both frameready and READY are 01 this will loop back to WaitForNMI until NMI clears the frameready flag.
jmp MainLoop ;jump back to MainLoop, infinite loop
; The NMI
.include "NMI.asm"
; Load Title Screen
.include "StartTitleScreen.asm"
; Update Title Screen
.include "UpdateTitleScreen.asm"
; Load Gameplay Screen
.include "StartGamePlay.asm"
; Update Gameplay
.include "UpdateGamePlay.asm"
;; data tables
.bank 1
.org $E000
; Subroutines
;.include "BackgroundUpdater.asm"
.include "EnemyAnimationRoutines.asm"
.include "PlayerManager.asm"
;.include "EnemiesManager.asm"
.include "GameplayManager.asm"
.include "Graphics.asm"
;;;;; The Vectors
.org $FFFA ;first of the three vectors starts here
.dw NMI ;when an NMI happens (once per frame if enabled) the
;processor will jump to the label NMI:
.dw RESET ;when the processor first turns on or is reset, it will jump
;to the label RESET:
.dw 0
.bank 2
.org $0000
.incbin "ShootingLikeAStar.chr"
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
;; Constants and Variables
.include "Macros.asm"
.include "MacrosPlayer.asm"
.include "EnemiesManager2.asm"
.include "Variables.asm"
.include "Constants.asm"
;; Code starting point
.bank 0
.org $C000
;; RESET Routine. Initialize Title, clear NMI ready flag
.include "Reset.asm"
;; MAIN LOOP
MainLoop:
.include "ReadControllers.asm"
.include "GameEngine.asm"
lda #READY ;frameready is now set to 1. This will Allow NMI to Draw To Screen
sta FRAME_READY
WaitForNMI: ;Allow NMI to complete one pass before Starting Main Loop again. This ensure no game logic will happen during NMI while its writing.
lda FRAME_READY ;01
cmp #READY ;01
beq WaitForNMI ;Since both frameready and READY are 01 this will loop back to WaitForNMI until NMI clears the frameready flag.
jmp MainLoop ;jump back to MainLoop, infinite loop
; The NMI
.include "NMI.asm"
; Load Title Screen
.include "StartTitleScreen.asm"
; Update Title Screen
.include "UpdateTitleScreen.asm"
; Load Gameplay Screen
.include "StartGamePlay.asm"
; Update Gameplay
.include "UpdateGamePlay.asm"
;; data tables
.bank 1
.org $E000
; Subroutines
;.include "BackgroundUpdater.asm"
.include "EnemyAnimationRoutines.asm"
.include "PlayerManager.asm"
;.include "EnemiesManager.asm"
.include "GameplayManager.asm"
.include "Graphics.asm"
;;;;; The Vectors
.org $FFFA ;first of the three vectors starts here
.dw NMI ;when an NMI happens (once per frame if enabled) the
;processor will jump to the label NMI:
.dw RESET ;when the processor first turns on or is reset, it will jump
;to the label RESET:
.dw 0
.bank 2
.org $0000
.incbin "ShootingLikeAStar.chr"