mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-23 14:25:10 +00:00
Replace file_i_deo and file_i_dei.
This commit is contained in:
parent
0b75afc415
commit
42dea5b914
4 changed files with 16 additions and 35 deletions
|
@ -151,12 +151,18 @@ file_delete(UxnFile *c)
|
|||
return unlink(c->current_filename);
|
||||
}
|
||||
|
||||
static UxnFile *
|
||||
file_instance(Device *d)
|
||||
{
|
||||
return &uxn_file[d - &d->u->dev[DEV_FILE0]];
|
||||
}
|
||||
|
||||
/* IO */
|
||||
|
||||
void
|
||||
file_i_deo(int instance, Device *d, Uint8 port)
|
||||
file_deo(Device *d, Uint8 port)
|
||||
{
|
||||
UxnFile *c = &uxn_file[instance];
|
||||
UxnFile *c = file_instance(d);
|
||||
Uint16 addr, len, res;
|
||||
switch(port) {
|
||||
case 0x5:
|
||||
|
@ -196,9 +202,9 @@ file_i_deo(int instance, Device *d, Uint8 port)
|
|||
}
|
||||
|
||||
Uint8
|
||||
file_i_dei(int instance, Device *d, Uint8 port)
|
||||
file_dei(Device *d, Uint8 port)
|
||||
{
|
||||
UxnFile *c = &uxn_file[instance];
|
||||
UxnFile *c = file_instance(d);
|
||||
Uint16 res;
|
||||
switch(port) {
|
||||
case 0xc:
|
||||
|
|
|
@ -11,6 +11,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
#define POLYFILEY 2
|
||||
#define DEV_FILE0 0xa
|
||||
|
||||
void file_i_deo(int instance, Device *d, Uint8 port);
|
||||
Uint8 file_i_dei(int instance, Device *d, Uint8 port);
|
||||
void file_deo(Device *d, Uint8 port);
|
||||
Uint8 file_dei(Device *d, Uint8 port);
|
||||
|
|
16
src/uxncli.c
16
src/uxncli.c
|
@ -17,8 +17,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|||
WITH REGARD TO THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
static Device *devfile0;
|
||||
|
||||
static int
|
||||
error(char *msg, const char *err)
|
||||
{
|
||||
|
@ -44,18 +42,6 @@ console_deo(Device *d, Uint8 port)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
file_deo(Device *d, Uint8 port)
|
||||
{
|
||||
file_i_deo(d - devfile0, d, port);
|
||||
}
|
||||
|
||||
static Uint8
|
||||
file_dei(Device *d, Uint8 port)
|
||||
{
|
||||
return file_i_dei(d - devfile0, d, port);
|
||||
}
|
||||
|
||||
static Uint8
|
||||
nil_dei(Device *d, Uint8 port)
|
||||
{
|
||||
|
@ -122,7 +108,7 @@ start(Uxn *u)
|
|||
/* empty */ uxn_port(u, 0x7, nil_dei, nil_deo);
|
||||
/* empty */ uxn_port(u, 0x8, nil_dei, nil_deo);
|
||||
/* empty */ uxn_port(u, 0x9, nil_dei, nil_deo);
|
||||
/* file0 */ devfile0 = uxn_port(u, 0xa, file_dei, file_deo);
|
||||
/* file0 */ uxn_port(u, 0xa, file_dei, file_deo);
|
||||
/* file1 */ uxn_port(u, 0xb, file_dei, file_deo);
|
||||
/* datetime */ uxn_port(u, 0xc, datetime_dei, nil_deo);
|
||||
/* empty */ uxn_port(u, 0xd, nil_dei, nil_deo);
|
||||
|
|
16
src/uxnemu.c
16
src/uxnemu.c
|
@ -43,7 +43,7 @@ static SDL_Rect gRect;
|
|||
|
||||
/* devices */
|
||||
|
||||
static Device *devscreen, *devmouse, *devctrl, *devaudio0, *devfile0;
|
||||
static Device *devscreen, *devmouse, *devctrl, *devaudio0;
|
||||
static Uint8 zoom = 1;
|
||||
static Uint32 stdin_event, audio0_event, redraw_event, interrupt_event;
|
||||
|
||||
|
@ -231,18 +231,6 @@ audio_deo(Device *d, Uint8 port)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
file_deo(Device *d, Uint8 port)
|
||||
{
|
||||
file_i_deo(d - devfile0, d, port);
|
||||
}
|
||||
|
||||
static Uint8
|
||||
file_dei(Device *d, Uint8 port)
|
||||
{
|
||||
return file_i_dei(d - devfile0, d, port);
|
||||
}
|
||||
|
||||
static Uint8
|
||||
nil_dei(Device *d, Uint8 port)
|
||||
{
|
||||
|
@ -289,7 +277,7 @@ start(Uxn *u, char *rom)
|
|||
/* unused */ uxn_port(u, 0x7, nil_dei, nil_deo);
|
||||
/* control */ devctrl = uxn_port(u, 0x8, nil_dei, nil_deo);
|
||||
/* mouse */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo);
|
||||
/* file0 */ devfile0 = uxn_port(u, 0xa, file_dei, file_deo);
|
||||
/* file0 */ uxn_port(u, 0xa, file_dei, file_deo);
|
||||
/* file1 */ uxn_port(u, 0xb, file_dei, file_deo);
|
||||
/* datetime */ uxn_port(u, 0xc, datetime_dei, nil_deo);
|
||||
/* unused */ uxn_port(u, 0xd, nil_dei, nil_deo);
|
||||
|
|
Loading…
Reference in a new issue