Move constructor code into the INIT segment

git-svn-id: svn://svn.cc65.org/cc65/trunk@3406 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2005-02-26 09:34:01 +00:00
parent d0bee35728
commit 8e95d036e3
4 changed files with 69 additions and 45 deletions

View file

@ -14,15 +14,22 @@
.include "apple2.inc" .include "apple2.inc"
; ------------------------------------------------------------------------
; Initialization
.segment "INIT"
initconio: initconio:
lda #$FF ; Normal character display mode lda #$FF ; Normal character display mode
sta INVFLG sta INVFLG
lda #$00 lda #$00
jsr SETWND ; Reset text window to full screen jmp SETWND ; Reset text window to full screen
rts
; ------------------------------------------------------------------------
; Plot a character - also used as internal function ; Plot a character - also used as internal function
.code
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C
jsr popa ; Get Y jsr popa ; Get Y
@ -56,8 +63,7 @@ newline:
bne :+ bne :+
lda #$00 lda #$00
sta CV sta CV
: jsr BASCALC : jmp BASCALC
rts
putchar: putchar:
and INVFLG ; Apply normal, inverse, flash and INVFLG ; Apply normal, inverse, flash

View file

@ -29,6 +29,8 @@
; - "Apple II ProDOS 8 TechNote #023: ProDOS 8 Changes and Minutia" ; - "Apple II ProDOS 8 TechNote #023: ProDOS 8 Changes and Minutia"
; - ProDOS TechRefMan, chapter 5.2.4 ; - ProDOS TechRefMan, chapter 5.2.4
.segment "INIT"
initdostype: initdostype:
lda MLI lda MLI
cmp #$4C ; Is MLI present? (JMP opcode) cmp #$4C ; Is MLI present? (JMP opcode)

View file

@ -10,6 +10,11 @@
; Identify machine according to: ; Identify machine according to:
; "Apple II Miscellaneous TechNote #7: Apple II Family Identification" ; "Apple II Miscellaneous TechNote #7: Apple II Family Identification"
; ------------------------------------------------------------------------
; Initialization
.segment "INIT"
initostype: initostype:
sec sec
jsr $FE1F jsr $FE1F
@ -30,6 +35,10 @@ next: inx
bne :- bne :-
beq next ; Branch always beq next ; Branch always
; ------------------------------------------------------------------------
.code
_get_ostype: _get_ostype:
lda ostype lda ostype
ldx #$00 ldx #$00

View file

@ -35,13 +35,20 @@ BASIC_BUF_LEN = 239
FNAM_LEN = $280 FNAM_LEN = $280
FNAM = $281 FNAM = $281
.assert MAXARGS <= (BASIC_BUF_LEN - 2)/2, error, "Too many arguments"
MAXARGS = 10 ; Maximum number of arguments allowed MAXARGS = 10 ; Maximum number of arguments allowed
REM = $B2 ; BASIC token-code REM = $B2 ; BASIC token-code
NAME_LEN = 15 ; maximum length of command-name NAME_LEN = 15 ; maximum length of command-name
; Get possible command-line arguments. ; Validate sizes
; .if MAXARGS > (BASIC_BUF_LEN - 2)/2
.error "Too many arguments"
.endif
; Get possible command-line arguments. Goes into the special INIT segment,
; which may be reused after the startup code is run
.segment "INIT"
initmainargs: initmainargs:
; Assume that the program was loaded, a moment ago, by the traditional LOAD ; Assume that the program was loaded, a moment ago, by the traditional LOAD