aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 1acae1b..21bc2a7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -223,6 +223,7 @@ void
223file_talk(Device *d, u8 b0, u8 w) { 223file_talk(Device *d, u8 b0, u8 w) {
224 if (w) { 224 if (w) {
225 u16 a, b, res; 225 u16 a, b, res;
226 UxnFile *f = &uxn_file[d - &d->u->dev[0xa]];
226 switch(b0) { 227 switch(b0) {
227 case 0x5: { 228 case 0x5: {
228 DEVPEEK16(a, 0x4); 229 DEVPEEK16(a, 0x4);
@@ -230,16 +231,17 @@ file_talk(Device *d, u8 b0, u8 w) {
230 if(b > 0x10000 - a) { 231 if(b > 0x10000 - a) {
231 b = 0x10000 - a; 232 b = 0x10000 - a;
232 } 233 }
233 res = file_stat(&d->mem[a], b); 234 res = file_stat(f, &d->mem[a], b);
234 DEVPOKE16(0x2, res); 235 DEVPOKE16(0x2, res);
235 } break; 236 } break;
236 case 0x6: { 237 case 0x6: {
238 // TODO: no file deletion for now
237 // res = file_delete(); 239 // res = file_delete();
238 // DEVPOKE16(0x2, res); 240 // DEVPOKE16(0x2, res);
239 } break; 241 } break;
240 case 0x9: { 242 case 0x9: {
241 DEVPEEK16(a, 0x8); 243 DEVPEEK16(a, 0x8);
242 res = file_init(&d->mem[a]); 244 res = file_init(f, &d->mem[a]);
243 DEVPOKE16(0x2, res); 245 DEVPOKE16(0x2, res);
244 } break; 246 } break;
245 case 0xd: { 247 case 0xd: {
@@ -248,7 +250,7 @@ file_talk(Device *d, u8 b0, u8 w) {
248 if(b > 0x10000 - a) { 250 if(b > 0x10000 - a) {
249 b = 0x10000 - a; 251 b = 0x10000 - a;
250 } 252 }
251 res = file_read(&d->mem[a], b); 253 res = file_read(f, &d->mem[a], b);
252 DEVPOKE16(0x2, res); 254 DEVPOKE16(0x2, res);
253 } break; 255 } break;
254 case 0xf: { 256 case 0xf: {
@@ -257,7 +259,7 @@ file_talk(Device *d, u8 b0, u8 w) {
257 if(b > 0x10000 - a) { 259 if(b > 0x10000 - a) {
258 b = 0x10000 - a; 260 b = 0x10000 - a;
259 } 261 }
260 res = file_write(&d->mem[a], b, d->dat[0x7]); 262 res = file_write(f, &d->mem[a], b, d->dat[0x7]);
261 DEVPOKE16(0x2, res); 263 DEVPOKE16(0x2, res);
262 } break; 264 } break;
263 } 265 }