Fix BASIC

This commit is contained in:
Kilian committed 2026-09-27 01:21:42 +02:00
1 parent c5a028c8c6
commit 9e6a96f93a
4 files changed
+40 -9

No files matched your search

-1
View File
@@ -17,5 +17,4 @@ SPACE_FOR_GOSUB := $3E
STACK_TOP := $FA
WIDTH := 40
WIDTH2 := 30
RAMSTART2 := $0400
+8
View File
@@ -204,9 +204,17 @@ L4098:
ldx #TEMPST
stx TEMPPT
.ifndef CONFIG_CBM_ALL
.ifdef KILIAN
lda #<$BC00
sta MEMSIZ
lda #>$BC00
sta MEMSIZ+1
jmp L4106
.else
lda #<QT_MEMORY_SIZE
ldy #>QT_MEMORY_SIZE
jsr STROUT
.endif
.ifdef APPLE
jsr INLINX
.else
+15
View File
@@ -13,5 +13,20 @@ int getChar(void) {
int c = getchar();
// Specifically send FF for EOF to trigger echo cancellation
if (c == EOF) {
return 0xFF;
}
// BASIC expects CR always
if (c == '\n') {
return '\r';
}
// BASIC is uppercase only
if (c >= 'a' && c <= 'z') {
c = c - 'a' + 'A';
}
return c;
}
+17 -8
View File
@@ -26,26 +26,35 @@ uint8_t readMemory(uint16_t address, uint8_t *ram, uint8_t *rom) {
}
void writeMemory(uint16_t address, uint8_t value, uint8_t *ram) {
if ((address < RAM_SIZE && address < IO_BASE) || address >= ROM_BASE) {
if (address < ROM_BASE && ram[IO_BASE + ROM_BANKED_OUT] != 0) {
/* Normal RAM */
if (address < IO_BASE) {
ram[address] = value;
return;
}
/* ROM area */
if (address >= ROM_BASE) {
if (ram[IO_BASE + ROM_BANKED_OUT] != 0) {
ram[address] = value;
}
} else {
return;
}
/* I/O area */
uint16_t _address = address - IO_BASE;
switch (_address) {
case SCREEN_ADDRESS: {
case SCREEN_ADDRESS:
putChar(value);
break;
}
case ROM_BANKED_OUT: {
case ROM_BANKED_OUT:
ram[IO_BASE + ROM_BANKED_OUT] = value;
break;
}
default:
break;
}
}
}
uint8_t readStack(uint8_t address, uint8_t *ram) { return ram[0x100 + address]; }