1( 54K . System Device Tests )
2
3|00 @System/vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
4|10 @Console/vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
5|0050 @Varvara/version
6
7|100
8
9@on-reset ( -> )
10 ;meta #06 DEO2
11 ( | Halt recover )
12 [ LIT2 80 -System/state ] DEO
13 [ LIT2 01 -System/state ] DEO
14 [ LIT2 00 -System/state ] DEO
15 ( | )
16 #800f DEO
17 system/test-wst ;dict/wst ROT <test>
18 system/test-rst ;dict/rst ROT <test>
19 ;dict/cpyl system/test-copyl <test>
20 ;dict/cpyr system/test-copyr <test>
21 ;dict/cpyl2 system/test-copyl2 <test>
22 ;dict/fill system/test-fill <test>
23 BRK
24 ( | boundary check )
25 ;mmu-over .System/expansion DEO2
26 ;dict/over #0000 LDA #ffff LDA #8888 EQU2 <test>
27 BRK
28
29@meta 00
30 ( name ) "System 20 "Device 20 "Test(80K) 0a
31 ( details ) "Testing 20 "Program 0a
32 ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
33 ( date ) "24 20 "Jun 20 "2026 00
34 ( . ) 01
35 ( - ) 56 =Varvara/version
36
37(
38@|test )
39
40@system/test-wst ( -- pass )
41 #12 .System/wst DEI #02 EQU NIP JMP2r
42
43@system/test-rst ( -- pass )
44 LITr 12 .System/rst DEI #03 EQU POPr JMP2r
45
46@system/test-fill ( -- pass )
47 ;buf #0003 ADD2 ;mmu-fill/a STA2
48 ;mmu-fill .System/expansion DEO2
49 ;buf #0013 ;res4 !mem/cmp
50
51@system/test-copyl ( -- pass )
52 ;buf #0006 ADD2 ;mmu-cpyl/a STA2
53 ;buf #0003 ADD2 ;mmu-cpyl/b STA2
54 ;mmu-cpyl .System/expansion DEO2
55 ;buf #0013 ;res1 !mem/cmp
56
57@system/test-copyr ( -- pass )
58 ;buf #0003 ADD2 ;mmu-cpyr/a STA2
59 ;buf #0009 ADD2 ;mmu-cpyr/b STA2
60 ;mmu-cpyr .System/expansion DEO2
61 ;buf #0013 ;res2 !mem/cmp
62
63@system/test-copyl2 ( -- pass )
64 ;buf #0009 ADD2 ;mmu-cpyl/a STA2
65 ;buf #0006 ADD2 ;mmu-cpyl/b STA2
66 ;mmu-cpyl .System/expansion DEO2
67 ;buf #0013 ;res3 !mem/cmp
68
69(
70@|Helpers )
71
72@<test> ( name* f -- )
73 ?{
74 str/<print>
75 #010f DEO
76 ;dict/fail !str/<print> }
77 str/<print>
78 ;dict/pass
79 ( >> )
80
81@str/<print> ( str* -- )
82 LDAk DUP ?{ POP POP2 JMP2r }
83 .Console/write DEO
84 INC2 !/<print>
85
86@mem/cmp ( a* length* b* -- t )
87 STH2
88 OVR2 ADD2 SWP2
89 &>l
90 EQU2k ?{
91 LDAk LDAkr STHr NEQ ?{ INC2 INC2r !&>l } }
92 POP2r EQU2 JMP2r
93
94@dict
95 &wst "System/wst: 20 $1
96 &rst "System/rst: 20 $1
97 &cpyl "System/cpyl: 20 $1
98 &cpyr "System/cpyr: 20 $1
99 &cpyl2 "System/cpyl2: 20 $1
100 &fill "System/fill: 20 $1
101 &over "System/overflow: 20 $1
102 &pass "pass 0a $1
103 &fail "fail 0a $1
104
105@buf [ "......[hello]..... $1 ]
106@res1 [ "...[hello]lo]..... $1 ]
107@res2 [ "...[hello[hello].. $1 ]
108@res3 [ "...[he[hello]lo].. $1 ]
109@res4 [ "...-------------.. $1 ]
110
111
112@mmu-fill [ 00 000d 0000 &a $2 2d ]
113
114@mmu-cpyl [ 01 0007 0000 &a $2 0000 &b $2 ]
115
116@mmu-cpyr [ 02 0007 0000 &a $2 0000 &b $2 ]
117
118@mmu-over [ 00 0002 0000 ffff 88 ]
119