2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 06.08.1998
|
|
|
|
;
|
2005-03-26 17:03:30 +00:00
|
|
|
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void __fastcall__ cputc (char c);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
2011-01-29 21:36:18 +00:00
|
|
|
.constructor initconio
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
2005-04-01 09:59:53 +00:00
|
|
|
.export _cputcxy, _cputc
|
2016-06-19 13:03:20 +00:00
|
|
|
.export cputdirect, newline, putchar, putchardirect
|
2016-06-05 12:58:38 +00:00
|
|
|
.import gotoxy, VTABZ
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-04-01 09:59:53 +00:00
|
|
|
.include "apple2.inc"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-03-06 20:26:22 +00:00
|
|
|
.segment "ONCE"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
2004-03-11 21:54:22 +00:00
|
|
|
initconio:
|
2005-04-21 02:08:29 +00:00
|
|
|
sta SETALTCHAR ; Switch in alternate charset
|
2013-05-09 11:56:54 +00:00
|
|
|
bit LORES ; Limit SET80COL-HISCR to text
|
2005-03-26 17:03:30 +00:00
|
|
|
rts
|
|
|
|
.endif
|
2004-03-11 21:54:22 +00:00
|
|
|
|
2005-03-26 17:03:30 +00:00
|
|
|
.code
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-03-26 17:03:30 +00:00
|
|
|
; Plot a character - also used as internal function
|
2005-02-26 09:34:01 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
_cputcxy:
|
2005-04-01 09:59:53 +00:00
|
|
|
pha ; Save C
|
2016-06-05 12:58:38 +00:00
|
|
|
jsr gotoxy ; Call this one, will pop params
|
|
|
|
pla ; Restore C and run into _cputc
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_cputc:
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$0D ; Test for \r = carrage return
|
2005-04-01 09:59:53 +00:00
|
|
|
beq left
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$0A ; Test for \n = line feed
|
2005-04-01 09:59:53 +00:00
|
|
|
beq newline
|
2018-08-19 21:40:50 +00:00
|
|
|
eor #$80 ; Invert high bit
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifndef __APPLE2ENH__
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$E0 ; Test for lowercase
|
2005-04-01 09:59:53 +00:00
|
|
|
bcc cputdirect
|
2005-04-21 02:08:29 +00:00
|
|
|
and #$DF ; Convert to uppercase
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
cputdirect:
|
2005-04-01 09:59:53 +00:00
|
|
|
jsr putchar
|
2005-04-21 02:08:29 +00:00
|
|
|
inc CH ; Bump to next column
|
2005-04-01 09:59:53 +00:00
|
|
|
lda CH
|
|
|
|
cmp WNDWDTH
|
|
|
|
bcc :+
|
2018-08-19 22:22:45 +00:00
|
|
|
jsr newline
|
2005-04-21 02:08:29 +00:00
|
|
|
left: lda #$00 ; Goto left edge of screen
|
2005-04-01 09:59:53 +00:00
|
|
|
sta CH
|
2005-03-26 17:03:30 +00:00
|
|
|
: rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
newline:
|
2005-04-21 02:08:29 +00:00
|
|
|
inc CV ; Bump to next line
|
2005-04-01 09:59:53 +00:00
|
|
|
lda CV
|
|
|
|
cmp WNDBTM
|
|
|
|
bcc :+
|
2005-04-21 02:08:29 +00:00
|
|
|
lda WNDTOP ; Goto top of screen
|
2005-04-01 09:59:53 +00:00
|
|
|
sta CV
|
|
|
|
: jmp VTABZ
|
2016-06-19 13:03:20 +00:00
|
|
|
|
2005-02-26 09:34:01 +00:00
|
|
|
putchar:
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
|
|
|
ldy INVFLG
|
2005-04-21 02:08:29 +00:00
|
|
|
cpy #$FF ; Normal character display mode?
|
2016-06-19 13:03:20 +00:00
|
|
|
beq putchardirect
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$E0 ; Lowercase?
|
2005-04-01 09:59:53 +00:00
|
|
|
bcc mask
|
2005-04-21 02:08:29 +00:00
|
|
|
and #$7F ; Inverse lowercase
|
2016-06-19 13:03:20 +00:00
|
|
|
bra putchardirect
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
2005-04-21 02:08:29 +00:00
|
|
|
mask: and INVFLG ; Apply normal, inverse, flash
|
2016-06-19 13:03:20 +00:00
|
|
|
|
|
|
|
putchardirect:
|
|
|
|
pha
|
|
|
|
ldy CH
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
2005-04-21 02:08:29 +00:00
|
|
|
bit RD80VID ; In 80 column mode?
|
2016-06-19 13:03:20 +00:00
|
|
|
bpl put ; No, just go ahead
|
2005-03-26 17:03:30 +00:00
|
|
|
tya
|
2005-04-01 09:59:53 +00:00
|
|
|
lsr ; Div by 2
|
2005-03-26 17:03:30 +00:00
|
|
|
tay
|
2016-06-19 13:03:20 +00:00
|
|
|
bcs put ; Odd cols go in main memory
|
2005-04-21 02:08:29 +00:00
|
|
|
bit HISCR ; Assume SET80COL
|
2016-06-19 13:03:20 +00:00
|
|
|
.endif
|
|
|
|
put: lda (BASL),Y ; Get current character
|
|
|
|
tax ; Return old character for _cgetc
|
|
|
|
pla
|
2005-04-01 09:59:53 +00:00
|
|
|
sta (BASL),Y
|
2016-06-19 13:03:20 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
|
|
|
bit LOWSCR ; Doesn't hurt in 40 column mode
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
|
|
|
rts
|