commit b4a7928

Devie Lu Linvega  ·  2025-12-23 19:46:04 +0000 UTC
parent 587c88e
Improved system tests
2 files changed,  +57, -31
+4, -2
 1@@ -61,9 +61,11 @@
 2 @|Helpers )
 3 
 4 @<test> ( name* f -- )
 5-	?{ &fail str/<print>
 6+	?{
 7+		str/<print>
 8 		#010f DEO
 9-		;dict/fail !str/<print> } &pass str/<print>
10+		;dict/fail !str/<print> }
11+	str/<print>
12 	;dict/pass
13 	( >> )
14 
+53, -29
  1@@ -1,52 +1,71 @@
  2 ( uxncli system.rom )
  3 
  4 |00 @System/vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
  5+|10 @Console/vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
  6+
  7 |100
  8 
  9 @on-reset ( -> )
 10 	#800f DEO
 11-	( | wst )
 12-	#12 .System/wst DEI #01 EQU ?{
 13-		;dict/wst1 <test>/fail
 14-		BRK }
 15-	;dict/wst1 <test>/pass
 16-	( | rst )
 17-	LITr 12 .System/rst DEI #01 EQU ?{
 18-		;dict/rst1 <test>/fail
 19-		BRK }
 20-	;dict/rst1 <test>/pass
 21-	( | copy left )
 22+	system/test-wst ;dict/wst ROT <test>
 23+	system/test-rst ;dict/rst ROT <test>
 24+	;dict/cpyl system/test-copyl <test>
 25+	;dict/cpyr system/test-copyr <test>
 26+	;dict/cpyl2 system/test-copyl2 <test>
 27+	;dict/fill system/test-fill <test>
 28+	BRK
 29+	( | boundary check )
 30+	;mmu-over .System/expansion DEO2
 31+	;dict/over #0000 LDA #ffff LDA #8888 EQU2 <test>
 32+	BRK
 33+
 34+(
 35+@|test )
 36+
 37+@system/test-wst ( --  pass )
 38+	#12 .System/wst DEI #01 EQU NIP JMP2r
 39+
 40+@system/test-rst ( --  pass )
 41+	LITr 12 .System/rst DEI #03 EQU POPr JMP2r
 42+
 43+@system/test-fill ( -- pass )
 44+	;buf #0003 ADD2 ;mmu-fill/a STA2
 45+	;mmu-fill .System/expansion DEO2
 46+	;buf #0013 ;res4 !mem/cmp
 47+
 48+@system/test-copyl ( -- pass )
 49 	;buf #0006 ADD2 ;mmu-cpyl/a STA2
 50 	;buf #0003 ADD2 ;mmu-cpyl/b STA2
 51 	;mmu-cpyl .System/expansion DEO2
 52-	;dict/cpyl ;buf #0013 ;res1 mem/cmp <test>
 53-	( | copy right )
 54+	;buf #0013 ;res1 !mem/cmp 
 55+
 56+@system/test-copyr ( -- pass )
 57 	;buf #0003 ADD2 ;mmu-cpyr/a STA2
 58 	;buf #0009 ADD2 ;mmu-cpyr/b STA2
 59 	;mmu-cpyr .System/expansion DEO2
 60-	;dict/cpyr ;buf #0013 ;res2 mem/cmp <test>
 61-	( | copy left )
 62+	;buf #0013 ;res2 !mem/cmp
 63+
 64+@system/test-copyl2 ( -- pass )
 65 	;buf #0009 ADD2 ;mmu-cpyl/a STA2
 66 	;buf #0006 ADD2 ;mmu-cpyl/b STA2
 67 	;mmu-cpyl .System/expansion DEO2
 68-	;dict/cpyl ;buf #0013 ;res3 mem/cmp <test>
 69-	( | memset )
 70-	;buf #0003 ADD2 ;mmu-fill/a STA2
 71-	;mmu-fill .System/expansion DEO2
 72-	;dict/fill ;buf #0013 ;res4 mem/cmp <test>
 73-	( | boundary check )
 74-	;mmu-over .System/expansion DEO2
 75-	;dict/over #0000 LDA #ffff LDA #8888 EQU2 <test>
 76-	BRK
 77+	 ;buf #0013 ;res3 !mem/cmp
 78+
 79+(
 80+@|Helpers )
 81 
 82 @<test> ( name* f -- )
 83 	?{
 84-	&fail str/<print> #010f DEO ;dict/fail !str/<print> }
 85-	&pass str/<print> ;dict/pass !str/<print>
 86+		str/<print>
 87+		#010f DEO
 88+		;dict/fail !str/<print> }
 89+	str/<print>
 90+	;dict/pass
 91+	( >> )
 92 
 93 @str/<print> ( str* -- )
 94 	LDAk DUP ?{ POP POP2 JMP2r }
 95-	#18 DEO
 96+	.Console/write DEO
 97 	INC2 !/<print>
 98 
 99 @mem/cmp ( a* length* b* -- t )
100@@ -58,10 +77,11 @@
101 	POP2r EQU2 JMP2r
102 
103 @dict
104-	&wst1 "System/wst: 20 $1
105-	&rst1 "System/rst: 20 $1
106+	&wst "System/wst: 20 $1
107+	&rst "System/rst: 20 $1
108 	&cpyl "System/cpyl: 20 $1
109 	&cpyr "System/cpyr: 20 $1
110+	&cpyl2 "System/cpyl2: 20 $1
111 	&fill "System/fill: 20 $1
112 	&over "System/overflow: 20 $1
113 	&pass "pass 0a $1
114@@ -73,8 +93,12 @@
115 @res3 [ "...[he[hello]lo].. $1 ]
116 @res4 [ "...-------------.. $1 ]
117 
118+
119 @mmu-fill [ 00 000d 0000 &a $2 2d ]
120+
121 @mmu-cpyl [ 01 0007 0000 &a $2 0000 &b $2 ]
122+
123 @mmu-cpyr [ 02 0007 0000 &a $2 0000 &b $2 ]
124+
125 @mmu-over [ 00 0002 0000 ffff 88 ]
126