CPCWiki forum

General Category => Programming => Topic started by: freemac on 21:03, 10 December 19

Title: Laser BASIC MEMORY &XXXX crash
Post by: freemac on 21:03, 10 December 19
Hi,

Got problem using Laser BASIC compiler when I use "MEMORY &3999" in order to load my 11KB ASM routine into &4000.
Quote
10 MEMORY &3999
20 load"molusk2.bin",&4000
30 call &4000
40 ... my basic code
the program does crash after a certain number of basic jump (after a certain number of level loading) 

Compiled program does take 12-14KB, and seems load at &0100-&2EFF

Where can I add my ASM in MEMORY, without hurting the default MEMORY setting ? Can I reset my MEMORY setting after my LOAD instruction ?
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: AMSDOS on 22:56, 10 December 19
I don't know Laser BASIC all that well, in theory it looks fine apart from the MEMORY &3999 which could be at MEMORY &3FFF with your Assembly code beginning at &4000, the screenshot though shows a Runtime error produced by Laser BASIC though, which suggests something not being quite right perhaps between your source code and the assembly routine, though I don't know for sure.  :(
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: freemac on 23:02, 10 December 19

Looking around the "default HIMEM of LASER Basic", I found &0F22 (by snapshoot compare (x39,x33 = &3339), offset with this "RUNTIME" message error)
Quote
10 MEMORY &3999
20 load"molusk2.bin",&4000
30 call &4000
40 MEMORY &F22
40 ... my basic code
As result I reach level 10 successfully, and then crash at begin of level 11.


I'll try &3FFF next time
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: freemac on 23:13, 10 December 19
I don't know Laser BASIC all that well, in theory it looks fine apart from the MEMORY &3999 which could be at MEMORY &3FFF with your Assembly code beginning at &4000, the screenshot though shows a Runtime error produced by Laser BASIC though, which suggests something not being quite right perhaps between your source code and the assembly routine, though I don't know for sure.  :(

Quote
10 MEMORY &3FFF
20 load"molusk2.bin",&4000
30 call &4000
40 ... my basic code
Tested also OK, level 10 reached successfully, and then crash at begin of level 11.

I gave also a try just with
Quote
10 MEMORY &3999
40 ... my basic code
got the same result with/without my ASM routine. Does crash also.
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: freemac on 13:19, 15 December 19
Quote
10 MEMORY &6FFF
20 load"molusk3.bin",&7000
30 call &7000
40 ... my basic code
Level 67 (8 levels in fact) reached.

Got a bug at start, but in a string area, so it does not affect my code.
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: GUNHED on 15:08, 15 December 19
Got problem using Laser BASIC compiler when I use "MEMORY &3999" in order to load my 11KB ASM routine into &4000.the program does crash ... snip


Well, first of all you should decide it you want to use decimal or hexadezimal code.


1. dezimal:
memory 3999
load"file",4000


2. hexadezimal:
memory &3FFF
load"file",&4000



Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: freemac on 16:15, 15 December 19
I have choosen HEXA  8)

I reach level 131 without ASM routine and then crash.

Got STRING garbage until &7000
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: freemac on 16:40, 15 December 19
If I remove the "SCORE:" :
Quote
280 'PRINT "SCORE:"+STR$(scoreP1%)+" -"+STR$(scoreP2%)
The last "PRINT USING FUNCTION" instruction used is some PRINT chr$(a%) used for drawing "Matrix level".

In dump I show that my routine starting at &7000 got eaten (laser_basic_matrixHexa.png)

If I remove Matrix level, and use this "SCORE:" formula :
Quote
281 PRINT "SCORE:":LOCATE 7,21:PRINT scoreP1%:LOCATE 11,21:PRINT"-":LOCATE 12,21:PRINT scoreP2%
my LASER BASIC compiled program does grow only 24 bytes per level (laser_basic_skullDump.png)
Title: Re: Laser BASIC MEMORY &XXXX crash
Post by: GUNHED on 17:13, 15 December 19
Some code gets overwritten, maybe you can add some kind of 'trace' code to check certain RAM bytes (for a change), and then report the change. That way you can find out what's responsible.