Apple2: Make 80-columns support dynamic on apple2 target
Add a machinetype identifier to help us quickly identify Apple //e (bit 7) and //e enhanced (bit 6). Use it in conio functions for 80-columns code instead of relying entirely on the __APPLE2ENH__ target. Move videomode() to the apple2 target, and have it return an error if 80-columns hardware is not available - this is a lie for now, it is considered available on //e enhanced, which may not be true, and not available on //e, which may also be not true. An ulterior patch will make that check correctly. Adapt the box/line drawing characters so that one can use MouseText on the apple2 target if it is available, by defining DYN_DRAW_BOX. No change by default: MouseText is considered available on apple2enh and not available on apple2.
This commit is contained in:
committed by
Oliver Schmidt
parent
cd92e4f0af
commit
816666615b
@@ -5,13 +5,13 @@
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
.constructor initconio
|
||||
.endif
|
||||
.export _cputcxy, _cputc
|
||||
.export cputdirect, newline, putchar, putchardirect
|
||||
.import gotoxy, VTABZ
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
.import machinetype
|
||||
.import uppercasemask
|
||||
.endif
|
||||
|
||||
@@ -22,12 +22,16 @@
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.ifdef __APPLE2ENH__
|
||||
initconio:
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bmi :+
|
||||
rts
|
||||
:
|
||||
.endif
|
||||
sta SETALTCHAR ; Switch in alternate charset
|
||||
bit LORES ; Limit SET80COL-HISCR to text
|
||||
rts
|
||||
.endif
|
||||
|
||||
.code
|
||||
|
||||
@@ -52,14 +56,22 @@ _cputc:
|
||||
|
||||
cputdirect:
|
||||
jsr putchar
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl :+
|
||||
.endif
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl :+
|
||||
inc OURCH ; Bump to next column
|
||||
lda OURCH
|
||||
.ifdef __APPLE2ENH__
|
||||
bra check ; Must leave CH alone
|
||||
: .endif
|
||||
inc CH ; Bump to next column
|
||||
.else
|
||||
jmp check
|
||||
.endif
|
||||
|
||||
: inc CH ; Bump to next column
|
||||
lda CH
|
||||
check: cmp WNDWDTH
|
||||
bcc done
|
||||
@@ -67,13 +79,24 @@ check: cmp WNDWDTH
|
||||
left:
|
||||
.ifdef __APPLE2ENH__
|
||||
stz CH ; Goto left edge of screen
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
lda #$00 ; Goto left edge of screen
|
||||
lda #$00
|
||||
sta CH
|
||||
.endif
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl done
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl done
|
||||
.ifdef __APPLE2ENH__
|
||||
stz OURCH ; Goto left edge of screen
|
||||
.else
|
||||
sta OURCH
|
||||
.endif
|
||||
|
||||
done: rts
|
||||
|
||||
newline:
|
||||
@@ -100,8 +123,14 @@ mask: and INVFLG ; Apply normal, inverse, flash
|
||||
putchardirect:
|
||||
tax
|
||||
ldy CH
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
sec ; Assume main memory
|
||||
|
||||
.ifndef __APPLE2ENH__
|
||||
bit machinetype
|
||||
bpl put
|
||||
.endif
|
||||
|
||||
bit RD80VID ; In 80 column mode?
|
||||
bpl put ; No, just go ahead
|
||||
lda OURCH
|
||||
@@ -111,14 +140,13 @@ putchardirect:
|
||||
php
|
||||
sei ; No valid MSLOT et al. in aux memory
|
||||
bit HISCR ; Assume SET80COL
|
||||
.endif
|
||||
|
||||
put: lda (BASL),Y ; Get current character
|
||||
sta tmp3 ; Save old character for _cgetc
|
||||
txa
|
||||
sta (BASL),Y
|
||||
.ifdef __APPLE2ENH__
|
||||
|
||||
bcs :+ ; In main memory
|
||||
bit LOWSCR
|
||||
plp
|
||||
: .endif
|
||||
rts
|
||||
: rts
|
||||
|
||||
Reference in New Issue
Block a user