1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00
cc65/libsrc/pce/cputc.s

96 lines
2.1 KiB
ArmAsm
Raw Normal View History

;
; 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
2015-10-02 14:50:22 +00:00
.import gotoxy
2015-08-29 13:58:57 +00:00
.import PLOT
.import xsize
2015-10-02 14:50:22 +00:00
.importzp tmp3, tmp4
2015-08-29 13:58:57 +00:00
.include "pce.inc"
2015-09-19 13:37:39 +00:00
.include "extzp.inc"
_cputcxy:
2015-08-29 13:58:57 +00:00
pha ; Save C
jsr gotoxy ; Set cursor, drop x and y
2015-08-29 13:58:57 +00:00
pla ; Restore C
; Plot a character - also used as internal function
2015-10-02 14:50:22 +00:00
_cputc: cmp #$0D ; CR?
2015-08-29 13:58:57 +00:00
bne L1
lda #0
sta CURS_X
2015-11-17 14:14:15 +00:00
beq plot ; Recalculate pointer
2015-10-02 14:50:22 +00:00
L1: cmp #$0A ; LF?
2015-11-17 14:14:15 +00:00
beq newline ; Recalculate pointer
; Printable char of some sort
cputdirect:
2015-08-29 13:58:57 +00:00
jsr putchar ; Write the character to the screen
; Advance cursor position
advance:
2015-08-29 13:58:57 +00:00
ldy CURS_X
iny
cpy xsize
bne L3
jsr newline ; new line
2015-10-02 14:50:22 +00:00
ldy #0 ; + CR
2015-08-29 13:58:57 +00:00
L3: sty CURS_X
jmp plot
newline:
2015-08-29 13:58:57 +00:00
inc CURS_Y
2015-11-17 14:14:15 +00:00
; Set cursor position; calculate VRAM pointer.
2015-08-29 13:58:57 +00:00
plot: ldy CURS_X
ldx CURS_Y
clc
jmp PLOT ; Set the new cursor
2015-11-17 14:14:15 +00:00
; Write one character to the screen without doing anything else.
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
2015-11-17 14:14:15 +00:00
st0 #VDC_MAWR ; Memory Address Write
2015-08-29 13:58:57 +00:00
lda SCREEN_PTR
sta VDC_DATA_LO
2015-10-02 14:50:22 +00:00
lda SCREEN_PTR+1
sta VDC_DATA_HI
2015-08-29 13:58:57 +00:00
st0 #VDC_VWR ; VWR
2015-08-29 13:58:57 +00:00
txa
sta VDC_DATA_LO ; character
2015-11-17 14:14:15 +00:00
lda CHARCOLOR ; pallette number
2015-08-29 13:58:57 +00:00
asl a
asl a
asl a
asl a
2015-08-29 13:58:57 +00:00
ora #$02
sta VDC_DATA_HI
2015-08-29 13:58:57 +00:00
rts
;-------------------------------------------------------------------------------
; force the init constructor to be imported
2015-08-29 13:58:57 +00:00
.import initconio
conio_init = initconio