I think you must be right John,
because this line works

20 PRINT A$(S):F=256*PEEK( VARPTR(D$(S)) +2)+PEEK( VARPTR(D$(S)) +1)



On Mon, May 28, 2018 at 7:37 PM, Stephen Adolph <[email protected]>
wrote:

> sounds plausible.
>
> for reference here is the code. I have 4 embedded ML programs that I want
> to select to run.
>
> 2 REM good command sequence
> 3 A$(0)="using good sequence":D$(0)="ó:@ð:@ð:¸ð:òð:4ð:°ð:1ð:¿ð77~2ÀüûÉ"
> 4 REM bad command sequence  add 7 after 4@
> 5 A$(1)="using bad sequence1":D$(1)="ó:@ð:@ð:¸ð:òð:4ð7:°ð:1ð:¿ð77~2ÀüûÉ"
> 6 REM bad command sequence 2 add 7 after 77
> 7 A$(2)="using bad sequence2":D$(2)="ó:@ð:@ð:¸ð:òð:4ð:°ð:1ð:¿ð77&~2ÀüûÉ"
> 8 REM bad command sequence 3 remove 7 from 77
> 9 A$(3)="using bad sequence3":D$(3)="ó:@ð:@ð:¸ð:òð:4ð:°ð:1ð:¿ð7~2ÀüûÉ"
> 10 CLS:PRINT"Send command + data to REXCPM"
> 11 INPUT"select command sequence (1-4)";S:IF S<1 OR S>4 THEN 10
> 12 S=S-1
> 20 PRINT A$(S):F=0:K=VARPTR(D$(S)):F=256*PEEK(K+2)+PEEK(K+1)
> 21 PRINTF
> 22 FORI=1TOLEN(D$(S)):IF ASC(MID$(D$(S),I,1)) <> PEEK(F+I-1) THEN
> BEEP:PRINT"bad!":END
> 23 NEXTI:PRINT"good!!"
> 30 INPUT"Enter command byte";L
> 40 INPUT"enter data byte";H
> 50 CALLF,0,256*H+L
> 60 PRINT"result = ";PEEK(64704)
> 70 PRINT"hit any key to repeat"
> 80 IFINKEY$=""THEN 80
> 90 GOTO10
>
>
> On Mon, May 28, 2018 at 7:36 PM, John R. Hogerhuis <[email protected]>
> wrote:
>
>>
>> On Mon, May 28, 2018 at 4:29 PM Stephen Adolph <[email protected]>
>> wrote:
>>
>>> yes, I do have a dim but ..not sure it matters though. I think I tried
>>> with and without.
>>>
>>
>> Hmm. Not sure how the basic variable allocator works. But if putting F=0
>> makes it work or not work I suspect that assigning F for the first time
>> creates a new variable and caused the array to move.
>>
>> DIM’ing either or both, or assigning a value like you did might resolve.
>>
>> Whether that’s a bug I don’t know. Maybe you just need to be careful not
>> to allocate variables between when you take VARPTR and when you use it the
>> address.
>>
>> — John
>>
>
>

Reply via email to