- defs could always be line-aligned (just leave spaces) and we could have a comment on the left
rb/wb ri/wi
– stacks and registers are all 32 bits – but the main content can be bytes
– READ byte VS READ value (4 bytes) – -> s-eq? wants to read a byte at a time -> eol flag could just be a byte.
– but: we also want to write registers
- [X] ‘step over’ is only for calls. just move the cursor to the next active cell, and then ‘run to cursor’
- [X] ‘run to cursor’ should move to next active cell, and then sets a breakpoint
[ ] show a stack somewhere
[ ] show the label
you should be able to execute assembly language instructions directly (in the vm implementation itself)
- maybe even show exactly how it’s getting assembled underneath
- run opcodes directly
- show stacks
- show ram
stacks are still cell-based
- b4a should extend b3a with:
- labels
- special control words ( { } | [ ] .data .code )
- call and $addr syntax
- eventually, write b4a in b3a
- immediate need: dictionary
- adds labels
- allow both decimal and hex numbers
.data
to allow building raw binary data- counted strings
.code
to make it nice to write forth-like code- auto-call functions
- add ‘si’ or ‘li’ before chars, numbers
.dict
to define a dictionary entry- structured programming constructs:
- .if .th .el .ef .en
- .wh .do .od
- .fr .nx
maybe .xxx is label and :xxx is dictionary entry?
- find definition
- get last entry address
- while entry address != 0 do:
- use offset to find string
- compare entry to goal string
- if match, then leave address of value on stack
- if entry = 0, say ‘not found’
- if compiling:
- write ‘call’ + address
- creates new entry
- reads token for name
- copies token to heap
- turns on the compiler
- prev: addr
- hash: (optional single cell with 32-bit hash/crc)
- word: str with len
- data: the data or value
- last @ ,
- here @ last !
- str,
- args: start, length
- duplicate and write the length
- copy the string
- read name
- write name
- last
- e-nm (“lb 4 ad”)
- s-eq uses “inc” (“lb 1 ad”)
- find (currently “word?”)
- copy input bytes to buffer
- let enter trigger word
- visual ‘buttons’ that do the work
- number buttons: multiply by base and add digit
- clear, inc, dec?
(so we can see the cursor moving)
- simple counter
- implement addition, multiplication
- show jumping over some code
- show ‘else’ using [a?] [b?] [c?] [d?]
- so consider this instead: [ c ? a | b ]
- now: [ c0 ? a | [ c1 ? b ] ]
- so just allow ‘elif’
http://www.freepascal.org/docs-html/rtl/sysutils/getenvironmentvariable.html
Retro 11.0 (1309798464) ok see ok 1423 nop 1424 nop 1425 lit 4 1427 @ 1428 call 167 1429 0; 1430 drop 1431 call 421 1432 lit 54 1434 call 443 1435 ; ok
{ � todo : custom memmory manager
http://www.freepascal.org/docs-html/prog/progsu160.html#x205-2180008.4.4
}
{ retro's file format conventions ( see image/kernel.rx in retro source ) }
type rx_header = class
prev, wordclass : int32;
docptr : ^ansistring;
xt : ^ansistring; { h.xt = @h.code }
token : ansistring;
code : ansistring;
end;
const
rx_last = 2;
rx_xtofs = ;
i could use help with the main tasklist, too, but:
- if you contribute / port something, make sure license is MIT/ ISC compatible (retroforth license is ISC)
- freepascal code has a tendency to use MPL/LGPL style. I’m okay with that, too.
There is psuedocode for all 8 here:
http://science.kennesaw.edu/~mguimara/3310/RA_SQL.htm
I made the java/processing game library at http://gamesketchlib.org/ and will try to follow the same design patterns as I work on this system.
ngaro only has 30 instructions, python has around the same. There is much overlap, and in forth-like languages, it’s very easy to translate things like this.
So it’s possible that at least some python code should be able to run here.
The first step would be to compile a table that compares and contrasts the two sets of bytecode:
python dis module and the opcode section in ngaro-vm reference
probably the most dynamic aspects of python will not run well, but simpler python code probably can.
I would really really like a modfile player for retro sounds and music. (don’t know what modfiles are? see http://modarchive.org/ )
[13:04] <dom96> I always wanted to compete in Ludum Dare. Sadly, nowadays there isn’t enough time. [13:05] <tangentstorm> http://web.archive.org/web/20080704164939/http://turcanator.tangentcode.com/ [13:05] <tangentstorm> this is a midi sequencer i wrote in pygame… i would love it if someone took that and turned it into the music engine for this system. [13:06] <tangentstorm> not the graphics part… but the time/synchronization code for the music events [13:07] <tangentstorm> to make something like this: http://www.photonstorm.com/flod
It would probably have like a .tostring, plus menu options?
Not really sure what would be included in the interface, but I had the debugger in one section of my org-file for ngaro.pas.org, and then it got spread out.
# b4th : a bootstrapped forth-like environment
# --------------------------------------------------------------
# <<isc-license>>
# --------------------------------------------------------------
<<b4:header>
JMP: --begin-- # jump over the data block
<<data>>
<<bios>>
:--begin--
<<boot>>
<<main>>
# -- DATA ------------------------------------------------------
<<data:end>
We will use the first 256-cell block (1KB) to hold global variables and system buffers.
Since the VM treats any number that is not an opcode as a call to a routine, this means the first 256 numbers can be used as opcodes. The default implementation requires only 30 opcodes, which leaves users plenty of room to add new opcodes if they want to experiment.
Now, tell the assembler to pad the rest of the 256-cell block with zeros.
� # <- http://en.wikipedia.org/wiki/End_Transmission_Block_character
# -- BIOS ------------------------------------------------------
:bios
# -- BOOT --( boot process )------------------------------------
#name: main
# -- MAIN --( the main loop of the system )---------------------
:mainloop
JMP: mainloop
I’m thinking for now, I would follow the colorforth convention of putting documentation in the odd numbered blocks and source code in the even numbered blocks. Some blocks would also be binary blocks used by the kernel.
In fact, I could just stipulate that up front: the first 16KB are reserved for the system, input buffer, memory map, etc… So code would start at $10.
Not really a loop at all, unless asking for a key blocks the cpu. An async version might check a specific port for a signal.