X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Fpet%2Fcputc.s;h=c9ac9928e0e6b7bd8183e840d6d44b34d8daa900;hb=9c177602277c9fdf515a29931089738cc70700ee;hp=fc599ba4acfe474000b94d2eeec664202d1c75a5;hpb=c6546592b67c88005ed4ef693cd86844b9977423;p=cc65 diff --git a/libsrc/pet/cputc.s b/libsrc/pet/cputc.s index fc599ba4a..c9ac9928e 100644 --- a/libsrc/pet/cputc.s +++ b/libsrc/pet/cputc.s @@ -8,10 +8,8 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers .include "pet.inc" - .include "../cbm/cbm.inc" _cputcxy: pha ; Save C @@ -28,42 +26,42 @@ _cputc: cmp #$0A ; CR? beq plot ; Recalculate pointers L1: cmp #$0D ; LF? - bne L2 - ldy CURS_Y - iny - bne newline ; Recalculate pointers + beq newline ; Recalculate pointers ; Printable char of some sort -L2: cmp #' ' + cmp #' ' bcc cputdirect ; Other control char tay bmi L10 cmp #$60 - bcc L3 + bcc L2 and #$DF bne cputdirect ; Branch always -L3: and #$3F +L2: and #$3F cputdirect: - jsr putchar ; Write the character to the screen + jsr putchar ; Write the character to the screen ; Advance cursor position advance: - iny - cpy xsize - bne L9 + cpy SCR_LINELEN ; xsize-1 + bne L3 + jsr newline ; new line + ldy #$FF ; + cr +L3: iny + sty CURS_X + rts + newline: - ldy #0 ; new line - clc - lda xsize + lda SCR_LINELEN ; xsize-1 + sec ; Account for -1 above adc SCREEN_PTR sta SCREEN_PTR bcc L4 inc SCREEN_PTR+1 L4: inc CURS_Y -L9: sty CURS_X rts ; Handle character if high bit set @@ -84,9 +82,9 @@ plot: ldy CURS_Y lda ScrLo,y sta SCREEN_PTR lda ScrHi,y - ldy xsize - cpy #40 - beq @L1 + ldy SCR_LINELEN + cpy #40+1 + bcc @L1 asl SCREEN_PTR ; 80 column mode rol a @L1: ora #$80 ; Screen at $8000 @@ -98,7 +96,7 @@ plot: ldy CURS_Y ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char rts