From a0a6537bdaa29743ceea170ee4884ab018da7369 Mon Sep 17 00:00:00 2001 From: jede Date: Sun, 7 Jul 2019 22:02:48 +0200 Subject: [PATCH 021/170] Fix typo and optimize --- libsrc/telestrat/bgcolor.s | 9 +++------ libsrc/telestrat/cputc.s | 7 +++++-- libsrc/telestrat/gotoxy.s | 8 ++++---- libsrc/telestrat/gotoy.s | 4 ++-- libsrc/telestrat/textcolor.s | 15 +++++++-------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/libsrc/telestrat/bgcolor.s b/libsrc/telestrat/bgcolor.s index 4af0ef76..14ecf4bd 100644 --- a/libsrc/telestrat/bgcolor.s +++ b/libsrc/telestrat/bgcolor.s @@ -7,12 +7,11 @@ .include "telestrat.inc" .proc _bgcolor - cmp BGCOLOR ; Do we set the same color? if we don't detect it, we loose one char on the screen for each textcolor call with the same color + cmp BGCOLOR ; Do we set the same color? If we don't detect it, we loose one char on the screen for each bgcolor call with the same color bne out ; Yes - lda #$00 - sta BGCOLOR_CHANGE - lda BGCOLOR ; Return last color + ldy #$00 + sty BGCOLOR_CHANGE rts out: @@ -24,5 +23,3 @@ out: txa ; Return previous color rts .endproc - - diff --git a/libsrc/telestrat/cputc.s b/libsrc/telestrat/cputc.s index f38db8a1..96763caf 100644 --- a/libsrc/telestrat/cputc.s +++ b/libsrc/telestrat/cputc.s @@ -11,18 +11,20 @@ .proc _cputc ldx CHARCOLOR_CHANGE beq do_not_change_color_foreground - + dec SCRX + dec SCRX pha lda CHARCOLOR BRK_TELEMON $4E ; Change color on the screen (foreground) lda #$00 sta CHARCOLOR_CHANGE + inc SCRX pla do_not_change_color_foreground: ldx BGCOLOR_CHANGE beq do_not_change_color - + dec SCRX ; Dec SCRX in order to place attribute before the right position pha lda BGCOLOR ORA #%00010000 ; Add 16 because background color is an attribute between 16 and 23. 17 is red background for example @@ -36,6 +38,7 @@ do_not_change_color: BRK_TELEMON XFWR ; Macro send char to screen (channel 0) rts .endproc +.bss CHARCOLOR: .res 1 CHARCOLOR_CHANGE: diff --git a/libsrc/telestrat/gotoxy.s b/libsrc/telestrat/gotoxy.s index 73e7d272..8dcb69e8 100644 --- a/libsrc/telestrat/gotoxy.s +++ b/libsrc/telestrat/gotoxy.s @@ -5,7 +5,7 @@ ; void gotoxy (unsigned char x, unsigned char y); ; - .export gotoxy, _gotoxy, _update_adscr + .export gotoxy, _gotoxy, update_adscr .import popa, CHARCOLOR_CHANGE, BGCOLOR_CHANGE @@ -21,7 +21,7 @@ gotoxy: jsr popa ; Get Y jsr popa sta SCRX - jsr _update_adscr ; Update adress video ram position when SCRY et SCRX are modified + jsr update_adscr ; Update adress video ram position when SCRY et SCRX are modified ; Force to put again attribute when it moves on the screen lda #$01 sta CHARCOLOR_CHANGE @@ -30,7 +30,7 @@ gotoxy: jsr popa ; Get Y .endproc -.proc _update_adscr +.proc update_adscr lda #