Code Monkey home page Code Monkey logo

basic-badge's People

Contributors

jaromir-sukuba avatar szczys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basic-badge's Issues

White screen when waking

Reproduce:

  • Leave the badge for a while (a few minutes)
  • Press power button to put it to sleep
  • Press power button to turn it back on
  • Screen is full white. BRK button has no effect

Timers feel slow

Timers feel slow as of v0.16 -- 1000ms delay seems closer to 2000ms.

CR and LF with PRINT word?

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?

Badge plays Zork

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.

Power On Self Test (POST)

For successful manufacturing we need a way to test the hardware on the badge.

  • Hold some button at power-up and POST will begin
  • Screen test (fill with several different colors?)
  • Print "testing speaker" on screen and play test tones
  • Print "write to flash..." on screen and write to flash
  • Read from flash, verify and print "Read from flash verified" (should write to this part of flash again with other data so future POST test doesn't get false positive)
  • Some screen that represents all buttons on the badge and user presses every one to ensure they are all working properly
  • What else?

BASIC word for RANDOM

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?

"API" for user added C

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).

User Program Flow

A good example of this is the apptemplate.c that Mike Harrison used for the Supercon badge in November. User knows:

  • Their "main" function will get called and passes an "action" value
  • These action values do things like let user code run initialization, hook into a timer-based recurring call (act_poll) which happens every X milliseconds, etc.
  • This method requires some header files to add user C file as a menu entry that can be selected on the badge

Low-level APIs

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:

  • Screen manipulation like how to write to screen, refresh screen, and clear screen
  • How to read the keyboard
  • How to use the write to and read from flash memory functions
  • How to use the audio functions (this might be a wishlist item, I don't know)

Badge plays Tetris

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.

Cursor

@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?

Figlet scrolling text

I've looked into implementing this and it should be quick. I'll work on it when I have some time.

| __ )  ___ _ __   ___| |__   ___  / _|/ _|
|  _ \ / _ \ '_ \ / __| '_ \ / _ \| |_| |_ 
| |_) |  __/ | | | (__| | | | (_) |  _|  _|
|____/ \___|_| |_|\___|_| |_|\___/|_| |_|  ```

We need termup word

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

Keyboard missing minus sign

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?

New word in BASIC for screen position

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 left
  • cursor 12,3 will move to X position 12 and Y position 3 (these are characters, not pixels)

Splash Screen

Badge should show a graphic when turned on.

The square of "text" on this poster that says "Hackaday Belgrade" might be interesting for this.

BASIC word list

What BASIC words are implemented? What need to be implemented? I don't know this information so please comment.

Save/Load from serial

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:

  • "LOAD SERIAL" puts badge into a mode that listens for incoming data on serial connection
  • "SAVE SERIAL" begins broadcasting the program via the serial connection

Typing GOTO without line number locks badge

  • Type some lines with line numbers as normal
  • Accidentally type "goto 10" without any line number
  • Badge locks, cannot use BRK
  • Badge must be reset and program buffer is lost

Menu System

User should have a way to navigate different badge features.

Menu items may include:

  • BASIC
  • Music program (if separate from basic)
  • Play Tetris
  • Play Zork
  • User Program (if added)
  • What else?

BRK key use

Implement BRK key to stop a running program

BASIC uin notworking

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 :(

Simple PEEK and POKE for BASIC

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:

  • i = peek X
  • poke X,VALUE
  • X would be 0x0000 to 0xFFFF and mapped to RAM not in use when BASIC interpreter is running

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.

Save/Load BASIC program from slots

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"

print var doesn't print anything

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

LET causes reset

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.

BASIC largest line number

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```

New word for BASIC color

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 background

Timer drift during music playback

Reported 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.

Add parameters for LIST word in BASIC

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:

  • User types list, entire program is listed and can be scrolled with up and down (already implemented but currently broken #14 )
  • User types list 140, line 140 is shown at the top of the screen with following lines listed to fill the screen

Music scripting

Should 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

Questions:

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?)

These details not crucial to implementation but wanted to put this here so we know what this may be used for. This music scripting is very important to our activities planned with badge. We are planning things like:

  • User gets paper booklet that has songs in it they can type in and play back
  • There will be a music "Scavenger Hunt" where users type in music and have to guess what songs they are. Team writes their answers down and hands them in to find winners for the day
  • Demoscene -- there should be a music and/or graphics contest using this badge

Formatting etc...

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.

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.