Browse code

Removed old system.catch example

neauoire authored on 19/12/2023 19:12:23
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,104 +0,0 @@
1
-( usage: uxncli system.catch.rom )
2
-
3
-|00 @System &catch $2 &expansion $2 &pad $2 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &halt $1
4
-|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
5
-
6
-|0100
7
-
8
-@on-reset ( -> )
9
-	;on-error .System/catch DEO2
10
-	;on-console .Console/vector DEO2
11
-	;dict/instruction <print-str>
12
-	BRK
13
-
14
-@on-console ( -> )
15
-	[ LIT2 &id =tests ] INC2k INC2 ,&id STR2
16
-	LDA2 JSR2 BRK
17
-
18
-@on-error ( addr* inst code -> )
19
-	#00 SWP DUP ADD ;err ADD2 LDA2 <print-str>
20
-	;dict/error <print-str>
21
-	<print-opcode>
22
-	;dict/at <print-str>
23
-	<print-hex>
24
-	LIT ". #18 DEO
25
-	BRK
26
-
27
-@try-divzero ( -- )
28
-	#02 #00 DIV JMP2r
29
-
30
-@try-underflow ( -- )
31
-	POP2 JMP2r
32
-
33
-@try-overflow ( -- )
34
-	#00
35
-	&l ( -- )
36
-		#ffff ROT INC DUP ?&l
37
-	POP JMP2r
38
-
39
-@exit ( -> )
40
-	#0000 .Console/vector DEO2
41
-	#800f DEO
42
-	BRK
43
-
44
-@<print-opcode> ( byte -- )
45
-	DUP #20 EQU ?&jci
46
-	DUP #40 EQU ?&jmi
47
-	DUP #60 EQU ?&jsi
48
-	DUP #00 EQU ?&brk
49
-	#00 OVR #1f AND #20 SFT2 ;opcodes ADD2 <print-str>
50
-	DUP #20 AND #00 EQU ?&>no-2
51
-		LIT "2 #18 DEO &>no-2
52
-	DUP #1f AND #00 EQU ?&>no-k
53
-	DUP #80 AND #00 EQU ?&>no-k
54
-		LIT "k #18 DEO &>no-k
55
-	DUP #40 AND #00 EQU ?&>no-r
56
-		LIT "r #18 DEO &>no-r
57
-	POP JMP2r
58
-	&brk POP ;opcodes/brk !<print-str>
59
-	&jmi POP ;opcodes/jmi !<print-str>
60
-	&jci POP ;opcodes/jci !<print-str>
61
-	&jsi POP ;opcodes/jsi !<print-str>
62
-
63
-@<print-hex> ( short* -- )
64
-	SWP <print-hex>/b
65
-	&b ( byte -- )
66
-		DUP #04 SFT <print-hex>/c
67
-	&c ( char -- )
68
-		#0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
69
-		JMP2r
70
-
71
-@<print-str> ( str* -- )
72
-	&w ( -- )
73
-		LDAk #18 DEO
74
-		INC2 LDAk ?&w
75
-	POP2 JMP2r
76
-
77
-@tests
78
-	=try-divzero =try-underflow =try-overflow =exit
79
-
80
-@err
81
-	=dict/unknown =dict/underflow =dict/overflow =dict/divzero
82
-
83
-@dict ( )
84
-	&error "error, 20 "during 20 $1
85
-	&unknown "Unkown 20 $1
86
-	&underflow "Underflow 20 $1
87
-	&overflow "Overflow 20 $1
88
-	&divzero "Division 20 "by 20 "zero 20 $1
89
-	&at ", 20 "at 20 "# $1
90
-	&instruction "Press 20 "enter 20 "to 20 "test 20 "each 20 "error. 0a $1
91
-
92
-@opcodes
93
-	[
94
-	"LIT $1 "INC $1 "POP $1 "NIP $1
95
-	"SWP $1 "ROT $1 "DUP $1 "OVR $1
96
-	"EQU $1 "NEQ $1 "GTH $1 "LTH $1
97
-	"JMP $1 "JCN $1 "JSR $1 "STH $1
98
-	"LDZ $1 "STZ $1 "LDR $1 "STR $1
99
-	"LDA $1 "STA $1 "DEI $1 "DEO $1
100
-	"ADD $1 "SUB $1 "MUL $1 "DIV $1
101
-	"AND $1 "ORA $1 "EOR $1 "SFT $1
102
-	&brk "BRK $1 &jmi "JMI $1 &jci "JCI
103
-	$1 &jsi "JSI $1 ]
104
-