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_SIZE = 20 * 24
SCREEN_BUF = $4000 - SCREEN_BUF_SIZE SCREEN_BUF = $4000 - SCREEN_BUF_SIZE
.code
.export screen_setup_20x24 .export screen_setup_20x24
.segment "INIT"
screen_setup_20x24: screen_setup_20x24:
; initialize SAVMSC ; initialize SAVMSC
@@ -79,5 +80,4 @@ dlist: .repeat 3
.assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary" .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
.end .end

View File

@@ -63,6 +63,7 @@ BCD2dec:tax
; Constructor that writes to the 1/10 sec register of the TOD to kick it ; 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 ; 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. ; and write it again, ignoring a possible change in between.
.segment "INIT"
.proc initsystime .proc initsystime
@@ -78,7 +79,6 @@ BCD2dec:tax
.endproc .endproc
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; TM struct with date set to 1970-01-01 ; TM struct with date set to 1970-01-01
.data .data
@@ -92,4 +92,3 @@ TM: .word 0 ; tm_sec
.word 0 ; tm_wday .word 0 ; tm_wday
.word 0 ; tm_yday .word 0 ; tm_yday
.word 0 ; tm_isdst .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 ; 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 ; 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. ; and write it again, ignoring a possible change in between.
.segment "INIT"
.proc initsystime .proc initsystime
@@ -81,7 +82,6 @@ BCD2dec:tax
.endproc .endproc
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; TM struct with date set to 1970-01-01 ; TM struct with date set to 1970-01-01
.data .data
@@ -95,4 +95,3 @@ TM: .word 0 ; tm_sec
.word 0 ; tm_wday .word 0 ; tm_wday
.word 0 ; tm_yday .word 0 ; tm_yday
.word 0 ; tm_isdst .word 0 ; tm_isdst

View File

@@ -11,12 +11,14 @@
.include "zeropage.inc" .include "zeropage.inc"
; Initialize one-character buffer that is filled by kbhit() ; Initialize one-character buffer that is filled by kbhit()
.segment "INIT"
initcgetc: initcgetc:
lda #$00 lda #$00
sta CHARBUF ; No character in buffer initially sta CHARBUF ; No character in buffer initially
rts rts
; Input routine from 65V PROM MONITOR, show cursor if enabled ; Input routine from 65V PROM MONITOR, show cursor if enabled
.code
_cgetc: _cgetc:
lda CHARBUF ; character in buffer available? lda CHARBUF ; character in buffer available?
beq nobuffer beq nobuffer

View File

@@ -5,9 +5,11 @@
.include "pce.inc" .include "pce.inc"
.include "extzp.inc" .include "extzp.inc"
.forceimport ticktock
.export _clock .export _clock
.forceimport ticktock
.importzp sreg .importzp sreg
.constructor initclock
.proc _clock .proc _clock
@@ -21,8 +23,7 @@
.endproc .endproc
.constructor initclock .segment "INIT"
initclock: initclock:
lda #0 lda #0
ldx #3 ldx #3

View File

@@ -1,14 +1,16 @@
.include "pce.inc" .include "pce.inc"
.include "extzp.inc" .include "extzp.inc"
.import vce_init .import vce_init
.import psg_init .import psg_init
.import vdc_init .import colors
.importzp ptr1, tmp1
.constructor initconio .constructor initconio
.macpack longbranch .macpack longbranch
.segment "INIT"
initconio: initconio:
jsr vce_init jsr vce_init
jsr psg_init jsr psg_init
@@ -20,7 +22,6 @@ initconio:
st2 #>$0088 st2 #>$0088
rts rts
.import colors
set_palette: set_palette:
stz VCE_ADDR_LO stz VCE_ADDR_LO
stz VCE_ADDR_HI stz VCE_ADDR_HI
@@ -48,11 +49,6 @@ set_palette:
rts rts
;----------------------------------------------------------------------------
;
;----------------------------------------------------------------------------
.importzp ptr1, tmp1
conio_init: conio_init:
; Load font ; Load font
st0 #VDC_MAWR st0 #VDC_MAWR
@@ -80,13 +76,11 @@ conio_init:
sta tmp1 sta tmp1
jsr copy jsr copy
ldx #0 ldx #0
stx BGCOLOR stx BGCOLOR
inx inx
stx CHARCOLOR stx CHARCOLOR
rts rts
copy: copy:

View File

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

View File

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