Fix many bugs
This commit is contained in:
parent
b8889bf37e
commit
02e52fe24d
8 changed files with 109 additions and 55 deletions
|
@ -85,6 +85,8 @@
|
||||||
#define CH_LTEE '+'
|
#define CH_LTEE '+'
|
||||||
#define CH_RTEE '+'
|
#define CH_RTEE '+'
|
||||||
#define CH_CROSS '+'
|
#define CH_CROSS '+'
|
||||||
|
#define CH_HLINE '-'
|
||||||
|
#define CH_VLINE '|'
|
||||||
#define CH_CURS_UP 11
|
#define CH_CURS_UP 11
|
||||||
#define CH_CURS_DOWN 10
|
#define CH_CURS_DOWN 10
|
||||||
#define CH_CURS_LEFT 8
|
#define CH_CURS_LEFT 8
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _cclearxy, _cclear
|
.export _cclearxy, _cclear
|
||||||
.import update_adscr
|
.import update_adscr, display_conio
|
||||||
|
|
||||||
.importzp tmp1
|
.importzp tmp1
|
||||||
.import popax
|
.import popax
|
||||||
|
@ -27,7 +27,7 @@ _cclear:
|
||||||
@L1:
|
@L1:
|
||||||
stx tmp1 ; Save X
|
stx tmp1 ; Save X
|
||||||
lda #' ' ; Erase current char
|
lda #' ' ; Erase current char
|
||||||
BRK_TELEMON XFWR
|
jsr display_conio
|
||||||
ldx tmp1
|
ldx tmp1
|
||||||
dex
|
dex
|
||||||
bne @L1
|
bne @L1
|
||||||
|
|
|
@ -1,22 +1,34 @@
|
||||||
;
|
;
|
||||||
; jede jede@oric.org 2018-04-17
|
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||||
;
|
|
||||||
|
|
||||||
; void chline (unsigned char length);
|
; void chline (unsigned char length);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _chline
|
.export _chlinexy, _chline
|
||||||
|
|
||||||
|
.import rvs, display_conio, update_adscr
|
||||||
|
.import popax
|
||||||
|
|
||||||
.include "telestrat.inc"
|
.include "telestrat.inc"
|
||||||
.include "zeropage.inc"
|
|
||||||
|
|
||||||
|
|
||||||
.proc _chline
|
_chlinexy:
|
||||||
sta tmp1
|
pha ; Save the length
|
||||||
@loop:
|
jsr popax ; Get X and Y
|
||||||
lda #'-' ; horizontal line screen code
|
sta SCRY ; Store Y
|
||||||
BRK_TELEMON XWR0 ; macro send char to screen (channel 0 in telemon terms)
|
stx SCRX ; Store X
|
||||||
dec tmp1
|
jsr update_adscr
|
||||||
bne @loop
|
pla ; Restore the length and run into _chline
|
||||||
rts
|
|
||||||
.endproc
|
_chline:
|
||||||
|
tax ; Is the length zero?
|
||||||
|
beq @L9 ; Jump if done
|
||||||
|
@L1:
|
||||||
|
lda #'-' ; Horizontal line screen code
|
||||||
|
ora rvs
|
||||||
|
|
||||||
|
jsr display_conio
|
||||||
|
|
||||||
|
@L2: dex
|
||||||
|
bne @L1
|
||||||
|
@L9: rts
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _clrscr
|
.export _clrscr
|
||||||
.import OLD_CHARCOLOR, OLD_BGCOLOR
|
.import OLD_CHARCOLOR, OLD_BGCOLOR, BGCOLOR, CHARCOLOR
|
||||||
|
|
||||||
.include "telestrat.inc"
|
.include "telestrat.inc"
|
||||||
|
|
||||||
|
@ -23,22 +23,25 @@
|
||||||
|
|
||||||
|
|
||||||
; reset prompt position
|
; reset prompt position
|
||||||
lda #<(SCREEN+40)
|
lda #<(SCREEN)
|
||||||
sta ADSCRL
|
sta ADSCR
|
||||||
lda #>(SCREEN+40)
|
lda #>(SCREEN)
|
||||||
sta ADSCRH
|
sta ADSCR+1
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta SCRDY
|
||||||
|
|
||||||
; reset display position
|
; reset display position
|
||||||
ldx #$01
|
ldx #$00
|
||||||
stx SCRY
|
stx SCRY
|
||||||
dex
|
|
||||||
stx SCRX
|
stx SCRX
|
||||||
|
|
||||||
; At this step X is equal to $00
|
stx OLD_BGCOLOR ; black
|
||||||
dex
|
stx BGCOLOR
|
||||||
; At this step X is equal to $FF
|
|
||||||
stx OLD_BGCOLOR
|
ldx #$07 ; white
|
||||||
stx OLD_CHARCOLOR
|
stx OLD_CHARCOLOR
|
||||||
|
stx CHARCOLOR
|
||||||
|
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
|
@ -4,24 +4,50 @@
|
||||||
; void cputc (char c);
|
; void cputc (char c);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _cputc, CHARCOLOR, OLD_CHARCOLOR, BGCOLOR, OLD_BGCOLOR
|
.export _cputc, _cputcxy, display_conio, CHARCOLOR, OLD_CHARCOLOR, BGCOLOR, OLD_BGCOLOR
|
||||||
|
|
||||||
|
|
||||||
|
.import update_adscr
|
||||||
|
.import popax
|
||||||
|
|
||||||
.include "telestrat.inc"
|
.include "telestrat.inc"
|
||||||
|
|
||||||
|
_cputcxy:
|
||||||
|
pha ; Save C
|
||||||
|
jsr popax ; Get X and Y
|
||||||
|
sta SCRY ; Store Y
|
||||||
|
stx SCRX ; Store X
|
||||||
|
jsr update_adscr
|
||||||
|
pla
|
||||||
|
|
||||||
.proc _cputc
|
.proc _cputc
|
||||||
|
cmp #$0D
|
||||||
|
bne @not_CR
|
||||||
|
ldy #$00
|
||||||
|
sty SCRX
|
||||||
|
rts
|
||||||
|
@not_CR:
|
||||||
|
cmp #$0A
|
||||||
|
bne @not_LF
|
||||||
|
|
||||||
|
inc SCRY
|
||||||
|
jmp update_adscr
|
||||||
|
|
||||||
|
|
||||||
|
@not_LF:
|
||||||
|
|
||||||
ldx CHARCOLOR
|
ldx CHARCOLOR
|
||||||
cpx OLD_CHARCOLOR
|
cpx OLD_CHARCOLOR
|
||||||
beq do_not_change_color_foreground
|
beq do_not_change_color_foreground
|
||||||
|
|
||||||
stx OLD_CHARCOLOR ; Store CHARCOLOR into OLD_CHARCOLOR
|
stx OLD_CHARCOLOR ; Store CHARCOLOR into OLD_CHARCOLOR
|
||||||
|
|
||||||
dec SCRX
|
|
||||||
dec SCRX
|
|
||||||
|
|
||||||
pha
|
pha
|
||||||
txa ; Swap X to A because, X contains CHARCOLOR
|
txa ; Swap X to A because, X contains CHARCOLOR
|
||||||
BRK_TELEMON XFWR ; Change color on the screen (foreground)
|
|
||||||
inc SCRX
|
jsr display_conio
|
||||||
|
|
||||||
pla
|
pla
|
||||||
|
|
||||||
do_not_change_color_foreground:
|
do_not_change_color_foreground:
|
||||||
|
@ -31,18 +57,38 @@ do_not_change_color_foreground:
|
||||||
|
|
||||||
stx OLD_BGCOLOR
|
stx OLD_BGCOLOR
|
||||||
|
|
||||||
dec SCRX ; Dec SCRX in order to place attribute before the right position
|
|
||||||
|
|
||||||
pha
|
pha
|
||||||
txa ; Swap X to A because, X contains BGCOLOR
|
txa ; Swap X to A because, X contains BGCOLOR
|
||||||
ORA #%00010000 ; Add 16 because background color is an attribute between 16 and 23. 17 is red background for example
|
ora #%00010000 ; Add 16 because background color is an attribute between 16 and 23. 17 is red background for example
|
||||||
BRK_TELEMON XFWR ; Change color on the screen (background)
|
|
||||||
|
jsr display_conio
|
||||||
pla
|
pla
|
||||||
|
|
||||||
do_not_change_color:
|
do_not_change_color:
|
||||||
BRK_TELEMON XFWR ; Macro send char to screen (channel 0)
|
; it continues to display_conio
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.proc display_conio
|
||||||
|
ldy SCRX
|
||||||
|
sta (ADSCR),y
|
||||||
|
iny
|
||||||
|
cpy #SCREEN_XSIZE
|
||||||
|
bne @no_inc
|
||||||
|
ldy #$00
|
||||||
|
sty SCRX
|
||||||
|
|
||||||
|
jmp update_adscr
|
||||||
|
|
||||||
|
@no_inc:
|
||||||
|
sty SCRX
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
CHARCOLOR:
|
CHARCOLOR:
|
||||||
.res 1
|
.res 1
|
||||||
|
@ -52,3 +98,4 @@ BGCOLOR:
|
||||||
.res 1
|
.res 1
|
||||||
OLD_BGCOLOR:
|
OLD_BGCOLOR:
|
||||||
.res 1
|
.res 1
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,5 @@
|
||||||
|
|
||||||
.proc _gotox
|
.proc _gotox
|
||||||
sta SCRX
|
sta SCRX
|
||||||
|
|
||||||
lda #$FF
|
|
||||||
sta OLD_CHARCOLOR
|
|
||||||
sta OLD_BGCOLOR
|
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
|
@ -29,30 +29,23 @@ gotoxy: jsr popa ; Get Y
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc update_adscr
|
.proc update_adscr
|
||||||
; Force to set again color if cursor moves
|
|
||||||
; $FF is used because we know that it's impossible to have this value with a color
|
|
||||||
; It prevents a bug : If bgcolor or textcolor is set to black for example with no char displays,
|
|
||||||
; next cputsxy will not set the attribute if y coordinate changes
|
|
||||||
lda #$FF
|
|
||||||
sta OLD_CHARCOLOR
|
|
||||||
sta OLD_BGCOLOR
|
|
||||||
|
|
||||||
lda #<SCREEN
|
lda #<SCREEN
|
||||||
sta ADSCRL
|
sta ADSCR
|
||||||
|
|
||||||
lda #>SCREEN
|
lda #>SCREEN
|
||||||
sta ADSCRH
|
sta ADSCR+1
|
||||||
|
|
||||||
ldy SCRY
|
ldy SCRY
|
||||||
beq out
|
beq out
|
||||||
loop:
|
loop:
|
||||||
lda ADSCRL
|
lda ADSCR
|
||||||
clc
|
clc
|
||||||
adc #SCREEN_XSIZE
|
adc #SCREEN_XSIZE
|
||||||
bcc skip
|
bcc skip
|
||||||
inc ADSCRH
|
inc ADSCR+1
|
||||||
skip:
|
skip:
|
||||||
sta ADSCRL
|
sta ADSCR
|
||||||
dey
|
dey
|
||||||
bne loop
|
bne loop
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _textcolor
|
.export _textcolor
|
||||||
.import CHARCOLOR
|
.import CHARCOLOR, OLD_CHARCOLOR
|
||||||
.include "telestrat.inc"
|
.include "telestrat.inc"
|
||||||
|
|
||||||
.proc _textcolor
|
.proc _textcolor
|
||||||
ldx CHARCOLOR ; Get previous color
|
ldx CHARCOLOR ; Get previous color
|
||||||
sta CHARCOLOR
|
sta CHARCOLOR
|
||||||
|
stx OLD_CHARCOLOR
|
||||||
txa ; Return previous color
|
txa ; Return previous color
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
Loading…
Add table
Reference in a new issue