New code from Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@3351 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-01-06 12:26:47 +00:00
parent 2ebb276929
commit 8188795240
15 changed files with 123 additions and 144 deletions

View File

@@ -6,10 +6,7 @@
.export screensize
.proc screensize
screensize:
ldx #40
ldy #24
rts
.endproc

View File

@@ -20,10 +20,10 @@ _chline:
chlinedirect:
cmp #$00 ; Is the length zero?
beq L9 ; Jump if done
beq done ; Jump if done
sta tmp1
L1: txa ; Screen code
: txa ; Screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: rts
bne :-
done: rts

View File

@@ -31,16 +31,12 @@ _cputcxy:
_cputc:
cmp #$0D ; Test for \r = carrage return
bne L1
lda #$00 ; Goto left edge of screen
sta CH
rts ; That's all we do
L1:
beq left
cmp #$0A ; Test for \n = line feed
beq newline
ora #$80 ; Turn on high bit
cmp #$E0 ; Test for lowercase
bmi cputdirect
bcc cputdirect
and #$DF ; Convert to uppercase
cputdirect:
@@ -48,33 +44,27 @@ cputdirect:
inc CH ; Bump to next column
lda CH
cmp #40
bne return
lda #$00
bne done
left: lda #$00 ; Goto left edge of screen
sta CH
return:
rts
done: rts
newline:
inc CV
lda CV
cmp #24
bne :+
lda #$00
sta CV
: jsr BASCALC
rts
putchar:
and INVFLG ; Apply normal, inverse, flash
ldy CH
sta (BASL),Y
rts
newline:
lda CH
pha
inc CV
lda CV
cmp #24
bne L2
lda #$00
sta CV
L2:
jsr BASCALC
pla
sta CH
rts
_gotoxy:
sta CV ; Store Y
jsr BASCALC

View File

@@ -20,11 +20,11 @@ _cvline:
cvlinedirect:
cmp #$00 ; Is the length zero?
beq L9 ; Jump if done
beq done ; Jump if done
sta tmp1
L1: txa ; Screen code
: txa ; Screen code
jsr putchar ; Write, no cursor advance
jsr newline ; Advance cursor to next line
dec tmp1
bne L1
L9: rts
bne :-
done: rts

View File

@@ -19,7 +19,6 @@
; ProDOS 2.0.2 $22
; ProDOS 2.0.3 $23
.constructor initdostype
.export __dos_type
@@ -36,9 +35,9 @@ initdostype:
bne done
lda $BFFF ; ProDOS KVERSION
cmp #$10
bpl L1
bcs :+
ora #$10 ; Make high nibble match major version
L1: sta __dos_type
: sta __dos_type
done: rts
.bss

View File

@@ -1,52 +1,70 @@
;
; Stefan Haubenthal, Jul 12 2003
; Oliver Schmidt, 04.01.2005
;
; unsigned char get_ostype(void)
;
.constructor initostype
.export _get_ostype, ostype
.export _get_ostype
; Identify machine according to:
; "Apple II Miscellaneous TechNote #7: Apple II Family Identification"
initostype:
ldx #$01 ; Start out with a plain Apple ][
lda $FBB3
cmp #$38
beq identified
inx ; It's at least an Apple ][+
cmp #$EA
bne apple2e
lda $FB1E
cmp #$AD
beq identified
inx ; It's an Apple /// in emulation mode
bne identified ; Branch always
apple2e:
ldx #$04 ; It's at least an Apple //e
lda $FBC0
cmp #$EA
beq identified
inx ; It's at least an enhanced Apple //e
cmp #$E0
bne apple2c
lda $FBDD
cmp #$02
bne identified
inx ; It's an Apple //e Option Card
bne identified ; Branch always
apple2c:
ldx #$07 ; It's an Apple //c
identified:
stx ostype
sec
jsr $FE1F
bcs nogs
tya
ora #$80
done: sta ostype
rts
nogs: ldx #$FF
next: inx
lda value,x
ldy index,x
beq done ; $00 is no valid index
cmp $FB00,y
beq next
: inx
ldy index,x
bne :-
beq next ; Branch always
_get_ostype:
lda ostype
ldx #$00
rts
.rodata
index: .byte $B3, $00 ; Apple ][
.byte $B3, $1E, $00 ; Apple ][+
.byte $B3, $1E, $00 ; Apple /// (emulation)
.byte $B3, $C0, $00 ; Apple //e
.byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card
.byte $B3, $C0, $00 ; Apple //e (enhanced)
.byte $B3, $C0, $BF, $00 ; Apple //c
.byte $B3, $C0, $BF, $00 ; Apple //c (3.5 ROM)
.byte $B3, $C0, $BF, $00 ; Apple //c (Mem. Exp.)
.byte $B3, $C0, $BF, $00 ; Apple //c (Rev. Mem. Exp.)
.byte $B3, $C0, $BF, $00 ; Apple //c Plus
.byte $00
value: .byte $38, $10 ; Apple ][
.byte $EA, $AD, $11 ; Apple ][+
.byte $EA, $8A, $20 ; Apple /// (emulation)
.byte $06, $EA, $30 ; Apple //e
.byte $06, $E0, $02, $00, $40 ; Apple //e Option Card
.byte $06, $E0, $31 ; Apple //e (enhanced)
.byte $06, $00, $FF, $50 ; Apple //c
.byte $06, $00, $00, $51 ; Apple //c (3.5 ROM)
.byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.)
.byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.)
.byte $06, $00, $05, $55 ; Apple //c Plus
.byte $00
.bss
ostype: .res 1

View File

@@ -13,16 +13,9 @@
.importzp sreg
.code
.proc __systime
__systime:
lda #$FF
tax
sta sreg
sta sreg+1
rts ; Return -1
.endproc

View File

@@ -7,11 +7,7 @@
.include "apple2.inc"
.proc _wherex
_wherex:
lda CH
ldx #$00
rts
.endproc

View File

@@ -7,11 +7,7 @@
.include "apple2.inc"
.proc _wherey
_wherey:
lda CV
ldx #$00
rts
.endproc