Merge branch 'main' of git.sr.ht:~rabbits/uxn
This commit is contained in:
commit
61be564f09
33
.build.yml
33
.build.yml
|
@ -18,8 +18,8 @@ sources:
|
||||||
- https://git.sr.ht/~rabbits/uxn
|
- https://git.sr.ht/~rabbits/uxn
|
||||||
tasks:
|
tasks:
|
||||||
- prepare: |
|
- prepare: |
|
||||||
rm -f out
|
rm -f out build
|
||||||
mkdir -p out
|
mkdir -p out build/uxn-lin64 build/uxn-win64 build/uxn-mac64 build/essentials/uxn
|
||||||
umask 077
|
umask 077
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
printf '%s\n' "${SSH_HOST_KEYS}" > ~/.ssh/known_hosts
|
printf '%s\n' "${SSH_HOST_KEYS}" > ~/.ssh/known_hosts
|
||||||
|
@ -27,11 +27,8 @@ tasks:
|
||||||
- build-linux: |
|
- build-linux: |
|
||||||
cd uxn
|
cd uxn
|
||||||
./build.sh --no-run
|
./build.sh --no-run
|
||||||
mv bin uxn
|
mv bin ../build/uxn-lin64/uxn
|
||||||
tar -czf ../out/uxn-linux-amd64.tar.gz uxn
|
- build-essentials: |
|
||||||
cd ..
|
|
||||||
- build-rompack: |
|
|
||||||
mkdir -p rompack/uxn
|
|
||||||
for F in uxn/projects/software/calc.tal uxn/projects/software/launcher.tal uxn/projects/examples/demos/piano.tal uxn/projects/examples/demos/clock.tal catclock/src/main.tal dexe/src/main.tal donsol/src/main.tal left/src/main.tal nasu/src/main.tal noodle/src/main.tal orca-toy/src/main.tal:orca.rom turye/src/main.tal; do
|
for F in uxn/projects/software/calc.tal uxn/projects/software/launcher.tal uxn/projects/examples/demos/piano.tal uxn/projects/examples/demos/clock.tal catclock/src/main.tal dexe/src/main.tal donsol/src/main.tal left/src/main.tal nasu/src/main.tal noodle/src/main.tal orca-toy/src/main.tal:orca.rom turye/src/main.tal; do
|
||||||
PROJECT="${F%%/*}"
|
PROJECT="${F%%/*}"
|
||||||
if [ "${F}" = "${F%:*}" ]; then
|
if [ "${F}" = "${F%:*}" ]; then
|
||||||
|
@ -43,17 +40,25 @@ tasks:
|
||||||
F="${F%:*}"
|
F="${F%:*}"
|
||||||
fi
|
fi
|
||||||
[ -d "${PROJECT}" ] || git clone "https://git.sr.ht/~rabbits/${PROJECT}"
|
[ -d "${PROJECT}" ] || git clone "https://git.sr.ht/~rabbits/${PROJECT}"
|
||||||
( cd "${PROJECT}" && ../uxn/uxn/uxnasm "${F#*/}" "../rompack/uxn/${ROMNAME}" || rm -f "../rompack/uxn/${ROMNAME}" )
|
( cd "${PROJECT}" && ../build/uxn-lin64/uxn/uxnasm "${F#*/}" "../build/essentials/uxn/${ROMNAME}" || rm -f "../build/essentials/uxn/${ROMNAME}" )
|
||||||
done
|
done
|
||||||
tar -czf out/uxn-rompack.tar.gz -C rompack uxn
|
|
||||||
( cd rompack && zip -qr ../out/uxn-rompack.zip uxn )
|
|
||||||
[ -e ~/.ssh/id_rsa ] || complete-build
|
[ -e ~/.ssh/id_rsa ] || complete-build
|
||||||
- build-windows: |
|
- build-windows: |
|
||||||
ssh win "rm -f uxn-windows-64bit.zip; export PATH=\"\${PATH}:/mingw64/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); MSYSTEM=MSYS ./build.sh --no-run; mv bin uxn; zip -qr ../uxn-windows-64bit.zip uxn"
|
ssh win "export PATH=\"\${PATH}:/mingw64/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); MSYSTEM=MSYS ./build.sh --no-run"
|
||||||
rsync win:uxn-windows-64bit.zip out/
|
rsync -rp win:uxn/bin/ build/uxn-win64/uxn/
|
||||||
- build-macos: |
|
- build-macos: |
|
||||||
ssh mac "rm -f uxn-macos.tar.gz; export PATH=\"\${PATH}:/usr/local/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); ./build.sh --no-run; mv bin uxn; tar -zcf ../uxn-macos.tar.gz uxn"
|
ssh mac "export PATH=\"\${PATH}:/usr/local/bin\"; set -ex; cd uxn; git fetch; git checkout .; git clean -xfd; git checkout $(cd uxn && git rev-parse HEAD); ./build.sh --no-run"
|
||||||
rsync mac:uxn-macos.tar.gz out/
|
rsync -rp mac:uxn/bin/ build/uxn-mac64/uxn/
|
||||||
|
- archive: |
|
||||||
|
for PROJECT in uxn-lin64 uxn-win64 uxn-mac64 essentials; do
|
||||||
|
tar -czf "out/${PROJECT}.tar.gz" -C "build/${PROJECT}" uxn
|
||||||
|
( cd "build/${PROJECT}" && zip -qr "../../out/${PROJECT}.zip" uxn )
|
||||||
|
if [ "${PROJECT}" != essentials ]; then
|
||||||
|
cp build/essentials/uxn/* "build/${PROJECT}/uxn/"
|
||||||
|
tar -czf "out/uxn-essentials-${PROJECT#uxn-}.tar.gz" -C "build/${PROJECT}" uxn
|
||||||
|
( cd "build/${PROJECT}" && zip -qr "../../out/uxn-essentials-${PROJECT#uxn-}.zip" uxn )
|
||||||
|
fi
|
||||||
|
done
|
||||||
- upload: |
|
- upload: |
|
||||||
if [ "$(cd uxn && git rev-parse HEAD)" != "$(cd uxn && git rev-parse origin/main)" ]; then exit; fi
|
if [ "$(cd uxn && git rev-parse HEAD)" != "$(cd uxn && git rev-parse origin/main)" ]; then exit; fi
|
||||||
ls -l out
|
ls -l out
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
( devices )
|
|
||||||
|
|
||||||
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|
|
||||||
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|
|
||||||
|
|
||||||
( program )
|
|
||||||
|
|
||||||
|0100 @Reset ( -> )
|
|
||||||
~projects/library/debugger.tal
|
|
||||||
#0123 #4567 #89ab #cdef
|
|
||||||
LIT2r 1234 LIT2r 5678 LIT2r 9abc LIT2r def0
|
|
||||||
( BREAKPOINT )
|
|
||||||
( LIT2r 0000 DIVr )
|
|
||||||
&loop INCk ,&loop JMP
|
|
||||||
BRK
|
|
||||||
|
|
|
@ -1,181 +0,0 @@
|
||||||
( in-Uxn debugger )
|
|
||||||
|
|
||||||
( To use, include this file just before the BRK in the program reset routine, e.g.:
|
|
||||||
|
|
||||||
|0100 ( -> )
|
|
||||||
( theme )
|
|
||||||
#0fe5 .System/r DEO2
|
|
||||||
#0fc5 .System/g DEO2
|
|
||||||
#0f25 .System/b DEO2
|
|
||||||
~projects/library/debugger.tal
|
|
||||||
BRK
|
|
||||||
|
|
||||||
The debugger will catch stack errors that arise after that point.
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
%BREAKPOINT { LIT2r :debug JSR2r }
|
|
||||||
|
|
||||||
@debug-start
|
|
||||||
;debug-vector .System/vector DEO2
|
|
||||||
;debug-end JMP2
|
|
||||||
|
|
||||||
@debug ( pc* -- )
|
|
||||||
#0001 SUB2 .System/eaddr DEO2
|
|
||||||
.System/ecode DEIk #07 EOR SWP DEO
|
|
||||||
,debug-vector/main JMP
|
|
||||||
|
|
||||||
@debug-vector ( -> )
|
|
||||||
STH STH STH STH ( <- only run in case of working stack overflow )
|
|
||||||
&main
|
|
||||||
|
|
||||||
( flush the working stack )
|
|
||||||
.System/wst DEI ;debug-wst/ptr STA
|
|
||||||
&flush-wst
|
|
||||||
.System/wst DEI #00 EQU ,&end-flush-wst JCN
|
|
||||||
#00 .System/wst DEI #0002 SUB2 ;debug-wst/dat ADD2 STA
|
|
||||||
,&flush-wst JMP
|
|
||||||
&end-flush-wst
|
|
||||||
|
|
||||||
( in case of working stack overflow, we need to append the four return stack bytes )
|
|
||||||
.System/ecode DEI #02 NEQ ,&skip-wst-append JCN
|
|
||||||
#00 ;debug-wst/ptr LDAk ( 00 ptr-hi ptr-lo ptr / ... z y x w )
|
|
||||||
DUP #04 ADD OVR2 STA
|
|
||||||
ROT ROT ADD2 ( start* / ... z y x w )
|
|
||||||
INC2 DUP2 #0004 ADD2 SWP2 ( end* start* / ... z y x w )
|
|
||||||
&loop
|
|
||||||
DUP2 STHr ROT ROT STA
|
|
||||||
INC2
|
|
||||||
GTH2k ,&loop JCN
|
|
||||||
POP2 POP2
|
|
||||||
&skip-wst-append
|
|
||||||
|
|
||||||
( flush the return stack )
|
|
||||||
.System/rst DEI ;debug-rst/ptr STA
|
|
||||||
&flush-rst
|
|
||||||
.System/rst DEI #00 EQU ,&end-flush-rst JCN
|
|
||||||
STHr #00 .System/rst DEI ;debug-rst/dat ADD2 STA
|
|
||||||
,&flush-rst JMP
|
|
||||||
&end-flush-rst
|
|
||||||
|
|
||||||
( Version 0.1 functionality: print the error and exit )
|
|
||||||
;debug-print-error JSR2
|
|
||||||
#01 .System/halt DEO
|
|
||||||
BRK
|
|
||||||
|
|
||||||
@debug-print-opcode ( instr -- )
|
|
||||||
DUP ,¬-brk JCN
|
|
||||||
POP ;&brk-msg ;debug-print JMP2 ( tail call )
|
|
||||||
&brk-msg "BRK 00
|
|
||||||
¬-brk
|
|
||||||
#00 OVR #1f AND #03 MUL ;&opcode-names ADD2 ( instr addr* )
|
|
||||||
LDAk .Console/write DEO INC2
|
|
||||||
LDAk .Console/write DEO INC2
|
|
||||||
LDA .Console/write DEO
|
|
||||||
DUP #1f AND ,¬-lit JCN
|
|
||||||
#7f AND
|
|
||||||
¬-lit
|
|
||||||
DUP #20 AND #00 EQU ,¬-2 JCN
|
|
||||||
LIT '2 .Console/write DEO
|
|
||||||
¬-2
|
|
||||||
DUP #80 AND #00 EQU ,¬-k JCN
|
|
||||||
LIT 'k .Console/write DEO
|
|
||||||
¬-k
|
|
||||||
#40 AND #00 EQU ,¬-r JCN
|
|
||||||
LIT 'r .Console/write DEO
|
|
||||||
¬-r
|
|
||||||
JMP2r
|
|
||||||
|
|
||||||
&opcode-names
|
|
||||||
"LITINCPOPDUPNIPSWPOVRROT
|
|
||||||
"EQUNEQGTHLTHJMPJCNJSRSTH
|
|
||||||
"LDZSTZLDRSTRLDASTADEIDEO
|
|
||||||
"ADDSUBMULDIVANDORAEORSFT
|
|
||||||
|
|
||||||
@debug-print ( addr* -- )
|
|
||||||
LDAk #00 EQU ,&end JCN
|
|
||||||
LDAk .Console/write DEO
|
|
||||||
INC2
|
|
||||||
,debug-print JMP
|
|
||||||
&end POP2 JMP2r
|
|
||||||
|
|
||||||
@debug-print-error
|
|
||||||
;&halted-msg ,debug-print JSR
|
|
||||||
#00 .System/ecode DEI #07 AND #20 SFT2 ;&messages-table ADD2
|
|
||||||
LDA2k ,debug-print JSR
|
|
||||||
INC2 INC2 LDA2 ,debug-print JSR
|
|
||||||
;&executing-msg ,debug-print JSR
|
|
||||||
.System/eaddr DEI2 LDA ;debug-print-opcode JSR2
|
|
||||||
;&at-msg ,debug-print JSR
|
|
||||||
.System/eaddr DEI2 ;debug-print-hex-short JSR2
|
|
||||||
#0a .Console/write DEO
|
|
||||||
;&wst-msg ,debug-print JSR
|
|
||||||
;&contents-msg ,debug-print JSR
|
|
||||||
;debug-wst ;debug-print-stack JSR2
|
|
||||||
#0a .Console/write DEO
|
|
||||||
;&rst-msg ,debug-print JSR
|
|
||||||
;&contents-msg ,debug-print JSR
|
|
||||||
;debug-rst ;debug-print-stack JSR2
|
|
||||||
#0a .Console/write DEO
|
|
||||||
JMP2r
|
|
||||||
|
|
||||||
&messages-table
|
|
||||||
:&wst-msg :&underflow-msg
|
|
||||||
:&rst-msg :&underflow-msg
|
|
||||||
:&wst-msg :&overflow-msg
|
|
||||||
:&rst-msg :&overflow-msg
|
|
||||||
:&wst-msg :&divzero-msg
|
|
||||||
:&rst-msg :&divzero-msg
|
|
||||||
:&emulator-msg :&interrupt-msg
|
|
||||||
:&userdef-msg :&breakpoint-msg
|
|
||||||
|
|
||||||
&halted-msg "Halted: 2000 ( #0002, at 0x0100 )
|
|
||||||
&wst-msg "Working-stack 2000
|
|
||||||
&rst-msg "Return-stack 2000
|
|
||||||
&emulator-msg "Emulator 2000
|
|
||||||
&userdef-msg "User-defined 2000
|
|
||||||
&underflow-msg "underflow 00
|
|
||||||
&overflow-msg "overflow 00
|
|
||||||
&divzero-msg "division 20 "by 20 "zero 00
|
|
||||||
&interrupt-msg "interrupt 00
|
|
||||||
&breakpoint-msg "breakpoint 00
|
|
||||||
&executing-msg 20 "executing 2000
|
|
||||||
&at-msg 20 "at 20 "0x 00
|
|
||||||
&contents-msg "contents: 00
|
|
||||||
|
|
||||||
@debug-print-hex-short ( value* -- )
|
|
||||||
SWP ,debug-print-hex-byte JSR
|
|
||||||
( fall through )
|
|
||||||
|
|
||||||
@debug-print-hex-byte ( value -- )
|
|
||||||
DUP #04 SFT ,debug-print-hex-nibble JSR
|
|
||||||
#0f AND
|
|
||||||
( fall through )
|
|
||||||
|
|
||||||
@debug-print-hex-nibble ( value -- )
|
|
||||||
#30 ADD DUP #39 GTH #27 MUL ADD
|
|
||||||
.Console/write DEO
|
|
||||||
JMP2r
|
|
||||||
|
|
||||||
@debug-print-stack ( addr* -- )
|
|
||||||
LDAk ,¬-empty JCN
|
|
||||||
POP2 ;&empty-msg ;debug-print JMP2 ( tail call )
|
|
||||||
¬-empty
|
|
||||||
LDAk STH INC2 ( dat* / count )
|
|
||||||
&loop
|
|
||||||
STHkr #00 EQU ,&end JCN
|
|
||||||
#20 .Console/write DEO
|
|
||||||
LDAk ,debug-print-hex-byte JSR
|
|
||||||
INC2
|
|
||||||
LITr 01 SUBr
|
|
||||||
,&loop JMP
|
|
||||||
&end
|
|
||||||
POP2 POPr
|
|
||||||
JMP2r
|
|
||||||
|
|
||||||
&empty-msg 20 "(empty) 00
|
|
||||||
|
|
||||||
@debug-wst &ptr $1 &dat $ff
|
|
||||||
@debug-rst &ptr $1 &dat $ff
|
|
||||||
@debug-end
|
|
||||||
|
|
|
@ -44,18 +44,6 @@ system_inspect(Uxn *u)
|
||||||
int
|
int
|
||||||
uxn_halt(Uxn *u, Uint8 error, Uint16 addr)
|
uxn_halt(Uxn *u, Uint8 error, Uint16 addr)
|
||||||
{
|
{
|
||||||
Device *d = &u->dev[0];
|
|
||||||
Uint16 vec = GETVECTOR(d);
|
|
||||||
DEVPOKE16(0x4, addr);
|
|
||||||
d->dat[0x6] = error;
|
|
||||||
if(vec) {
|
|
||||||
/* need to rearm to run System/vector again */
|
|
||||||
d->dat[0] = 0;
|
|
||||||
d->dat[1] = 0;
|
|
||||||
if(error != 2) /* working stack overflow has special treatment */
|
|
||||||
vec += 0x0004;
|
|
||||||
return uxn_eval(u, vec);
|
|
||||||
}
|
|
||||||
system_inspect(u);
|
system_inspect(u);
|
||||||
fprintf(stderr, "Halted: %s#%04x, at 0x%04x\n", errors[error], u->ram[addr], addr);
|
fprintf(stderr, "Halted: %s#%04x, at 0x%04x\n", errors[error], u->ram[addr], addr);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -39,7 +39,6 @@ uxn_eval(Uxn *u, Uint16 pc)
|
||||||
Stack *src, *dst;
|
Stack *src, *dst;
|
||||||
Device *dev;
|
Device *dev;
|
||||||
if(!pc || u->dev[0].dat[0xf]) return 0;
|
if(!pc || u->dev[0].dat[0xf]) return 0;
|
||||||
if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
|
|
||||||
while((instr = u->ram[pc++])) {
|
while((instr = u->ram[pc++])) {
|
||||||
/* Return Mode */
|
/* Return Mode */
|
||||||
if(instr & 0x40) {
|
if(instr & 0x40) {
|
||||||
|
|
Loading…
Reference in New Issue