hack-a-day / basic-badge Goto Github PK
View Code? Open in Web Editor NEW2018 Hackaday Belgrade Hardware Badge
License: MIT License
2018 Hackaday Belgrade Hardware Badge
License: MIT License
Reproduce:
Add a BASIC word that takes user input and assigns it to a variable.
Examples shown on this page:
https://en.wikibooks.org/wiki/BASIC_Programming/Beginning_BASIC/User_Input
Timers feel slow as of v0.16 -- 1000ms delay seems closer to 2000ms.
I noticed a change in behavior. Before, PRINT word always caused a line feed/carriage return, now it does not. I don't see a backslash on the keyboard for \n. How can we cause a carriage LF/CR behavior with the print statement?
Acording to this repo, Zork I source code is in the public domain so we could use it on the badge if we have time to implement.
For successful manufacturing we need a way to test the hardware on the badge.
New word to return a random number.
I'm unsure the best implementation for this. Many BASIC language RND commands I've looked up return a floating point number but that doesn't seems to be useful on an embedded platform. Perhaps this syntax would be useful:
RND X
returns a random number between 0 and X (inclusive). So RND 1
will return either 0 or 1. I think the most likely use case for user will be let random = rnd 1
but depending on how the tokenizer works this may not parse. Can you think of an easy way to implement this?
We need a specification that users can count on to add their own C programs to the badge (requires MPLABX, compile, and flash to badge).
A good example of this is the apptemplate.c that Mike Harrison used for the Supercon badge in November. User knows:
User needs to know about how to access some core function on the firmware. Again, Mike Harrison's work is an interesting example (although we should need far fewer hooks than he included). Some of these may be:
Currently a TUNE word will play forever. This might be annoying when 300 people have these badges at the con.
Is it possible for the tone to stop automatically if there isn't an additional TUNE command issued?
Tetris is likely the most popular game we could put on badge.
I have ported Tetris to 2017 Hackaday Supercon badge. Depending on when #1 is done I may have time to port to this badge too.
@vantonic has requested a cursor in BASIC. His suggestion was a simple underscore or a block. His feeling is that people will be looking for a cursor and that this makes it feel more like a retrocomputer.
I am uncertain that this is needed. Traditionally a cursor blinks and without the blink I don't think it has the same effect. Making the cursor blink is likely a non-trivial change.
@jaromir-sukuba do you have an opinion one way or the other on this?
Word to control the LED on the badge.
I've looked into implementing this and it should be quick. I'll work on it when I have some time.
| __ ) ___ _ __ ___| |__ ___ / _|/ _|
| _ \ / _ \ '_ \ / __| '_ \ / _ \| |_| |_
| |_) | __/ | | | (__| | | | (_) | _| _|
|____/ \___|_| |_|\___|_| |_|\___/|_| |_| ```
I think we need a "termup" word for forging terminal update when termt is set to 0.
The reason for this is that screen refresh rate can make weird behavior for graphics. Here's an example: run the program and see ball bounce with jerky movement due to refresh rate:
int8_t bprog[BPROG_LEN+1] =
"10 let x = 39\n\
20 let d = 0\n\
30 clrscr\n\
40 color 11,0\n\
50 setxy x,10\n\
60 chr 32\n\
70 if d = 1 then gosub 200\n\
80 if d = 0 then gosub 300\n\
90 chr 254\n\
100 if x = 0 then d = 1\n\
110 if x = 39 then d = 0\n\
120 wait 100\n\
130 goto 50\n\
200 x = x + 1\n\
210 return\n\
300 x = x - 1\n\
310 setxy x,10\n\
320 return\n\
";
adding the following (with new word) would fix that:
05 termt 0
95 termup
Implement extended character set for use on badge.
Here is a reference for making the font:
https://upload.wikimedia.org/wikipedia/commons/c/c4/C64_Petscii_Charts.png
Key that shares quotation mark is outputting an underscore. I don't see another key to use for minus sign. This is crucial to writing basic programs.
If we need an underscore, maybe shift spacebar makes sense?
Add a word like CURSOR
that moves the print text to a place on the character display.
cursor 0,0
will move to the top leftcursor 12,3
will move to X position 12 and Y position 3 (these are characters, not pixels)Badge should show a graphic when turned on.
The square of "text" on this poster that says "Hackaday Belgrade" might be interesting for this.
What BASIC words are implemented? What need to be implemented? I don't know this information so please comment.
This is related to #2
This will allow two badges to connect together (or computer USB-to-Serial cable) for transferring BASIC programs between two badges connected by wire.
Suggested:
User should have a way to navigate different badge features.
Menu items may include:
Tell me, please, how hardware & software of "Hack-a-Day'2018 Badge" licensed?
Implement BRK key to stop a running program
I'm sending stuff to the serial port.
In BASIC, if I use sload I can see the data I'm sending.
if I write
10 print uin 1
20 goto 10
nothing gets printed :(
I was discussing this with @vantonic last night. Would it be possible to implement simple RAM access in BASIC? I know we're limited to 16-bit numbers in interpreter. But since we don't have DIM and are limited to 26 variables, this would give a lot more flexibility.
Here's how it might work:
edit: I put in an 8-bit value before but meant 16-bit. To me it makes sense to use HEX so you don't need to type 65535 but really whatever is easiest to implement since we're at the deadline for this.
Basic should provide error reporting. Something like:
"Syntax Error on Line XX"
This has previously been working but now is not working.
When user types a BASIC program there should be a way to save it to the flash chip and load it back again.
We discussed something like telling BASIC interpreter: "SAVE 0", "SAVE 1"
10 let i=1
20 print i
returns to prompt but nothing is printed. If you make it 20 if i=1 then print "true"
it works.
Also just found another peculiar bug:
10 let i=1
20 print i
30 if i=5 then print "nope"
40 if i=1 then print "true"
results in output 5 thPtrue
Since v0.35 I cannot use the let command in a program without resetting the badge:
10 let i=1
causes a reset as soon as enter is pressed. let i=1
will not cause a reset.
I think I'm having a problem with line number being too large. This test program hangs:
20 gosub 3050
30 print "end"
40 end
3050 print "sub"
3060 return```
Add a word in BASIC to allow simple foreground/background colors. Considering this is a retrocomputer, EGA 16-color palette would be amazing!
COLOR 4,8
would set up characters that were red on a dark gray backgroundReported by @vantonic
At this moment it works fine, there is only a problem with music tone
stability. For some reason, the pitch drifts and I think that OCxR and
OCxRS registers are somehow affected during tone playing.
If user wants to examine a specific line of code, it would be helpful to do so directly with the list
command. Basic functionality might work like this:
list
, entire program is listed and can be scrolled with up and down (already implemented but currently broken #14 )list 140
, line 140 is shown at the top of the screen with following lines listed to fill the screenShould have a simple scripting language to make badge play music.
Voja has an existing spec for this, the finished product can be heard in this demo video.
We discussed this possibly being part of the BASIC implementation. Adding something like a new word that would let each changing sound event to be listed like this:
TONE 14 21 ee 12
How do we save and load music? I would be nice if you could save many of these (they should take a lot less space than an actual BASIC program, right?)
Hello,
we should define what formatting/structure should the sources have. When writing, I'm using Whitesmiths indentation style, tabs (not expanded to spaces) and tab size 4, probably not being the most common style.
Currently, the sources are rather heavy mix of all styles. I tend to write as it comes, not being bothered by particular style (unless it's 1TBS) making code beautification at the end of work, just before releasing. Any ideas?
If none, I'll format it to Whitesmiths or GNU style, tabs expanded to spaces, 4 spaces wide.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.