From 6cc654cca84b58671ab7ec0adeb8bdecaca5acfb Mon Sep 17 00:00:00 2001 From: mrdudz Date: Mon, 28 Sep 2015 15:10:57 +0200 Subject: [PATCH] added extra check for graphical chars --- libsrc/c64/soft80.inc | 24 +++++++++--------------- libsrc/c64/soft80_chline.s | 5 ++++- libsrc/c64/soft80_cputc.s | 19 +++++++++++++++---- libsrc/c64/soft80_cvline.s | 5 ++++- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/libsrc/c64/soft80.inc b/libsrc/c64/soft80.inc index d67011b4a..d534cac69 100644 --- a/libsrc/c64/soft80.inc +++ b/libsrc/c64/soft80.inc @@ -1,10 +1,8 @@ -; ram under i/o soft80_lo_charset = $d000 soft80_hi_charset = $d400 -soft80_vram = $d800 +soft80_vram = $d800 ; ram under i/o soft80_colram = $d800 ; color ram (used for temp. storage) -; ram under kernel soft80_bitmap = $e000 charsperline = 80 @@ -15,15 +13,11 @@ CH_HLINE = 96 CH_CROSS = 123 CH_VLINE = 125 CH_PI = 126 - -; FIXME: these are defined in cbm.h normally, the putchar stuff should accept -; the regular codes instead of the following ones: - -CH_LTEE = 171-160 -CH_URCORNER = 174-160 -CH_LLCORNER = 173-160 -CH_ULCORNER = 176-160 -CH_BTEE = 177-160 -CH_TTEE = 178-160 -CH_RTEE = 179-160 -CH_LRCORNER = 189-160 +CH_LTEE = 171 +CH_URCORNER = 174 +CH_LLCORNER = 173 +CH_ULCORNER = 176 +CH_BTEE = 177 +CH_TTEE = 178 +CH_RTEE = 179 +CH_LRCORNER = 189 diff --git a/libsrc/c64/soft80_chline.s b/libsrc/c64/soft80_chline.s index ac9d123d3..e15d0c483 100644 --- a/libsrc/c64/soft80_chline.s +++ b/libsrc/c64/soft80_chline.s @@ -7,6 +7,9 @@ .import popa, _gotoxy, soft80_cputdirect .importzp tmp1 + .include "c64.inc" + .include "soft80.inc" + soft80_chlinexy: pha ; Save the length jsr popa ; Get y @@ -17,7 +20,7 @@ soft80_chline: cmp #0 ; Is the length zero? beq L9 ; Jump if done sta tmp1 -L1: lda #96 ; Horizontal line, petscii code +L1: lda #CH_HLINE ; Horizontal line, petscii code jsr soft80_cputdirect ; Direct output dec tmp1 bne L1 diff --git a/libsrc/c64/soft80_cputc.s b/libsrc/c64/soft80_cputc.s index c81913476..d4c7e3050 100644 --- a/libsrc/c64/soft80_cputc.s +++ b/libsrc/c64/soft80_cputc.s @@ -40,28 +40,39 @@ soft80_plot: ldx CURS_Y ldy CURS_X clc - jmp soft80_kplot ; Set the new cursor + jmp soft80_kplot ; Set the new cursor L1: cmp #$0D ; LF? - beq soft80_newline ; Recalculate pointers + beq soft80_newline ; Recalculate pointers ; Printable char of some sort tay bpl L10 + ; extra check for petscii codes 160-191, these have been moved to + ; 0-31 in the charset + and #%11100000 + cmp #%10100000 + bne @sk + + tya + and #%00011111 + bpl L10 ; branch always +@sk: + tya clc adc #$20 and #$7F L10: soft80_cputdirect: - jsr soft80_putchar ; Write the character to the screen + jsr soft80_putchar ; Write the character to the screen ; Advance cursor position advance: - iny + iny ; contains CURS_X cpy #charsperline beq L3 diff --git a/libsrc/c64/soft80_cvline.s b/libsrc/c64/soft80_cvline.s index 847186a3b..eaa850118 100644 --- a/libsrc/c64/soft80_cvline.s +++ b/libsrc/c64/soft80_cvline.s @@ -7,6 +7,9 @@ .import popa, _gotoxy, soft80_putchar, soft80_newline .importzp tmp1 + .include "c64.inc" + .include "soft80.inc" + soft80_cvlinexy: pha ; Save the length jsr popa ; Get y @@ -17,7 +20,7 @@ soft80_cvline: cmp #0 ; Is the length zero? beq L9 ; Jump if done sta tmp1 -L1: lda #125 ; Vertical bar, petscii code +L1: lda #CH_VLINE ; Vertical bar, petscii code jsr soft80_putchar ; Write, no cursor advance jsr soft80_newline ; Advance cursor to next line dec tmp1 -- 2.39.5