GrafX2 2.9.3227
The ultimate 256-color painting program
6502.h File Reference
#include <Z/hardware/CPU/architecture/6502.h>
+ Include dependency graph for 6502.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  M6502
 6502 emulator instance. More...
 

Macros

#define CPU_6502_API   Z_API
 

Functions

CPU_6502_API void m6502_power (M6502 *object, zboolean state)
 Changes the CPU power status. More...
 
CPU_6502_API void m6502_reset (M6502 *object)
 Resets the CPU. More...
 
CPU_6502_API zusize m6502_run (M6502 *object, zusize cycles)
 Runs the CPU for a given number of cycles. More...
 
CPU_6502_API void m6502_nmi (M6502 *object)
 Performs a non-maskable interrupt (NMI). More...
 
CPU_6502_API void m6502_irq (M6502 *object, zboolean state)
 Changes the state of the maskable interrupt (IRQ). More...
 

Macro Definition Documentation

◆ CPU_6502_API

#define CPU_6502_API   Z_API

Function Documentation

◆ m6502_power()

CPU_6502_API void m6502_power ( M6502 object,
zboolean  state 
)

Changes the CPU power status.

Parameters
objectA pointer to a 6502 emulator instance.
stateTRUE = power ON; FALSE = power OFF.

References A, FALSE, IRQ, NMI, P, PC, S, X, Y, Z_6502_VALUE_AFTER_POWER_ON_A, Z_6502_VALUE_AFTER_POWER_ON_P, Z_6502_VALUE_AFTER_POWER_ON_PC, Z_6502_VALUE_AFTER_POWER_ON_S, Z_6502_VALUE_AFTER_POWER_ON_X, and Z_6502_VALUE_AFTER_POWER_ON_Y.

Referenced by C64_LoadPrg().

◆ m6502_reset()

CPU_6502_API void m6502_reset ( M6502 object)

Resets the CPU.

This is equivalent to a pulse on the RESET line of a real 6502.

Parameters
objectA pointer to a 6502 emulator instance.

References FALSE, IRQ, NMI, P, PC, READ_POINTER, S, Z_6502_VALUE_AFTER_POWER_ON_P, and Z_6502_VALUE_AFTER_POWER_ON_S.

◆ m6502_run()

CPU_6502_API zusize m6502_run ( M6502 object,
zusize  cycles 
)

Runs the CPU for a given number of cycles.

Parameters
objectA pointer to a 6502 emulator instance.
cyclesThe number of cycles to be executed.
Returns
The number of cycles executed.
Note
Given the fact that one 6502 instruction needs between 2 and 7 cycles to be executed, it's not always possible to run the CPU the exact number of cycles specfified.

References CYCLES, FALSE, instruction_table, IP, IRQ, NMI, OPCODE, P, PC, PUSH_16, PUSH_8, READ_8, and READ_POINTER.

Referenced by C64_LoadPrg().

◆ m6502_nmi()

CPU_6502_API void m6502_nmi ( M6502 object)

Performs a non-maskable interrupt (NMI).

This is equivalent to a pulse on the NMI line of a real 6502.

Parameters
objectA pointer to a 6502 emulator instance.

References NMI, and TRUE.

◆ m6502_irq()

CPU_6502_API void m6502_irq ( M6502 object,
zboolean  state 
)

Changes the state of the maskable interrupt (IRQ).

This is equivalent to a change on the IRQ line of a real 6502.

Parameters
objectA pointer to a 6502 emulator instance.
stateTRUE = line high; FALSE = line low.

References IRQ.

Referenced by C64_LoadPrg(), and C64_mem_write().