2000-05-28 13:40:48 +00:00
|
|
|
;
|
2019-01-22 23:05:31 +00:00
|
|
|
; Mark Keates, Christian Groessler, Piotr Fusik
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; void cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void cputc (char c);
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _cputcxy, _cputc
|
|
|
|
.export plot, cputdirect, putchar
|
2016-06-05 12:58:38 +00:00
|
|
|
.import gotoxy, mul40
|
2013-05-09 11:56:54 +00:00
|
|
|
.importzp tmp4,ptr4
|
|
|
|
.import _revflag,setcursor
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_cputcxy:
|
2013-05-09 11:56:54 +00:00
|
|
|
pha ; Save C
|
2016-06-05 12:58:38 +00:00
|
|
|
jsr gotoxy ; Set cursor, drop x and y
|
2013-05-09 11:56:54 +00:00
|
|
|
pla ; Restore C
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_cputc:
|
2013-05-09 11:56:54 +00:00
|
|
|
cmp #$0D ; CR
|
|
|
|
bne L4
|
|
|
|
lda #0
|
|
|
|
sta COLCRS
|
|
|
|
beq plot ; return
|
2002-11-26 21:34:13 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
L4: cmp #$0A ; LF
|
|
|
|
beq newline
|
|
|
|
cmp #ATEOL ; Atari-EOL?
|
|
|
|
beq newline
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2019-01-23 18:02:26 +00:00
|
|
|
asl a ; shift out the inverse bit
|
|
|
|
adc #$c0 ; grab the inverse bit; convert ATASCII to screen code
|
|
|
|
bpl codeok ; screen code ok?
|
|
|
|
eor #$40 ; needs correction
|
|
|
|
codeok: lsr a ; undo the shift
|
2019-01-22 23:05:31 +00:00
|
|
|
bcc cputdirect
|
2019-01-23 18:02:26 +00:00
|
|
|
eor #$80 ; restore the inverse bit
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
cputdirect: ; accepts screen code
|
|
|
|
jsr putchar
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
; advance cursor
|
2013-05-09 11:56:54 +00:00
|
|
|
inc COLCRS
|
|
|
|
lda COLCRS
|
|
|
|
cmp #40
|
|
|
|
bcc plot
|
|
|
|
lda #0
|
|
|
|
sta COLCRS
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export newline
|
2000-05-28 13:40:48 +00:00
|
|
|
newline:
|
2013-05-09 11:56:54 +00:00
|
|
|
inc ROWCRS
|
|
|
|
lda ROWCRS
|
|
|
|
cmp #24
|
|
|
|
bne plot
|
|
|
|
lda #0
|
|
|
|
sta ROWCRS
|
|
|
|
plot: jsr setcursor
|
|
|
|
ldy COLCRS
|
|
|
|
ldx ROWCRS
|
|
|
|
rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
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:
|
2013-05-09 11:56:54 +00:00
|
|
|
pha ; save char
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0
|
|
|
|
lda OLDCHR
|
|
|
|
sta (OLDADR),y
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ROWCRS
|
|
|
|
jsr mul40 ; destroys tmp4
|
|
|
|
clc
|
|
|
|
adc SAVMSC ; add start of screen memory
|
|
|
|
sta ptr4
|
|
|
|
txa
|
|
|
|
adc SAVMSC+1
|
|
|
|
sta ptr4+1
|
|
|
|
pla ; get char again
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ora _revflag
|
|
|
|
sta OLDCHR
|
2002-11-03 22:54:52 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy COLCRS
|
|
|
|
sta (ptr4),y
|
|
|
|
jmp setcursor
|