Documented project mode

This commit is contained in:
Devine Lu Linvega 2022-08-31 14:22:50 -07:00
parent fca42d3fa5
commit c1046973bc
3 changed files with 44 additions and 13 deletions

View File

@ -4,16 +4,6 @@
The assembler is written in about 400 lines, it's designed to help bootstrap the Uxn ecosystem and to demonstrate the concept of a personal one-page computer concept. The goal is for Driflim's source code to be released as a print-friendly document, along with its assembled hexadecimal data and the _napkin definition_ of the Uxn virtual machine.
### Project
- `procblim.tal` Pre-processor.
- `drifblim.tal` Assembler.
#### Extras
- `unicycle.tal` Console REPL.
- `bicycle.tal` [Graphical REPL](https://wiki.xxiivv.com/bicycle).
## Build
This assembler is written in the language it is assembling, creating a chicken-and-egg problem. You have two choices, download a pre-assembled [drifblim.rom](https://rabbits.srht.site/drifblim/drifblim.rom)(1300 bytes), or use [uxnasm.c](https://git.sr.ht/~rabbits/uxn/tree/main/item/src/uxnasm.c).
@ -32,6 +22,19 @@ If do not wish to assemble it yourself, you can download [drifblim.rom](https://
_Drifblim is strong enough to lift Pokémon or people but has no control over its flight. This causes it to drift with the wind and end up anywhere._
## Project Mode
Drifblim allows for live-reloading when used as a `launcher.rom`(f4). To use this feature, you need to create a `.drifblim` file of 61 bytes to be loaded in the zero-page:
- `00-2f`, source path.
- `30-5f`, destination path.
- `60`, non-zero values will also run the run on assembly.
#### Extras
- `unicycle.tal` Console REPL.
- `bicycle.tal` [Graphical REPL](https://wiki.xxiivv.com/bicycle).
## Support
- Linted with [uxnlin.rom](https://git.sr.ht/~rabbits/uxnlin)

View File

@ -27,5 +27,5 @@ uxncli bin/hello.rom
# Pack
uxncli bin/drifblim.rom etc/bh.tal bin/bh.rom
uxncli bin/bh.rom bin/drifblim.rom > bin/bh.log
# uxncli bin/drifblim.rom etc/bh.tal bin/bh.rom
# uxncli bin/bh.rom bin/drifblim.rom > bin/bh.log

View File

@ -8,6 +8,7 @@
@src $30
@dst $30
@run $1
@res
@buf $30
@scope $30
@ -15,7 +16,18 @@
@size $2
@prg-ptr $2
|0100 ( -> ) ;await-src .Console/vector DEO2 ;dict/input ;pstr JSR2 BRK
|0100 ( -> )
( project )
;dict/drifblim .File1/name DEO2
#0061 .File1/length DEO2
#0000 .File1/read DEO2
.File1/success DEI2 ORA ,on-ready JCN
;await-src .Console/vector DEO2 ;dict/input ;pstr JSR2
BRK
@await-src ( -> ) .Console/read DEI .src ;skey JSR2 ,ready-dst JCN BRK
@ready-dst ( -> ) ;await-dst .Console/vector DEO2 ;dict/output ;pstr JSR2 BRK
@await-dst ( -> ) .Console/read DEI .dst ;skey JSR2 ,on-ready JCN BRK
@ -39,11 +51,20 @@
( print symbols )
;print-summary JSR2
.run LDZ ,&run JCN
( halt )
#0101 #0e DEO2
BRK
&run
;dst .File1/name DEO2
#fe00 .File1/length DEO2
;loader-rom #ffd5 #002a ;mcpy JSR2
#ffd5
JMP2
(
@|main )
@ -367,6 +388,7 @@ BRK
@skey ( key buf -- proc ) OVR #21 LTH ,&eval JCN #00 SWP ;sput JSR2 #00 JMP2r &eval POP2 #01 JMP2r
@mclr ( src* len2* -- ) OVR2 ADD2 SWP2 &l STH2k #0000 STH2r STA2 INC2 INC2 GTH2k ,&l JCN POP2 POP2 JMP2r
@scmp ( a* b* -- f ) STH2 &l LDAk LDAkr STHr ANDk #00 EQU ,&e JCN NEQk ,&e JCN POP2 INC2 INC2r ,&l JMP &e NIP2 POP2r EQU JMP2r
@mcpy ( src* dst* len* -- ) SWP2 STH2 OVR2 ADD2 SWP2 &loop LDAk STH2kr STA INC2r INC2 GTH2k ,&loop JCN POP2 POP2 POP2r JMP2r
@shex ( str* -- val* )
@ -470,6 +492,12 @@ JMP2r
&label "Label $1
&source "Source $1
&far "Too 20 "Far $1
&drifblim ".drifblim $1
@loader-rom
8000 8000 0711 0106 80f7 0d02 a001 00af
80ac 37a0 ffd5 80a2 36ef 3826 8000 0505
1521 aa80 f50d 2222 6f2c
@incsrc $30