2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 06.08.1998
|
|
|
|
;
|
|
|
|
; void cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void cputc (char c);
|
|
|
|
;
|
|
|
|
|
2004-03-11 21:54:22 +00:00
|
|
|
.constructor initconio
|
2000-05-28 13:40:48 +00:00
|
|
|
.export _cputcxy, _cputc
|
|
|
|
.export _gotoxy, cputdirect
|
|
|
|
.export newline, putchar
|
|
|
|
|
|
|
|
.import popa
|
|
|
|
|
|
|
|
.include "apple2.inc"
|
|
|
|
|
2004-03-11 21:54:22 +00:00
|
|
|
initconio:
|
|
|
|
lda #$FF ; Normal character display mode
|
|
|
|
sta INVFLG
|
|
|
|
rts
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
; Plot a character - also used as internal function
|
|
|
|
|
|
|
|
_cputcxy:
|
|
|
|
pha ; Save C
|
|
|
|
jsr popa ; Get Y
|
|
|
|
jsr _gotoxy
|
|
|
|
pla ; Restore C
|
|
|
|
|
|
|
|
_cputc:
|
|
|
|
cmp #$0D ; Test for \r = carrage return
|
|
|
|
bne L1
|
|
|
|
lda #$00 ; Goto left edge of screen
|
|
|
|
sta CH
|
|
|
|
rts ; That's all we do
|
|
|
|
L1:
|
|
|
|
cmp #$0A ; Test for \n = line feed
|
|
|
|
beq newline
|
2004-03-11 21:54:22 +00:00
|
|
|
ora #$80 ; Turn on high bit
|
|
|
|
cmp #$E0 ; Test for lowercase
|
|
|
|
bmi cputdirect
|
|
|
|
and #$DF ; Convert to uppercase
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
cputdirect:
|
|
|
|
jsr putchar
|
2004-03-11 21:54:22 +00:00
|
|
|
inc CH ; Bump to next column
|
2000-05-28 13:40:48 +00:00
|
|
|
lda CH
|
2004-03-11 21:54:22 +00:00
|
|
|
cmp WNDWDTH
|
2000-05-28 13:40:48 +00:00
|
|
|
bne return
|
|
|
|
lda #$00
|
|
|
|
sta CH
|
|
|
|
return:
|
|
|
|
rts
|
|
|
|
|
|
|
|
putchar:
|
2004-03-11 21:54:22 +00:00
|
|
|
and INVFLG ; Apply normal, inverse, flash
|
2000-05-28 13:40:48 +00:00
|
|
|
ldy CH
|
2004-03-11 21:54:22 +00:00
|
|
|
sta (BASL),Y
|
2000-05-28 13:40:48 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
newline:
|
|
|
|
lda CH
|
|
|
|
pha
|
|
|
|
inc CV
|
|
|
|
lda CV
|
2004-03-11 21:54:22 +00:00
|
|
|
cmp WNDBTM
|
2000-05-28 13:40:48 +00:00
|
|
|
bne L2
|
|
|
|
lda #$00
|
|
|
|
sta CV
|
|
|
|
L2:
|
|
|
|
jsr VTABZ
|
|
|
|
pla
|
|
|
|
sta CH
|
|
|
|
rts
|
|
|
|
|
|
|
|
_gotoxy:
|
|
|
|
sta CV ; Store Y
|
|
|
|
jsr VTABZ
|
|
|
|
jsr popa ; Get X
|
|
|
|
sta CH ; Store X
|
|
|
|
rts
|