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
|
2002-11-26 21:34:13 +00:00
|
|
|
.import _revflag,setcursor
|
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
|
2002-11-26 21:34:13 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
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
|
|
|
|
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
|
2002-11-26 21:34:13 +00:00
|
|
|
plot: jsr setcursor
|
|
|
|
ldy COLCRS
|
2000-05-28 13:40:48 +00:00
|
|
|
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
|
2002-11-26 21:34:13 +00:00
|
|
|
jsr mul40 ; destroys tmp4
|
|
|
|
clc
|
2000-05-28 13:40:48 +00:00
|
|
|
adc SAVMSC ; add start of screen memory
|
|
|
|
sta ptr4
|
2002-11-26 21:34:13 +00:00
|
|
|
txa
|
2000-05-28 13:40:48 +00:00
|
|
|
adc SAVMSC+1
|
|
|
|
sta ptr4+1
|
|
|
|
pla ; get char again
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2002-11-26 21:34:13 +00:00
|
|
|
ora _revflag
|
2002-11-03 22:54:52 +00:00
|
|
|
sta OLDCHR
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
ldy COLCRS
|
|
|
|
sta (ptr4),y
|
2002-11-26 21:34:13 +00:00
|
|
|
jmp setcursor
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
.rodata
|
|
|
|
ataint: .byte 64,0,32,96
|