0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-26 07:45:14 +00:00

Replace load/save with read/write

This commit is contained in:
Andrew Alderwick 2021-11-07 19:10:30 +00:00
parent 3606081184
commit 054361cb70
15 changed files with 33 additions and 33 deletions

View file

@ -21,7 +21,7 @@
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )

View file

@ -2,7 +2,7 @@
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( vectors )
@ -37,12 +37,12 @@
Load the output ROM over the currently running program, almost as if
we loaded the ROM with uxnemu directly!
It's not a totally pristine environment, as File/load doesn't zero out
It's not a totally pristine environment, as File/read doesn't zero out
memory beyond the end of the file. So if the assembled program assumes
that all memory above it is zero, it may misbehave.
Asma itself doesn't use the zero page, but this example code writes a
DEO2 instruction to 0x00ff. In order to execute File/load and have the
DEO2 instruction to 0x00ff. In order to execute File/read and have the
CPU continue at memory location 0x0100, we write the final DEO2
instruction there and jump there as our final act.
@ -52,7 +52,7 @@
)
;&dest-file .File/name DEO2
#ff00 .File/length DEO2
#0100 .File/load
#0100 .File/read
LIT DEO2 #00ff STA
LIT BRK #0100 STA
#00ff JMP2

View file

@ -30,7 +30,7 @@
|70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
@ -137,7 +137,7 @@
( load sample )
OVR TOS #0019 ** ;pad-path ++ .File/name DEO2
OVR #04 / #40 SFT .Audio0/length + DEI2 .File/length DEO2
OVR TOS 2** ;pad-addr ++ LDA2 .File/load DEO2
OVR TOS 2** ;pad-addr ++ LDA2 .File/read DEO2
( draw pad )
OVR #01 ;draw-pad JSR2
( draw mixer )

View file

@ -12,7 +12,7 @@
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
( variables )
@ -30,21 +30,21 @@
( load font )
#4900 .File/length DEO2
;font-path-large .File/name DEO2
;font-data .File/load DEO2
;font-data .File/read DEO2
( draw label )
#0020 #0020 ;title #01 ;draw-uf3 JSR2
( load font )
#2100 .File/length DEO2
;font-path-medium .File/name DEO2
;font-data .File/load DEO2
;font-data .File/read DEO2
( draw label )
#0020 #0048 ;body #02 ;draw-uf2 JSR2
( load font )
#0900 .File/length DEO2
;font-path-small .File/name DEO2
;font-data .File/load DEO2
;font-data .File/read DEO2
( draw label )
#0030 #00b8 ;footer #03 ;draw-uf1 JSR2

View file

@ -27,7 +27,7 @@
|70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )

View file

@ -4,7 +4,7 @@
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
@ -20,7 +20,7 @@
( load contents from file )
#1000 .File/length DEO2
;filename .File/name DEO2
;contents .File/load DEO2
;contents .File/read DEO2
.File/success DEI2 ORA ,&success JCN
( failed to read: bright yellow background )

View file

@ -3,7 +3,7 @@
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
@ -19,7 +19,7 @@
( save contents to file )
;contents/end ;contents SUB2 .File/length DEO2
;filename .File/name DEO2
;contents .File/save DEO2
;contents .File/write DEO2
.File/success DEI2 ORA ,&success JCN
( failed to write: bright yellow background )

View file

@ -8,7 +8,7 @@
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &pad $8 &write $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
@ -26,7 +26,7 @@
( load file )
#1000 .File/length DEO2
;srcpath .File/name DEO2
MEMORY .File/load DEO2
MEMORY .File/read DEO2
.File/success DEI2 ORA ;on-success JCN2
@ -58,7 +58,7 @@ BRK
( save file )
#1000 .File/length DEO2
;dstpath .File/name DEO2
MEMORY .File/save DEO2
MEMORY .File/write DEO2
BRK

View file

@ -1,13 +1,13 @@
( GUI Picture )
%RTN { JMP2r }
%LOAD-IMAGE { .File/length DEO2 .File/name DEO2 ;image .File/load DEO2 }
%LOAD-IMAGE { .File/length DEO2 .File/name DEO2 ;image .File/read DEO2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )

View file

@ -509,7 +509,7 @@ include projects/library/binary-tree.tal
@asma-flush-to-file ( len* -- )
.File/length DEO2
;asma/dest-filename LDA2 .File/name DEO2
;asma-write-buffer .File/save DEO2
;asma-write-buffer .File/write DEO2
JMP2r
@asma-flush-to-console ( len* -- )

View file

@ -5,7 +5,7 @@
*** CAUTION: this library is deprecated! ***
Chunked file reads are now possible in the File device directly: just use
File/load or File/save multiple times. This library exists for compatibility to
File/read or File/write multiple times. This library exists for compatibility to
keep asma going until it gets a more substantial rewrite.
***
@ -32,7 +32,7 @@ don't know the file size. Copes with files up to 4,294,967,295 bytes long.
,ffwd JSR
SWP2 ( F* B* U* / FN* SZ* OH* OL* )
ROT2k NIP2 ( F* B* U* B* F* / FN* SZ* OH* OL* )
OVR2 .File/load DEO2 ( F* B* U* B* F* / FN* SZ* OH* OL* )
OVR2 .File/read DEO2 ( F* B* U* B* F* / FN* SZ* OH* OL* )
.File/success DEI2 SWP2 ( F* B* U* B* length* F* / FN* SZ* OH* OL* )
JSR2 ( F* B* U'* done-up-to* / FN* SZ* OH* OL* )
ROT2 SWP2 ( F* U'* B* done-up-to* / FN* SZ* OH* OL* )
@ -57,13 +57,13 @@ don't know the file size. Copes with files up to 4,294,967,295 bytes long.
&coarse ( length* offset* )
GTH2k ,&fine JCN
OVR2 .File/length DEO2
,&addr LDR2 .File/load DEO2
,&addr LDR2 .File/read DEO2
OVR2 SUB2
,&coarse JMP
&fine ( length* offset* )
.File/length DEO2 ( length* )
,&addr LDR2 .File/load DEO2
,&addr LDR2 .File/read DEO2
.File/length DEO2 ( )
JMP2r

View file

@ -14,7 +14,7 @@
( return if file can't be found, or zero length )
#0001 .File/length DEO2
;&tmp .File/load DEO2
;&tmp .File/read DEO2
.File/success DEI2 ORA JMP JMP2r
( clear wst )
@ -81,7 +81,7 @@
OVR2 #f401 ( arguments for STZ2 at fd, plus an extra 01 )
STHkr ( first argument for ADD2 )
.File/success ( argument for DEI2 )
#0100 .File/load ( arguments for DEO2 )
#0100 .File/read ( arguments for DEO2 )
#ff00 .File/length DEO2
#00f0 JMP2

View file

@ -2,7 +2,7 @@
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( vectors )

View file

@ -35,7 +35,7 @@
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
( variables )
@ -581,7 +581,7 @@ RTN
;theme-txt .File/name DEO2
#0006 .File/length DEO2
#fffa .File/load DEO2
#fffa .File/read DEO2
.File/success DEI2 #0006 !! ,&ignore JCN
#fffa LDA2 .System/r DEO2

View file

@ -28,7 +28,7 @@
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1 ]
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &load $2 &save $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
@ -248,7 +248,7 @@ RTN
;theme-txt .File/name DEO2
#0006 .File/length DEO2
#fffa .File/load DEO2
#fffa .File/read DEO2
.File/success DEI2 #0006 !! ,&ignore JCN
#fffa LDA2 .System/r DEO2