From a2c9cb021a396c8e8771ad6bfb00fbed6e47cc87 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Tue, 15 Mar 2016 21:36:38 +0100
Subject: [PATCH] Moved things into ONCE.
Code and or data used only during initialization belongs into the ONCE segment.
---
libsrc/c16/cgetc.s | 11 +++--------
libsrc/nes/ppu.s | 5 +++--
libsrc/plus4/cgetc.s | 11 +++--------
3 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/libsrc/c16/cgetc.s b/libsrc/c16/cgetc.s
index a476a5d1b..3ee31a757 100644
--- a/libsrc/c16/cgetc.s
+++ b/libsrc/c16/cgetc.s
@@ -69,6 +69,9 @@ L2: jsr KBDREAD ; Read char and return in A
.endproc
+fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
+ .byte 133, 137, 134, 138, 135, 139, 136, 140
+
.code
@@ -82,11 +85,3 @@ L2: jsr KBDREAD ; Read char and return in A
rts
.endproc
-
-
-; Function key table, readonly
-
-.rodata
-fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
- .byte 133, 137, 134, 138, 135, 139, 136, 140
-
diff --git a/libsrc/nes/ppu.s b/libsrc/nes/ppu.s
index 06dc10a65..07b6842f7 100644
--- a/libsrc/nes/ppu.s
+++ b/libsrc/nes/ppu.s
@@ -68,6 +68,8 @@
;-----------------------------------------------------------------------------
+.segment "ONCE"
+
.proc ppuinit
lda #%10101000
@@ -104,7 +106,6 @@
.endproc
-
;-----------------------------------------------------------------------------
.proc paletteinit
@@ -126,7 +127,7 @@
bne @loop
rts
-
+
.endproc
;-----------------------------------------------------------------------------
diff --git a/libsrc/plus4/cgetc.s b/libsrc/plus4/cgetc.s
index 25a63c053..784bac267 100644
--- a/libsrc/plus4/cgetc.s
+++ b/libsrc/plus4/cgetc.s
@@ -72,6 +72,9 @@ L2: sta ENABLE_ROM ; Bank in the ROM
.endproc
+fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
+ .byte 133, 137, 134, 138, 135, 139, 136, 140
+
.segment "LOWCODE" ; Accesses the ROM - must go into low mem
@@ -87,11 +90,3 @@ L2: sta ENABLE_ROM ; Bank in the ROM
rts
.endproc
-
-
-; Function key table, readonly
-
-.rodata
-fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
- .byte 133, 137, 134, 138, 135, 139, 136, 140
-
--
2.39.5