Removed datetime as Device
This commit is contained in:
parent
dbd430026d
commit
621308986c
6
build.sh
6
build.sh
|
@ -12,14 +12,14 @@ if [ "${1}" = '--install' ];
|
||||||
then
|
then
|
||||||
echo "Installing.."
|
echo "Installing.."
|
||||||
gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11
|
gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11
|
||||||
gcc src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxncli
|
# gcc src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxncli
|
||||||
cp bin/uxn11 ~/bin
|
cp bin/uxn11 ~/bin
|
||||||
else
|
else
|
||||||
gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11
|
gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11
|
||||||
gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
|
# gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
# echo "Running.."
|
# echo "Running.."
|
||||||
bin/uxn11 ~/roms/left.rom
|
bin/uxn11 ~/roms/catclock.rom
|
||||||
|
|
|
@ -16,7 +16,7 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Uint8
|
Uint8
|
||||||
datetime_dei(Device *d, Uint8 port)
|
datetime_dei(Uint8 *d, Uint8 port)
|
||||||
{
|
{
|
||||||
time_t seconds = time(NULL);
|
time_t seconds = time(NULL);
|
||||||
struct tm zt = {0};
|
struct tm zt = {0};
|
||||||
|
@ -35,6 +35,6 @@ datetime_dei(Device *d, Uint8 port)
|
||||||
case 0x8: return t->tm_yday >> 8;
|
case 0x8: return t->tm_yday >> 8;
|
||||||
case 0x9: return t->tm_yday;
|
case 0x9: return t->tm_yday;
|
||||||
case 0xa: return t->tm_isdst;
|
case 0xa: return t->tm_isdst;
|
||||||
default: return d->dat[port];
|
default: return d[port];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE.
|
WITH REGARD TO THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Uint8 datetime_dei(Device *d, Uint8 port);
|
Uint8 datetime_dei(Uint8 *d, Uint8 port);
|
||||||
|
|
|
@ -32,7 +32,6 @@ uxn_eval(Uxn *u, Uint16 pc)
|
||||||
unsigned int a, b, c, j, k, bs, instr, errcode;
|
unsigned int a, b, c, j, k, bs, instr, errcode;
|
||||||
Uint8 kptr, *sp;
|
Uint8 kptr, *sp;
|
||||||
Stack *src, *dst;
|
Stack *src, *dst;
|
||||||
Device *dev;
|
|
||||||
if(!pc || u->dev[0].dat[0xf]) return 0;
|
if(!pc || u->dev[0].dat[0xf]) return 0;
|
||||||
while((instr = u->ram[pc++])) {
|
while((instr = u->ram[pc++])) {
|
||||||
/* Return Mode */
|
/* Return Mode */
|
||||||
|
|
10
src/uxn11.c
10
src/uxn11.c
|
@ -64,10 +64,10 @@ uxn11_dei(struct Uxn *u, Uint8 addr)
|
||||||
Uint8 p = addr & 0x0f;
|
Uint8 p = addr & 0x0f;
|
||||||
Device *d = &u->dev[addr >> 4];
|
Device *d = &u->dev[addr >> 4];
|
||||||
switch(addr & 0xf0) {
|
switch(addr & 0xf0) {
|
||||||
case 0x20: screen_dei(d, p); break;
|
case 0x20: return screen_dei(d, p); break;
|
||||||
case 0xa0: file_dei(d, p); break;
|
case 0xa0: return file_dei(d, p); break;
|
||||||
case 0xb0: file_dei(d, p); break;
|
case 0xb0: return file_dei(d, p); break;
|
||||||
case 0xc0: datetime_dei(d, p); break;
|
case 0xc0: return datetime_dei(d->dat, p); break;
|
||||||
}
|
}
|
||||||
return d->dat[p];
|
return d->dat[p];
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ start(Uxn *u, char *rom)
|
||||||
/* mouse */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo);
|
/* mouse */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo);
|
||||||
/* file0 */ 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);
|
/* file1 */ uxn_port(u, 0xb, file_dei, file_deo);
|
||||||
/* datetime */ uxn_port(u, 0xc, datetime_dei, nil_deo);
|
/* datetime */ uxn_port(u, 0xc, nil_dei, nil_deo);
|
||||||
/* empty */ uxn_port(u, 0xd, nil_dei, nil_deo);
|
/* empty */ uxn_port(u, 0xd, nil_dei, nil_deo);
|
||||||
/* reserved */ uxn_port(u, 0xe, nil_dei, nil_deo);
|
/* reserved */ uxn_port(u, 0xe, nil_dei, nil_deo);
|
||||||
/* reserved */ uxn_port(u, 0xf, nil_dei, nil_deo);
|
/* reserved */ uxn_port(u, 0xf, nil_dei, nil_deo);
|
||||||
|
|
Loading…
Reference in New Issue