Expanded File/offset to 32-bit /offset-hs and /offset-ls

This commit is contained in:
Andrew Alderwick 2021-08-28 00:37:27 +01:00
parent 28569d118e
commit a92fd8fb22
12 changed files with 15 additions and 15 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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )

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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
( variables )

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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2
|a0 @File &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2
( variables )

View File

@ -25,7 +25,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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
( variables )

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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
( variables )

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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
( variables )

View File

@ -7,7 +7,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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
( 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 [ &pad $8 &write $1 ]
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ]
( vectors )
@ -62,7 +62,7 @@
that will prevent an infinite loop.
)
;&dest-file .File/name DEO2
#0000 .File/offset DEO2
#0000 .File/offset-ls DEO2
#ff00 .File/length DEO2
#0100 .File/load
LIT DEO2 #00ff STA
@ -269,7 +269,7 @@
&loop
OVR2 .File/name DEO2
DUP2 .File/offset DEO2
DUP2 .File/offset-ls DEO2
;asma-read-buffer/end ;asma-read-buffer SUB2 STH2k .File/length DEO2
;asma-read-buffer DUP2k .File/load DEO2
.File/success DEI2
@ -544,7 +544,7 @@
@asma-flush-to-file ( len* -- )
DUP2 .File/length DEO2
,asma-output/offset LDR2 DUP2 .File/offset DEO2 ADD2 ,asma-output/offset STR2
,asma-output/offset LDR2 DUP2 .File/offset-ls DEO2 ADD2 ,asma-output/offset STR2
;asma/dest-filename LDA2 .File/name DEO2
;asma-write-buffer .File/save DEO2
JMP2r

View File

@ -10,7 +10,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
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|a0 @File &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2
|a0 @File &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2
( init )

View File

@ -76,7 +76,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w)
if(w && (read || b0 == 0xf)) {
char *name = (char *)&d->mem[mempeek16(d->dat, 0x8)];
Uint16 result = 0, length = mempeek16(d->dat, 0xa);
Uint16 offset = mempeek16(d->dat, 0x4);
long offset = (mempeek16(d->dat, 0x4) << 16) + mempeek16(d->dat, 0x6);
Uint16 addr = mempeek16(d->dat, b0 - 1);
FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w"));
if(f) {

View File

@ -344,7 +344,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w)
if(w && (read || b0 == 0xf)) {
char *name = (char *)&d->mem[mempeek16(d->dat, 0x8)];
Uint16 result = 0, length = mempeek16(d->dat, 0xa);
Uint16 offset = mempeek16(d->dat, 0x4);
long offset = (mempeek16(d->dat, 0x4) << 16) + mempeek16(d->dat, 0x6);
Uint16 addr = mempeek16(d->dat, b0 - 1);
FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w"));
if(f) {