diff options
author | Bad Diode <bd@badd10de.dev> | 2023-08-29 18:18:37 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-08-29 18:18:37 +0200 |
commit | 56c43c1e27fb6cd2c536ce12a199ad69acfd3633 (patch) | |
tree | 72bc42696cbdd3500aaac730bb1ef656245c0ef2 /src | |
parent | 4f0a38e9b1d98d07a36499e3024518b7e78f261c (diff) | |
download | uxngba-56c43c1e27fb6cd2c536ce12a199ad69acfd3633.tar.gz uxngba-56c43c1e27fb6cd2c536ce12a199ad69acfd3633.zip |
Test and fix DEO with (DEI/DEO2 et al still incorrect)
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 17 | ||||
-rw-r--r-- | src/uxn-core.s | 13 |
2 files changed, 21 insertions, 9 deletions
@@ -207,11 +207,16 @@ init_uxn() { | |||
207 | // 0x60, 0x00, 0x03, 0x80, 0xff, 0x00, 0xa0, 0xaa, 0xbb, 0xa0, 0xcc, 0xdd, 0x6c | 207 | // 0x60, 0x00, 0x03, 0x80, 0xff, 0x00, 0xa0, 0xaa, 0xbb, 0xa0, 0xcc, 0xdd, 0x6c |
208 | // 0x80, 0x01, 0x20, 0x00, 0x03, 0x80, 0xff, 0x00, 0xa0, 0xaa, 0xbb, 0xa0, 0xcc, 0xdd, | 208 | // 0x80, 0x01, 0x20, 0x00, 0x03, 0x80, 0xff, 0x00, 0xa0, 0xaa, 0xbb, 0xa0, 0xcc, 0xdd, |
209 | // DEO/DEO2 | 209 | // DEO/DEO2 |
210 | 0x80, 0x68, 0x80, 0x18, 0x17, 0x80, 0x65, 0x80, 0x18, 0x17, 0x80, 0x6c, 0x80, 0x18, 0x17, 0x80, | 210 | // 0x80, 0x68, 0x80, 0x18, 0x17, 0x80, 0x65, 0x80, 0x18, 0x17, 0x80, 0x6c, 0x80, 0x18, 0x17, 0x80, |
211 | 0x6c, 0x80, 0x18, 0x17, 0x80, 0x6f, 0x80, 0x18, 0x17, 0x80, 0x0a, 0x80, 0x18, 0x17, | 211 | // 0x6c, 0x80, 0x18, 0x17, 0x80, 0x6f, 0x80, 0x18, 0x17, 0x80, 0x0a, 0x80, 0x18, 0x17, |
212 | // 0xa0, 0x00, 0x68, 0x80, 0x18, 0x37, 0x80, 0x65, 0x80, 0x18, 0x17, 0x80, 0x6c, 0x80, 0x18, 0x17, 0x80, | 212 | // 0xa0, 0x00, 0x68, 0x80, 0x18, 0x37, 0x80, 0x65, 0x80, 0x18, 0x17, 0x80, 0x6c, 0x80, 0x18, 0x17, 0x80, |
213 | // 0x6c, 0x80, 0x18, 0x17, 0x80, 0x6f, 0x80, 0x18, 0x17, 0x80, 0x0a, 0x80, 0x18, 0x17, | 213 | // 0x6c, 0x80, 0x18, 0x17, 0x80, 0x6f, 0x80, 0x18, 0x17, 0x80, 0x0a, 0x80, 0x18, 0x17, |
214 | // 0xa0, 0x2c, 0xe9, 0x80, 0x08, 0x37, | 214 | // 0xa0, 0x2c, 0xe9, 0x80, 0x08, 0x37, |
215 | 0xa0, 0x6b, 0x4f, 0x80, 0x18, 0x17, 0x80, 0x18, 0x17, 0xa0, 0x0a, 0x18, 0x17, | ||
216 | // 0xa0, 0x6b, 0x4f, 0x80, 0x18, 0x17, 0x80, 0x18, | ||
217 | // 0x17, 0xa0, 0x0a, 0x18, 0x17, 0xc0, 0x6b, 0x80, | ||
218 | // 0x4f, 0x0f, 0x6f, 0x80, 0x18, 0x17, 0x80, 0x18, | ||
219 | // 0x17, 0xa0, 0x0a, 0x18, 0x17, 0x00, 0x00, | ||
215 | }; | 220 | }; |
216 | memcpy(uxn_ram + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom)); | 221 | memcpy(uxn_ram + PAGE_PROGRAM, uxn_rom, sizeof(uxn_rom)); |
217 | 222 | ||
@@ -231,7 +236,6 @@ init_uxn() { | |||
231 | } | 236 | } |
232 | 237 | ||
233 | // TODO: | 238 | // TODO: |
234 | // - OPrk modes | ||
235 | // - Test DEI functions | 239 | // - Test DEI functions |
236 | 240 | ||
237 | int | 241 | int |
@@ -264,11 +268,6 @@ main(void) { | |||
264 | // Main loop. | 268 | // Main loop. |
265 | // uxn_eval(&u, PAGE_PROGRAM); | 269 | // uxn_eval(&u, PAGE_PROGRAM); |
266 | u8 frame_counter = 0; | 270 | u8 frame_counter = 0; |
267 | // NOTE: A VBLANK is 83776 cycles, anything other than that will make it so | ||
268 | // we fail to render at 60FPS. | ||
269 | |||
270 | // TODO: ... | ||
271 | // TODO: ... | ||
272 | 271 | ||
273 | uxn_eval_asm(PAGE_PROGRAM); | 272 | uxn_eval_asm(PAGE_PROGRAM); |
274 | 273 | ||
@@ -293,7 +292,7 @@ main(void) { | |||
293 | txt_printf("%02x ", wst[i]); | 292 | txt_printf("%02x ", wst[i]); |
294 | } | 293 | } |
295 | } | 294 | } |
296 | txt_printf("\n\n"); | 295 | // txt_printf("\n\n"); |
297 | // txt_printf("RST ("); | 296 | // txt_printf("RST ("); |
298 | // txt_printf("SIZE: %d)", rst_ptr - (uintptr_t)rst); | 297 | // txt_printf("SIZE: %d)", rst_ptr - (uintptr_t)rst); |
299 | // for (size_t i = 0; i < 64; i++) { | 298 | // for (size_t i = 0; i < 64; i++) { |
diff --git a/src/uxn-core.s b/src/uxn-core.s index 1a365ed..5b20e03 100644 --- a/src/uxn-core.s +++ b/src/uxn-core.s | |||
@@ -485,13 +485,24 @@ dei2: | |||
485 | b uxn_decode | 485 | b uxn_decode |
486 | 486 | ||
487 | deo: | 487 | deo: |
488 | @ Get args (idx/port/value). | ||
488 | wpop8 r3 | 489 | wpop8 r3 |
489 | mov r4, r3, lsr #4 @ idx | 490 | mov r4, r3, lsr #4 @ idx |
490 | and r3, #0x0f @ port | 491 | and r3, #0x0f @ port |
491 | wpop8 r5 @ value | 492 | wpop8 r5 @ value |
493 | |||
494 | @ Find current devide. | ||
492 | ldr r6, =deo_map | 495 | ldr r6, =deo_map |
493 | ldr r6, [r6, r4, lsl #2] | 496 | ldr r6, [r6, r4, lsl #2] |
497 | |||
498 | @ Save registers that can be affected. | ||
494 | stmfd sp!, {r0, r7, lr} | 499 | stmfd sp!, {r0, r7, lr} |
500 | ldr r0, =wst_ptr | ||
501 | str r1, [r0] | ||
502 | ldr r0, =rst_ptr | ||
503 | str r2, [r0] | ||
504 | |||
505 | @ Call the deo function. | ||
495 | ldr r0, =device_data | 506 | ldr r0, =device_data |
496 | lsl r4, #4 | 507 | lsl r4, #4 |
497 | add r0, r4 | 508 | add r0, r4 |
@@ -499,6 +510,8 @@ deo: | |||
499 | mov r1, r3 | 510 | mov r1, r3 |
500 | mov lr, pc | 511 | mov lr, pc |
501 | bx r6 | 512 | bx r6 |
513 | |||
514 | @ Restore saved variables. | ||
502 | ldmfd sp!, {r0, r7, lr} | 515 | ldmfd sp!, {r0, r7, lr} |
503 | ldr r1, wst_ptr | 516 | ldr r1, wst_ptr |
504 | ldr r2, rst_ptr | 517 | ldr r2, rst_ptr |