v0.52. Fix memory corruption bug.

This fixes a memory corruption bug that occurred when compiling code with subroutines.  The symbol table was corrupting the source code.  This was showing up on 6502 systems only (seemed okay on Linux).
This commit is contained in:
Bobbi Webber-Manners 2018-04-28 14:00:56 -04:00 committed by GitHub
parent 9550257613
commit cdbfeafda9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 9 deletions

Binary file not shown.

Binary file not shown.

View File

@ -84,9 +84,11 @@ test.d64: 8ball20.prg 8ballvm20.prg 8ball64.prg 8ballvm64.prg
c1541 -attach test.d64 -write 8ball64.prg
c1541 -attach test.d64 -write 8ballvm64.prg
test.dsk: eightball.system ebvm.system
test.dsk: eightball.system ebvm.system sieve4.8b
java -jar ~/Desktop/Apple2/AppleCommander-1.3.5.jar -d test.dsk e8ball.system
java -jar ~/Desktop/Apple2/AppleCommander-1.3.5.jar -d test.dsk ebvm.system
java -jar ~/Desktop/Apple2/AppleCommander-1.3.5.jar -d test.dsk sieve4.8b
java -jar ~/Desktop/Apple2/AppleCommander-1.3.5.jar -p test.dsk e8ball.system sys <eightball.system
java -jar ~/Desktop/Apple2/AppleCommander-1.3.5.jar -p test.dsk ebvm.system sys <ebvm.system
java -jar ~/Desktop/Apple2/AppleCommander-1.3.5.jar -p test.dsk sieve4.8b txt <sieve4.8b

BIN
eightball

Binary file not shown.

View File

@ -3017,7 +3017,7 @@ unsigned char dosubr()
* of the location of the variables in the compiled code.
* TODO: There is no way to free this without deleting all of heap2 (source code)
*/
s = alloc2(sizeof(var_t) + sizeof(int));
s = alloc2(sizeof(sub_t));
strncpy(s->name, readbuf, 8);
s->addr = rtPC;
s->next = NULL;
@ -3177,7 +3177,7 @@ unsigned char docall()
* Do this before evaluating arguments, which overwrites readbuf
*/
if (compile) {
s = alloc2(sizeof(var_t) + sizeof(int));
s = alloc2(sizeof(sub_t));
strncpy(s->name, readbuf, 8);
}
@ -4730,17 +4730,17 @@ main()
#ifdef A2E
videomode(VIDEOMODE_80COL);
revers(1);
print(" *** EIGHTBALL V0.51 *** \n");
print(" *** EIGHTBALL V0.52 *** \n");
print(" *** (C)BOBBI, 2018 *** \n\n");
revers(0);
#elif defined(C64)
print(" *** EightBall v0.51 *** ");
print(" *** EightBall v0.52 *** ");
print(" *** (c)Bobbi, 2018 *** \n\n");
#elif defined(VIC20)
/* Looks great in 22 cols! */
print("*** EightBall v0.51 ***** (c)Bobbi, 2017 ***\n\n");
print("*** EightBall v0.52****** (c)Bobbi, 2017 ***\n\n");
#else
print(" *** EightBall v0.51 *** \n");
print(" *** EightBall v0.52 *** \n");
print(" *** (c)Bobbi, 2018 *** \n\n");
#endif

Binary file not shown.

View File

@ -1,7 +1,7 @@
' Sieve of Eratosthenes
byte A[10000] = 1
call doall(100)
byte A[400] = 1
call doall(20)
end
sub doall(word nr)

BIN
test.d64

Binary file not shown.

BIN
test.dsk

Binary file not shown.