1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 06:30:16 +00:00
cc65/libsrc/apple2/cputc.s
cuz a57deeb58a Reworked version by Oliver Schmidt
git-svn-id: svn://svn.cc65.org/cc65/trunk@2913 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-11 21:54:22 +00:00

82 lines
1.1 KiB
ArmAsm

;
; Ullrich von Bassewitz, 06.08.1998
;
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
.constructor initconio
.export _cputcxy, _cputc
.export _gotoxy, cputdirect
.export newline, putchar
.import popa
.include "apple2.inc"
initconio:
lda #$FF ; Normal character display mode
sta INVFLG
rts
; 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
ora #$80 ; Turn on high bit
cmp #$E0 ; Test for lowercase
bmi cputdirect
and #$DF ; Convert to uppercase
cputdirect:
jsr putchar
inc CH ; Bump to next column
lda CH
cmp WNDWDTH
bne return
lda #$00
sta CH
return:
rts
putchar:
and INVFLG ; Apply normal, inverse, flash
ldy CH
sta (BASL),Y
rts
newline:
lda CH
pha
inc CV
lda CV
cmp WNDBTM
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