2018 Hackaday Belgrade Hardware Badge
- Hardware Lead: Voja Antonic
- Software Lead: Jaromir Sukuba
Hardware details available on the BASIC Badge project page.
Firmware at the day of conference was 1.00. There are new versions coming since then, see changes at https://github.com/Hack-a-Day/basic-badge/blob/master/firmware/badge1.X/changes.txt
print
println
if
else
goto
gosub
return
for
next
end
let
rem
led X,Y
- control LED, X[0..2] RGB, Y[0..1] on/offtune A,B,C,D
- plays tones A, B, C for duration Dclrscr
- clear screensetxy X,Y
- set cursor at X,Ywait X
- wait for X mscolor X,Y
- X=Foreground, Y=Background using EGA 16-color palettechr X
- prints character with ASCII representation Xtermt X
- sets VT100 terminal on or off (1-on, 0-off)rnd X
- function to return random number 0..Xein X
- function to return value of expansion pin Xeout X,Y
- control expansion pin, X[0..3], Y[0..1] on/offedr X,Y
- sets expansion pin function X[0..3], Y[0..1] output/inputuin X
- function to return received byte from serial port, if X=0, function is non-blocking, if X=1, function is blockinguout X
- outputs value X to serial port as single byteinput "string"
- prints string and returns user entered valuepeek X
- returns value from memory location Xpoke X,Y
- write value Y into memory, on location Xcursor X
- turns cursor on (X=1) or off (X=0)kin X
- function to return byte from keyboard, if X=0, function is non-blocking, if X=1, function is blocking
run
- runs programsave X
- Save program buffer to flash. There are 16 slots: X[0..15]load X
- Load program into buffer from flash. There are 16 slots: X[0..15]list
- list whole programmore
- list program by pagesclr
- clears all code from the program bufferfree
- prints amount of free program buffersload
- load new program into buffer from serial portssave
- output program buffer via serial porthelp
- prints out basic BASIC help
The BASIC badge is based around a PIC32MX370F512H. Software is compiled using MPLABX, XC32 compiler, and legacy peripheral libraries from Microchip.
-
Download three packages:
- Navigate to the Downloads" tab at the bottom of the Microchip Compilers page.
- Download
MPLAB® XC32/32++ Compiler v2.05
for your operating system - Download
PIC32 Legacy Peripheral Libraries
for your operating system - Navigate to the "Downloads" tab part way down the screen at the Microchip MPLAB X IDE page.
-
Install the packages:
- Install the XC32 compiler first
- Install the peripheral libraries next. IMPORTANT: You must specify the same directory as the XC32 compiler. This will likely not be the default option during install. For Linux installation this director was:
/opt/microchip/xc32/v2.05/
- Install MPLABX IDE
-
Open the MPLABX project from this repository
- A PIC programmer like the PICKIT3 is required to program your badge
- On the PIC programmer, pins 1-5 correspond to RES, V+, GND, B0, and B1 on the badge
- Launch "CP/M @ Z80" on the badge
- b:
- xmdm r e:ZORK1.DAT
- sudo apt-get install lrzsz
- sudo chmod 777 /dev/ttyUSB0
- sx -X ZORK1.DAT > /dev/ttyUSB0 < /dev/ttyUSB0
- High Importance:
- BASIC interpreter
- Line editor for BASIC programs
- Save/Load ability (stored in program memory)
- Simple menu system
- Medium Importance
- Hardware control on expansion port
- Game(s) that come with the badge
- Ability for users to write C files and compile them into new firmward to flash to badge
- Low Importance
- Serial connection allows users to program BASIC onto badge from computer without full reflash (needs USB to serial adapter)
- Programming challenge? Like a game that encourages writing BASIC to solve it
- Bling (demos that run on the badge)