mirror of https://git.sr.ht/~rabbits/uxn
11 changed files with 229 additions and 55 deletions
@ -0,0 +1,46 @@
|
||||
</$objtype/mkfile |
||||
|
||||
TARG=assembler debugger emulator |
||||
ROM=assembler left nasu neralie noodle orca |
||||
CFLAGS=$CFLAGS -I/sys/include/npe |
||||
BIN=/$objtype/bin/uxn |
||||
HFILES=\ |
||||
/sys/include/npe/stdio.h\ |
||||
src/apu.h\ |
||||
src/ppu.h\ |
||||
src/uxn.h\ |
||||
|
||||
CLEANFILES=${TARG:%=bin/%} ${ROM:%=bin/%.rom} |
||||
|
||||
default:V: all |
||||
|
||||
all:V: ${TARG:%=bin/%} ${ROM:%=bin/%.rom} |
||||
|
||||
</sys/src/cmd/mkmany |
||||
|
||||
/sys/include/npe/stdio.h: |
||||
hget https://git.sr.ht/~ft/npe/archive/master.tar.gz | tar xz && |
||||
cd npe-master && |
||||
mk install && |
||||
rm -r npe-master |
||||
|
||||
bin/%.rom: projects/software/%.usm bin/assembler |
||||
bin/assembler projects/software/$stem.usm $target |
||||
|
||||
bin/assembler:Q: $O.assembler |
||||
mkdir -p bin && cp $prereq $target |
||||
|
||||
bin/debugger:Q: $O.debugger |
||||
mkdir -p bin && cp $prereq $target |
||||
|
||||
bin/emulator:Q: $O.emulator |
||||
mkdir -p bin && cp $prereq $target |
||||
|
||||
$O.assembler: assembler.$O |
||||
|
||||
$O.debugger: debugger.$O uxn.$O |
||||
|
||||
$O.emulator: emulator.$O apu.$O ppu.$O uxn.$O |
||||
|
||||
%.$O: src/%.c |
||||
$CC $CFLAGS -Isrc -o $target src/$stem.c |
||||
@ -1,67 +1,188 @@
|
||||
( Dev/File ) |
||||
|
||||
%RTN { JMP2r } |
||||
%STEP8 { #0033 SFT2 } |
||||
%++ { #01 ADD } |
||||
|
||||
%MEMORY { #1000 } |
||||
|
||||
;loadbtn { x 2 y 2 } |
||||
;output { x 2 y 2 } |
||||
;pointer { x 2 y 2 } |
||||
;label { x 2 y 2 color 1 addr 2 } |
||||
|
||||
( devices ) |
||||
|
||||
|0100 ;Console { pad 8 char 1 byte 1 short 2 } |
||||
|0160 ;File { offset 2 append 1 pad 5 name 2 length 2 load 2 save 2 } |
||||
|01F0 .RESET .FRAME .ERROR ( vectors ) |
||||
|01F8 [ 13fd 1ef3 1bf2 ] ( palette ) |
||||
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |
||||
|0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 } |
||||
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 } |
||||
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |
||||
|0170 ;File { vector 2 pad 6 name 2 length 2 load 2 save 2 } |
||||
|
||||
( program ) |
||||
|
||||
|0200 @RESET |
||||
|
||||
#11 |
||||
$loop |
||||
,text1 ,print-label JSR2 |
||||
,scramble JSR2 |
||||
#01 SUB DUP ,$loop ROT JNZ2 |
||||
|0200 |
||||
|
||||
( theme ) #804b =System.r #804b =System.g #e0bb =System.b |
||||
( vectors ) ,on-mouse =Mouse.vector |
||||
( vectors ) ,on-transfer =File.vector |
||||
|
||||
#0020 =loadbtn.x |
||||
#0020 =loadbtn.y |
||||
#0020 =output.x |
||||
#0030 =output.y |
||||
|
||||
~loadbtn.x ~loadbtn.y #26 ,load_txt ,draw-label JSR2 |
||||
|
||||
,draw-file JSR2 |
||||
|
||||
BRK |
||||
|
||||
@print-label ( text ) |
||||
|
||||
$loop NOP |
||||
( send ) DUP2 PEK2 =Console.char |
||||
( incr ) #0001 ADD2 |
||||
( loop ) DUP2 PEK2 #00 NEQ ^$loop MUL JMP |
||||
@on-transfer ( -> ) |
||||
|
||||
,draw-file JSR2 |
||||
~output.x ~output.y #0088 ADD2 #23 ,done_txt ,draw-label JSR2 |
||||
( release ) #00 =Mouse.state |
||||
|
||||
BRK |
||||
|
||||
@on-mouse ( -> ) |
||||
|
||||
~loadbtn.x ~loadbtn.y #26 ,load_txt ,draw-label JSR2 |
||||
~loadbtn.x #0028 ADD2 ~loadbtn.y #23 ,srcpath ,draw-label JSR2 |
||||
|
||||
~Mouse.state #00 EQU ^$touch-end JNZ |
||||
|
||||
~Mouse.y STEP8 ~loadbtn.y NEQ2 ^$no-touch-load JNZ |
||||
~loadbtn.x ~loadbtn.y #27 ,load_txt ,draw-label JSR2 |
||||
,srcpath #0100 ,load-file JSR2 |
||||
( release ) #00 =Mouse.state |
||||
$no-touch-load |
||||
|
||||
$touch-end |
||||
|
||||
,draw-cursor JSR2 |
||||
|
||||
BRK |
||||
|
||||
@draw-file ( -- ) |
||||
|
||||
#00 #10 |
||||
$ver |
||||
( pos-y ) OVR #00 SWP #0008 MUL2 ~output.y ADD2 =Screen.y |
||||
#00 #10 |
||||
$hor |
||||
( pos-x ) OVR #00 SWP #0008 MUL2 ~output.x ADD2 =Screen.x |
||||
( get x,y ) SWP2 OVR STH SWP2 OVR STHr |
||||
( get id ) #10 MUL ADD |
||||
( get data ) #00 SWP MEMORY ADD2 PEK2 |
||||
( get sprite ) #20 SUB #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr |
||||
( draw ) #2d =Screen.color |
||||
( incr ) SWP ++ SWP |
||||
DUP2 NEQ ^$hor JNZ |
||||
POP2 |
||||
( incr ) SWP ++ SWP |
||||
DUP2 NEQ ^$ver JNZ |
||||
POP2 |
||||
|
||||
RTN |
||||
|
||||
@scramble |
||||
|
||||
,filename =File.name |
||||
|
||||
#00 =File.append |
||||
#0000 =File.offset |
||||
#0003 =File.length |
||||
,text1 #000d ADD2 =File.save |
||||
|
||||
#01 =File.append |
||||
#0003 =File.offset |
||||
#000d =File.length |
||||
,text1 =File.save |
||||
@load-file ( path length -- ) |
||||
|
||||
#0000 =File.offset |
||||
#0004 =File.length |
||||
,text1 =File.load |
||||
|
||||
#0004 =File.offset |
||||
#0008 =File.length |
||||
,text1 #0008 ADD2 =File.load |
||||
=File.length =File.name MEMORY =File.load |
||||
|
||||
RTN |
||||
|
||||
@draw-cursor ( -- ) |
||||
|
||||
( clear last cursor ) |
||||
,clear_icn =Screen.addr |
||||
~pointer.x =Screen.x |
||||
~pointer.y =Screen.y |
||||
#30 =Screen.color |
||||
|
||||
( record pointer positions ) |
||||
~Mouse.x =pointer.x ~Mouse.y =pointer.y |
||||
|
||||
( draw new cursor ) |
||||
,cursor_icn =Screen.addr |
||||
~pointer.x =Screen.x |
||||
~pointer.y =Screen.y |
||||
#32 ~Mouse.state #00 NEQ ADD =Screen.color |
||||
|
||||
RTN |
||||
|
||||
@draw-label ( x y color addr -- ) |
||||
|
||||
#000c =File.offset |
||||
#0004 =File.length |
||||
,text1 #0004 ADD2 =File.load |
||||
( load ) =label.addr =label.color =Screen.y =Screen.x |
||||
~label.addr |
||||
$loop |
||||
( draw ) DUP2 PEK2 #20 SUB #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color |
||||
( incr ) #0001 ADD2 |
||||
( incr ) ~Screen.x #0008 ADD2 =Screen.x |
||||
DUP2 PEK2 #00 NEQ ^$loop JNZ |
||||
POP2 |
||||
|
||||
RTN |
||||
|
||||
@clear_icn [ 0000 0000 0000 0000 ] |
||||
@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
||||
|
||||
@done_txt [ LOAD 20 SUCCESS! 00 ] |
||||
@load_txt [ LOAD 00 ] |
||||
@save_txt [ SAVE 00 ] |
||||
|
||||
@text1 [ Welcome 20 to 20 UxnVM 0a00 ] |
||||
@filename [ textio.bit ] |
||||
@srcpath [ README.md 00 ] |
||||
@dstpath [ bin/export.md 00 ] |
||||
|
||||
@FRAME BRK |
||||
@ERROR BRK |
||||
@font ( specter8-frag font ) |
||||
[ |
||||
0000 0000 0000 0000 0008 0808 0800 0800 |
||||
0014 1400 0000 0000 0024 7e24 247e 2400 |
||||
0008 1e28 1c0a 3c08 0000 2204 0810 2200 |
||||
0030 4832 4c44 3a00 0008 1000 0000 0000 |
||||
0004 0808 0808 0400 0020 1010 1010 2000 |
||||
0000 2214 0814 2200 0000 0808 3e08 0800 |
||||
0000 0000 0000 0810 0000 0000 3e00 0000 |
||||
0000 0000 0000 0800 0000 0204 0810 2000 |
||||
003c 464a 5262 3c00 0018 0808 0808 1c00 |
||||
003c 4202 3c40 7e00 003c 421c 0242 3c00 |
||||
000c 1424 447e 0400 007e 407c 0242 3c00 |
||||
003c 407c 4242 3c00 007e 0204 0810 1000 |
||||
003c 423c 4242 3c00 003c 4242 3e02 3c00 |
||||
0000 0010 0000 1000 0000 1000 0010 1020 |
||||
0000 0810 2010 0800 0000 003e 003e 0000 |
||||
0000 1008 0408 1000 003c 420c 1000 1000 |
||||
003c 4232 4a42 3c00 003c 4242 7e42 4200 |
||||
007c 427c 4242 7c00 003c 4240 4042 3c00 |
||||
007c 4242 4242 7c00 007e 4078 4040 7e00 |
||||
007e 4078 4040 4000 003c 4240 4642 3c00 |
||||
0042 427e 4242 4200 001c 0808 0808 1c00 |
||||
007e 0202 0242 3c00 0042 4478 4442 4200 |
||||
0040 4040 4040 7e00 0042 665a 4242 4200 |
||||
0042 6252 4a46 4200 003c 4242 4242 3c00 |
||||
007c 4242 7c40 4000 003c 4242 4244 3a00 |
||||
007c 4242 7c44 4200 003e 403c 0242 3c00 |
||||
007e 0808 0808 1000 0042 4242 4244 3a00 |
||||
0042 4242 4224 1800 0042 4242 5a66 4200 |
||||
0042 423c 4242 4200 0042 423e 0242 3c00 |
||||
007e 020c 3040 7e00 000c 0808 0808 0c00 |
||||
0040 2010 0804 0200 0030 1010 1010 3000 |
||||
0008 1400 0000 0000 0000 0000 0000 7e00 |
||||
0008 0400 0000 0000 0000 3c02 3e42 3a00 |
||||
0040 407c 4242 7c00 0000 3c42 4042 3c00 |
||||
0002 023e 4242 3e00 0000 3c42 7e40 3e00 |
||||
0000 3e40 7840 4000 0000 3c42 3e02 3c00 |
||||
0040 405c 6242 4200 0008 0018 0808 0400 |
||||
0008 0018 0808 4830 0040 4244 7844 4200 |
||||
0010 1010 1010 0c00 0000 6c52 5252 5200 |
||||
0000 5c62 4242 4200 0000 3c42 4242 3c00 |
||||
0000 7c42 427c 4040 0000 3e42 423e 0202 |
||||
0000 5c62 4040 4000 0000 3e40 3c02 7c00 |
||||
0008 7e08 0808 1000 0000 4242 4244 3a00 |
||||
0000 4242 4224 1800 0000 5252 5252 2e00 |
||||
0000 4224 1824 4200 0000 4242 3e02 7c00 |
||||
0000 7e02 3c40 7e00 000c 0810 1008 0c00 |
||||
0008 0808 0808 0800 0030 1008 0810 3000 |
||||
0000 0032 4c00 0000 3c42 99a1 a199 423c |
||||
] |
||||
Loading…
Reference in new issue