Created
May 23, 2020 16:50
-
-
Save sehugg/e7d2e466a4d4af7a75f33a28db6fcd34 to your computer and use it in GitHub Desktop.
Workaround gotoxy() kernel crash in C64 open source BIOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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