annotate stateview.c @ 989:d70000fdff0b

Implemented IR and undefined bits of info word for address error exception frames
author Michael Pavone <pavone@retrodev.com>
date Wed, 27 Apr 2016 21:39:17 -0700
parents f7bbbf49db4e
children 56b1748a8473
rev   line source
pavone@467 1 /*
pavone@467 2 Copyright 2013 Michael Pavone
pavone@467 3 This file is part of BlastEm.
pavone@467 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
pavone@467 5 */
pavone@20 6 #include <stdlib.h>
pavone@20 7 #include <stdio.h>
pavone@20 8 #include "vdp.h"
pavone@20 9 #include "render.h"
pavone@793 10 #include "util.h"
pavone@75 11 #include "blastem.h"
pavone@75 12
pavone@75 13 //not used, but referenced by the renderer since it handles input
pavone@75 14 io_port gamepad_1;
pavone@75 15 io_port gamepad_2;
pavone@465 16 uint8_t reset = 1;
pavone@465 17 uint8_t busreq = 0;
pavone@75 18
pavone@783 19 uint8_t z80_ram[Z80_RAM_BYTES];
pavone@783 20
pavone@75 21 uint16_t read_dma_value(uint32_t address)
pavone@75 22 {
pavone@75 23 return 0;
pavone@75 24 }
pavone@20 25
pavone@962 26 m68k_context *m68k_handle_code_write(uint32_t address, m68k_context *context)
pavone@962 27 {
pavone@962 28 return NULL;
pavone@962 29 }
pavone@962 30
pavone@962 31 z80_context *z80_handle_code_write(uint32_t address, z80_context *context)
pavone@962 32 {
pavone@962 33 return NULL;
pavone@962 34 }
pavone@962 35
pavone@982 36 uint16_t get_open_bus_value()
pavone@982 37 {
pavone@982 38 return 0;
pavone@982 39 }
pavone@982 40
pavone@465 41 void ym_data_write(ym2612_context * context, uint8_t value)
pavone@465 42 {
pavone@465 43 }
pavone@465 44
pavone@465 45 void ym_address_write_part1(ym2612_context * context, uint8_t address)
pavone@465 46 {
pavone@465 47 }
pavone@465 48
pavone@465 49 void ym_address_write_part2(ym2612_context * context, uint8_t address)
pavone@465 50 {
pavone@465 51 }
pavone@465 52
pavone@465 53 void handle_keydown(int keycode)
pavone@465 54 {
pavone@465 55 }
pavone@465 56
pavone@465 57 void handle_keyup(int keycode)
pavone@465 58 {
pavone@465 59 }
pavone@465 60
pavone@465 61 void handle_joydown(int joystick, int button)
pavone@465 62 {
pavone@465 63 }
pavone@465 64
pavone@465 65 void handle_joyup(int joystick, int button)
pavone@465 66 {
pavone@465 67 }
pavone@465 68
pavone@465 69 void handle_joy_dpad(int joystick, int dpadnum, uint8_t value)
pavone@465 70 {
pavone@465 71 }
pavone@465 72
pavone@959 73 void handle_mousedown(int mouse, int button)
pavone@959 74 {
pavone@959 75 }
pavone@959 76
pavone@959 77 void handle_mouseup(int mouse, int button)
pavone@959 78 {
pavone@959 79 }
pavone@959 80
pavone@959 81 void handle_mouse_moved(int mouse, uint16_t x, uint16_t y, int16_t deltax, int16_t deltay)
pavone@959 82 {
pavone@959 83 }
pavone@959 84
pavone@465 85 tern_node * config;
pavone@703 86 int headless = 0;
pavone@465 87
pavone@20 88 int main(int argc, char ** argv)
pavone@20 89 {
pavone@20 90 if (argc < 2) {
pavone@792 91 fatal_error("Usage: stateview FILENAME\n");
pavone@20 92 }
pavone@20 93 FILE * state_file = fopen(argv[1], "rb");
pavone@20 94 if (!state_file) {
pavone@792 95 fatal_error("Failed to open %s\n", argv[1]);
pavone@20 96 }
pavone@812 97 set_exe_str(argv[0]);
pavone@465 98 config = load_config(argv[0]);
pavone@465 99 int width = -1;
pavone@465 100 int height = -1;
pavone@33 101 if (argc > 2) {
pavone@33 102 width = atoi(argv[2]);
pavone@33 103 if (argc > 3) {
pavone@33 104 height = atoi(argv[3]);
pavone@33 105 }
pavone@33 106 }
pavone@465 107 int def_width = 0;
pavone@465 108 char *config_width = tern_find_ptr(config, "videowidth");
pavone@465 109 if (config_width) {
pavone@465 110 def_width = atoi(config_width);
pavone@465 111 }
pavone@465 112 if (!def_width) {
pavone@465 113 def_width = 640;
pavone@465 114 }
pavone@465 115 width = width < 320 ? def_width : width;
pavone@465 116 height = height < 240 ? (width/320) * 240 : height;
pavone@465 117
pavone@20 118 vdp_context context;
pavone@719 119 render_init(width, height, "GST State Viewer", 60, 0);
pavone@703 120 init_vdp_context(&context, 0);
pavone@424 121 vdp_load_gst(&context, state_file);
pavone@20 122 vdp_run_to_vblank(&context);
pavone@322 123 vdp_print_sprite_table(&context);
pavone@75 124 printf("Display %s\n", (context.regs[REG_MODE_2] & DISPLAY_ENABLE) ? "enabled" : "disabled");
pavone@20 125 render_context(&context);
pavone@43 126 render_wait_quit(&context);
pavone@20 127 return 0;
pavone@20 128 }