nesemu/debugger/memory_view.h

76 lines
1.7 KiB
C
Raw Normal View History

2024-01-07 16:20:37 -05:00
//
2024-01-14 21:59:13 -05:00
// Created by william on 6/1/24.
2024-01-07 16:20:37 -05:00
//
#ifndef NESEMULATOR_MEMORY_VIEW_H
#define NESEMULATOR_MEMORY_VIEW_H
#include <panel.h>
#include "../include/types.h"
2024-01-14 21:59:13 -05:00
#include "cursor.h"
#include "window.h"
2024-01-07 16:20:37 -05:00
#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 {
2024-01-14 21:59:13 -05:00
InteractWindow *window;
2024-01-09 14:46:20 -05:00
byte *ram;
2024-01-07 16:20:37 -05:00
address base_address;
} MemoryView;
2024-01-09 15:56:54 -05:00
/**
* 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
* @param ram A pointer to the RAM
*/
void mv_init(InteractWindow *interact, ram ram, int x, int y);
2024-01-07 16:20:37 -05:00
2024-01-09 15:56:54 -05:00
/**
* Prints the RAM content from the viewer base address.
*
* @param view
*/
void mv_print(MemoryView *view);
2024-01-07 16:20:37 -05:00
2024-01-09 15:56:54 -05:00
/**
* 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);
2024-01-07 16:20:37 -05:00
2024-01-09 15:56:54 -05:00
/**
* 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);
2024-01-09 14:46:20 -05:00
2024-01-09 15:56:54 -05:00
/**
* Moves the cursor up, down, right or left.
*
* @param view
* @param horizontal
* @param vertical
*/
void mv_cursor_move(InteractWindow *window, int horizontal, int vertical);
2024-01-09 14:46:20 -05:00
2024-01-09 15:56:54 -05:00
/**
* 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);
2024-01-07 16:20:37 -05:00
#endif //NESEMULATOR_MEMORY_VIEW_H