I just got a new VIC-20. I found that the sine curve and circle examples in the VIC-20 Programmer's Reference Guide displayed some garbage in the lower right part of the graphics area. I managed to isolate the issue to the following program where line 10 prints the value 147. At first, I thought there was something wrong with my new VIC-20 but then I tried the same little program with my old VIC-20 (where disk drive connection doesn't work) and it gave the same result so apparently it is not an error with my new VIC-20.
1 REM RUN THIS PROGRAM WITH UNEXPANDED VIC-20
5 POKE7679,0:REM SET HIGHEST POSITION IN BASIC RAM AREA TO 0
7 PRINTCHR$(147):REM CLEAR SCREEN
10 PRINTPEEK(7679):REM I WOULD EXPECT THIS TO PRINT 0 BUT IT PRINTS 147
A peculiar behaviour
Moderator: Moderators
-
- Vic 20 Drifter
- Posts: 22
- Joined: Fri Jun 02, 2017 11:56 am
- Location: Sweden
Re: A peculiar behaviour
The basic interpreter stores variables at the end of the basic memory I think. When using chr$, a temporary variable is probably made and stored there by the interpreter. Try to change chr$(147) to another value and you will see. Works exactly the same on the c64.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
-
- Vic 20 Drifter
- Posts: 22
- Joined: Fri Jun 02, 2017 11:56 am
- Location: Sweden
Re: A peculiar behaviour
Yes, I think you're right. String storage starts at the end of BASIC memory and goes downward so probably CHR$(147) is interpreted as a string that is put at the end of BASIC memory. I guess you would need to lower the end of BASIC memory to be able to write to 7679 without it being overwritten by BASIC.Boray wrote:The basic interpreter stores variables at the end of the basic memory I think. When using chr$, a temporary variable is probably made and stored there by the interpreter. Try to change chr$(147) to another value and you will see. Works exactly the same on the c64.
Re: A peculiar behaviour
Are you sure? It almost seems like the start of BASIC has been moved to 7680.
Rob
-
- Vic 20 Drifter
- Posts: 22
- Joined: Fri Jun 02, 2017 11:56 am
- Location: Sweden
Re: A peculiar behaviour
No, I haven't changed the start of BASIC when running my short code example.GreyGhost wrote:Are you sure? It almost seems like the start of BASIC has been moved to 7680.