5

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.

Dacobi
  • 417
  • 4
  • 14
  • It's unclear what `TMP` is. Is that your whole code? Do you have the load address set for your `PRG`? Sounds like `CHR$` is trying to allocate a new string and fails because it thinks there is no free memory left. – Jester Aug 24 '19 at 23:07
  • Sorry, TMP is Turbo Macro Pro v1.2. In the full code I have some assembly code at *=$1000. but if the BASIC line is 10 SYS 4096, I don't get the OUT OF MEMORY ERROR. – Dacobi Aug 25 '19 at 08:56
  • Turns out that if I assemble to disk and then restart and RUN from disk it works fine, so must be some memory problem with TMP. I just don't understand what. – Dacobi Aug 25 '19 at 09:42

1 Answers1

3

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.

Mike
  • 2,721
  • 1
  • 15
  • 20