nesemu/debugger/memory_view.h

74 lines
1.7 KiB
C

//
// Created by william on 6/1/24.
//
#ifndef NESEMULATOR_MEMORY_VIEW_H
#define NESEMULATOR_MEMORY_VIEW_H
#include <panel.h>
#include "../include/types.h"
#include "cursor.h"
#include "window.h"
#define MEMORY_VIEW_HEIGHT 19
#define MEMORY_VIEW_WIDTH 56
#define MEMORY_VIEW_LINE_COUNT 0xf
#define MEMORY_VIEW_LINE_BYTE_COUNT 0xf
#define MEMORY_VIEW_BYTE_COUNT 0xff
typedef struct memory_view {
InteractWindow *window;
address base_address;
} MemoryView;
/**
* Initializes a memory view for a system RAM.
* The viewer base address will be set to 0x0000, and the cursor (0, 0).
* The content of the memory will be printed on a new curses window.
* @param view A pointer to the view to initialize
*/
void mv_init(InteractWindow *interact, int x, int y);
/**
* Prints the RAM content from the viewer base address.
*
* @param view
*/
void mv_print(MemoryView *view);
/**
* Sets the viewer base address to the target address page (the first byte) and prints the RAM.
*
* @param view
* @param target The target address to print
*/
void mv_goto(MemoryView *view, address target);
/**
* Scrolls the base address up or down by steps of 0x10.
*
* @param view
* @param direction The scroll direction
*/
void mv_scroll(MemoryView *view, int direction);
/**
* Moves the cursor up, down, right or left.
*
* @param view
* @param horizontal
* @param vertical
*/
void mv_cursor_move(InteractWindow *window, int horizontal, int vertical);
/**
* Moves the cursor to a specific memory address.
* The view will not be scrolled if the target address is not displayed.
*
* @param view
* @param target
*/
void mv_cursor_set_addr(MemoryView *view, address target);
#endif //NESEMULATOR_MEMORY_VIEW_H