Mercurial > repos > blastem
changeset 2603:acb8f0f70a68
Delete some old test source files from early in development
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 13 Feb 2025 21:04:28 -0800 |
parents | 10c7f1e44c47 |
children | c768bbd912f1 |
files | test.c test_arm.c test_int_timing.c test_x86.c testgst.c |
diffstat | 5 files changed, 0 insertions(+), 335 deletions(-) [+] |
line wrap: on
line diff
--- a/test.c Thu Feb 13 21:03:04 2025 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include "vdp.h" - -int headless = 1; -uint16_t read_dma_value(uint32_t address) -{ - return 0; -} - -uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) -{ - return 0; -} - -void render_alloc_surfaces(vdp_context * context) -{ - context->oddbuf = context->framebuf = malloc(512 * 256 * 4 * 2); - memset(context->oddbuf, 0, 512 * 256 * 4 * 2); - context->evenbuf = ((char *)context->oddbuf) + 512 * 256 * 4; -} - -int check_hint_time(vdp_context * v_context) -{ - uint32_t orig_hint_cycle = vdp_next_hint(v_context); - uint32_t cur_hint_cycle; - printf("hint cycle is %d at vcounter: %d, hslot: %d\n", orig_hint_cycle, v_context->vcounter, v_context->hslot); - int res = 1; - while ((cur_hint_cycle = vdp_next_hint(v_context)) > v_context->cycles) - { - if (cur_hint_cycle != orig_hint_cycle) { - fprintf(stderr, "ERROR: hint cycle changed to %d at vcounter: %d, hslot: %d\n", cur_hint_cycle, v_context->vcounter, v_context->hslot); - orig_hint_cycle = cur_hint_cycle; - res = 0; - } - vdp_run_context(v_context, v_context->cycles + 1); - } - printf("hint fired at cycle: %d, vcounter: %d, hslot: %d\n", cur_hint_cycle, v_context->vcounter, v_context->hslot); - vdp_int_ack(v_context, 4); - return res; -} - - -int main(int argc, char ** argv) -{ - vdp_context v_context; - init_vdp_context(&v_context, 0); - vdp_control_port_write(&v_context, 0x8144); - vdp_control_port_write(&v_context, 0x8C81); - vdp_control_port_write(&v_context, 0x8A7F); - vdp_control_port_write(&v_context, 0x8014); - v_context.hint_counter = 0x7F; - v_context.vcounter = 128; - v_context.hslot = 165; - //check single shot behavior - int res = check_hint_time(&v_context); - //check every line behavior - while (v_context.vcounter < 225) - { - vdp_run_context(&v_context, v_context.cycles + 1); - } - vdp_control_port_write(&v_context, 0x8A00); - int hint_count = 0; - while (res && v_context.vcounter != 224) - { - res = res && check_hint_time(&v_context); - hint_count++; - } - if (res && hint_count != 225) { - fprintf(stderr, "ERROR: hint count should be 225 but was %d instead\n", hint_count); - res = 0; - } - return 0; -}
--- a/test_arm.c Thu Feb 13 21:03:04 2025 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#include <stdio.h> -#include "gen_arm.h" - -typedef int32_t (*fib_fun)(int32_t); - -int main(int arc, char **argv) -{ - code_info code; - init_code_info(&code); - uint32_t *fib = code.cur; - subi(&code, r0, r0, 2, SET_COND); - movi_cc(&code, r0, 1, NO_COND, CC_LT); - bx_cc(&code, lr, CC_LT); - pushm(&code, LR | R4); - mov(&code, r4, r0, NO_COND); - bl(&code, fib); - mov(&code, r1, r0, NO_COND); - addi(&code, r0, r4, 1, NO_COND); - mov(&code, r4, r1, NO_COND); - bl(&code, fib); - add(&code, r0, r4, r0, NO_COND); - popm(&code, LR | R4); - bx(&code, lr); - - fib_fun fibc = (fib_fun)fib; - printf("fib(10): %d\n", fibc(10)); - - return 0; -}
--- a/test_int_timing.c Thu Feb 13 21:03:04 2025 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* - Copyright 2017 Michael Pavone - This file is part of BlastEm. - BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. -*/ -#include <stdio.h> -#include "vdp.h" - -int headless = 1; - -uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) -{ - return 0; -} - -uint16_t read_dma_value(uint32_t address) -{ - return 0; -} - -uint32_t *render_get_framebuffer(uint8_t which, int *pitch) -{ - *pitch = 0; - return NULL; -} - -void render_framebuffer_updated(uint8_t which, int width) -{ -} - -void warning(char *format, ...) -{ -} - - -int main(int argc, char **argv) -{ - vdp_context context; - int ret = 0; - init_vdp_context(&context, 0); - vdp_control_port_write(&context, 0x8000 | BIT_PAL_SEL); - vdp_control_port_write(&context, 0x8100 | BIT_DISP_EN | BIT_VINT_EN | BIT_MODE_5); - puts("Testing H32 Mode"); - while (!(context.flags2 & FLAG2_VINT_PENDING)) - { - vdp_run_context(&context, context.cycles + 1); - } - vdp_int_ack(&context); - uint32_t vint_cycle = vdp_next_vint(&context); - while (!(context.flags2 & FLAG2_VINT_PENDING)) - { - vdp_run_context(&context, context.cycles + 1); - uint32_t vint_cycle2 = vdp_next_vint(&context); - if (vint_cycle2 != vint_cycle) { - printf("VINT Cycle changed from %d to %d @ line %d, slot %d\n", vint_cycle, vint_cycle2, context.vcounter, context.hslot);; - ret = 1; - vint_cycle = vint_cycle2; - } - } - vdp_int_ack(&context); - puts("Testing H40 Mode"); - vdp_control_port_write(&context, 0x8C81); - while (!(context.flags2 & FLAG2_VINT_PENDING)) - { - vdp_run_context(&context, context.cycles + 1); - } - vdp_int_ack(&context); - vint_cycle = vdp_next_vint(&context); - while (!(context.flags2 & FLAG2_VINT_PENDING)) - { - vdp_run_context(&context, context.cycles + 1); - uint32_t vint_cycle2 = vdp_next_vint(&context); - if (vint_cycle2 != vint_cycle) { - printf("VINT Cycle changed from %d to %d @ line %d, slot %d\n", vint_cycle, vint_cycle2, context.vcounter, context.hslot);; - ret = 1; - vint_cycle = vint_cycle2; - } - } - vdp_int_ack(&context); - puts("Testing Mode 4"); - vdp_control_port_write(&context, 0x8C00); - vdp_control_port_write(&context, 0x8100 | BIT_DISP_EN | BIT_VINT_EN); - while (!(context.flags2 & FLAG2_VINT_PENDING)) - { - vdp_run_context(&context, context.cycles + 1); - } - context.flags2 &= ~FLAG2_VINT_PENDING; - vint_cycle = vdp_next_vint(&context); - while (!(context.flags2 & FLAG2_VINT_PENDING)) - { - vdp_run_context(&context, context.cycles + 1); - uint32_t vint_cycle2 = vdp_next_vint(&context); - if (vint_cycle2 != vint_cycle) { - printf("VINT Cycle changed from %d to %d @ line %d, slot %d\n", vint_cycle, vint_cycle2, context.vcounter, context.hslot);; - ret = 1; - vint_cycle = vint_cycle2; - } - } - printf("Result: %s\n", ret ? "failure" : "success"); - return ret; -} \ No newline at end of file
--- a/test_x86.c Thu Feb 13 21:03:04 2025 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - Copyright 2013 Michael Pavone - This file is part of BlastEm. - BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. -*/ -#include "gen_x86.h" -#include "m68k_core.h" -#include <stdio.h> -#include <stddef.h> - -int main(int argc, char ** argv) -{ - uint8_t foo[512]; - uint8_t *cur = foo, *end; - cur = mov_rr(cur, RAX, RBX, SZ_B); - cur = mov_rr(cur, RCX, RDX, SZ_B); - cur = mov_rr(cur, R8, R9, SZ_B); - cur = mov_rr(cur, R8, RAX, SZ_B); - cur = mov_rr(cur, RAX, RBX, SZ_W); - cur = mov_rr(cur, R11, R12, SZ_W); - cur = mov_rr(cur, RAX, RBX, SZ_D); - cur = mov_rr(cur, RAX, RBX, SZ_Q); - cur = mov_ir(cur, 5, RAX, SZ_D); - cur = mov_ir(cur, 3, R8, SZ_D); - cur = mov_ir(cur, 4, RSP, SZ_B); - cur = add_rr(cur, RAX, RBX, SZ_D); - cur = add_ir(cur, 5, RAX, SZ_B); - cur = add_ir(cur, 5, RBX, SZ_B); - cur = add_ir(cur, 5, RBP, SZ_B); - cur = pushf(cur); - cur = popf(cur); - cur = setcc_r(cur, CC_S, RBX); - cur = setcc_r(cur, CC_Z, RDX); - cur = setcc_r(cur, CC_O, BH); - cur = setcc_r(cur, CC_C, DH); - cur = setcc_rind(cur, CC_C, RSI); - cur = mov_rrdisp8(cur, RCX, RSI, offsetof(m68k_context, dregs) + 4 * sizeof(uint32_t), SZ_D); - cur = mov_rdisp8r(cur, RSI, offsetof(m68k_context, dregs) + 5 * sizeof(uint32_t), RCX, SZ_D); - cur = mov_rrind(cur, DH, RSI, SZ_B); - cur = jcc(cur, CC_NZ, -2); - cur = jcc(cur, CC_Z, 0); - cur = jcc(cur, CC_LE, 0x7CA); - for (end = cur, cur = foo; cur != end; cur++) { - printf(" %X", *cur); - } - puts(""); - return 0; -}
--- a/testgst.c Thu Feb 13 21:03:04 2025 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - Copyright 2013 Michael Pavone - This file is part of BlastEm. - BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. -*/ -#include "gst.h" -#include <string.h> -#include <stdlib.h> - -uint8_t busreq; -uint8_t reset; - -void latch_mode(vdp_context * context) -{ -} -void ym_data_write(ym2612_context * context, uint8_t value) -{ - if (context->selected_reg >= YM_REG_END) { - return; - } - if (context->selected_part) { - if (context->selected_reg < YM_PART2_START) { - return; - } - context->part2_regs[context->selected_reg - YM_PART2_START] = value; - } else { - if (context->selected_reg < YM_PART1_START) { - return; - } - context->part1_regs[context->selected_reg - YM_PART1_START] = value; - } -} - -void ym_address_write_part1(ym2612_context * context, uint8_t address) -{ - //printf("address_write_part1: %X\n", address); - context->selected_reg = address; - context->selected_part = 0; -} - -void ym_address_write_part2(ym2612_context * context, uint8_t address) -{ - //printf("address_write_part2: %X\n", address); - context->selected_reg = address; - context->selected_part = 1; -} - -uint16_t ram[64*1024]; -uint8_t zram[8*1024]; - - -int main(int argc, char ** argv) -{ - vdp_context vdp; - ym2612_context ym; - psg_context psg; - m68k_context m68k; - z80_context z80; - genesis_context gen; - if (argc < 3) { - fputs("Usage: testgst infile outfile\n", stderr); - return 1; - } - memset(&gen, 0, sizeof(gen)); - memset(&m68k, 0, sizeof(m68k)); - memset(&z80, 0, sizeof(z80)); - memset(&ym, 0, sizeof(ym)); - memset(&vdp, 0, sizeof(vdp)); - memset(&psg, 0, sizeof(psg)); - m68k.mem_pointers[1] = ram; - z80.mem_pointers[0] = zram; - vdp.vdpmem = malloc(VRAM_SIZE); - gen.vdp = &vdp; - gen.ym = &ym; - gen.psg = &psg; - gen.m68k = &m68k; - gen.z80 = &z80; - uint32_t pc = load_gst(&gen, argv[1]); - save_gst(&gen, argv[2], pc); - return 0; -}