From a92fd8fb223524a519a8161fd9b02bd6ee38f191 Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sat, 28 Aug 2021 00:37:27 +0100 Subject: [PATCH] Expanded File/offset to 32-bit /offset-hs and /offset-ls --- projects/examples/blank.tal | 2 +- projects/examples/demos/drum-rack.tal | 2 +- projects/examples/demos/font.tal | 2 +- projects/examples/demos/piano.tal | 2 +- projects/examples/devices/file.load.tal | 2 +- projects/examples/devices/file.save.tal | 2 +- projects/examples/devices/file.tal | 2 +- projects/examples/gui/picture.tal | 2 +- projects/software/asma.tal | 8 ++++---- projects/software/repl.tal | 2 +- src/uxncli.c | 2 +- src/uxnemu.c | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/projects/examples/blank.tal b/projects/examples/blank.tal index c4183f2..9ef66e5 100644 --- a/projects/examples/blank.tal +++ b/projects/examples/blank.tal @@ -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 ) diff --git a/projects/examples/demos/drum-rack.tal b/projects/examples/demos/drum-rack.tal index b400fd5..8b339dc 100644 --- a/projects/examples/demos/drum-rack.tal +++ b/projects/examples/demos/drum-rack.tal @@ -30,7 +30,7 @@ |70 @Midi [ &vector $2 &channel $1 ¬e $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 ) diff --git a/projects/examples/demos/font.tal b/projects/examples/demos/font.tal index 7001ab3..004a82e 100644 --- a/projects/examples/demos/font.tal +++ b/projects/examples/demos/font.tal @@ -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 ) diff --git a/projects/examples/demos/piano.tal b/projects/examples/demos/piano.tal index 9056c02..d81b6b1 100644 --- a/projects/examples/demos/piano.tal +++ b/projects/examples/demos/piano.tal @@ -25,7 +25,7 @@ |70 @Midi [ &vector $2 &channel $1 ¬e $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 ) diff --git a/projects/examples/devices/file.load.tal b/projects/examples/devices/file.load.tal index 0f9e579..a3369d8 100644 --- a/projects/examples/devices/file.load.tal +++ b/projects/examples/devices/file.load.tal @@ -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 ) diff --git a/projects/examples/devices/file.save.tal b/projects/examples/devices/file.save.tal index 87dd50b..3fa9e69 100644 --- a/projects/examples/devices/file.save.tal +++ b/projects/examples/devices/file.save.tal @@ -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 ) diff --git a/projects/examples/devices/file.tal b/projects/examples/devices/file.tal index d7a911b..cb8f4fc 100644 --- a/projects/examples/devices/file.tal +++ b/projects/examples/devices/file.tal @@ -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 ) diff --git a/projects/examples/gui/picture.tal b/projects/examples/gui/picture.tal index 10be460..0446885 100644 --- a/projects/examples/gui/picture.tal +++ b/projects/examples/gui/picture.tal @@ -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 ) diff --git a/projects/software/asma.tal b/projects/software/asma.tal index f377689..51739e2 100644 --- a/projects/software/asma.tal +++ b/projects/software/asma.tal @@ -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 diff --git a/projects/software/repl.tal b/projects/software/repl.tal index b910594..8d581b6 100644 --- a/projects/software/repl.tal +++ b/projects/software/repl.tal @@ -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 ) diff --git a/src/uxncli.c b/src/uxncli.c index 241984b..921cbb3 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -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) { diff --git a/src/uxnemu.c b/src/uxnemu.c index 549cb1f..4c8f892 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -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) {