mirror of
https://github.com/cc65/cc65.git
synced 2024-12-26 08:32:00 +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 '+'
|
||||
|
||||
/* Return codes for get_ostype */
|
||||
#define APPLE_IIPLAIN 0x01 /* Plain Apple ][ */
|
||||
#define APPLE_IIPLUS 0x02 /* Apple ][+ */
|
||||
#define APPLE_IIIEM 0x03 /* Apple /// in emulation mode */
|
||||
#define APPLE_IIE 0x04 /* Apple //e */
|
||||
#define APPLE_IIEENH 0x05 /* Enhanced Apple //e */
|
||||
#define APPLE_IIECARD 0x06 /* Apple //e Option Card */
|
||||
#define APPLE_IIC 0x07 /* Apple //c */
|
||||
|
||||
#define APPLE_UNKNOWN 0x00
|
||||
#define APPLE_II 0x10 /* Apple ][ */
|
||||
#define APPLE_IIPLUS 0x11 /* Apple ][+ */
|
||||
#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */
|
||||
#define APPLE_IIE 0x30 /* Apple //e */
|
||||
#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */
|
||||
#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
|
||||
|
||||
.proc screensize
|
||||
|
||||
screensize:
|
||||
ldx #40
|
||||
ldy #24
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -13,16 +13,9 @@
|
||||
|
||||
.importzp sreg
|
||||
|
||||
.code
|
||||
|
||||
.proc __systime
|
||||
|
||||
__systime:
|
||||
lda #$FF
|
||||
tax
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts ; Return -1
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
@ -7,11 +7,7 @@
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.proc _wherex
|
||||
|
||||
_wherex:
|
||||
lda CH
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -7,11 +7,7 @@
|
||||
|
||||
.include "apple2.inc"
|
||||
|
||||
.proc _wherey
|
||||
|
||||
_wherey:
|
||||
lda CV
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -8,11 +8,7 @@
|
||||
|
||||
.include "../apple2/apple2.inc"
|
||||
|
||||
.proc screensize
|
||||
|
||||
screensize:
|
||||
ldx WNDWDTH
|
||||
ldy #24
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -26,13 +26,13 @@ _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
|
||||
|
||||
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
.include "../apple2/apple2.inc"
|
||||
|
||||
|
||||
initconio:
|
||||
lda #$FF ; Normal character display mode
|
||||
sta INVFLG
|
||||
@ -33,10 +32,7 @@ _cputcxy:
|
||||
|
||||
_cputc:
|
||||
cmp #$0D ; Test for \r = carrage return
|
||||
bne L1
|
||||
stz CH ; Goto left edge of screen
|
||||
rts ; That's all we do
|
||||
L1:
|
||||
beq left
|
||||
cmp #$0A ; Test for \n = line feed
|
||||
beq newline
|
||||
ora #$80 ; Turn on high bit
|
||||
@ -46,9 +42,18 @@ cputdirect:
|
||||
inc CH ; Bump to next column
|
||||
lda CH
|
||||
cmp WNDWDTH
|
||||
bne return
|
||||
stz CH
|
||||
return:
|
||||
bne done
|
||||
left: stz CH ; Goto left edge of screen
|
||||
done: rts
|
||||
|
||||
newline:
|
||||
inc CV
|
||||
lda CV
|
||||
cmp #24
|
||||
bne :+
|
||||
lda #$00
|
||||
sta CV
|
||||
: jsr BASCALC
|
||||
rts
|
||||
|
||||
putchar:
|
||||
@ -56,13 +61,11 @@ putchar:
|
||||
cpy #$FF ; Normal character display mode?
|
||||
beq put
|
||||
cmp #$E0 ; Lowercase?
|
||||
bmi mask
|
||||
bcc mask
|
||||
and #$7F ; Inverse lowercase
|
||||
bra put
|
||||
mask:
|
||||
and INVFLG ; Apply normal, inverse, flash
|
||||
put:
|
||||
ldy CH
|
||||
mask: and INVFLG ; Apply normal, inverse, flash
|
||||
put: ldy CH
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl col40 ; No, in 40 cols
|
||||
pha
|
||||
@ -75,23 +78,7 @@ put:
|
||||
sta (BASL),Y
|
||||
bit LOWSCR
|
||||
rts
|
||||
col40:
|
||||
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
|
||||
col40: sta (BASL),Y
|
||||
rts
|
||||
|
||||
_gotoxy:
|
||||
|
@ -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
|
||||
|
@ -47,15 +47,15 @@ noxy: sta XORIGIN
|
||||
plx ; Restore index
|
||||
loop: lda XOFFS,x
|
||||
clc
|
||||
bpl L1 ; Relative to left edge?
|
||||
bpl :+ ; Relative to left edge?
|
||||
adc WIDTH
|
||||
L1: adc XORIGIN
|
||||
: adc XORIGIN
|
||||
jsr pusha
|
||||
lda YOFFS,x
|
||||
clc
|
||||
bpl L2 ; Relative to top?
|
||||
bpl :+ ; Relative to top?
|
||||
adc HEIGHT
|
||||
L2: adc YORIGIN
|
||||
: adc YORIGIN
|
||||
jsr _gotoxy ; Call this one, will pop params
|
||||
txa
|
||||
tay
|
||||
|
Loading…
Reference in New Issue
Block a user