Rocket 68
A Motorola 68000 CPU emulator in C
Loading...
Searching...
No Matches
loader.c File Reference

S-record and binary loader implementation. More...

#include "loader.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Functions

bool m68k_load_srec (M68kCpu *cpu, const char *filename)
 Load Motorola S-record data into CPU memory.
bool m68k_load_bin (M68kCpu *cpu, const char *filename, u32 address, u32 *size_out)
 Load a raw binary file into CPU memory.
bool m68k_load_ihex (M68kCpu *cpu, const char *filename)
 Load Intel HEX data into CPU memory.

Detailed Description

S-record and binary loader implementation.

Function Documentation

◆ m68k_load_bin()

bool m68k_load_bin ( M68kCpu * cpu,
const char * filename,
u32 address,
u32 * size_out )

Load a raw binary file into CPU memory.

Parameters
cpuCPU instance with bound memory.
filenamePath to a binary file.
addressStart address in emulated memory.
size_outOptional output for the number of bytes written into emulated memory; may be NULL. Set to 0 when the file cannot be opened. A value smaller than the file size indicates the load stopped at the end of bound memory.
Returns
false only if the input file cannot be opened; otherwise true.

◆ m68k_load_ihex()

bool m68k_load_ihex ( M68kCpu * cpu,
const char * filename )

Load Intel HEX data into CPU memory.

Parameters
cpuCPU instance with bound memory.
filenamePath to an Intel HEX file.
Returns
false only if the input file cannot be opened; otherwise true.

Data records (type 00) honor the extended segment (02) and extended linear (04) base records. Start address records (03 and 05) set the program counter through m68k_set_pc. Parsing errors and checksum mismatches in individual records are reported to stderr, and the affected records are skipped.

◆ m68k_load_srec()

bool m68k_load_srec ( M68kCpu * cpu,
const char * filename )

Load Motorola S-record data into CPU memory.

Parameters
cpuCPU instance with bound memory.
filenamePath to an S-record file.
Returns
false only if the input file cannot be opened; otherwise true.

Parsing errors and checksum mismatches in individual records are reported to stderr, and the affected records are skipped.