pure asm implementation of bsplot
This commit is contained in:
parent
2c37e150a9
commit
ab2ca897ce
108
include/conio.c
108
include/conio.c
|
@ -134,8 +134,77 @@ __asm bsinit
|
||||||
#elif defined(__CBMPET__)
|
#elif defined(__CBMPET__)
|
||||||
#define bsout 0xffd2
|
#define bsout 0xffd2
|
||||||
#define bsin 0xffe4
|
#define bsin 0xffe4
|
||||||
__asm bsplot{
|
/* This is inspired by the cc65 source code from pet/cputc.s */
|
||||||
/* no equivalent on PET */
|
#define CURS_X $c6
|
||||||
|
#define CURS_Y $d8
|
||||||
|
#define SCREEN_PTR $c4
|
||||||
|
#define SCR_LINELEN $d5
|
||||||
|
__asm bsplot
|
||||||
|
{
|
||||||
|
sty CURS_X
|
||||||
|
stx CURS_Y
|
||||||
|
plot: ldy CURS_Y
|
||||||
|
lda ScrLo,y
|
||||||
|
sta SCREEN_PTR
|
||||||
|
lda ScrHi,y
|
||||||
|
ldy SCR_LINELEN
|
||||||
|
cpy #40+1
|
||||||
|
bcc col80
|
||||||
|
asl SCREEN_PTR /* 80 column mode */
|
||||||
|
rol
|
||||||
|
col80: ora #$80 /* Screen at $8000 */
|
||||||
|
sta SCREEN_PTR+1
|
||||||
|
rts
|
||||||
|
ScrLo: byt 0x00
|
||||||
|
byt 0x28
|
||||||
|
byt 0x50
|
||||||
|
byt 0x78
|
||||||
|
byt 0xA0
|
||||||
|
byt 0xC8
|
||||||
|
byt 0xF0
|
||||||
|
byt 0x18
|
||||||
|
byt 0x40
|
||||||
|
byt 0x68
|
||||||
|
byt 0x90
|
||||||
|
byt 0xB8
|
||||||
|
byt 0xE0
|
||||||
|
byt 0x08
|
||||||
|
byt 0x30
|
||||||
|
byt 0x58
|
||||||
|
byt 0x80
|
||||||
|
byt 0xA8
|
||||||
|
byt 0xD0
|
||||||
|
byt 0xF8
|
||||||
|
byt 0x20
|
||||||
|
byt 0x48
|
||||||
|
byt 0x70
|
||||||
|
byt 0x98
|
||||||
|
byt 0xC0
|
||||||
|
ScrHi: byt 0x00
|
||||||
|
byt 0x00
|
||||||
|
byt 0x00
|
||||||
|
byt 0x00
|
||||||
|
byt 0x00
|
||||||
|
byt 0x00
|
||||||
|
byt 0x00
|
||||||
|
byt 0x01
|
||||||
|
byt 0x01
|
||||||
|
byt 0x01
|
||||||
|
byt 0x01
|
||||||
|
byt 0x01
|
||||||
|
byt 0x01
|
||||||
|
byt 0x02
|
||||||
|
byt 0x02
|
||||||
|
byt 0x02
|
||||||
|
byt 0x02
|
||||||
|
byt 0x02
|
||||||
|
byt 0x02
|
||||||
|
byt 0x02
|
||||||
|
byt 0x03
|
||||||
|
byt 0x03
|
||||||
|
byt 0x03
|
||||||
|
byt 0x03
|
||||||
|
byt 0x03
|
||||||
}
|
}
|
||||||
__asm bsinit
|
__asm bsinit
|
||||||
{
|
{
|
||||||
|
@ -352,40 +421,6 @@ void textcursor(bool show)
|
||||||
|
|
||||||
void gotoxy(char cx, char cy)
|
void gotoxy(char cx, char cy)
|
||||||
{
|
{
|
||||||
#ifdef __CBMPET__
|
|
||||||
/* This is inspired by the cc65 source code from pet/cputc.s */
|
|
||||||
#define CURS_X $c6
|
|
||||||
#define CURS_Y $d8
|
|
||||||
#define SCREEN_PTR $c4
|
|
||||||
#define SCR_LINELEN $d5
|
|
||||||
|
|
||||||
static const char ScrLo[] = { 0x00, 0x28, 0x50, 0x78, 0xA0, 0xC8, 0xF0, 0x18,
|
|
||||||
0x40, 0x68, 0x90, 0xB8, 0xE0, 0x08, 0x30, 0x58,
|
|
||||||
0x80, 0xA8, 0xD0, 0xF8, 0x20, 0x48, 0x70, 0x98,
|
|
||||||
0xC0 };
|
|
||||||
|
|
||||||
static const char ScrHi[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
|
|
||||||
0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
|
|
||||||
0x03 };
|
|
||||||
__asm {
|
|
||||||
lda cx
|
|
||||||
sta CURS_X
|
|
||||||
lda cy
|
|
||||||
sta CURS_Y
|
|
||||||
ldy CURS_Y
|
|
||||||
lda ScrLo,y
|
|
||||||
sta SCREEN_PTR
|
|
||||||
lda ScrHi,y
|
|
||||||
ldy SCR_LINELEN
|
|
||||||
cpy #40+1
|
|
||||||
bcc col80
|
|
||||||
asl SCREEN_PTR /* 80 column mode */
|
|
||||||
rol
|
|
||||||
col80: ora #$80 /* Screen at $8000 */
|
|
||||||
sta SCREEN_PTR+1
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
ldx cy
|
ldx cy
|
||||||
|
@ -393,7 +428,6 @@ void gotoxy(char cx, char cy)
|
||||||
clc
|
clc
|
||||||
jsr bsplot
|
jsr bsplot
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void textcolor(char c)
|
void textcolor(char c)
|
||||||
|
|
Loading…
Reference in New Issue