Title: | Interface to Binary Monitor in VICE C64 Emulator |
---|---|
Description: | Interface to the binary monitor in VICE - the c64 emulator. |
Authors: | mikefc |
Maintainer: | mikefc <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-15 03:50:43 UTC |
Source: | https://github.com/coolbutuseless/c64vice |
Internal helper class for dealing with byte sequences
Internal helper class for dealing with byte sequences
vec
vector of bytes
idx
current index within self$vec Initialise
new()
ByteStream$new(vec)
vec
vector of bytes. will be cast to integer Advance the indxe pointer without returning the value
advance()
ByteStream$advance(i)
i
number of bytes to advance Consume bytes and return the values
consume()
ByteStream$consume(n)
n
number of bytes to consume
consume_len2()
Consume 2 bytes and interpret as a little-endian integer
ByteStream$consume_len2()
consume_len4()
Consume 4 bytes and interpret as a little-endian integer
ByteStream$consume_len4()
eos()
Have we reached/exceeded the length of the bytestream
ByteStream$eos()
clone()
The objects of this class are cloneable with this method.
ByteStream$clone(deep = FALSE)
deep
Whether to make a deep clone.
c64 machine constants
machine
machine
An object of class list
of length 4.
Functions indexed by both their command code (e.g. "0x31") and by their description (e.g. "registers_get")
req
req
An object of class list
of length 0.
Step over a certain number of instructions.
req_advance_instructions(n, sub1 = TRUE)
req_advance_instructions(n, sub1 = TRUE)
n |
number of instructions to jump over |
sub1 |
Should subroutines count as a single instruction? |
empty response
Load a program then return to the monitor
req_autostart(filename, file_idx, run_after_load = TRUE)
req_autostart(filename, file_idx, run_after_load = TRUE)
filename |
Name of file |
file_idx |
If given a disk image, the index of the file to execute. Default: 0. |
run_after_load |
logical. Default: TRUE |
Gives a listing of all the bank IDs for the running machine with their names.
req_banks_available()
req_banks_available()
named list of bank IDs
Deletes any type of checkpoint. (break, watch, trace)
req_checkpoint_delete(checkpoint)
req_checkpoint_delete(checkpoint)
checkpoint |
number 32bit int. |
empty response
Gets any type of checkpoint. (break, watch, trace)
req_checkpoint_get(checkpoint)
req_checkpoint_get(checkpoint)
checkpoint |
number 32bit int. |
a named list
Checkpoint number
Currently hit? logical
Start address
End address
Stop when hit? Logical.
Logical.
CPU operatio: 1 = Load, 2 = Store, 4 = Exec
Deletes the checkpoint after it has been hit once. This is similar to "until" command, but it will not resume the emulator.
Number of hits
Ignore count
Has condition? Logical.
Memory space.
List of checkpoints
req_checkpoint_list()
req_checkpoint_list()
causes VICE to emit a series of responses (as would be returned
by a sequence of req_checkpoint_get()
) followed by the actual
response body which is just a count of the total number of checkpoints
This combines the functionality of several textual commands (break, watch, # trace) into one, as they are all the same with only minor variations. To set conditions, see section 13.4.8 Condition set (0x22) after executing this one.
req_checkpoint_set( start, end, stop_when_hit = TRUE, enabled = TRUE, cpu_op = 1, temporary = TRUE, mem_space = machine$mem_space$main )
req_checkpoint_set( start, end, stop_when_hit = TRUE, enabled = TRUE, cpu_op = 1, temporary = TRUE, mem_space = machine$mem_space$main )
start |
start address |
end |
end address |
stop_when_hit |
logical. Default: TRUE |
enabled |
logical. default: TRUE |
cpu_op |
1 = load. 2 = store. 4 = exec. devault: 1 |
temporary |
Deletes the checkpoint after it has been hit once. This is similar to "until" command, but it will not resume the emulator. |
mem_space |
memory space (integer). Default: 0 (main memory). Other acceptable values 1=drive8, 2=drive9, 3=drive10, 4=drive11 |
checkpoint list. Samve as req_checkpont_set
Checkpoint toggle
req_checkpoint_toggle(checkpoint, enabled)
req_checkpoint_toggle(checkpoint, enabled)
checkpoint |
number 32bit int. |
enabled |
Should checkpoint be enabled? logical. |
empty response
Sets a condition on an existing checkpoint. It is not currently possible to retrieve conditions after setting them.
req_condition_set(checkpoint, condition_expr)
req_condition_set(checkpoint, condition_expr)
checkpoint |
number 32bit int. |
condition_expr |
Condition expression string. This is the same format used on the command line. |
empty response
This function returns a matrix which includes the screen capture including a generous border on each side.
req_display_get()
req_display_get()
name list of metainformation including 'img' which contains the colour indices at each memory location.
length of the fields before the display buffer
Raw size of the returned matrix of pixels
Offset within the image to the actual screen pixels
dimensions of screen pixels starting at position (xoff, yoff)
bits per pixel
raw vector of colour at each pixel.
[req_palette_get()]
Saves the machine state to a file.
req_dump(filename, save_roms = FALSE, save_disks = FALSE)
req_dump(filename, save_roms = FALSE, save_disks = FALSE)
filename |
filename to save machine state into |
save_roms |
save ROMs to snapshot file? Logical. default: FALSE |
save_disks |
save disks to snapshot file. Logical. default: FALSE |
empty response
This command is the same as "return" in the text monitor.
req_execute_until_return()
req_execute_until_return()
empty response
Exit the monitor until the next breakpoint.
req_exit()
req_exit()
empty response
Set the simulated joyport value.
req_joyport_set(port, value)
req_joyport_set(port, value)
port |
the port to set the value on |
value |
value to set |
empty response
Add text to the keyboard buffer.
req_keyboard_feed(text)
req_keyboard_feed(text)
text |
PETSCII text |
empty response
13.4.1 Memory get (0x01)
req_memory_get(start, end, mem_space = 0, side_effects = FALSE, bank_id = 0)
req_memory_get(start, end, mem_space = 0, side_effects = FALSE, bank_id = 0)
start |
start address (integer) |
end |
end address (integer) |
mem_space |
memory space (integer). Default: 0 (main memory). Other acceptable values 1=drive8, 2=drive9, 3=drive10, 4=drive11 |
side_effects |
Should the read cause side effects? Default: FALSE |
bank_id |
which bank you want. This is dependent on your machine. If the memspace selected doesn't support banks, this value is ignored. |
cmd <- 0x01
vector of raw bytes
[req_banks_available()]
Writes a chunk of memory from a start address to an end address (inclusive).
req_memory_set( bytes, start, bank_id = 0, mem_space = machine$mem_space$main, side_effects = FALSE )
req_memory_set( bytes, start, bank_id = 0, mem_space = machine$mem_space$main, side_effects = FALSE )
bytes |
raw vector of bytes to be written to memory |
start |
start address (integer) |
bank_id |
which bank you want. This is dependent on your machine. If the memspace selected doesn't support banks, this value is ignored. |
mem_space |
memory space (integer). Default: 0 (main memory). Other acceptable values 1=drive8, 2=drive9, 3=drive10, 4=drive11 |
side_effects |
Should the read cause side effects? Default: FALSE |
empty response
Get the colors in the current palette
req_palette_get()
req_palette_get()
character vector of colours
Get an empty response
req_ping()
req_ping()
empty response
Gives a listing of all the registers for the running machine with their names.
req_registers_available(mem_space = machine$mem_space$main)
req_registers_available(mem_space = machine$mem_space$main)
mem_space |
memory space (integer). Default: 0 (main memory). Other acceptable values 1=drive8, 2=drive9, 3=drive10, 4=drive11 |
named list of regiseters
Get details about the registers
req_registers_get(mem_space = machine$mem_space$main)
req_registers_get(mem_space = machine$mem_space$main)
mem_space |
memory space (integer). Default: 0 (main memory). Other acceptable values 1=drive8, 2=drive9, 3=drive10, 4=drive11 |
named integer vector where names are the register names.
Set the register values
req_registers_set(..., mem_space = machine$mem_space$main)
req_registers_set(..., mem_space = machine$mem_space$main)
... |
name/value pairs specifying values for the named registers.
e.g. |
mem_space |
memory space (integer). Default: 0 (main memory). Other acceptable values 1=drive8, 2=drive9, 3=drive10, 4=drive11 |
named integer vector where names are the register names.
Reset the system or a drive
req_reset(hard_reset = TRUE, drive = NULL)
req_reset(hard_reset = TRUE, drive = NULL)
hard_reset |
logical. default: TRUE |
drive |
integer. 8-11. If set, then this drive is reset rather than the main system. |
Get a resource value from the emulator. See section 6.1 Format of resource files.
req_resource_get(resource)
req_resource_get(resource)
resource |
resource name. See https://vice-emu.sourceforge.io/vice_6.html#SEC84 |
named list of 'type' of value (string or integer) and 'value'
Set a resource value in the emulator. See section 6.1 Format of resource files.
req_resource_set(resource, value)
req_resource_set(resource, value)
resource |
resource name. See https://vice-emu.sourceforge.io/vice_6.html#SEC84 |
value |
value to set. allowed: string or integer. |
empty response
Loads the machine state from a file.
req_undump(filename)
req_undump(filename)
filename |
filename containing dump of the machine state. |
The current program counter position
Set the simulated userport value.
req_userport_set(value)
req_userport_set(value)
value |
value to set |
empty response
Get general information about VICE. Currently returns the versions.
req_vice_info()
req_vice_info()
list with vice and SVN versions
Run a PRG given as a numeric vector or a filename
run_prg(prg, ...)
run_prg(prg, ...)
prg |
filename or raw/numeric vector |
... |
extra arguments passed to |
Take a screenshot and save as PNG file
save_screenshot(filename, scale = 4, keep_border = TRUE)
save_screenshot(filename, scale = 4, keep_border = TRUE)
filename |
PNG filename |
scale |
scale factor applied to image before saving. defualt: 4 |
keep_border |
keep the borders as part of the screenshot. |
Deliver a request of raw bytes to the VICE binary monitor
send_req( request, parse_response = TRUE, keep_raw = FALSE, wait = 0.2, host = "localhost", port = 6502 )
send_req( request, parse_response = TRUE, keep_raw = FALSE, wait = 0.2, host = "localhost", port = 6502 )
request |
raw vector |
parse_response |
default: TRUE. If FALSE then return raw vector |
keep_raw |
should the raw bytes be returned as part of the parsed response? Default: FALSE |
wait |
how long to wait before checking for the response to the request. Default: 0.2s. Different commands, networks and Operating Systems will have different requirements here. |
host |
host to connect to. Default: "localhost" |
port |
port on host to connect to. Default: 6502. This is the default port set by VICE when running the binary monitor. |
named list with parsed response or a raw vector (if parse_response = FALSE
)
Take a screenshot
take_screenshot(keep_border = TRUE)
take_screenshot(keep_border = TRUE)
keep_border |
keep the borders as part of the screenshot. |
raster