2 ; Ullrich von Bassewitz, 06.08.1998
4 ; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
5 ; void __fastcall__ cputc (char c);
11 .export _cputcxy, _cputc
12 .export cputdirect, newline, putchar, putchardirect
21 sta SETALTCHAR ; Switch in alternate charset
22 bit LORES ; Limit SET80COL-HISCR to text
28 ; Plot a character - also used as internal function
32 jsr gotoxy ; Call this one, will pop params
33 pla ; Restore C and run into _cputc
36 cmp #$0D ; Test for \r = carrage return
38 cmp #$0A ; Test for \n = line feed
40 eor #$80 ; Invert high bit
42 cmp #$E0 ; Test for lowercase
44 and #$DF ; Convert to uppercase
49 inc CH ; Bump to next column
54 left: lda #$00 ; Goto left edge of screen
59 inc CV ; Bump to next line
63 lda WNDTOP ; Goto top of screen
70 cpy #$FF ; Normal character display mode?
74 and #$7F ; Inverse lowercase
77 mask: and INVFLG ; Apply normal, inverse, flash
83 bit RD80VID ; In 80 column mode?
84 bpl put ; No, just go ahead
88 bcs put ; Odd cols go in main memory
89 bit HISCR ; Assume SET80COL
91 put: lda (BASL),Y ; Get current character
92 tax ; Return old character for _cgetc
96 bit LOWSCR ; Doesn't hurt in 40 column mode