2014-11-29 13:18:48 +00:00
|
|
|
;
|
|
|
|
; void cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void cputc (char c);
|
|
|
|
;
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
.export _cputcxy, _cputc, cputdirect, putchar
|
|
|
|
.export newline, plot
|
|
|
|
.import popa, _gotoxy
|
|
|
|
.import PLOT
|
|
|
|
.import xsize
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
.importzp tmp3,tmp4
|
|
|
|
|
|
|
|
.include "pce.inc"
|
2015-09-19 13:37:39 +00:00
|
|
|
.include "extzp.inc"
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
_cputcxy:
|
2015-08-29 13:58:57 +00:00
|
|
|
pha ; Save C
|
|
|
|
jsr popa ; Get Y
|
|
|
|
jsr _gotoxy ; Set cursor, drop x
|
|
|
|
pla ; Restore C
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
; Plot a character - also used as internal function
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
_cputc: cmp #$0d ; CR?
|
|
|
|
bne L1
|
|
|
|
lda #0
|
|
|
|
sta CURS_X
|
|
|
|
beq plot ; Recalculate pointers
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
L1: cmp #$0a ; LF?
|
|
|
|
beq newline ; Recalculate pointers
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
; Printable char of some sort
|
|
|
|
|
|
|
|
cputdirect:
|
2015-08-29 13:58:57 +00:00
|
|
|
jsr putchar ; Write the character to the screen
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
; Advance cursor position
|
|
|
|
|
|
|
|
advance:
|
2015-08-29 13:58:57 +00:00
|
|
|
ldy CURS_X
|
|
|
|
iny
|
|
|
|
cpy xsize
|
|
|
|
bne L3
|
|
|
|
jsr newline ; new line
|
|
|
|
ldy #0 ; + cr
|
|
|
|
L3: sty CURS_X
|
|
|
|
jmp plot
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
newline:
|
2015-08-29 13:58:57 +00:00
|
|
|
inc CURS_Y
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
; Set cursor position, calculate RAM pointers
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
plot: ldy CURS_X
|
|
|
|
ldx CURS_Y
|
|
|
|
clc
|
|
|
|
jmp PLOT ; Set the new cursor
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
; Write one character to the screen without doing anything else, return X
|
|
|
|
; position in Y
|
|
|
|
|
|
|
|
putchar:
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
ora RVS ; Set revers bit
|
2015-07-12 12:27:24 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
tax
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
st0 #VDC_MAWR ; Memory Adress Write
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
lda SCREEN_PTR
|
|
|
|
sta a:VDC_DATA_LO
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
lda SCREEN_PTR + 1
|
|
|
|
sta a:VDC_DATA_HI
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
st0 #VDC_VWR ; VWR
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
txa
|
|
|
|
sta a:VDC_DATA_LO ; character
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
lda CHARCOLOR
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
ora #$02
|
|
|
|
sta a:VDC_DATA_HI
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
rts
|
2015-07-13 10:10:09 +00:00
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
; force the init constructor to be imported
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
.import initconio
|
|
|
|
conio_init = initconio
|