commit ee3f098
Devine Lu Linvega
·
2025-08-21 02:37:08 +0000 UTC
parent c8c8bcd
Basic file test rom
1 files changed,
+29,
-7
+29,
-7
1@@ -8,15 +8,23 @@
2 @on-reset ( -> )
3 file/<create>
4 file/<load>
5- ( | test load )
6- ;file/a1 LDA2 ;file/a2 LDA2 EQU2 ?{
7- ;dict/failed str/<print>
8- #010e DEO
9- BRK }
10+ #0004 .File/success DEI2 NEQ2 ?fail
11+ ;file/a1 LDA2 ;file/a2 LDA2 NEQ2 ?fail
12+ ;file/stat-buf file/<stat>
13+ ;file/stat-hs LDA2 LIT2 "00 NEQ2 ?fail
14+ ;file/stat-ls LDA2 LIT2 "04 NEQ2 ?fail
15+ file/<delete>
16+ ;file/null-buf file/<stat>
17+ ;file/null-buf LDA2 LIT2 "!! NEQ2 ?fail
18 ;dict/passed str/<print>
19 #800e DEO
20 BRK
21
22+@fail ( -> )
23+ ;dict/failed str/<print>
24+ #010e DEO
25+ BRK
26+
27 (
28 @|File )
29
30@@ -28,10 +36,21 @@
31
32 @file/<load> ( -- )
33 ;&name .File/name DEO2
34- #0004 .File/length DEO2
35+ ( two more bytes than max length ) #0006 .File/length DEO2
36 ;&buf .File/read DEO2
37 JMP2r
38
39+@file/<stat> ( buf* -- )
40+ ;&name .File/name DEO2
41+ #0004 .File/length DEO2
42+ .File/stat DEO2
43+ JMP2r
44+
45+@file/<delete> ( -- )
46+ ;&name .File/name DEO2
47+ #01 .File/delete DEO
48+ JMP2r
49+
50 &name "test.txt $1
51
52 (
53@@ -48,5 +67,8 @@
54 @dict/failed "Failed. 0a $1
55 &passed "Passed. 0a $1
56
57-@file/data &a1 1234 &b1 5678 &buf &a2 $2 &b2 $2
58+@file/data &a1 1234 &b1 5678
59+ ( load buf ) &buf &a2 $2 &b2 $2
60+ ( stat buf ) &stat-buf &stat-hs $2 &stat-ls $2
61+ ( null buf ) &null-buf $4
62