mirror of
https://github.com/cc65/cc65.git
synced 2025-01-14 00:32:08 +00:00
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:
parent
2ebb276929
commit
8188795240
@ -74,14 +74,21 @@
|
|||||||
#define CH_CROSS '+'
|
#define CH_CROSS '+'
|
||||||
|
|
||||||
/* Return codes for get_ostype */
|
/* Return codes for get_ostype */
|
||||||
#define APPLE_IIPLAIN 0x01 /* Plain Apple ][ */
|
#define APPLE_UNKNOWN 0x00
|
||||||
#define APPLE_IIPLUS 0x02 /* Apple ][+ */
|
#define APPLE_II 0x10 /* Apple ][ */
|
||||||
#define APPLE_IIIEM 0x03 /* Apple /// in emulation mode */
|
#define APPLE_IIPLUS 0x11 /* Apple ][+ */
|
||||||
#define APPLE_IIE 0x04 /* Apple //e */
|
#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */
|
||||||
#define APPLE_IIEENH 0x05 /* Enhanced Apple //e */
|
#define APPLE_IIE 0x30 /* Apple //e */
|
||||||
#define APPLE_IIECARD 0x06 /* Apple //e Option Card */
|
#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */
|
||||||
#define APPLE_IIC 0x07 /* Apple //c */
|
#define APPLE_IIECARD 0x40 /* Apple //e Option Card */
|
||||||
|
#define APPLE_IIC 0x50 /* Apple //c */
|
||||||
|
#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */
|
||||||
|
#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */
|
||||||
|
#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */
|
||||||
|
#define APPLE_IICPLUS 0x55 /* Apple //c Plus */
|
||||||
|
#define APPLE_IIGS 0x80 /* Apple IIgs */
|
||||||
|
#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */
|
||||||
|
#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
|
|
||||||
.export screensize
|
.export screensize
|
||||||
|
|
||||||
.proc screensize
|
screensize:
|
||||||
|
|
||||||
ldx #40
|
ldx #40
|
||||||
ldy #24
|
ldy #24
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
@ -20,10 +20,10 @@ _chline:
|
|||||||
|
|
||||||
chlinedirect:
|
chlinedirect:
|
||||||
cmp #$00 ; Is the length zero?
|
cmp #$00 ; Is the length zero?
|
||||||
beq L9 ; Jump if done
|
beq done ; Jump if done
|
||||||
sta tmp1
|
sta tmp1
|
||||||
L1: txa ; Screen code
|
: txa ; Screen code
|
||||||
jsr cputdirect ; Direct output
|
jsr cputdirect ; Direct output
|
||||||
dec tmp1
|
dec tmp1
|
||||||
bne L1
|
bne :-
|
||||||
L9: rts
|
done: rts
|
||||||
|
@ -31,16 +31,12 @@ _cputcxy:
|
|||||||
|
|
||||||
_cputc:
|
_cputc:
|
||||||
cmp #$0D ; Test for \r = carrage return
|
cmp #$0D ; Test for \r = carrage return
|
||||||
bne L1
|
beq left
|
||||||
lda #$00 ; Goto left edge of screen
|
|
||||||
sta CH
|
|
||||||
rts ; That's all we do
|
|
||||||
L1:
|
|
||||||
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
|
||||||
bmi cputdirect
|
bcc cputdirect
|
||||||
and #$DF ; Convert to uppercase
|
and #$DF ; Convert to uppercase
|
||||||
|
|
||||||
cputdirect:
|
cputdirect:
|
||||||
@ -48,33 +44,27 @@ cputdirect:
|
|||||||
inc CH ; Bump to next column
|
inc CH ; Bump to next column
|
||||||
lda CH
|
lda CH
|
||||||
cmp #40
|
cmp #40
|
||||||
bne return
|
bne done
|
||||||
lda #$00
|
left: lda #$00 ; Goto left edge of screen
|
||||||
sta CH
|
sta CH
|
||||||
return:
|
done: rts
|
||||||
rts
|
|
||||||
|
|
||||||
|
newline:
|
||||||
|
inc CV
|
||||||
|
lda CV
|
||||||
|
cmp #24
|
||||||
|
bne :+
|
||||||
|
lda #$00
|
||||||
|
sta CV
|
||||||
|
: jsr 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
|
||||||
|
|
||||||
newline:
|
|
||||||
lda CH
|
|
||||||
pha
|
|
||||||
inc CV
|
|
||||||
lda CV
|
|
||||||
cmp #24
|
|
||||||
bne L2
|
|
||||||
lda #$00
|
|
||||||
sta CV
|
|
||||||
L2:
|
|
||||||
jsr BASCALC
|
|
||||||
pla
|
|
||||||
sta CH
|
|
||||||
rts
|
|
||||||
|
|
||||||
_gotoxy:
|
_gotoxy:
|
||||||
sta CV ; Store Y
|
sta CV ; Store Y
|
||||||
jsr BASCALC
|
jsr BASCALC
|
||||||
|
@ -20,11 +20,11 @@ _cvline:
|
|||||||
|
|
||||||
cvlinedirect:
|
cvlinedirect:
|
||||||
cmp #$00 ; Is the length zero?
|
cmp #$00 ; Is the length zero?
|
||||||
beq L9 ; Jump if done
|
beq done ; Jump if done
|
||||||
sta tmp1
|
sta tmp1
|
||||||
L1: txa ; Screen code
|
: txa ; Screen code
|
||||||
jsr putchar ; Write, no cursor advance
|
jsr putchar ; Write, no cursor advance
|
||||||
jsr newline ; Advance cursor to next line
|
jsr newline ; Advance cursor to next line
|
||||||
dec tmp1
|
dec tmp1
|
||||||
bne L1
|
bne :-
|
||||||
L9: rts
|
done: rts
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
; ProDOS 2.0.2 $22
|
; ProDOS 2.0.2 $22
|
||||||
; ProDOS 2.0.3 $23
|
; ProDOS 2.0.3 $23
|
||||||
|
|
||||||
|
|
||||||
.constructor initdostype
|
.constructor initdostype
|
||||||
.export __dos_type
|
.export __dos_type
|
||||||
|
|
||||||
@ -36,9 +35,9 @@ initdostype:
|
|||||||
bne done
|
bne done
|
||||||
lda $BFFF ; ProDOS KVERSION
|
lda $BFFF ; ProDOS KVERSION
|
||||||
cmp #$10
|
cmp #$10
|
||||||
bpl L1
|
bcs :+
|
||||||
ora #$10 ; Make high nibble match major version
|
ora #$10 ; Make high nibble match major version
|
||||||
L1: sta __dos_type
|
: sta __dos_type
|
||||||
done: rts
|
done: rts
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
@ -1,52 +1,70 @@
|
|||||||
;
|
;
|
||||||
; Stefan Haubenthal, Jul 12 2003
|
; Oliver Schmidt, 04.01.2005
|
||||||
;
|
;
|
||||||
; unsigned char get_ostype(void)
|
; unsigned char get_ostype(void)
|
||||||
;
|
;
|
||||||
|
|
||||||
.constructor initostype
|
.constructor initostype
|
||||||
.export _get_ostype, ostype
|
.export _get_ostype
|
||||||
|
|
||||||
; 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"
|
||||||
|
|
||||||
initostype:
|
initostype:
|
||||||
ldx #$01 ; Start out with a plain Apple ][
|
sec
|
||||||
lda $FBB3
|
jsr $FE1F
|
||||||
cmp #$38
|
bcs nogs
|
||||||
beq identified
|
tya
|
||||||
inx ; It's at least an Apple ][+
|
ora #$80
|
||||||
cmp #$EA
|
done: sta ostype
|
||||||
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
|
|
||||||
rts
|
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:
|
_get_ostype:
|
||||||
lda ostype
|
lda ostype
|
||||||
ldx #$00
|
ldx #$00
|
||||||
rts
|
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
|
.bss
|
||||||
|
|
||||||
ostype: .res 1
|
ostype: .res 1
|
||||||
|
@ -13,16 +13,9 @@
|
|||||||
|
|
||||||
.importzp sreg
|
.importzp sreg
|
||||||
|
|
||||||
.code
|
__systime:
|
||||||
|
|
||||||
.proc __systime
|
|
||||||
|
|
||||||
lda #$FF
|
lda #$FF
|
||||||
tax
|
tax
|
||||||
sta sreg
|
sta sreg
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
rts ; Return -1
|
rts ; Return -1
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,11 +7,7 @@
|
|||||||
|
|
||||||
.include "apple2.inc"
|
.include "apple2.inc"
|
||||||
|
|
||||||
.proc _wherex
|
_wherex:
|
||||||
|
|
||||||
lda CH
|
lda CH
|
||||||
ldx #$00
|
ldx #$00
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
|
@ -7,11 +7,7 @@
|
|||||||
|
|
||||||
.include "apple2.inc"
|
.include "apple2.inc"
|
||||||
|
|
||||||
.proc _wherey
|
_wherey:
|
||||||
|
|
||||||
lda CV
|
lda CV
|
||||||
ldx #$00
|
ldx #$00
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
|
@ -8,11 +8,7 @@
|
|||||||
|
|
||||||
.include "../apple2/apple2.inc"
|
.include "../apple2/apple2.inc"
|
||||||
|
|
||||||
.proc screensize
|
screensize:
|
||||||
|
|
||||||
ldx WNDWDTH
|
ldx WNDWDTH
|
||||||
ldy #24
|
ldy #24
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ _chline:
|
|||||||
|
|
||||||
chlinedirect:
|
chlinedirect:
|
||||||
cmp #$00 ; Is the length zero?
|
cmp #$00 ; Is the length zero?
|
||||||
beq L9 ; Jump if done
|
beq done ; Jump if done
|
||||||
sta tmp1
|
sta tmp1
|
||||||
L1: txa ; Screen code
|
: txa ; Screen code
|
||||||
jsr cputdirect ; Direct output
|
jsr cputdirect ; Direct output
|
||||||
dec tmp1
|
dec tmp1
|
||||||
bne L1
|
bne :-
|
||||||
L9: rts
|
done: rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
.include "../apple2/apple2.inc"
|
.include "../apple2/apple2.inc"
|
||||||
|
|
||||||
|
|
||||||
initconio:
|
initconio:
|
||||||
lda #$FF ; Normal character display mode
|
lda #$FF ; Normal character display mode
|
||||||
sta INVFLG
|
sta INVFLG
|
||||||
@ -33,10 +32,7 @@ _cputcxy:
|
|||||||
|
|
||||||
_cputc:
|
_cputc:
|
||||||
cmp #$0D ; Test for \r = carrage return
|
cmp #$0D ; Test for \r = carrage return
|
||||||
bne L1
|
beq left
|
||||||
stz CH ; Goto left edge of screen
|
|
||||||
rts ; That's all we do
|
|
||||||
L1:
|
|
||||||
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
|
||||||
@ -46,9 +42,18 @@ cputdirect:
|
|||||||
inc CH ; Bump to next column
|
inc CH ; Bump to next column
|
||||||
lda CH
|
lda CH
|
||||||
cmp WNDWDTH
|
cmp WNDWDTH
|
||||||
bne return
|
bne done
|
||||||
stz CH
|
left: stz CH ; Goto left edge of screen
|
||||||
return:
|
done: rts
|
||||||
|
|
||||||
|
newline:
|
||||||
|
inc CV
|
||||||
|
lda CV
|
||||||
|
cmp #24
|
||||||
|
bne :+
|
||||||
|
lda #$00
|
||||||
|
sta CV
|
||||||
|
: jsr BASCALC
|
||||||
rts
|
rts
|
||||||
|
|
||||||
putchar:
|
putchar:
|
||||||
@ -56,13 +61,11 @@ putchar:
|
|||||||
cpy #$FF ; Normal character display mode?
|
cpy #$FF ; Normal character display mode?
|
||||||
beq put
|
beq put
|
||||||
cmp #$E0 ; Lowercase?
|
cmp #$E0 ; Lowercase?
|
||||||
bmi mask
|
bcc mask
|
||||||
and #$7F ; Inverse lowercase
|
and #$7F ; Inverse lowercase
|
||||||
bra put
|
bra put
|
||||||
mask:
|
mask: and INVFLG ; Apply normal, inverse, flash
|
||||||
and INVFLG ; Apply normal, inverse, flash
|
put: ldy CH
|
||||||
put:
|
|
||||||
ldy CH
|
|
||||||
bit RD80VID ; In 80 column mode?
|
bit RD80VID ; In 80 column mode?
|
||||||
bpl col40 ; No, in 40 cols
|
bpl col40 ; No, in 40 cols
|
||||||
pha
|
pha
|
||||||
@ -75,23 +78,7 @@ put:
|
|||||||
sta (BASL),Y
|
sta (BASL),Y
|
||||||
bit LOWSCR
|
bit LOWSCR
|
||||||
rts
|
rts
|
||||||
col40:
|
col40: sta (BASL),Y
|
||||||
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
|
rts
|
||||||
|
|
||||||
_gotoxy:
|
_gotoxy:
|
||||||
|
@ -20,11 +20,11 @@ _cvline:
|
|||||||
|
|
||||||
cvlinedirect:
|
cvlinedirect:
|
||||||
cmp #$00 ; Is the length zero?
|
cmp #$00 ; Is the length zero?
|
||||||
beq L9 ; Jump if done
|
beq done ; Jump if done
|
||||||
sta tmp1
|
sta tmp1
|
||||||
L1: txa ; Screen code
|
: txa ; Screen code
|
||||||
jsr putchar ; Write, no cursor advance
|
jsr putchar ; Write, no cursor advance
|
||||||
jsr newline ; Advance cursor to next line
|
jsr newline ; Advance cursor to next line
|
||||||
dec tmp1
|
dec tmp1
|
||||||
bne L1
|
bne :-
|
||||||
L9: rts
|
done: rts
|
||||||
|
@ -47,15 +47,15 @@ noxy: sta XORIGIN
|
|||||||
plx ; Restore index
|
plx ; Restore index
|
||||||
loop: lda XOFFS,x
|
loop: lda XOFFS,x
|
||||||
clc
|
clc
|
||||||
bpl L1 ; Relative to left edge?
|
bpl :+ ; Relative to left edge?
|
||||||
adc WIDTH
|
adc WIDTH
|
||||||
L1: adc XORIGIN
|
: adc XORIGIN
|
||||||
jsr pusha
|
jsr pusha
|
||||||
lda YOFFS,x
|
lda YOFFS,x
|
||||||
clc
|
clc
|
||||||
bpl L2 ; Relative to top?
|
bpl :+ ; Relative to top?
|
||||||
adc HEIGHT
|
adc HEIGHT
|
||||||
L2: adc YORIGIN
|
: adc YORIGIN
|
||||||
jsr _gotoxy ; Call this one, will pop params
|
jsr _gotoxy ; Call this one, will pop params
|
||||||
txa
|
txa
|
||||||
tay
|
tay
|
||||||
|
Loading…
x
Reference in New Issue
Block a user