;
-; Mark Keates, Christian Groessler
+; Mark Keates, Christian Groessler, Piotr Fusik
;
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
cmp #ATEOL ; Atari-EOL?
beq newline
- tay
- rol a
- rol a
- rol a
- rol a
- and #3
- tax
- tya
- and #$9f
- ora ataint,x
+ asl a
+ adc #$c0
+ bpl intok
+ eor #$40
+intok: lsr
+ bcc cputdirect
+ eor #$80
cputdirect: ; accepts screen code
jsr putchar
ldy COLCRS
sta (ptr4),y
jmp setcursor
-
- .rodata
-ataint: .byte 64,0,32,96
; locals
string := tmp1
- cols := tmp3
pixels := tmp4
font := regsave
-.rodata
- ataint: .byte 64,0,32,96
.bss
rows: .res 1
.endif
; Draw one character
- ; Convert to ANTIC code
-draw: tay
- rol a
- rol a
- rol a
- rol a
- and #3
- tax
- tya
- and #$9f
- ora ataint,x
- ; Save and clear inverse video bit
- sta inv
- and #$7F
+draw:
+ ; Extract the inverse mask
+ ldx #0
+ asl a
+ bcc noinv
+ dex
+noinv: stx inv
+
; Calculate font data address
+ ldx CHBAS
+ cmp #$20*2
+ bpl lowhalf
+ ; Semigraphic or lowercase
+ inx
+ inx
+lowhalf:
+ asl a
+ bcc lowquarter
+ ; Letter
+ inx
+lowquarter:
+ asl a
sta font
- lda #0
- sta font + 1
+ stx font+1
- .repeat 3
- asl font
- rol a
- .endrepeat
-
- adc CHBAS
- sta font + 1
; Save old coords
bit text_dir
bpl hor
; Put one row of the glyph
putrow: sty rows
lda (font),y
- bit inv
- bpl noinv
- eor #$FF
-noinv: sta pixels
- lda #7
- sta cols
+ eor inv
+ sec
+ rol a
+ sta pixels
; Put one column of the row
-putcol: asl pixels
- bcc next_col
+putcol: bcc next_col
lda x1
pha
lda x1 + 1
sub mag_x
sta y2
L2:
- dec cols
- bpl putcol
+ asl pixels
+ bne putcol
next_row:
; Go to next row
bit text_dir