git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit b75f9701da9212fa27759748afd85a341219d611
parent 53445a6b8e0287542193381bb5402906ebb7a024
Author: Michel Iwaniec <46843052+michel-iwaniec@users.noreply.github.com>
Date:   Thu,  4 Jan 2024 23:03:45 +0000

Merge pull request #607 from michel-iwaniec/nes_optimize_crt0_zeropage_use

NES: Trim away 2 bytes of zeropage
Diffstat:
Mgbdk-lib/libc/targets/mos6502/font.s12++++++------
Mgbdk-lib/libc/targets/mos6502/mode.s4++--
Mgbdk-lib/libc/targets/mos6502/nes/crt0.s9++++-----
3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/gbdk-lib/libc/targets/mos6502/font.s b/gbdk-lib/libc/targets/mos6502/font.s @@ -114,7 +114,7 @@ font_load_found: tya pha ; Only copy the tiles in if were in text mode - lda *.mode + lda .mode and #.T_MODE beq font_load_skip_copy_current jsr font_copy_current @@ -217,7 +217,7 @@ font_set:: bne 1$ ; Now see if were checking special chars - lda *.mode + lda .mode and #.M_NO_INTERP bne 2$ jsr .cr_curs @@ -339,7 +339,7 @@ _gotoxy:: rts _posx:: - lda *.mode + lda .mode and #.T_MODE bne 1$ jsr .tmode @@ -348,7 +348,7 @@ _posx:: rts _posy:: - lda *.mode + lda .mode and #.T_MODE bne 1$ jsr .tmode @@ -401,7 +401,7 @@ _posy:: jmp 99$ 2$: ;; See if scrolling is disabled - lda *.mode + lda .mode and #.M_NO_SCROLL beq 3$ ;; Nope - reset the cursor to (0,0) @@ -437,5 +437,5 @@ _posy:: ;; Clear screen jsr .cls_no_reset_pos lda #.T_MODE - sta *.mode + sta .mode rts diff --git a/gbdk-lib/libc/targets/mos6502/mode.s b/gbdk-lib/libc/targets/mos6502/mode.s @@ -11,7 +11,7 @@ _mode:: .set_mode:: - sta *.mode + sta .mode ;; AND to get rid of the extra flags and #0x03 asl ; Multiply mode by 4 @@ -25,5 +25,5 @@ _mode:: jmp [*temp_word] ; Jump to initialization routine _get_mode:: - lda *.mode + lda .mode rts diff --git a/gbdk-lib/libc/targets/mos6502/nes/crt0.s b/gbdk-lib/libc/targets/mos6502/nes/crt0.s @@ -42,6 +42,7 @@ _attribute_shadow = 0x188 .area _BASE ;; Constant data .area _LIT + .area _RODATA ;; Constant data, used to init _DATA .area _INITIALIZER .area _XINIT @@ -66,10 +67,8 @@ _sys_time:: .ds 2 _shadow_PPUCTRL:: .ds 1 _shadow_PPUMASK:: .ds 1 __crt0_spritePageValid: .ds 1 -__crt0_NMI_Done: .ds 1 __crt0_NMI_insideNMI: .ds 1 __crt0_ScrollHV: .ds 1 -.mode:: .ds 1 _bkg_scroll_x:: .ds 1 _bkg_scroll_y:: .ds 1 _attribute_row_dirty:: .ds 1 @@ -80,6 +79,7 @@ _attribute_column_dirty:: .ds 1 .area _BSS __crt0_paletteShadow:: .ds 25 +.mode:: .ds 1 .area _CODE @@ -232,9 +232,6 @@ NotInsideNMI: lda *(_sys_time+1) adc #0 sta *(_sys_time+1) - - lda #0x80 - sta __crt0_NMI_Done lda *_shadow_PPUCTRL ora *__crt0_ScrollHV @@ -249,6 +246,8 @@ NotInsideNMI: nop nop nop + lda #0x00 + lda 0x0000 ; Call the handler jsr .jmp_to_LCD_isr

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.