Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modified C64 PRG BASIC header?

I recently bought a c64 mini and been trying to code some assembly using Turbo Macro Pro v1.2.

While working on the hello world program I found a tutorial where an auto run BASIC header was used.

I tried to also include a PRINT CHR$(147) to clear the screen, but I get an OUT OF MEMORY ERROR.

the original BASIC header was:

*=$0801
.byte $0c, $08, $0a, $00, $9e, $20
.byte $34, $30, $39, $36, $00, $00
.byte $00

I modified it to:

*=$0801
.byte $0e, $08, $0a, $00, $99, $20
.byte $c7, $28, $31, $34, $37, $29
.byte $00, 
.byte $19, $08, $14, $00, $9e, $20
.byte $34, $30, $39, $36, $00, $00
.byte $00

When I assemble and run from TMP and then type LIST i get,

10 PRINT CHR$(147)
20 SYS 4096

But when RUN I get the OUT OF MEMORY ERROR at line 10.

Am I doing something wrong? Or is it really out of memory for this instruction?

TMP is still loaded in memory in the background. I'm currently running this in VICE.

like image 264
Dacobi Avatar asked Oct 27 '22 09:10

Dacobi


1 Answers

I would guess that TMP allocates all of the memory it can for lookup tables, intermediate code etc. The last thing it wants is BASIC messing things up and so it will point the top of BASIC memory somewhere safe. Allocatable BASIC memory can be found in pointers at 43-44 and 55-56, indicating the start/end of BASIC memory. Normally, they are $0801 to $A000 but I'm guessing TMP sets them otherwise.

like image 62
Mike Avatar answered Nov 02 '22 05:11

Mike