Skip to content

Instantly share code, notes, and snippets.

@sehugg
Created May 23, 2020 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sehugg/e7d2e466a4d4af7a75f33a28db6fcd34 to your computer and use it in GitHub Desktop.
Save sehugg/e7d2e466a4d4af7a75f33a28db6fcd34 to your computer and use it in GitHub Desktop.
Workaround gotoxy() kernel crash in C64 open source BIOS
#include <stdio.h>
#include <conio.h>
#include <c64.h>
#include <cbm_petscii_charmap.h>
void xygoto(char x, char y) {
x=x; y=y; // to avoid "unused variable" warning
__asm__ ("jsr popa");
__asm__ ("tax"); // pop X
__asm__ ("jsr popa");
__asm__ ("tay"); // pop Y
__asm__ ("clc");
__asm__ ("jsr $fff0"); // call PLOT kernal routine
}
void main(void) {
clrscr();
printf("\r\nHello World! Press a key ...\r\n");
cgetc();
cputs("Print next line");
xygoto(15,5);
cputs("Print @ 15,5");
xygoto(16,6);
cputs("Print @ 16,6");
while (1) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment