From: Oliver Schmidt
Date: Fri, 9 Oct 2015 19:44:20 +0000 (+0200)
Subject: Consistently place constructors (and their exclusive subroutines) in "INIT".
X-Git-Tag: V2.16~220
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=326da8514549afb72cafef5142690feada29170d;p=cc65
Consistently place constructors (and their exclusive subroutines) in "INIT".
---
diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s
index 412dd582d..660276675 100644
--- a/libsrc/atari5200/conioscreen.s
+++ b/libsrc/atari5200/conioscreen.s
@@ -7,9 +7,10 @@
SCREEN_BUF_SIZE = 20 * 24
SCREEN_BUF = $4000 - SCREEN_BUF_SIZE
- .code
.export screen_setup_20x24
+ .segment "INIT"
+
screen_setup_20x24:
; initialize SAVMSC
@@ -79,5 +80,4 @@ dlist: .repeat 3
.assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
-
.end
diff --git a/libsrc/c128/systime.s b/libsrc/c128/systime.s
index 0a7f8f367..e12d016b8 100644
--- a/libsrc/c128/systime.s
+++ b/libsrc/c128/systime.s
@@ -63,6 +63,7 @@ BCD2dec:tax
; Constructor that writes to the 1/10 sec register of the TOD to kick it
; into action. If this is not done, the clock hangs. We will read the register
; and write it again, ignoring a possible change in between.
+.segment "INIT"
.proc initsystime
@@ -78,7 +79,6 @@ BCD2dec:tax
.endproc
-
;----------------------------------------------------------------------------
; TM struct with date set to 1970-01-01
.data
@@ -92,4 +92,3 @@ TM: .word 0 ; tm_sec
.word 0 ; tm_wday
.word 0 ; tm_yday
.word 0 ; tm_isdst
-
diff --git a/libsrc/c64/systime.s b/libsrc/c64/systime.s
index a00df1397..f8cd1b714 100644
--- a/libsrc/c64/systime.s
+++ b/libsrc/c64/systime.s
@@ -63,6 +63,7 @@ BCD2dec:tax
; Constructor that writes to the 1/10 sec register of the TOD to kick it
; into action. If this is not done, the clock hangs. We will read the register
; and write it again, ignoring a possible change in between.
+.segment "INIT"
.proc initsystime
@@ -81,7 +82,6 @@ BCD2dec:tax
.endproc
-
;----------------------------------------------------------------------------
; TM struct with date set to 1970-01-01
.data
@@ -95,4 +95,3 @@ TM: .word 0 ; tm_sec
.word 0 ; tm_wday
.word 0 ; tm_yday
.word 0 ; tm_isdst
-
diff --git a/libsrc/osic1p/cgetc.s b/libsrc/osic1p/cgetc.s
index 0c7c69488..5ddca2870 100644
--- a/libsrc/osic1p/cgetc.s
+++ b/libsrc/osic1p/cgetc.s
@@ -11,12 +11,14 @@
.include "zeropage.inc"
; Initialize one-character buffer that is filled by kbhit()
+ .segment "INIT"
initcgetc:
lda #$00
sta CHARBUF ; No character in buffer initially
rts
; Input routine from 65V PROM MONITOR, show cursor if enabled
+ .code
_cgetc:
lda CHARBUF ; character in buffer available?
beq nobuffer
diff --git a/libsrc/pce/clock.s b/libsrc/pce/clock.s
index 8fda58adc..261739df8 100644
--- a/libsrc/pce/clock.s
+++ b/libsrc/pce/clock.s
@@ -5,9 +5,11 @@
.include "pce.inc"
.include "extzp.inc"
- .forceimport ticktock
.export _clock
+ .forceimport ticktock
.importzp sreg
+ .constructor initclock
+
.proc _clock
@@ -21,8 +23,7 @@
.endproc
- .constructor initclock
-
+ .segment "INIT"
initclock:
lda #0
ldx #3
diff --git a/libsrc/pce/conio.s b/libsrc/pce/conio.s
index 1428ef59f..64df87018 100644
--- a/libsrc/pce/conio.s
+++ b/libsrc/pce/conio.s
@@ -1,14 +1,16 @@
.include "pce.inc"
.include "extzp.inc"
- .import vce_init
- .import psg_init
- .import vdc_init
+ .import vce_init
+ .import psg_init
+ .import colors
+ .importzp ptr1, tmp1
.constructor initconio
.macpack longbranch
+ .segment "INIT"
initconio:
jsr vce_init
jsr psg_init
@@ -20,7 +22,6 @@ initconio:
st2 #>$0088
rts
- .import colors
set_palette:
stz VCE_ADDR_LO
stz VCE_ADDR_HI
@@ -48,11 +49,6 @@ set_palette:
rts
-;----------------------------------------------------------------------------
-;
-;----------------------------------------------------------------------------
-
- .importzp ptr1, tmp1
conio_init:
; Load font
st0 #VDC_MAWR
@@ -80,13 +76,11 @@ conio_init:
sta tmp1
jsr copy
-
ldx #0
stx BGCOLOR
inx
stx CHARCOLOR
-
rts
copy:
diff --git a/libsrc/pce/psg.s b/libsrc/pce/psg.s
index 17d26b941..b1d610fa1 100644
--- a/libsrc/pce/psg.s
+++ b/libsrc/pce/psg.s
@@ -1,8 +1,8 @@
-
.include "pce.inc"
.export psg_init
+ .segment "INIT"
psg_init:
clx
stz PSG_GLOBAL_PAN ; Clear global balance
diff --git a/libsrc/pce/vce.s b/libsrc/pce/vce.s
index 3c19fd55b..af69c5ed1 100644
--- a/libsrc/pce/vce.s
+++ b/libsrc/pce/vce.s
@@ -1,8 +1,8 @@
-
.include "pce.inc"
.export vce_init
+ .segment "INIT"
vce_init:
; Set CTA to zero
stz VCE_ADDR_LO