Giter VIP home page Giter VIP logo

basic816's Issues

Populating an arrays of string causes program to crash

Version:
KERNEL: v0.4.0-alpha+333 (2021-08-07)
BASIC VERSION: BASIC816 v0.2.0-alpha+411
HARDWARE: Foenix U

Description:
When you try to assign multiple values to an array of String in BASIC the program crashes and takes you to the MONITOR prompt (PROGRAM COUNTER: 1A67B5)

You can use the following code to demonstrate the issue:

Code:

5 DIM N$(10)
10 FOR C%=1 TO 10
20 READ M$
30 N$(C%)=M$
40 NEXT
50 END
1000 DATA "C","C#","D","D#","E","F","F#","G","G#","A","A#","B"

Feature request: Ctrl-C in GET and INPUT

The GET and INPUT statements ignore Ctrl-C when paused for input. They should accept Ctrl-C, interrupt the prompt, and halt the program if running, or return to the prompt having taken no effect on the variable in immediate mode.

(Alt-SysRq does work in these input modes, so there's a workaround.)

Sprite commands always reference sprite 1

Version: Basic816 v0.2.0-alpha+254
Description: you can activate with basic commands one sprite, but when trying to activate a second one the commands seem to be applied to sprite 1 regardless of the number parameter used on the sprite command.

The provided code should show two sprites on screen but when configuring the second sprite the first one disappears and shows only the second one.
After running the program if you execute a SPRITEAT 1,100,100 it moves the recently configured 2nd sprite, this further proves that commands are being applied to sprite 1

Code:

10 CLS
20 GRAPHICS 47
30 spb%=&hb00000: REM sprite base pointer
40 FOR c%=0 to 1024:POKE sbc%+c%,1:NEXT
50 SPRITE 1,0,spb%
60 SPRITEAT 1,100,100
70 SPRITESHOW 1,1
80 PRINT "Press a key to show sprite 2"
90 GET k$:IF k$="" THEN 90
100 SPRITE 2,0,spb%
100 SPRITEAT 2,150,100
120 SPRITESHOW 2,1

Feature request: "resave" command

The save command refuses to overwrite a file of the same name. I appreciate this design, but I'm wondering whether I'd prefer an iterative workflow that would let me save in place. Moreover, it would be convenient if I didn't have to remember my filename just to checkpoint save my program.

Would there be interest in having BASIC816 remember the most recent load/save filename, and a "resave" command that takes no arguments and overwrites the file with that name? I welcome counterarguments based on ergonomics, I don't know if this is the best or safest solution. One could argue that non-destructive dir, del, and save "filename" are sufficient for avoiding accidental overwrites. One could also argue that load "filename" shouldn't be enough to enable resave, and maybe an explicit save more recent than load should be required.

Data statement produces a syntax error

Hardware: Foenix U
Kernel Version: v0.4.0-alpha+329
Basic Version: v0.2.0-alpha+408

Issue Description: When including a DATA statement in a BASIC program it won't execute and fail with a syntax error

You can replicate the behavior with the following code:

10 FOR c%=1 to 10
20 READ a%
30 PRINT a%
40 NEXT
50 DATA 10,20,30,40,50,11,22,33,44,55

This code fails and produces the following error

Syntax error at 50

Feature Request: Return to BASIC from BRUN with exit code.

Shell scripting on Linux/MacOS support the variable $? to get the exit/error code of the last process, and DOS/Windows used %ERRORLEVEL%.

I would like a mechanism to return an exit code from a program launched with BRUN, and to be able to read it from BASIC for scripting purposes.

For example:

10 BRUN "dosometask.prg"
20 IF ERR > 0 THEN GOSUB 50

I propose having the called program place a 16bit value in the A or X register and return to BASIC with a RTL.

See GW-BASIC ERR/ERL for ideas: https://hwiegman.home.xs4all.nl/gw-man/ERRERL.html
See GW-BASIC ON ERROR for ideas: https://hwiegman.home.xs4all.nl/gw-man/ONERROR.html

<> Operator

The not equal <> operator doesn't seem to work in an IF..THEN statement
For example:
140 i=3
141 n=2
145 if (i<>n) then 200
150 end
200 print "not equal"

Feature Request: Run AUTOEXEC.BAS on bootup.

Background:
If you have it set the DIP switches to boot from a drive, the system will try to load the boot record. If the boot record is executable, it will try to run it. If the boot record isn't executable or the DIP switches are set to BASIC, it will just run BASIC.

Proposal:
The interpreter should check the DIP switches on startup. If the DIP switch is set to boot from drive, then should try to run a startup BASIC file from that drive.

Document del command

The "del" command (for deleting a file) does not appear in the BASIC816 manual.

Feature Request: BRUN parameter passing

Requesting a way to pass parameter data to an executable using BRUN.

BRUN "editor.pgx option1 option2 filename"

or

BRUN "editor.pgx", "option1 option2 filename"

Some proposed solutions by @pweingar on Discord order by complexity:

  1. The entire path string presented to the called program through a pointer at a set location
  2. a pointer to just the options (after the executable file name) presented through a set location
  3. a separate, optional string parameter to BRUN that is presented at a set location

I prefer option (1), since it lets me populate argv[0] in C.

General File I/O Statements Need to be Implemented

Statements and functions to support general purpose file I/O need to be implemented, for example:

  • OPEN, opens a file for reading or writing
  • CLOSE, closes a file previously open
  • INPUT#, reads data from a file
  • PRINT#, writes data to a file
  • etc.

Using Dim on any variable type results in Type Mismatch error

Version:
BASIC816 v0.2.0-alpha+274

Description:
Using Dim command either with an integer variable or a string variable always results in a type mismatch error
Can be reproduced with the Code provided, changing the variable type to x$ on line 10 produces the same type mismatch error

Code:

10 DIM x%(20)
20 for c%=1 to 20:x%(c%)=c%:NEXT

Peek command seems to alter memory

Version:
BASIC816 v0.2.0-alpha+274

Description:
When you peek at a memory address (at least in the graphics area memory &hb0000) the memory position at the location+4 that you peek is zeroed.
For a graphical demo of this behavior the provided code shows sprite 1 on screen and then proceeds to poke 1s to create a solid sprite. Just after this the code peeks at all its values.
You'll see the sprite appear and dissapear magically!

Code:

5 CLS
10 GRAPHICS 47
20 spb%=&hb00000: REM sprite block constant
30 SPRITE 1,0,spb%
40 SPRITEAT 1,100,100
50 SPRITESHOW 1,1
60 FOR c%=0 to 1024:POKE spb%+c%,1:NEXT
70 FOR c%=0 to 1024:a%=PEEK(spb%+c%):NEXT

Integer resets from 430 to 175 in loop test

When I ran this program on my Foenix Rev 3C, it counted from 1 to 430. However instead of 431 coming after 430, it went to 175, then counted back to 430. So it goes 1 -> 430 -> 175 -> 430 -> 175 -> 430. etc. etc.

5 a=1
10 a=a+1
20 print a
30 goto 10

Negative steps are odd

FOR I = 5 TO 1 STEP -1 produces weird results with floats. Should probably be illegal argument.

Feature request: Ctrl-C / Alt+SysRq should switch graphics modes

When interrupting a program that has switched away from a text-supporting graphics mode with Ctrl-C (BASIC interrupt) or Alt+SysRq (Monitor interrupt), the current behavior leaves the graphics mode as is, hiding the BASIC/Monitor prompt and making it difficult to know if the program was successfully interrupted or how to return to a prompt. These interruption methods should change the graphics mode, or do whatever else is needed to be responsive to the interrupt and give the user a way back to a useful prompt.

Trying to save a BASIC program >16Kb results in lockup

Version:
KERNEL: v0.4.0-alpha+333 (2021-08-07)
BASIC VERSION: BASIC816 v0.2.0-alpha+411
HARDWARE: Foenix U

Description:
When a BASIC program reaches a size of more than 16K and is saved (on any device) the machine locks up and shows the following number (address?):

1A45E1

You can use the attached file to demonstrate the issue in the following way:

  • Unzip & Load the Attached file SPRED41.ZIP
  • Add the following lines of code (tried to keep it to a minimum)

Code:

6100 rem change background color - blue component
6110 bkg%=&haf000d
6120 poke bkg%,colb%
6130 spriteat 7,sx%*4+colb%+32,sy%*44+32
6140 goto 500
  • Try to save the file with any name
  • The file won't save & the computer will lock up showing the stated number (Error Code / memory address?)

SPRED41.zip

Division

SP%=65536
PRINT SP% / 2
Returns a value of 65536 no matter what value the divisor is.

BASIC samples need to be updated to Vicky II and latest keywords

docs/samples/lines.bas is using out-of-date keywords (pixmap, clrpixmap) and command arguments (line).

It'd also be good for lines.bas to use graphics mode &H0F, so that interrupting the program (Ctrl-C) can display the BASIC ready prompt or display syntax errors. As is, these cases are invisible, and a beginner would not know to type "graphics 1" blindly to get back to a prompt.

(In my case I entered the program with the out-of-date keywords, and it switched the graphics mode then terminated with the syntax error, which looked to me like an uninterruptable crash but was actually just an invisible ready prompt.)

String comparison on If statement

version Tested: BASIC816 v.0.2.0-alpha+254
description: There is a new problem with strings when used in an if statement for this version
How to replicate:

10 get k$:if k$="" then goto 10
20 if k$="s" then print "YES!"
30 goto 10

if you press "s" you get a:
Syntax error at 20

SpriteShow Out of Range after Sprite 17 instead of 31 (0 based)

Hi, I ran in to "Out of range" errors when I tried using the sprites above 17. I was thinking it would support up to sprite 31. Other Sprite commands also failed above sprite number 17 too, so maybe this is something at the system level versus Basic816.

Doc bug: "tile set or tile map"

In the reference text for the tile-related statements, there are multiple references to "tile set or tile map," as if they both refer to the same concept. These should be corrected to refer to the proper concept in each instance.

If I'm understanding correctly, a tile set is the collection of up to 256 8x8 bitmaps and an affiliated bitmap LUT, and you can have up to four file sets (0-3). A tile map is a rectangle of two-byte tile IDs (tile number and set number), a visibility status, and a rendering offset, and you can have up to four tile maps (0-3).

SAVE fails after a handful of saved files.

This is really a kernel issue, but I'm filing this under BASIC since most people will see it as a BASIC issue.

After a few saves, the SAVE command will fall through to the monitor with an address of $38:434E. The trigger appears to be that the sector for the directory becomes full, and the kernel is attempting to allocate a new cluster for the directory, but it is failing to do so and falling through to an assert-type condition.

Powers don't work

This is the source of much discussion in the maths community as to what a^b does for non integer b's especially, but currently -2^2 is -4 not 4. Suggest where the power is even integer the result should be +ve, all others -ve ?

BITMAP address parameter undocumented

There is no explanation for the optional address parameter for the BITMAP statement. I assume this changes the memory location in VRAM used for the bitmap (set in $AF0101-0103).

Executing line number #5120 in BASIC ends the program execution

Version:
KERNEL: v0.4.0-alpha+329 (2021-06-05)
BASIC VERSION: BASIC816 v0.2.0-alpha+408
HARDWARE: Foenix U

Description:
When you create BASIC code that uses line #5120 the program ends without executing the code on this line number.
You can use the following code to demonstrate the issue:

Code:

10 x%=0 
20 GOTO 5000 
5000 x%=x%+1 
5100 IF x%=5 THEN 5120 
5110 GOTO 5000 
5120 PRINT x% 

To further demostrate the issue, if you change the following lines the code works as expected

5100 IF x%=5 THEN 5130
5130 PRINT x%

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.