Merge pull request #198 from root42/detect-basic-and-gotoxy-for-pet

Implement gotoxy for PET
This commit is contained in:
drmortalwombat 2025-03-23 14:54:10 +01:00 committed by GitHub
commit 3f4268328e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,6 +131,18 @@ __asm bsinit
lda #147
jmp $ffd2
}
#elif defined(__CBMPET__)
#define bsout 0xffd2
#define bsin 0xffe4
__asm bsplot
{
/* no equivalent on PET */
}
__asm bsinit
{
/* no equivalent on PET */
}
#define bsget 0xffcf
#else
#define bsout 0xffd2
#define bsin 0xffe4
@ -341,13 +353,32 @@ void textcursor(bool show)
void gotoxy(char cx, char cy)
{
#if defined(__CBMPET__)
#define CURS_X 0xc6
#define CURS_Y 0xd8
#define SCREEN_PTR 0xc4
#define SCR_LINELEN 0xd5
__assume(cy < 25);
*(volatile char *)CURS_X = cx;
*(volatile char *)CURS_Y = cy;
if (*(volatile char *)SCR_LINELEN > 40)
cy <<= 1;
const unsigned off = cy * 40;
* (volatile unsigned *)SCREEN_PTR = off + 0x8000;
#else
__asm
{
ldx cy
ldy cx
clc
jsr bsplot
}
}
#endif
}
void textcolor(char c)