From 504401a6d3526454acb89392521e5cbeb4e090e0 Mon Sep 17 00:00:00 2001 From: Damian Yerrick Date: Sat, 23 Dec 2017 22:23:19 -0500 Subject: [PATCH] show ROM size in status bar --- CHANGES.txt | 4 +- src/main.s | 123 ++++++++++++++++++++++++++-------------------- src/pently.inc | 3 ++ src/pentlymusic.s | 13 ++++- src/pentlysound.s | 2 + 5 files changed, 90 insertions(+), 55 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 21a400c..087bc68 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,8 +8,8 @@ * pentlyas.py: output lists each song's total size in comments * Add "Isometry" song demonstrating attack track more thoroughly * makefile: change score filename -* NES shell: move credit line to status bar -* NES shell: profiler shows current and peak CPU usage +* NES shell: move copyright notice to status bar +* NES shell: status shows ROM size and current and peak CPU usage * NES/NSF executables no longer in Git; will be in releases instead 0.05wip7 (2017-09) diff --git a/src/main.s b/src/main.s index 6c71dd1..5943634 100644 --- a/src/main.s +++ b/src/main.s @@ -28,6 +28,11 @@ .import getTVSystem .importzp NUM_SONGS +; Size diagnostics +.import periodTableHi, periodTableLo +PERIOD_SIZE = (periodTableHi - periodTableLo) * 2 +PENTLY_SIZE = PENTLYMUSIC_SIZE + PENTLYSOUND_SIZE + PERIOD_SIZE + .segment "ZEROPAGE" nmis: .res 1 oam_used: .res 1 @@ -47,6 +52,7 @@ STATUS_BAR_TOP = 24 STATUS_BAR_ADDR = $2000 + 32 * STATUS_BAR_TOP BEAT_POS_ADDR = STATUS_BAR_ADDR + 32 * 1 + 2 CYCLES_ADDR = STATUS_BAR_ADDR + 32 * 1 + 25 +ROM_SIZE_ADDR = STATUS_BAR_ADDR + 32 * 2 + 2 WORD_PEAK_ADDR = STATUS_BAR_ADDR + 32 * 2 + 21 PEAK_ADDR = WORD_PEAK_ADDR + 4 @@ -126,20 +132,6 @@ PEAK_ADDR = WORD_PEAK_ADDR + 4 sta cyclespeaklo ; Present one frame with only sprite 0 to prime the profiler - - lda #>WORD_PEAK_ADDR - sta PPUADDR - lda #STATUS_BAR_ADDR + bcc lineloop + done: + rts +.endproc + .proc display_todo lda #VBLANK_NMI ldx #$00 @@ -300,47 +340,17 @@ dst = $02 sta dst+0 lda #>TRACKNAMES_ADDR sta dst+1 - lda #tracknames_txt - sta src+1 -todo_rowloop: - ldy dst+1 - sty PPUADDR - ldy dst+0 - sty PPUADDR - ldy #0 -todo_charloop: - lda (src),y - beq todo_done - cmp #$0A - beq is_newline - sta PPUDATA - iny - bne todo_charloop -is_newline: + jsr puts_multiline_ay - sec - tya - adc src - sta src - lda src+1 - adc #0 - sta src+1 - lda dst - adc #32 - sta dst - lda dst+1 - adc #0 + lda #ROM_SIZE_ADDR sta dst+1 - - ; crop to the status bar top - lda dst+0 - cmp #STATUS_BAR_ADDR - bcc todo_rowloop -todo_done: + ldy #bytes_txt + jsr puts_multiline_ay ; Draw top of status bar lda #>STATUS_BAR_ADDR @@ -410,6 +420,15 @@ tracknames_txt: .incbin "tracknames.txt" .byt 0 +bytes_txt: + .byt "ROM:" + .byt '0'|<((PENTLY_SIZE / 1000) .MOD 10) + .byt '0'|<((PENTLY_SIZE / 100) .MOD 10) + .byt '0'|<((PENTLY_SIZE / 10) .MOD 10) + .byt '0'|<((PENTLY_SIZE / 1) .MOD 10) + .byt " bytes Peak",0 + + main_palette: .byt $0F,$00,$10,$30, $0F,$00,$10,$30, $0F,$00,$10,$30, $0F,$00,$10,$30 .byt $0F,$00,$10,$30, $0F,$00,$10,$30, $0F,$00,$10,$30, $0F,$00,$10,$30 diff --git a/src/pently.inc b/src/pently.inc index b8d85a5..e1dd6f5 100644 --- a/src/pently.inc +++ b/src/pently.inc @@ -134,3 +134,6 @@ PENTLY_USE_BPMMATH = 1 .globalzp pently_tempoCounterLo, pently_tempoCounterHi .global pently_fpmLo, pently_fpmHi + +; Size (for debugging) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +.global PENTLYSOUND_SIZE, PENTLYMUSIC_SIZE \ No newline at end of file diff --git a/src/pentlymusic.s b/src/pentlymusic.s index b4abe83..a031697 100644 --- a/src/pentlymusic.s +++ b/src/pentlymusic.s @@ -128,6 +128,8 @@ pentlymusicbase: .res pentlymusicbase_size .endif .segment PENTLY_RODATA +pentlymusic_rodata_start = * + FRAMES_PER_MINUTE_PAL = 3000 FRAMES_PER_MINUTE_NTSC = 3606 pently_fpmLo: @@ -154,6 +156,8 @@ porta1x_rates_hi: .endif .segment PENTLY_CODE +pentlymusic_code_start = * + .proc pently_start_music asl a tax @@ -1321,4 +1325,11 @@ is_decrease: bcc at_target .endproc -.endif \ No newline at end of file +.endif + + +.segment PENTLY_RODATA +pentlymusic_rodata_size = * - pentlymusic_rodata_start +.segment PENTLY_CODE +pentlymusic_code_size = * - pentlymusic_code_start +PENTLYMUSIC_SIZE = pentlymusic_rodata_size + pentlymusic_code_size diff --git a/src/pentlysound.s b/src/pentlysound.s index c9703ba..8707bd5 100644 --- a/src/pentlysound.s +++ b/src/pentlysound.s @@ -55,6 +55,7 @@ ch_lastfreqhi = pentlyBSS + 2 sfx_remainlen = pentlyBSS + 3 .segment PENTLY_CODE +pentlysound_code_start = * ;; ; Initializes all sound channels. @@ -294,3 +295,4 @@ no_change_to_hi_period: rts .endproc +PENTLYSOUND_SIZE = * - pentlysound_code_start \ No newline at end of file