1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 02:29:32 +00:00

Consistently place constructors (and their exclusive subroutines) in "INIT".

This commit is contained in:
Oliver Schmidt 2015-10-09 21:44:20 +02:00
parent 575f859a03
commit 326da85145
8 changed files with 17 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -1,8 +1,8 @@
.include "pce.inc"
.export psg_init
.segment "INIT"
psg_init:
clx
stz PSG_GLOBAL_PAN ; Clear global balance

View File

@ -1,8 +1,8 @@
.include "pce.inc"
.export vce_init
.segment "INIT"
vce_init:
; Set CTA to zero
stz VCE_ADDR_LO