2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Mark Keates, Christian Groessler
|
|
|
|
;
|
|
|
|
; void cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void cputc (char c);
|
|
|
|
;
|
|
|
|
|
|
|
|
.export _cputcxy, _cputc
|
|
|
|
.export plot, cputdirect, putchar
|
2000-06-23 22:05:59 +00:00
|
|
|
.import popa, _gotoxy, mul40
|
2000-07-21 08:26:44 +00:00
|
|
|
.importzp tmp4,ptr4
|
|
|
|
.import _revflag
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.include "atari.inc"
|
|
|
|
|
|
|
|
_cputcxy:
|
|
|
|
pha ; Save C
|
|
|
|
jsr popa ; Get Y
|
|
|
|
jsr _gotoxy ; Set cursor, drop x
|
|
|
|
pla ; Restore C
|
|
|
|
|
|
|
|
_cputc:
|
|
|
|
cmp #$0D ; CR
|
|
|
|
bne L4
|
|
|
|
lda #0
|
|
|
|
sta COLCRS
|
|
|
|
beq plot ; return
|
|
|
|
|
|
|
|
L4: cmp #$0A ; LF
|
|
|
|
beq newline
|
|
|
|
cmp #ATEOL ; Atari-EOL?
|
|
|
|
beq newline
|
|
|
|
|
|
|
|
tay
|
|
|
|
rol a
|
|
|
|
rol a
|
|
|
|
rol a
|
|
|
|
rol a
|
|
|
|
and #3
|
|
|
|
tax
|
|
|
|
tya
|
|
|
|
and #$9f
|
|
|
|
ora ataint,x
|
|
|
|
|
|
|
|
cputdirect: ; accepts screen code
|
|
|
|
jsr putchar
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2002-11-04 23:30:19 +00:00
|
|
|
; update cursor position pointer
|
|
|
|
ldy #0
|
|
|
|
lda OLDCHR
|
|
|
|
sta (OLDADR),y
|
|
|
|
inc OLDADR
|
|
|
|
bne L1
|
2002-11-03 22:54:52 +00:00
|
|
|
inc OLDADR+1
|
2002-11-04 23:30:19 +00:00
|
|
|
L1: lda (OLDADR),y
|
|
|
|
sta OLDCHR
|
|
|
|
ora _revflag
|
|
|
|
sta (OLDADR),y
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; advance cursor
|
2002-11-04 23:30:19 +00:00
|
|
|
inc COLCRS
|
2000-05-28 13:40:48 +00:00
|
|
|
lda COLCRS
|
|
|
|
cmp #40
|
|
|
|
bcc plot
|
|
|
|
lda #0
|
|
|
|
sta COLCRS
|
|
|
|
|
|
|
|
.export newline
|
|
|
|
newline:
|
|
|
|
inc ROWCRS
|
|
|
|
lda ROWCRS
|
|
|
|
cmp #24
|
|
|
|
bne plot
|
|
|
|
lda #0
|
|
|
|
sta ROWCRS
|
|
|
|
plot: ldy COLCRS
|
|
|
|
ldx ROWCRS
|
|
|
|
rts
|
|
|
|
|
2002-11-03 22:54:52 +00:00
|
|
|
; turn off cursor, update screen, turn on cursor
|
2000-05-28 13:40:48 +00:00
|
|
|
putchar:
|
|
|
|
pha ; save char
|
2002-11-03 22:54:52 +00:00
|
|
|
|
|
|
|
ldy #0
|
|
|
|
lda OLDCHR
|
|
|
|
sta (OLDADR),y
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
lda ROWCRS
|
2000-06-23 22:05:59 +00:00
|
|
|
jsr mul40
|
2000-05-28 13:40:48 +00:00
|
|
|
L3: clc
|
|
|
|
adc SAVMSC ; add start of screen memory
|
|
|
|
sta ptr4
|
|
|
|
lda tmp4
|
|
|
|
adc SAVMSC+1
|
|
|
|
sta ptr4+1
|
|
|
|
pla ; get char again
|
2002-11-03 22:54:52 +00:00
|
|
|
|
|
|
|
sta OLDCHR
|
|
|
|
|
2000-05-30 22:20:01 +00:00
|
|
|
ora _revflag
|
2000-05-28 13:40:48 +00:00
|
|
|
ldy COLCRS
|
|
|
|
sta (ptr4),y
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2002-11-04 23:30:19 +00:00
|
|
|
; update OLDADR (maybe ROWCRS and COLCRS were changed)
|
2002-11-03 22:54:52 +00:00
|
|
|
sty tmp4
|
|
|
|
lda ptr4
|
|
|
|
clc
|
|
|
|
adc tmp4
|
|
|
|
sta OLDADR
|
|
|
|
lda ptr4+1
|
|
|
|
adc #0
|
|
|
|
sta OLDADR+1
|
2000-05-28 13:40:48 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
.rodata
|
|
|
|
ataint: .byte 64,0,32,96
|
|
|
|
|