Login
Back to forumSee the full topicGo to last reply

Posted By

JamesC
on 2017-12-06
00:56:56
 Re: Does the Plus/4 support some form of VARPTR() command?

Alright, let's not reinvent the wheel. We can do this with a very minor change.

1. Start your program with an 88-characters-long REM (two full screen lines plus 8 characters of the 3rd line):

10 REM1234567890123456789012345678901234567890123456789012345678901234567890123456789012

2. If your program resides in normal BASIC space, then it starts at $1000 (4096). Add 6 to get the address of the first '1' in Line 10. In this example, it is at 4102.

3. READ your data (up to 82 bytes), then POKE it directly into the REM statement. Same idea as the ML$ in Microsoft BASIC.

20 FOR I = 0 TO 81 : READ D : POKE 4102 + I, D
30 NEXT D
40 (program continues here)

4. Commodore BASIC does not allow us to DELETE lines while a program is running. But once the data is POKEd into the REM statement, you can DELETE the FOR-READ-POKE-NEXT lines and the DATA statements while in immediate mode (when the program is NOT running):

DELETE 20 - 30 (the FOR-NEXT loop)
DELETE 10000 - 10020 (the DATA statements)

5. AND THEN SAVE THE PROGRAM. This will give you a program with your machine language routine ALREADY IN THE REM STATEMENT, which saves you from READing and POKEing every time you load and run it! happy

DSAVE "MY PROGRAM.BAS"

6. Within your program, anytime you want to execute your machine-language routine, simply SYS 4102. happy






Back to top


Copyright © Plus/4 World Team, 2001-2024