Browse code

Merge branch 'main' of git.sr.ht:~rabbits/uxn

neauoire authored on 23/01/2022 22:19:19
Showing 5 changed files
... ...
@@ -18,8 +18,8 @@ sources:
18 18
     - https://git.sr.ht/~rabbits/uxn
19 19
 tasks:
20 20
     - prepare: |
21
-        rm -f out
22
-        mkdir -p out
21
+        rm -f out build
22
+        mkdir -p out build/uxn-lin64 build/uxn-win64 build/uxn-mac64 build/essentials/uxn
23 23
         umask 077
24 24
         mkdir -p ~/.ssh
25 25
         printf '%s\n' "${SSH_HOST_KEYS}" > ~/.ssh/known_hosts
... ...
@@ -27,11 +27,8 @@ tasks:
27 27
     - build-linux: |
28 28
         cd uxn
29 29
         ./build.sh --no-run
30
-        mv bin uxn
31
-        tar -czf ../out/uxn-linux-amd64.tar.gz uxn
32
-        cd ..
33
-    - build-rompack: |
34
-        mkdir -p rompack/uxn
30
+        mv bin ../build/uxn-lin64/uxn
31
+    - build-essentials: |
35 32
         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
36 33
             PROJECT="${F%%/*}"
37 34
             if [ "${F}" = "${F%:*}" ]; then
... ...
@@ -43,17 +40,25 @@ tasks:
43 40
                 F="${F%:*}"
44 41
             fi
45 42
             [ -d "${PROJECT}" ] || git clone "https://git.sr.ht/~rabbits/${PROJECT}"
46
-            ( cd "${PROJECT}" && ../uxn/uxn/uxnasm "${F#*/}" "../rompack/uxn/${ROMNAME}" || rm -f "../rompack/uxn/${ROMNAME}" )
43
+            ( cd "${PROJECT}" && ../build/uxn-lin64/uxn/uxnasm "${F#*/}" "../build/essentials/uxn/${ROMNAME}" || rm -f "../build/essentials/uxn/${ROMNAME}" )
47 44
         done
48
-        tar -czf out/uxn-rompack.tar.gz -C rompack uxn
49
-        ( cd rompack && zip -qr ../out/uxn-rompack.zip uxn )
50 45
         [ -e ~/.ssh/id_rsa ] || complete-build
51 46
     - build-windows: |
52
-        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"
53
-        rsync win:uxn-windows-64bit.zip out/
47
+        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"
48
+        rsync -rp win:uxn/bin/ build/uxn-win64/uxn/
54 49
     - build-macos: |
55
-        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"
56
-        rsync mac:uxn-macos.tar.gz out/
50
+        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"
51
+        rsync -rp mac:uxn/bin/ build/uxn-mac64/uxn/
52
+    - archive: |
53
+        for PROJECT in uxn-lin64 uxn-win64 uxn-mac64 essentials; do
54
+            tar -czf "out/${PROJECT}.tar.gz" -C "build/${PROJECT}" uxn
55
+            ( cd "build/${PROJECT}" && zip -qr "../../out/${PROJECT}.zip" uxn )
56
+            if [ "${PROJECT}" != essentials ]; then
57
+                cp build/essentials/uxn/* "build/${PROJECT}/uxn/"
58
+                tar -czf "out/uxn-essentials-${PROJECT#uxn-}.tar.gz" -C "build/${PROJECT}" uxn
59
+                ( cd "build/${PROJECT}" && zip -qr "../../out/uxn-essentials-${PROJECT#uxn-}.zip" uxn )
60
+            fi
61
+        done
57 62
     - upload: |
58 63
         if [ "$(cd uxn && git rev-parse HEAD)" != "$(cd uxn && git rev-parse origin/main)" ]; then exit; fi
59 64
         ls -l out
60 65
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-( devices )
2
-
3
-|00 @System     &vector $2 &wst      $1 &rst    $1 &eaddr  $2 &ecode  $1 &pad     $1 &r       $2 &g      $2 &b     $2 &debug  $1 &halt $1
4
-|10 @Console    &vector $2 &read     $1 &pad    $5 &write  $1 &error  $1
5
-
6
-( program )
7
-
8
-|0100 @Reset ( -> )
9
-	~projects/library/debugger.tal
10
-	#0123 #4567 #89ab #cdef
11
-	LIT2r 1234 LIT2r 5678 LIT2r 9abc LIT2r def0
12
-	( BREAKPOINT )
13
-	( LIT2r 0000 DIVr )
14
-	&loop INCk ,&loop JMP
15
-	BRK
16
-
17 0
deleted file mode 100644
... ...
@@ -1,181 +0,0 @@
1
-( in-Uxn debugger )
2
-
3
-( To use, include this file just before the BRK in the program reset routine, e.g.:
4
-
5
-	|0100 ( -> )
6
-		( theme )
7
-		#0fe5 .System/r DEO2
8
-		#0fc5 .System/g DEO2
9
-		#0f25 .System/b DEO2
10
-	~projects/library/debugger.tal
11
-	BRK
12
-
13
-The debugger will catch stack errors that arise after that point.
14
-
15
-)
16
-
17
-%BREAKPOINT { LIT2r :debug JSR2r }
18
-
19
-@debug-start
20
-;debug-vector .System/vector DEO2
21
-;debug-end JMP2
22
-
23
-@debug ( pc* -- )
24
-	#0001 SUB2 .System/eaddr DEO2
25
-	.System/ecode DEIk #07 EOR SWP DEO
26
-	,debug-vector/main JMP
27
-
28
-@debug-vector ( -> )
29
-	STH STH STH STH ( <- only run in case of working stack overflow )
30
-	&main
31
-
32
-	( flush the working stack )
33
-	.System/wst DEI ;debug-wst/ptr STA
34
-	&flush-wst
35
-	.System/wst DEI #00 EQU ,&end-flush-wst JCN
36
-	#00 .System/wst DEI #0002 SUB2 ;debug-wst/dat ADD2 STA
37
-	,&flush-wst JMP
38
-	&end-flush-wst
39
-
40
-	( in case of working stack overflow, we need to append the four return stack bytes )
41
-	.System/ecode DEI #02 NEQ ,&skip-wst-append JCN
42
-	#00 ;debug-wst/ptr LDAk ( 00 ptr-hi ptr-lo ptr / ... z y x w )
43
-		DUP #04 ADD OVR2 STA
44
-		ROT ROT ADD2 ( start* / ... z y x w )
45
-		INC2 DUP2 #0004 ADD2 SWP2 ( end* start* / ... z y x w )
46
-		&loop
47
-		DUP2 STHr ROT ROT STA
48
-		INC2
49
-		GTH2k ,&loop JCN
50
-		POP2 POP2
51
-	&skip-wst-append
52
-
53
-	( flush the return stack )
54
-	.System/rst DEI ;debug-rst/ptr STA
55
-	&flush-rst
56
-	.System/rst DEI #00 EQU ,&end-flush-rst JCN
57
-	STHr #00 .System/rst DEI ;debug-rst/dat ADD2 STA
58
-	,&flush-rst JMP
59
-	&end-flush-rst
60
-
61
-	( Version 0.1 functionality: print the error and exit )
62
-	;debug-print-error JSR2
63
-	#01 .System/halt DEO
64
-	BRK
65
-
66
-@debug-print-opcode ( instr -- )
67
-	DUP ,&not-brk JCN
68
-	POP ;&brk-msg ;debug-print JMP2 ( tail call )
69
-	&brk-msg "BRK 00
70
-	&not-brk
71
-	#00 OVR #1f AND #03 MUL ;&opcode-names ADD2 ( instr addr* )
72
-	LDAk .Console/write DEO INC2
73
-	LDAk .Console/write DEO INC2
74
-	LDA  .Console/write DEO
75
-	DUP #1f AND ,&not-lit JCN
76
-	#7f AND
77
-	&not-lit
78
-	DUP #20 AND #00 EQU ,&not-2 JCN
79
-	LIT '2 .Console/write DEO
80
-	&not-2
81
-	DUP #80 AND #00 EQU ,&not-k JCN
82
-	LIT 'k .Console/write DEO
83
-	&not-k
84
-	    #40 AND #00 EQU ,&not-r JCN
85
-	LIT 'r .Console/write DEO
86
-	&not-r
87
-	JMP2r
88
-
89
-	&opcode-names
90
-		"LITINCPOPDUPNIPSWPOVRROT
91
-		"EQUNEQGTHLTHJMPJCNJSRSTH
92
-		"LDZSTZLDRSTRLDASTADEIDEO
93
-		"ADDSUBMULDIVANDORAEORSFT
94
-
95
-@debug-print ( addr* -- )
96
-	LDAk #00 EQU ,&end JCN
97
-	LDAk .Console/write DEO
98
-	INC2
99
-	,debug-print JMP
100
-	&end POP2 JMP2r
101
-
102
-@debug-print-error
103
-	;&halted-msg ,debug-print JSR
104
-	#00 .System/ecode DEI #07 AND #20 SFT2 ;&messages-table ADD2
105
-	LDA2k ,debug-print JSR
106
-	INC2 INC2 LDA2 ,debug-print JSR
107
-	;&executing-msg ,debug-print JSR
108
-	.System/eaddr DEI2 LDA ;debug-print-opcode JSR2
109
-	;&at-msg ,debug-print JSR
110
-	.System/eaddr DEI2 ;debug-print-hex-short JSR2
111
-	#0a .Console/write DEO
112
-	;&wst-msg ,debug-print JSR
113
-	;&contents-msg ,debug-print JSR
114
-	;debug-wst ;debug-print-stack JSR2
115
-	#0a .Console/write DEO
116
-	;&rst-msg ,debug-print JSR
117
-	;&contents-msg ,debug-print JSR
118
-	;debug-rst ;debug-print-stack JSR2
119
-	#0a .Console/write DEO
120
-	JMP2r
121
-
122
-	&messages-table
123
-		:&wst-msg :&underflow-msg
124
-		:&rst-msg :&underflow-msg
125
-		:&wst-msg :&overflow-msg
126
-		:&rst-msg :&overflow-msg
127
-		:&wst-msg :&divzero-msg
128
-		:&rst-msg :&divzero-msg
129
-		:&emulator-msg :&interrupt-msg
130
-		:&userdef-msg :&breakpoint-msg
131
-
132
-	&halted-msg "Halted: 2000 ( #0002, at 0x0100 )
133
-	&wst-msg "Working-stack 2000
134
-	&rst-msg "Return-stack 2000
135
-	&emulator-msg "Emulator 2000
136
-	&userdef-msg "User-defined 2000
137
-	&underflow-msg "underflow 00
138
-	&overflow-msg "overflow 00
139
-	&divzero-msg "division 20 "by 20 "zero 00
140
-	&interrupt-msg "interrupt 00
141
-	&breakpoint-msg "breakpoint 00
142
-	&executing-msg 20 "executing 2000
143
-	&at-msg 20 "at 20 "0x 00
144
-	&contents-msg "contents: 00
145
-
146
-@debug-print-hex-short ( value* -- )
147
-	SWP ,debug-print-hex-byte JSR
148
-	( fall through )
149
-
150
-@debug-print-hex-byte ( value -- )
151
-	DUP #04 SFT ,debug-print-hex-nibble JSR
152
-	#0f AND
153
-	( fall through )
154
-
155
-@debug-print-hex-nibble ( value -- )
156
-	#30 ADD DUP #39 GTH #27 MUL ADD
157
-	.Console/write DEO
158
-	JMP2r
159
-
160
-@debug-print-stack ( addr* -- )
161
-	LDAk ,&not-empty JCN
162
-	POP2 ;&empty-msg ;debug-print JMP2 ( tail call )
163
-	&not-empty
164
-	LDAk STH INC2 ( dat* / count )
165
-	&loop
166
-		STHkr #00 EQU ,&end JCN
167
-		#20 .Console/write DEO
168
-		LDAk ,debug-print-hex-byte JSR
169
-		INC2
170
-		LITr 01 SUBr
171
-		,&loop JMP
172
-	&end
173
-	POP2 POPr
174
-	JMP2r
175
-	
176
-	&empty-msg 20 "(empty) 00
177
-
178
-@debug-wst &ptr $1 &dat $ff
179
-@debug-rst &ptr $1 &dat $ff
180
-@debug-end
181
-
... ...
@@ -44,18 +44,6 @@ system_inspect(Uxn *u)
44 44
 int
45 45
 uxn_halt(Uxn *u, Uint8 error, Uint16 addr)
46 46
 {
47
-	Device *d = &u->dev[0];
48
-	Uint16 vec = GETVECTOR(d);
49
-	DEVPOKE16(0x4, addr);
50
-	d->dat[0x6] = error;
51
-	if(vec) {
52
-		/* need to rearm to run System/vector again */
53
-		d->dat[0] = 0;
54
-		d->dat[1] = 0;
55
-		if(error != 2) /* working stack overflow has special treatment */
56
-			vec += 0x0004;
57
-		return uxn_eval(u, vec);
58
-	}
59 47
 	system_inspect(u);
60 48
 	fprintf(stderr, "Halted: %s#%04x, at 0x%04x\n", errors[error], u->ram[addr], addr);
61 49
 	return 0;
... ...
@@ -39,7 +39,6 @@ uxn_eval(Uxn *u, Uint16 pc)
39 39
 	Stack *src, *dst;
40 40
 	Device *dev;
41 41
 	if(!pc || u->dev[0].dat[0xf]) return 0;
42
-	if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
43 42
 	while((instr = u->ram[pc++])) {
44 43
 		/* Return Mode */
45 44
 		if(instr & 0x40) {