Interrupt handlers rather likely access text screen holes. Especially MSLOT is obligatory for every interrupt handler that requires access to an extension ROM ($C800-$CFFE) in order to be able to re-enable the extension ROM that was enabled when the interrupt occured. Those text screen holes only hold valid values in main memory so interrupts must be disabled while the aux memory text screen is mapped.
34 lines
884 B
ArmAsm
34 lines
884 B
ArmAsm
;
|
|
; 2020-07-12, Oliver Schmidt
|
|
;
|
|
; char cpeekc (void);
|
|
;
|
|
|
|
.export _cpeekc
|
|
|
|
.include "apple2.inc"
|
|
|
|
_cpeekc:
|
|
ldy CH
|
|
.ifdef __APPLE2ENH__
|
|
sec ; Assume main memory
|
|
bit RD80VID ; In 80 column mode?
|
|
bpl peek ; No, just go ahead
|
|
tya
|
|
lsr ; Div by 2
|
|
tay
|
|
bcs peek ; Odd cols are in main memory
|
|
php
|
|
sei ; No valid MSLOT et al. in aux memory
|
|
bit HISCR ; Assume SET80COL
|
|
.endif
|
|
peek: lda (BASL),Y ; Get character
|
|
.ifdef __APPLE2ENH__
|
|
bcs :+ ; In main memory
|
|
bit LOWSCR
|
|
plp
|
|
: .endif
|
|
eor #$80 ; Invert high bit
|
|
ldx #>$0000
|
|
rts
|