commit
d348d82d5a
8 changed files with 323 additions and 4 deletions
|
@ -15,6 +15,22 @@
|
||||||
.export _textcolor := soft80_textcolor ; color.s
|
.export _textcolor := soft80_textcolor ; color.s
|
||||||
.export _bgcolor := soft80_bgcolor ; color.s
|
.export _bgcolor := soft80_bgcolor ; color.s
|
||||||
|
|
||||||
|
; soft80_cpeekc.s
|
||||||
|
.import soft80_cpeekc
|
||||||
|
.export _cpeekc := soft80_cpeekc ; cpeekc.s
|
||||||
|
|
||||||
|
; soft80_cpeekcolor.s
|
||||||
|
.import soft80_cpeekcolor
|
||||||
|
.export _cpeekcolor := soft80_cpeekcolor ; cpeekcolor.s
|
||||||
|
|
||||||
|
; soft80_cpeekrevers.s
|
||||||
|
.import soft80_cpeekrevers
|
||||||
|
.export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s
|
||||||
|
|
||||||
|
; soft80_cpeeks.s
|
||||||
|
.import soft80_cpeeks
|
||||||
|
.export _cpeeks := soft80_cpeeks ; cpeeks.s
|
||||||
|
|
||||||
; soft80_cputc.s
|
; soft80_cputc.s
|
||||||
.import soft80_cputc
|
.import soft80_cputc
|
||||||
.import soft80_cputcxy
|
.import soft80_cputcxy
|
||||||
|
@ -50,3 +66,6 @@
|
||||||
; Chars used by chline () and cvline ()
|
; Chars used by chline () and cvline ()
|
||||||
.exportzp chlinechar = CH_HLINE
|
.exportzp chlinechar = CH_HLINE
|
||||||
.exportzp cvlinechar = CH_VLINE
|
.exportzp cvlinechar = CH_VLINE
|
||||||
|
|
||||||
|
.import return1
|
||||||
|
.export _doesclrscrafterexit := return1
|
||||||
|
|
|
@ -18,6 +18,22 @@
|
||||||
.export _textcolor := soft80mono_textcolor ; color.s
|
.export _textcolor := soft80mono_textcolor ; color.s
|
||||||
.export _bgcolor := soft80mono_bgcolor ; color.s
|
.export _bgcolor := soft80mono_bgcolor ; color.s
|
||||||
|
|
||||||
|
; soft80mono_cpeekc.s
|
||||||
|
.import soft80_cpeekc
|
||||||
|
.export _cpeekc := soft80_cpeekc ; cpeekc.s
|
||||||
|
|
||||||
|
; soft80mono_cpeekcolor.s
|
||||||
|
.import soft80mono_cpeekcolor
|
||||||
|
.export _cpeekcolor := soft80mono_cpeekcolor ; cpeekcolor.s
|
||||||
|
|
||||||
|
; soft80mono_cpeekrevers.s
|
||||||
|
.import soft80_cpeekrevers
|
||||||
|
.export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s
|
||||||
|
|
||||||
|
; soft80mono_cpeeks.s
|
||||||
|
.import soft80_cpeeks
|
||||||
|
.export _cpeeks := soft80_cpeeks ; cpeeks.s
|
||||||
|
|
||||||
; soft80mono_cputc.s
|
; soft80mono_cputc.s
|
||||||
.import soft80mono_cputc
|
.import soft80mono_cputc
|
||||||
.import soft80mono_cputcxy
|
.import soft80mono_cputcxy
|
||||||
|
@ -53,3 +69,6 @@
|
||||||
; Chars used by chline () and cvline ()
|
; Chars used by chline () and cvline ()
|
||||||
.exportzp chlinechar = CH_HLINE
|
.exportzp chlinechar = CH_HLINE
|
||||||
.exportzp cvlinechar = CH_VLINE
|
.exportzp cvlinechar = CH_VLINE
|
||||||
|
|
||||||
|
.import return1
|
||||||
|
.export _doesclrscrafterexit := return1
|
||||||
|
|
148
libsrc/c64/soft80_cpeekc.s
Normal file
148
libsrc/c64/soft80_cpeekc.s
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
;
|
||||||
|
; 2017-12-28, Groepaz
|
||||||
|
;
|
||||||
|
; char cpeekc (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export soft80_cpeekc, soft80_cpeekchar
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
.include "soft80.inc"
|
||||||
|
|
||||||
|
.macpack longbranch
|
||||||
|
|
||||||
|
.segment "CODE"
|
||||||
|
|
||||||
|
soft80_cpeekc:
|
||||||
|
jsr soft80_cpeekchar
|
||||||
|
; 0-1F -> A0-BF
|
||||||
|
; 20-7F -> 20-7F
|
||||||
|
cmp #$20
|
||||||
|
bcs @sk
|
||||||
|
;clc
|
||||||
|
adc #$a0
|
||||||
|
@sk:
|
||||||
|
ldx #0
|
||||||
|
rts
|
||||||
|
|
||||||
|
soft80_cpeekchar:
|
||||||
|
|
||||||
|
sei
|
||||||
|
lda #$34
|
||||||
|
sta $01
|
||||||
|
|
||||||
|
lda CURS_X
|
||||||
|
and #$01
|
||||||
|
|
||||||
|
jne @l1a
|
||||||
|
|
||||||
|
; test non-inverted character (left side)
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
@l2aa:
|
||||||
|
ldy #0
|
||||||
|
|
||||||
|
.repeat 8,line
|
||||||
|
lda (SCREEN_PTR),y
|
||||||
|
and #$f0
|
||||||
|
cmp soft80_hi_charset+(line*$80),x
|
||||||
|
bne @l2b
|
||||||
|
.if (line < 7)
|
||||||
|
iny
|
||||||
|
.endif
|
||||||
|
.endrepeat
|
||||||
|
|
||||||
|
@backok:
|
||||||
|
lda #$36
|
||||||
|
sta $01
|
||||||
|
cli
|
||||||
|
txa ; return char in A
|
||||||
|
ldx #$00 ; revers flag
|
||||||
|
rts
|
||||||
|
@l2b:
|
||||||
|
inx
|
||||||
|
cpx #$80
|
||||||
|
jne @l2aa
|
||||||
|
|
||||||
|
; test inverted character (left side)
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
@l2aa2:
|
||||||
|
ldy #0
|
||||||
|
|
||||||
|
.repeat 8,line
|
||||||
|
lda (SCREEN_PTR),y
|
||||||
|
and #$f0
|
||||||
|
eor #$f0
|
||||||
|
cmp soft80_hi_charset+(line*$80),x
|
||||||
|
bne @l2b2
|
||||||
|
.if (line < 7)
|
||||||
|
iny
|
||||||
|
.endif
|
||||||
|
.endrepeat
|
||||||
|
|
||||||
|
@backokrevers:
|
||||||
|
lda #$36
|
||||||
|
sta $01
|
||||||
|
cli
|
||||||
|
txa ; return char in A
|
||||||
|
ldx #$01 ; revers flag
|
||||||
|
rts
|
||||||
|
|
||||||
|
@l2b2:
|
||||||
|
inx
|
||||||
|
cpx #$80
|
||||||
|
jne @l2aa2
|
||||||
|
|
||||||
|
@backerr:
|
||||||
|
lda #$36
|
||||||
|
sta $01
|
||||||
|
cli
|
||||||
|
ldx #0
|
||||||
|
txa
|
||||||
|
rts
|
||||||
|
|
||||||
|
; test non-inverted character (right side)
|
||||||
|
|
||||||
|
@l1a:
|
||||||
|
ldx #0
|
||||||
|
@l1aa:
|
||||||
|
ldy #0
|
||||||
|
.repeat 8,line
|
||||||
|
lda (SCREEN_PTR),y
|
||||||
|
and #$0f
|
||||||
|
eor soft80_lo_charset+(line*$80),x
|
||||||
|
bne @l2bb
|
||||||
|
.if line < 7
|
||||||
|
iny
|
||||||
|
.endif
|
||||||
|
.endrepeat
|
||||||
|
jmp @backok
|
||||||
|
@l2bb:
|
||||||
|
inx
|
||||||
|
cpx #$80
|
||||||
|
bne @l1aa
|
||||||
|
|
||||||
|
; test inverted character (right side)
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
@l1aa2:
|
||||||
|
ldy #0
|
||||||
|
.repeat 8,line
|
||||||
|
lda (SCREEN_PTR),y
|
||||||
|
and #$0f
|
||||||
|
eor #$0f
|
||||||
|
eor soft80_lo_charset+(line*$80),x
|
||||||
|
bne @l2bb2
|
||||||
|
.if line < 7
|
||||||
|
iny
|
||||||
|
.endif
|
||||||
|
.endrepeat
|
||||||
|
jmp @backokrevers
|
||||||
|
@l2bb2:
|
||||||
|
inx
|
||||||
|
cpx #$80
|
||||||
|
bne @l1aa2
|
||||||
|
|
||||||
|
jmp @backerr
|
||||||
|
|
19
libsrc/c64/soft80_cpeekcolor.s
Normal file
19
libsrc/c64/soft80_cpeekcolor.s
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
;
|
||||||
|
; 2017-12-27, Groepaz
|
||||||
|
;
|
||||||
|
; unsigned char cpeekcolor (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export soft80_cpeekcolor
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
.include "soft80.inc"
|
||||||
|
|
||||||
|
.segment "CODE"
|
||||||
|
|
||||||
|
soft80_cpeekcolor:
|
||||||
|
ldy #0
|
||||||
|
lda (CRAM_PTR),y
|
||||||
|
and #$0f
|
||||||
|
ldx #0
|
||||||
|
rts
|
15
libsrc/c64/soft80_cpeekrevers.s
Normal file
15
libsrc/c64/soft80_cpeekrevers.s
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
;
|
||||||
|
; 2017-12-28, Groepaz
|
||||||
|
;
|
||||||
|
; unsigned char cpeekrevers (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.import soft80_cpeekchar
|
||||||
|
|
||||||
|
.export soft80_cpeekrevers
|
||||||
|
|
||||||
|
soft80_cpeekrevers:
|
||||||
|
jsr soft80_cpeekchar
|
||||||
|
txa
|
||||||
|
ldx #0
|
||||||
|
rts
|
71
libsrc/c64/soft80_cpeeks.s
Normal file
71
libsrc/c64/soft80_cpeeks.s
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
;
|
||||||
|
; 2017-12-27, groepaz
|
||||||
|
;
|
||||||
|
; void cpeeks (char* s, unsigned length);
|
||||||
|
;
|
||||||
|
.export soft80_cpeeks
|
||||||
|
.import soft80_cpeekc, soft80_kplot, popax
|
||||||
|
|
||||||
|
.importzp ptr1, ptr2
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
.include "soft80.inc"
|
||||||
|
|
||||||
|
soft80_cpeeks:
|
||||||
|
eor #<$FFFF ; counting a word upward is faster
|
||||||
|
sta ptr2 ; so, we use -(length + 1)
|
||||||
|
txa
|
||||||
|
eor #>$FFFF
|
||||||
|
sta ptr2+1
|
||||||
|
|
||||||
|
jsr popax
|
||||||
|
sta ptr1
|
||||||
|
stx ptr1+1
|
||||||
|
|
||||||
|
; save current cursor position
|
||||||
|
lda CURS_X
|
||||||
|
pha
|
||||||
|
lda CURS_Y
|
||||||
|
pha
|
||||||
|
|
||||||
|
; get the string
|
||||||
|
@lp:
|
||||||
|
jsr soft80_cpeekc
|
||||||
|
ldy #0
|
||||||
|
sta (ptr1),y
|
||||||
|
|
||||||
|
; advance cursor position
|
||||||
|
ldy CURS_X
|
||||||
|
ldx CURS_Y
|
||||||
|
iny
|
||||||
|
cpy #charsperline
|
||||||
|
bne @sk2
|
||||||
|
ldy #0
|
||||||
|
inx
|
||||||
|
@sk2:
|
||||||
|
sty CURS_X
|
||||||
|
stx CURS_Y
|
||||||
|
clc
|
||||||
|
jsr soft80_kplot
|
||||||
|
|
||||||
|
inc ptr1
|
||||||
|
bne @sk
|
||||||
|
inc ptr1+1
|
||||||
|
@sk:
|
||||||
|
inc ptr2
|
||||||
|
bne @lp
|
||||||
|
inc ptr2+1
|
||||||
|
bne @lp
|
||||||
|
|
||||||
|
; terminate the string
|
||||||
|
lda #0
|
||||||
|
ldy #0
|
||||||
|
sta (ptr1),y
|
||||||
|
|
||||||
|
; restore the cursor position
|
||||||
|
pla
|
||||||
|
tax ; CURS_Y
|
||||||
|
pla
|
||||||
|
tay ; CURS_X
|
||||||
|
clc
|
||||||
|
jmp soft80_kplot
|
17
libsrc/c64/soft80mono_cpeekcolor.s
Normal file
17
libsrc/c64/soft80mono_cpeekcolor.s
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
;
|
||||||
|
; 2017-12-27, Groepaz
|
||||||
|
;
|
||||||
|
; unsigned char cpeekcolor (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export soft80mono_cpeekcolor
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
.include "soft80.inc"
|
||||||
|
|
||||||
|
.segment "CODE"
|
||||||
|
|
||||||
|
soft80mono_cpeekcolor:
|
||||||
|
lda CHARCOLOR
|
||||||
|
ldx #0
|
||||||
|
rts
|
|
@ -113,6 +113,17 @@ static unsigned char testCPeekC (char ch)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* toggle revers mode every few chars so cpeekc gets tested for both */
|
||||||
|
revers ((ch >> 3) & 1);
|
||||||
|
|
||||||
|
/* output additional space every now and then, that way not only even or only
|
||||||
|
odd half of the character cell will be tested */
|
||||||
|
#if defined(__C64__)
|
||||||
|
if ((width == 80) && ((ch % 17) == 0)) {
|
||||||
|
cputc(' ');
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Output the char to the screen. */
|
/* Output the char to the screen. */
|
||||||
cputc (ch);
|
cputc (ch);
|
||||||
|
|
||||||
|
@ -141,8 +152,8 @@ static unsigned char testCPeekC (char ch)
|
||||||
*/
|
*/
|
||||||
ch2_c = peekChWithoutTranslation ();
|
ch2_c = peekChWithoutTranslation ();
|
||||||
if ((ch2_c != ch2_b)
|
if ((ch2_c != ch2_b)
|
||||||
#if defined(__C128__)
|
#if defined(__C128__) || defined(__C64__)
|
||||||
/* VDC memory is not accessable */
|
/* VDC memory is not accessible, soft80 has no "videoram" */
|
||||||
&& (width == 40)
|
&& (width == 40)
|
||||||
#endif
|
#endif
|
||||||
){
|
){
|
||||||
|
@ -230,7 +241,7 @@ int main (void)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
clrscr ();
|
clrscr ();
|
||||||
revers (1);
|
revers (0);
|
||||||
textcolor(1);
|
textcolor(1);
|
||||||
bgcolor(0);
|
bgcolor(0);
|
||||||
screensize (&width, &i);
|
screensize (&width, &i);
|
||||||
|
@ -261,7 +272,7 @@ int main (void)
|
||||||
|
|
||||||
#if defined (__CBM610__) || defined (__PET__)
|
#if defined (__CBM610__) || defined (__PET__)
|
||||||
cprintf("\n\rno COLOR_RAM\n\r");
|
cprintf("\n\rno COLOR_RAM\n\r");
|
||||||
#elif defined (__C128__)
|
#elif defined (__C128__) || defined (__C64__)
|
||||||
if (width == 40) {
|
if (width == 40) {
|
||||||
cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM);
|
cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue