-
Tetris was running on the badge
11/13/2022 at 09:11 • 0 commentsWe actually finished port of Tetris for the Badge, but as a custom firmware for PIC24 (yea I know it's kind of cheating):
But anyway I'm still planning to support Supercon.6 badge target in my SDK and I even connected Cherry-MX keys to the badge to make playing future 4-bit Tetris as easy as possible :)
-
RASM is now fully supporting Voja4 CPU
10/30/2022 at 11:18 • 5 commentsI just finished creation of the table:
https://gitlab.com/nedopc/sdk/-/blob/master/rasm/voja4.tab
It was partially generated by C-program:
https://gitlab.com/nedopc/sdk/-/blob/master/utils/voja4gen.c
Also rasm.c was extended to support new rules (now it's v2.6):
https://gitlab.com/nedopc/sdk/-/blob/master/rasm/rasm.c
In order to run it on your machine you need to do:
> git clone https://gitlab.com/nedopc/sdk.git Cloning into 'sdk'... remote: Enumerating objects: 1216, done. remote: Counting objects: 100% (1216/1216), done. remote: Compressing objects: 100% (506/506), done. remote: Total 1216 (delta 732), reused 1130 (delta 688), pack-reused 0 Receiving objects: 100% (1216/1216), 491.77 KiB | 0 bytes/s, done. Resolving deltas: 100% (732/732), done. Checking connectivity... done. > cd sdk > cd rasm > make gcc -O2 -I../common -c rasm.c gcc -O2 -I../common -c ../common/my_text.c gcc rasm.o my_text.o -o rasm
After that you will be able to assemble Voja4 programs using ./rasm FILENAME.A -tvoja4.tab
(or you can copy voja4.tab to default.tab and then you can do just ./rasm FILENAME.A).A little bit about RASM - it's slightly unusual assembler - for example for comments it may use \ or //
All numbers are decimals. For hexadecimals you need to use # (like #100 is 256).
Your program can have ORG as 1st directive (without ORG assembling will be done from address 0).
Macros defined by EQU must start with @ to differentiate them from labels. Includes are started with +
Other supported directives are DB, DW (sequence of bytes and sequence of words respectively) and DUP - unfortunatelly for this particular CPU they are unusable, because data memory is not available for assembler here and all data locations must be defined through EQUs (I'll prepare include file soon).
-
Voja's 4-bit CPU support in RASM
10/26/2022 at 05:10 • 0 commentsMy assembler RASM (so called RoboAssembler that I started in January 1997) has external table file where you can write rules to convert assembler instructions to sequence of bytes - some of such rules are simple and straightforward:
ADD_R0,-1 #00 #1F ADD_R0,R0 #01 #00 MOV_[R0,R0],R0 #0A #00
As you can see every 12-bit instruction is represented by 2 bytes (higher byte 1st, lower byte 2nd and sorry I can't support [R0:R0] because colon : means label in RASM and instruction prefixes may not have spaces inside so that's why it's having _ in it)
And some rules have logic inside the code of RASM. For example relative jumps were already supported in code when I implemented 8086 support about 20 years ago.
JR #0F B
RASM already knows that if we put label as argument of such instruction it will calculate offset:
LABELUP: ADD_R0,R0 JR LABELUP JR LABELDOWN MOV_[R0,R0],R0 LABELDOWN: ADD_R0,-1
will assemble into
000 01 LABELUP: ADD_R0,R0 00 001 0F JR LABELUP FE 002 0F JR LABELDOWN 01 003 0A MOV_[R0,R0],R0 00 004 00 LABELDOWN: ADD_R0,-1 1F
Some instructions will require to add more logic into RASM to support new rules, for example 4-bit argument should be summarized with 2nd byte of instruction in some cases - such rule in table file may look like this:
ADD_R0, #00 #10+
That means that ADD_R0, 1 should be translated into #00 #11 and for example ADD_R0, 12 into #00 #1C etc.
Also we need to add some logic that in case of label as an argument of such instruction will take 4 lower bits of the label to implement MOV_PCL, label
Long jumps and long calls most likely should be converted to pair of instructions transparently and invisibly for user:
JMP #0E B #09 #D0+ // MOV_PC,(LBL>>4) MOV_PCL,LBL&15 CALL #0E B #09 #C0+ // MOV_PC,(LBL>>4) MOV_JSR,LBL&15
Also RASM is not able to support instructions looking like MOV [NN],R0 and MOV R0,[NN] so instead I'll add new aliases for these two: SR0 NN (Save R0) and LR0 NN (Load R0).
-
Robby compiler for Voja's 4-bit processor?
10/24/2022 at 03:39 • 0 commentsSince new Supercon badge was introduced I started thinking about possible porting of my Robby compiler (aka nedoPC SDK) to this 4-bit processor - it should be doable. Robby is a programming language that operates only 16-bit signed integers. I can write libraries to calculate 16-bit math using 4-bit instructions (but technically possible to create 8-bit Robby flavor where all variables are 8-bit instead of 16-bit).
I can start this effort by creating instruction table for my 2-pass RoboAssembler (that is part of nedoPC SDK and even if I stop on this stage it already becomes useful thing I think).
Graphics in nedoPC SDK usually works with 8x8 tiles, but Supercon.6 badge only have 8x16 LED matrix, so I'll probably limit myself by PIXEL x,y and CLEAR x,y graphics commands (that currently available only for ZX Spectrum machine in unreleased version of SDK) leaving tile API out of the picture. If I'll be able to support Supercon.6 CPU then it should be relatively easy for me to port TETRIS ( nobody wrote tetris for this badge yet, right? ; ) that was already re-written in Robby (formerly known as RW1 programming language) by me 20 years ago:
it was for Sprinter 320x256 screen (256 colors) and this one is for ZX Spectrum 256x192 screen:
In case of Supercon.6 badge it will be LED "pixels" instead of 8x8 tiles (as above) - so game area will shrink to 8x16, but it still should be playable. The only thing to add to hardware must be add-on board with navigation keys connected to input pins of the connector. Any thoughts about usefulness of all of these? ;)
Voja's project with CPU docs: https://hackaday.io/project/182568-badge-for-2020-supercon-years-of-lockdown
-
Circuits.CC is back
05/11/2019 at 03:26 • 0 commentsYesterday I released new version of http://Circuits.CC web-editor for schematics and PCB in ASCII (kind of) - this version 0.3 (released 6.5 years after v0.2) has Rgrid.js as AJAX engine with virtual machine that is capable of running multiple "robots" written in Robby programming language (formerly known as RW1 or "Robot Warfare 1"). As in the last version it has robot-librarian that handles library of components on the left side of the screen. Now I rewrote back-end from Hope programming language with SQLite3 database to PHP programming language with MySQL database - now it's working a little faster and it should have some room to scale. And I even added comments with help of IntenseDebate service :)
As I already mentioned in previous log, Circuits.CC had a little peak of popularity (kind of) at the end of 2012 when Dangerous Prototypes and Adafruit blogs wrote a short articles about it:
In August 2017 I switched Circuits.CC back-end off after moving to another server, but I saved a database with full history of all (almost 100,000) user clicks since November 23rd, 2012 (with IP-addresses and Timestampes after December 5th, 2012) so recently I decided to make an animated movie clip from it to visualize that history and yesterday uploaded it to YouTube - see what 1000 people did with it in 100,000 mouse clicks ;)
As you can see at the end of this video I used this editor to draw schematics of XORYA in 2015 (and in the last year I used the same Rgrid-engine for TERNARO web-site).
So now Circuits.CC is alive again! Welcome to try it - in near future I will even add ability to write your own "robots" - Rgrid.js performs simultaneous interpretation of multiple robots in the same time (actually it's more like compilation to JS than interpretation). Enjoy! :)
You can find all source codes on GitLab: https://gitlab.com/shaos/circuits_cc
-
Robot Warfare 1
05/19/2018 at 18:35 • 0 commentsAs I wrote in details of this project, programming language that I use here came from my "hobby" game "Robot Warfare 1" that I released in 1998 as shareware - it was used to program robots - something like this:
% ================= WSIMPLE.RW1 ================== % Example of simple robot % with an eye % and a gun. % Run: RW1_DUEL.EXE WSIMPLE.RW1 ROBOT "WinSimple Robot" COLOR FFD010 FRONT EYE LEFT GUN START: ACT FRONT % Look in front if N!=6 : L1 % If there is a robot there then RIGHT ACT LEFT % shoot LEFT GOTO START L1: if N!=3 : L3 % If there is a box with missles then STEP % go ahead GOTO START L3: % If there is neither box nor robot then % it means that there is a barrier in the direction if D==1 : L4 % If the distance from it is greater then 1 then STEP % make a step GOTO START L4: RIGHT % If the barrier is in the next cell GOTO START % turn to right END
In 1999-2000 I upgraded this programming language for "Robot Warfare 1" v2 to make it more C-like (in the same time I released its compiler as open source software under GPL) - now simplest robot looks like this:
robot "NewSimple" author "SANYA" color 000030 front eye left gun right gun +rw1_std.rwi main() { act front if(N==@t_robot) call shoot1 else { say "See &N ( &D ) M=&M E=&E !" if(N==@t_box||D>1) step else { if(R>500) right else left } } } shoot1() { right A = @left for(aa=0,aa<3,aa++) { call shoota } left } shoota() { act A act A act A act A act A }
then I created RW1P2 - crosscompiler that compiles robot bytecode to i8080 assembler program using some set of rules and libraries, for example we can have a tile 8x8:
######## => #FF # # => #81 # # # # => #A5 # # => #81 # # => #81 # ##### => #9F # # => #81 ######## => #FF
with black ink and red paper - it's hexadecimal 40:
;8x8-2/16 ;myspr.spr file MYSPR DB #FF,#81,#A5,#81,#81,#9F,#81,#FF,#40 ;@
then tile compiler will turn it into binary with header file that could be included into the program:
// MY.RW1 robot "MY" author "Shaos" +myspr.rwi main() { dx = 20 dy = 10 for(xx=0,xx<dx,xx++) { for(yy=0,yy<dy,yy++) { select xx yy // choose cell for tile output set @MYSPR // print tile there } } }
Most significant thing that I did on this programming language was port of "Just Another Tetris" (GPL software by Mattias Wadman) to PetersPlus Sprinter computer in 2002 (and other computers supported by RW1P2):
P.S. Another pretty noisy thing written in this programming language was ASCII PCB and schematics online editor at the end of 2012, but it is totally different story ;)