Removed peek16
This commit is contained in:
parent
0ee477615b
commit
4789d8ccef
|
@ -146,7 +146,9 @@ file_deo(Device *d, Uint8 port)
|
||||||
{
|
{
|
||||||
Uint16 a, b, res;
|
Uint16 a, b, res;
|
||||||
switch(port) {
|
switch(port) {
|
||||||
case 0x1: d->vector = peek16(d->dat, 0x0); break;
|
case 0x1:
|
||||||
|
DEVPEEK16(d->vector, 0x0);
|
||||||
|
break;
|
||||||
case 0x9:
|
case 0x9:
|
||||||
DEVPEEK16(a, 0x8);
|
DEVPEEK16(a, 0x8);
|
||||||
res = file_init(&d->mem[a]);
|
res = file_init(&d->mem[a]);
|
||||||
|
|
|
@ -31,8 +31,6 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
#define DEVW(d, x, y) { dev = (d); if(bs) { DEVW8((x), (y) >> 8); DEVW8((x) + 1, (y)); } else { DEVW8((x), (y)) } }
|
#define DEVW(d, x, y) { dev = (d); if(bs) { DEVW8((x), (y) >> 8); DEVW8((x) + 1, (y)); } else { DEVW8((x), (y)) } }
|
||||||
#define WARP(x) { if(bs) u->ram.ptr = (x); else u->ram.ptr += (Sint8)(x); }
|
#define WARP(x) { if(bs) u->ram.ptr = (x); else u->ram.ptr += (Sint8)(x); }
|
||||||
|
|
||||||
Uint16 peek16(Uint8 *m, Uint16 a) { Uint16 r = m[a] << 8; return r + m[a + 1]; }
|
|
||||||
|
|
||||||
int
|
int
|
||||||
uxn_eval(Uxn *u, Uint16 vec)
|
uxn_eval(Uxn *u, Uint16 vec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,8 +48,6 @@ typedef struct Uxn {
|
||||||
Device dev[16];
|
Device dev[16];
|
||||||
} Uxn;
|
} Uxn;
|
||||||
|
|
||||||
Uint16 peek16(Uint8 *m, Uint16 a);
|
|
||||||
|
|
||||||
int uxn_boot(Uxn *c, Uint8 *memory);
|
int uxn_boot(Uxn *c, Uint8 *memory);
|
||||||
int uxn_eval(Uxn *u, Uint16 vec);
|
int uxn_eval(Uxn *u, Uint16 vec);
|
||||||
int uxn_halt(Uxn *u, Uint8 error, char *name, int id);
|
int uxn_halt(Uxn *u, Uint8 error, char *name, int id);
|
||||||
|
|
17
src/uxnemu.c
17
src/uxnemu.c
|
@ -217,13 +217,16 @@ audio_deo(Device *d, Uint8 port)
|
||||||
UxnAudio *c = &uxn_audio[d - devaudio0];
|
UxnAudio *c = &uxn_audio[d - devaudio0];
|
||||||
if(!audio_id) return;
|
if(!audio_id) return;
|
||||||
if(port == 0xf) {
|
if(port == 0xf) {
|
||||||
|
Uint16 addr, adsr;
|
||||||
SDL_LockAudioDevice(audio_id);
|
SDL_LockAudioDevice(audio_id);
|
||||||
c->len = peek16(d->dat, 0xa);
|
DEVPEEK16(adsr, 0x8);
|
||||||
c->addr = &d->mem[peek16(d->dat, 0xc)];
|
DEVPEEK16(c->len, 0xa);
|
||||||
|
DEVPEEK16(addr, 0xc);
|
||||||
|
c->addr = &d->mem[addr];
|
||||||
c->volume[0] = d->dat[0xe] >> 4;
|
c->volume[0] = d->dat[0xe] >> 4;
|
||||||
c->volume[1] = d->dat[0xe] & 0xf;
|
c->volume[1] = d->dat[0xe] & 0xf;
|
||||||
c->repeat = !(d->dat[0xf] & 0x80);
|
c->repeat = !(d->dat[0xf] & 0x80);
|
||||||
audio_start(c, peek16(d->dat, 0x8), d->dat[0xf] & 0x7f);
|
audio_start(c, adsr, d->dat[0xf] & 0x7f);
|
||||||
SDL_UnlockAudioDevice(audio_id);
|
SDL_UnlockAudioDevice(audio_id);
|
||||||
SDL_PauseAudioDevice(audio_id, 0);
|
SDL_PauseAudioDevice(audio_id, 0);
|
||||||
}
|
}
|
||||||
|
@ -444,8 +447,12 @@ run(Uxn *u)
|
||||||
SDL_free(event.drop.file);
|
SDL_free(event.drop.file);
|
||||||
}
|
}
|
||||||
/* Audio */
|
/* Audio */
|
||||||
else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY)
|
else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) {
|
||||||
uxn_eval(u, peek16((devaudio0 + (event.type - audio0_event))->dat, 0));
|
Device *d = devaudio0 + (event.type - audio0_event);
|
||||||
|
Uint16 res;
|
||||||
|
DEVPEEK16(res, 0x00);
|
||||||
|
uxn_eval(u, res);
|
||||||
|
}
|
||||||
/* Mouse */
|
/* Mouse */
|
||||||
else if(event.type == SDL_MOUSEMOTION)
|
else if(event.type == SDL_MOUSEMOTION)
|
||||||
mouse_pos(devmouse,
|
mouse_pos(devmouse,
|
||||||
|
|
Loading…
Reference in New Issue