error with basl .

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

error with basl .

Post by funkheld »

Hi good afternoon.

what kind of error is this in the Basl program?

Thanks.
greeting

Code: Select all

RESTORE ASM
 
READ Z
FOR P = 1024 TO (1024 + Z)
  READ Z
  POKE 1024+P,Z
NEXT P

ASM:
 DATA 73
 DATA  $A9, $04, $85, $01, $A9, $44, $A0, $20, $20, $63
 DATA  $FE, $A9, $3A, $A0, $20, $20, $24, $FE, $A9, $3F
 DATA  $A0, $20, $20, $5A, $FE, $20, $21, $FE, $A9, $3F
 DATA  $A0, $20, $20, $5A, $FE, $20, $21, $FE, $20, $06
 DATA  $FE, $85, $02, $84, $03, $A0, $00, $B1, $02, $F0
 DATA  $06, $20, $D2, $FF, $C8, $D0, $F6, $60, $84, $1C
 DATA  $F5, $C2, $8F, $83, $20, $00, $00, $00, $82, $00
 DATA  $00, $00, $00,

 
 END
 
Attachments
basl.jpg
basl.jpg (36.44 KiB) Viewed 437 times
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

Re: error with basl .

Post by TomXP411 »

To see the actual problem line, you need to
LIST 3
Remember that BASLOAD just adds line numbers and converts labels and variables. So you need to look at the converted source to see what the reported error is.

But there are several things wrong here.

First, you are setting up the loop conditions with Z, then changing Z inside the loop.

This is a bad idea.

Also, you appear to be loading your DATA into at 1024 (based on the initial value of P), but then you're adding 1024 inside the loop. This will actually load the data into address 2048 - which is where the BASIC program resides. So you've just succeeded in overwriting the program with garbage data.

Try this loop, instead:
READ Z
A1=1024
A2=A1+Z-1
FOR P=A1 TO A2
  READ Z
  POKE P,Z
NEXT
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: error with basl .

Post by funkheld »

Hi, Thank You.

I misinterpreted that completely. :oops: :oops:

Thanks.
greeting
Post Reply