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:
parent
d0bee35728
commit
8e95d036e3
4 changed files with 69 additions and 45 deletions
|
@ -14,60 +14,66 @@
|
||||||
|
|
||||||
.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
|
||||||
jsr _gotoxy
|
jsr _gotoxy
|
||||||
pla ; Restore C
|
pla ; Restore C
|
||||||
|
|
||||||
_cputc:
|
_cputc:
|
||||||
cmp #$0D ; Test for \r = carrage return
|
cmp #$0D ; Test for \r = carrage return
|
||||||
beq left
|
beq left
|
||||||
cmp #$0A ; Test for \n = line feed
|
cmp #$0A ; Test for \n = line feed
|
||||||
beq newline
|
beq newline
|
||||||
ora #$80 ; Turn on high bit
|
ora #$80 ; Turn on high bit
|
||||||
cmp #$E0 ; Test for lowercase
|
cmp #$E0 ; Test for lowercase
|
||||||
bcc cputdirect
|
bcc cputdirect
|
||||||
and #$DF ; Convert to uppercase
|
and #$DF ; Convert to uppercase
|
||||||
|
|
||||||
cputdirect:
|
cputdirect:
|
||||||
jsr putchar
|
jsr putchar
|
||||||
inc CH ; Bump to next column
|
inc CH ; Bump to next column
|
||||||
lda CH
|
lda CH
|
||||||
cmp #40
|
cmp #40
|
||||||
bne done
|
bne done
|
||||||
left: lda #$00 ; Goto left edge of screen
|
left: lda #$00 ; Goto left edge of screen
|
||||||
sta CH
|
sta CH
|
||||||
done: rts
|
done: rts
|
||||||
|
|
||||||
newline:
|
newline:
|
||||||
inc CV
|
inc CV
|
||||||
lda CV
|
lda CV
|
||||||
cmp #24
|
cmp #24
|
||||||
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
|
ldy CH
|
||||||
ldy CH
|
sta (BASL),Y
|
||||||
sta (BASL),Y
|
rts
|
||||||
rts
|
|
||||||
|
|
||||||
_gotoxy:
|
_gotoxy:
|
||||||
sta CV ; Store Y
|
sta CV ; Store Y
|
||||||
jsr BASCALC
|
jsr BASCALC
|
||||||
jsr popa ; Get X
|
jsr popa ; Get X
|
||||||
sta CH ; Store X
|
sta CH ; Store X
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -40,6 +42,6 @@ initdostype:
|
||||||
: sta __dos_type
|
: sta __dos_type
|
||||||
done: rts
|
done: rts
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
__dos_type: .res 1
|
__dos_type: .res 1
|
||||||
|
|
|
@ -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,13 +35,17 @@ 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
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
index: .byte $B3, $00 ; Apple ][
|
index: .byte $B3, $00 ; Apple ][
|
||||||
.byte $B3, $1E, $00 ; Apple ][+
|
.byte $B3, $1E, $00 ; Apple ][+
|
||||||
|
@ -65,6 +74,6 @@ value: .byte $38, $10 ; Apple ][
|
||||||
.byte $00
|
.byte $00
|
||||||
|
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
ostype: .res 1
|
ostype: .res 1
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
; 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"
|
||||||
|
|
||||||
; Get possible command-line arguments.
|
|
||||||
;
|
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue