ThomasAdam wrote:Perhaps someone should take me through what happens when a program is loaded into memory, so I can best understand why, in REM statements, this would even have any effect.
Don't worry too much about obscuring the listing for now, let's just make a listing beep with VDU 7.
So your listing in memory is stored as the line number, a token for REM, then the text of your REM.
When you do LIST, the command will read & display the line number (from binary to decimal characters), read & translate the token for REM (so the one byte token expands to the text REM on-screen), and then stream out (using the VDU driver) the text following the REM command.
So if you have
10 REM Hello
It is stored as two bytes (IIRC) for the line number, one byte for the REM token, then Hello.
So when you list, it effectively does VDU H VDU e VDU l VDU l VDU o.
If you replace (with a ? poke) the H of Hello with a binary 7 - that's a beep.
So when you list, it effectively does VDU 7 (
beep) VDU e VDU l VDU l VDU o.
You can replace 7 with other VDU codes, like 21, or 12 (clear screen.)
I'll dig out the actual token for REM and more information on how a program is stored - or do some peeking & poking yourself.