aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-08-18 09:42:00 +0200
committerBad Diode <bd@badd10de.dev>2021-08-18 09:42:00 +0200
commit882ae2a693a50cdfa072462be2d57b93078cf916 (patch)
tree8ceb3d51711c93a78bd221f7f59c22864a1d549a /src/main.c
parent3652f2a9f8190e688d0e358d3a8ae6ea5c31b45d (diff)
downloaduxngba-882ae2a693a50cdfa072462be2d57b93078cf916.tar.gz
uxngba-882ae2a693a50cdfa072462be2d57b93078cf916.zip
Update UXN core with INC/DEC changes
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/main.c b/src/main.c
index 06d2d5b..c15a9e3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -229,22 +229,22 @@ init_uxn(Uxn *u) {
229 memcpy(u->ram.dat + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom)); 229 memcpy(u->ram.dat + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom));
230 230
231 // Prepare devices. 231 // Prepare devices.
232 portuxn(u, 0x0, "system", system_talk); 232 uxn_port(u, 0x0, "system", system_talk);
233 portuxn(u, 0x1, "console", console_talk); 233 uxn_port(u, 0x1, "console", console_talk);
234 devscreen = portuxn(u, 0x2, "screen", screen_talk); 234 devscreen = uxn_port(u, 0x2, "screen", screen_talk);
235 devaudio = portuxn(u, 0x3, "audio0", audio_talk); 235 devaudio = uxn_port(u, 0x3, "audio0", audio_talk);
236 portuxn(u, 0x4, "audio1", audio_talk); 236 uxn_port(u, 0x4, "audio1", audio_talk);
237 portuxn(u, 0x5, "audio2", audio_talk); 237 uxn_port(u, 0x5, "audio2", audio_talk);
238 portuxn(u, 0x6, "audio3", audio_talk); 238 uxn_port(u, 0x6, "audio3", audio_talk);
239 portuxn(u, 0x7, "---", nil_talk); 239 uxn_port(u, 0x7, "---", nil_talk);
240 devctrl = portuxn(u, 0x8, "controller", nil_talk); 240 devctrl = uxn_port(u, 0x8, "controller", nil_talk);
241 devmouse = portuxn(u, 0x9, "mouse", nil_talk); 241 devmouse = uxn_port(u, 0x9, "mouse", nil_talk);
242 portuxn(u, 0xa, "file", file_talk); 242 uxn_port(u, 0xa, "file", file_talk);
243 portuxn(u, 0xb, "datetime", datetime_talk); 243 uxn_port(u, 0xb, "datetime", datetime_talk);
244 portuxn(u, 0xc, "---", nil_talk); 244 uxn_port(u, 0xc, "---", nil_talk);
245 portuxn(u, 0xd, "---", nil_talk); 245 uxn_port(u, 0xd, "---", nil_talk);
246 portuxn(u, 0xe, "---", nil_talk); 246 uxn_port(u, 0xe, "---", nil_talk);
247 portuxn(u, 0xf, "---", nil_talk); 247 uxn_port(u, 0xf, "---", nil_talk);
248 mempoke16(devscreen->dat, 2, ppu.hor * 8); 248 mempoke16(devscreen->dat, 2, ppu.hor * 8);
249 mempoke16(devscreen->dat, 4, ppu.ver * 8); 249 mempoke16(devscreen->dat, 4, ppu.ver * 8);
250} 250}
@@ -258,7 +258,7 @@ handle_input(Uxn *u) {
258 switch (ctrl_methods[ctrl_idx]) { 258 switch (ctrl_methods[ctrl_idx]) {
259 case CONTROL_CONTROLLER: { 259 case CONTROL_CONTROLLER: {
260 devctrl->dat[2] = 0; 260 devctrl->dat[2] = 0;
261 evaluxn(u, mempeek16(devctrl->dat, 0)); 261 uxn_eval(u, mempeek16(devctrl->dat, 0));
262 devctrl->dat[3] = 0; 262 devctrl->dat[3] = 0;
263 } break; 263 } break;
264 case CONTROL_MOUSE: { 264 case CONTROL_MOUSE: {
@@ -266,7 +266,7 @@ handle_input(Uxn *u) {
266 devmouse->dat[7] = 0; 266 devmouse->dat[7] = 0;
267 mempoke16(devmouse->dat, 0x2, -10); 267 mempoke16(devmouse->dat, 0x2, -10);
268 mempoke16(devmouse->dat, 0x4, -10); 268 mempoke16(devmouse->dat, 0x4, -10);
269 evaluxn(u, mempeek16(devmouse->dat, 0)); 269 uxn_eval(u, mempeek16(devmouse->dat, 0));
270 } break; 270 } break;
271 case CONTROL_KEYBOARD: { 271 case CONTROL_KEYBOARD: {
272 toggle_keyboard(); 272 toggle_keyboard();
@@ -327,7 +327,7 @@ handle_input(Uxn *u) {
327 *flag &= ~0x80; 327 *flag &= ~0x80;
328 } 328 }
329 329
330 evaluxn(u, mempeek16(devctrl->dat, 0)); 330 uxn_eval(u, mempeek16(devctrl->dat, 0));
331 devctrl->dat[3] = 0; 331 devctrl->dat[3] = 0;
332 } else if (ctrl_methods[ctrl_idx] == CONTROL_MOUSE) { 332 } else if (ctrl_methods[ctrl_idx] == CONTROL_MOUSE) {
333 // Detect "mouse key press". 333 // Detect "mouse key press".
@@ -367,7 +367,7 @@ handle_input(Uxn *u) {
367 // Eval mouse. 367 // Eval mouse.
368 mempoke16(devmouse->dat, 0x2, mouse.x); 368 mempoke16(devmouse->dat, 0x2, mouse.x);
369 mempoke16(devmouse->dat, 0x4, mouse.y); 369 mempoke16(devmouse->dat, 0x4, mouse.y);
370 evaluxn(u, mempeek16(devmouse->dat, 0)); 370 uxn_eval(u, mempeek16(devmouse->dat, 0));
371 } else if (ctrl_methods[ctrl_idx] == CONTROL_KEYBOARD) { 371 } else if (ctrl_methods[ctrl_idx] == CONTROL_KEYBOARD) {
372 if (key_tap(KEY_LEFT)) { 372 if (key_tap(KEY_LEFT)) {
373 update_cursor(cursor_position - 1); 373 update_cursor(cursor_position - 1);
@@ -411,7 +411,7 @@ handle_input(Uxn *u) {
411 devctrl->dat[3] = symbol; 411 devctrl->dat[3] = symbol;
412 } break; 412 } break;
413 } 413 }
414 evaluxn(u, mempeek16(devctrl->dat, 0)); 414 uxn_eval(u, mempeek16(devctrl->dat, 0));
415 devctrl->dat[3] = 0; 415 devctrl->dat[3] = 0;
416 } 416 }
417 } 417 }
@@ -445,12 +445,12 @@ int main(void) {
445 init_sound(); 445 init_sound();
446 446
447 // Main loop. 447 // Main loop.
448 evaluxn(&u, 0x0100); 448 uxn_eval(&u, 0x0100);
449 PROF_INIT(); 449 PROF_INIT();
450 while(true) { 450 while(true) {
451 bios_vblank_wait(); 451 bios_vblank_wait();
452 PROF(handle_input(&u), input_cycles); 452 PROF(handle_input(&u), input_cycles);
453 PROF(evaluxn(&u, mempeek16(devscreen->dat, 0)), eval_cycles); 453 PROF(uxn_eval(&u, mempeek16(devscreen->dat, 0)), eval_cycles);
454 PROF(sound_mix(), mix_cycles); 454 PROF(sound_mix(), mix_cycles);
455 PROF_SHOW(); 455 PROF_SHOW();
456 PROF(flipbuf(&ppu), flip_cycles); 456 PROF(flipbuf(&ppu), flip_cycles);