Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor adds number sequence when line contains a 206 (DEFFN) code #4

Open
lippmaje opened this issue Jul 20, 2022 · 5 comments
Open

Comments

@lippmaje
Copy link

lippmaje commented Jul 20, 2022

The editor adds a number sequence (#14 plus 5 more bytes) in front of a comma whenever the source code contains the number 206. It also happens when the line number itself is made up from a 206 (lowbyte). See the sample below. Saving this sample and reloading it causes the unwanted number sequence(s) to reappear.

   5 REM False number bytes after a 206 data field.
   6 REM Does not happen with 205 or other numbers.
  10 DATA 206: REM a,b,c
  20 DATA 205: REM a,b,c
  30 DATA 206: REM a,
  40 DATA 206: REM ,b
  50 DATA 206: DATA "z,x",z,x: REM z,x
  60 DATA 207: DATA "z,","x,","z,x"
8900 REM Also happens if line nr contains 206, like
8901 REM with 8910 which is 34*256 + 206
8909 DATA "z,x"
8910 DATA "z,z,x"
8911 DATA "z,x"
9998 REM The number bytes prefix all commas of that line.
9999 REM If removed, they reappear after reload.

issue_206

@lippmaje
Copy link
Author

lippmaje commented Jul 20, 2022

Hint: When you add a DEF FN statement to a program, the ZX basic system adds an empty number sequence (#14 plus 5 zeroes) to any parameter in the comma-separated parameter list. See ROM at $1F86. My assumption is that Basinc tries to mimick this behavior but fails to determine if the 206 is indeed a DEFFN or something else.

The issue may be caused by FindDEFFN() / ProcessDEFFN() in BASSupport.pas. I still have no clue how to compile the sources.

@ref-xx
Copy link
Owner

ref-xx commented Aug 26, 2022

I could not be able to replicate the issue here (tested in 1.75, 1.78, 1.79).
(btw. please use latest version, 1.77 is outdated)

@lippmaje
Copy link
Author

It would be great to be able to submit defects against the latest version. However, the last commit here is from Oct 21 v1.77. Do you update the GitHub project?

@ref-xx
Copy link
Owner

ref-xx commented Nov 29, 2022

ok, I finally confirm and understand the problem. as you have perfectly pinpoint, both FindDEFFN() / ProcessDEFFN() was to blame.

@lippmaje lippmaje closed this as completed Feb 3, 2024
@lippmaje lippmaje reopened this Feb 18, 2024
@lippmaje
Copy link
Author

lippmaje commented Feb 18, 2024

v1.794

It looks like it happens again. Line 9422 is 36*256+206 and BasinC happily inserts 6 bytes into the DATA statement. Removing the chars and saving does not work because it gets added again as soon as you reload the program.

BAS file:
deffnbug.zip

screen6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants