diff --git a/include/apple2.h b/include/apple2.h index dbed3364d..57d7086ce 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -207,6 +207,8 @@ void rebootafterexit (void); #define _textcolor(color) COLOR_WHITE #define _bgcolor(color) COLOR_BLACK #define _bordercolor(color) COLOR_BLACK +#define _cpeekcolor() COLOR_WHITE +#define _cpeekrevers() 0 diff --git a/include/conio.h b/include/conio.h index 72421af86..bac20e3c5 100644 --- a/include/conio.h +++ b/include/conio.h @@ -201,16 +201,19 @@ void __fastcall__ cputhex16 (unsigned val); */ #ifdef _textcolor -# define textcolor(x) _textcolor(x) +# define textcolor(color) _textcolor(color) #endif #ifdef _bgcolor -# define bgcolor(x) _bgcolor(x) +# define bgcolor(color) _bgcolor(color) #endif #ifdef _bordercolor -# define bordercolor(x) _bordercolor(x) +# define bordercolor(color) _bordercolor(color) #endif #ifdef _cpeekcolor -# define cpeekcolor(x) _cpeekcolor(x) +# define cpeekcolor() _cpeekcolor() +#endif +#ifdef _cpeekrevers +# define cpeekrevers() _cpeekrevers() #endif diff --git a/libsrc/apple2/cpeekc.s b/libsrc/apple2/cpeekc.s new file mode 100644 index 000000000..a547f7867 --- /dev/null +++ b/libsrc/apple2/cpeekc.s @@ -0,0 +1,28 @@ +; +; 2020-07-12, Oliver Schmidt +; +; char cpeekc (void); +; + + .export _cpeekc + + .include "apple2.inc" + +_cpeekc: + ldy CH + .ifdef __APPLE2ENH__ + 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 + bit HISCR ; Assume SET80COL + .endif +peek: lda (BASL),Y ; Get character + .ifdef __APPLE2ENH__ + bit LOWSCR ; Doesn't hurt in 40 column mode + .endif + eor #$80 ; Invert high bit + ldx #$00 + rts