LMMS
Loading...
Searching...
No Matches
Kss_Cpu.cpp File Reference
#include "Kss_Cpu.h"
#include "blargg_endian.h"
#include <string.h>
#include "blargg_source.h"

Macros

#define SYNC_TIME()
#define RELOAD_TIME()
#define CPU_OUT(cpu, addr, data, time)
#define CPU_IN(cpu, addr, time)
#define CPU_WRITE(cpu, addr, data, time)
#define SZ28P(n)
#define SZ28PC(n)
#define SZ28C(n)
#define SZ28(n)
#define SET_R(n)
#define GET_R()
#define TIME   (s_time + s.base)
#define RW_MEM(addr, rw)
#define READ_PROG(addr)
#define READ(addr)
#define WRITE(addr, data)
#define READ_WORD(addr)
#define WRITE_WORD(addr, data)
#define IN(addr)
#define OUT(addr, data)
#define R8(n, offset)
#define R16(n, shift, offset)
#define CASE5(a, b, c, d, e)
#define CASE6(a, b, c, d, e, f)
#define CASE7(a, b, c, d, e, f, g)
#define CASE8(a, b, c, d, e, f, g, h)
#define GET_ADDR()
#define ZERO   (flags & Z40)
#define CARRY   (flags & C01)
#define EVEN   (flags & P04)
#define MINUS   (flags & S80)
#define JR(cond)
#define JP(cond)
#define RET(cond)
#define CALL(cond)
#define RLC(read, write)
#define RL(read, write)
#define SLA(read, add, write)
#define RRC(read, write)
#define RR(read, write)
#define SRA(read, write)
#define SRL(read, write)
#define GET_ADDR()
#define IXY_DISP(ixy, disp)
#define SET_IXY(in)

Variables

int const S80 = 0x80
int const Z40 = 0x40
int const F20 = 0x20
int const H10 = 0x10
int const F08 = 0x08
int const V04 = 0x04
int const P04 = 0x04
int const N02 = 0x02
int const C01 = 0x01
static byte const ed_dd_timing [0x100]

Macro Definition Documentation

◆ CALL

#define CALL ( cond)
Value:
if ( cond ) goto call_taken; goto call_not_taken;

◆ CARRY

#define CARRY   (flags & C01)

◆ CASE5

#define CASE5 ( a,
b,
c,
d,
e )
Value:
case 0x##a:case 0x##b:case 0x##c:case 0x##d:case 0x##e
uint8_t a
Definition Spc_Cpu.h:141
* e
Definition inflate.c:1404
unsigned d
Definition inflate.c:940
unsigned x[BMAX+1]
Definition inflate.c:1586
return c
Definition crypt.c:175
b
Definition crypt.c:628

◆ CASE6

#define CASE6 ( a,
b,
c,
d,
e,
f )
Value:
CASE5( a, b, c, d, e ): case 0x##f
#define CASE5(a, b, c, d, e)
Definition Ay_Cpu.cpp:113
unsigned f
Definition inflate.c:1572

◆ CASE7

#define CASE7 ( a,
b,
c,
d,
e,
f,
g )
Value:
CASE6( a, b, c, d, e, f ): case 0x##g
#define CASE6(a, b, c, d, e, f)
Definition Ay_Cpu.cpp:114
int g
Definition inflate.c:1573

◆ CASE8

#define CASE8 ( a,
b,
c,
d,
e,
f,
g,
h )
Value:
CASE7( a, b, c, d, e, f, g ): case 0x##h
#define CASE7(a, b, c, d, e, f, g)
Definition Ay_Cpu.cpp:115
uch h[RAND_HEAD_LEN]
Definition crypt.c:459

◆ CPU_IN

#define CPU_IN ( cpu,
addr,
time )
Value:
kss_cpu_in( this, time, addr )
int kss_cpu_in(class Kss_Cpu *, cpu_time_t, unsigned addr)
Definition Kss_Emu.cpp:364

◆ CPU_OUT

#define CPU_OUT ( cpu,
addr,
data,
time )
Value:
kss_cpu_out( this, time, addr, data )
void kss_cpu_out(class Kss_Cpu *, cpu_time_t, unsigned addr, int data)
Definition Kss_Emu.cpp:314
JSAMPIMAGE data
Definition jpeglib.h:945

◆ CPU_WRITE

#define CPU_WRITE ( cpu,
addr,
data,
time )
Value:
(SYNC_TIME(), kss_cpu_write( this, addr, data ))
#define SYNC_TIME()
Definition Ay_Cpu.cpp:27
void kss_cpu_write(class Kss_Cpu *, unsigned addr, int data)
Definition Kss_Emu.cpp:307

◆ EVEN

#define EVEN   (flags & P04)

◆ GET_ADDR [1/2]

#define GET_ADDR ( )
Value:
GET_LE16( instr + 1 )
#define GET_LE16(addr)
Definition blargg_endian.h:154

◆ GET_ADDR [2/2]

#define GET_ADDR ( )
Value:
GET_LE16( instr )

◆ GET_R

#define GET_R ( )
Value:
(r.r)
int r
Definition crypt.c:458

◆ IN

#define IN ( addr)
Value:
CPU_IN( this, addr, TIME )
#define TIME
Definition Ay_Cpu.cpp:88
#define CPU_IN(cpu, addr, TIME)
Definition Ay_Cpu.cpp:35

◆ IXY_DISP

#define IXY_DISP ( ixy,
disp )
Value:
uint16_t ((ixy) + (disp))
unsigned short uint16_t
Definition mid.cpp:99

◆ JP

#define JP ( cond)
Value:
if ( !(cond) ) goto jp_not_taken; pc = GET_ADDR(); goto loop;
#define GET_ADDR()
Definition Ay_Cpu.cpp:91
uint16_t pc
Definition Spc_Cpu.h:144
goto loop
Definition Spc_Cpu.h:155

◆ JR

#define JR ( cond)
Value:
{\
int offset = (int8_t) data;\
pc++;\
if ( !(cond) )\
goto jr_not_taken;\
pc = uint16_t (pc + offset);\
goto loop;\
}
signed char int8_t
Definition mid.cpp:95

◆ MINUS

#define MINUS   (flags & S80)

◆ OUT

#define OUT ( addr,
data )
Value:
CPU_OUT( this, addr, data, TIME )
#define CPU_OUT(cpu, addr, data, TIME)
Definition Ay_Cpu.cpp:32

◆ R16

#define R16 ( n,
shift,
offset )
Value:
(*(uint16_t*) ((char*) r16_ - (offset >> (shift - 1)) + ((n) >> (shift - 1))))
int n
Definition crypt.c:458

◆ R8

#define R8 ( n,
offset )
Value:
((r8_ - offset) [(n) ^ 1])

◆ READ

#define READ ( addr)
Value:
READ_PROG( addr )
#define READ_PROG(addr)
Definition Ay_Cpu.cpp:89

◆ READ_PROG

#define READ_PROG ( addr)
Value:
RW_MEM( addr, read )
#define RW_MEM(addr, rw)
Definition Kss_Cpu.cpp:115
read(f, &c, 1)

◆ READ_WORD

#define READ_WORD ( addr)
Value:
GET_LE16( &READ( addr ) )
#define READ(addr)
Definition Ay_Cpu.cpp:92

◆ RELOAD_TIME

#define RELOAD_TIME ( )
Value:
(void) (s_time = s.time)
unsigned s
Definition inflate.c:1555
#define void
Definition unzip.h:396

◆ RET

#define RET ( cond)
Value:
if ( cond ) goto ret_taken; s_time -= 6; goto loop;

◆ RL

#define RL ( read,
write )
Value:
{\
uint16_t result = (read << 1) | (flags & C01);\
flags = SZ28PC( result );\
write;\
goto loop;\
}
#define SZ28PC(n)
Definition Ay_Cpu.cpp:52
int const C01
Definition Ay_Cpu.cpp:49
int result
Definition process.c:1455

◆ RLC

#define RLC ( read,
write )
Value:
{\
result = uint8_t (result << 1) | (result >> 7);\
flags = SZ28P( result ) | (result & C01);\
write;\
goto loop;\
}
#define SZ28P(n)
Definition Ay_Cpu.cpp:51
unsigned char uint8_t
Definition mid.cpp:98

◆ RR

#define RR ( read,
write )
Value:
{\
uint8_t temp = result & C01;\
result = uint8_t (flags << 7) | (result >> 1);\
flags = SZ28P( result ) | temp;\
write;\
goto loop;\
}

◆ RRC

#define RRC ( read,
write )
Value:
{\
flags = result & C01;\
result = uint8_t (result << 7) | (result >> 1);\
flags |= SZ28P( result );\
write;\
goto loop;\
}

◆ RW_MEM

#define RW_MEM ( addr,
rw )
Value:
(s.rw [(addr) >> page_shift] [KSS_CPU_PAGE_OFFSET( addr )])
#define KSS_CPU_PAGE_OFFSET(addr)
Definition Kss_Cpu.h:100

◆ SET_IXY

#define SET_IXY ( in)
Value:
if ( opcode == 0xDD ) ix = in; else iy = in;
opcode
Definition Spc_Cpu.h:173
float in
Definition lilv_test.c:1460

◆ SET_R

#define SET_R ( n)
Value:
(void) (r.r = n)

◆ SLA

#define SLA ( read,
add,
write )
Value:
{\
uint16_t result = (read << 1) | add;\
flags = SZ28PC( result );\
write;\
goto loop;\
}

◆ SRA

#define SRA ( read,
write )
Value:
{\
flags = result & C01;\
result = (result & 0x80) | (result >> 1);\
flags |= SZ28P( result );\
write;\
goto loop;\
}

◆ SRL

#define SRL ( read,
write )
Value:
{\
flags = result & C01;\
result >>= 1;\
flags |= SZ28P( result );\
write;\
goto loop;\
}

◆ SYNC_TIME

#define SYNC_TIME ( )
Value:
(void) (s.time = s_time)

◆ SZ28

#define SZ28 ( n)
Value:
SZ28C( n )
#define SZ28C(n)
Definition Ay_Cpu.cpp:53

◆ SZ28C

#define SZ28C ( n)
Value:
(szpc [n] & ~P04)
int const P04
Definition Ay_Cpu.cpp:47

◆ SZ28P

#define SZ28P ( n)
Value:
szpc [n]

◆ SZ28PC

#define SZ28PC ( n)
Value:
szpc [n]

◆ TIME

#define TIME   (s_time + s.base)

◆ WRITE

#define WRITE ( addr,
data )
Value:
CPU_WRITE( this, addr, data, TIME )
#define CPU_WRITE(cpu, addr, data, time)
Definition gb_cpu_io.h:71

◆ WRITE_WORD

#define WRITE_WORD ( addr,
data )
Value:
SET_LE16( &RW_MEM( addr, write ), data )
#define SET_LE16(addr, data)
Definition blargg_endian.h:155

◆ ZERO

#define ZERO   (flags & Z40)

Variable Documentation

◆ C01

int const C01 = 0x01

◆ ed_dd_timing

byte const ed_dd_timing[0x100]
static
Initial value:
= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x06,0x0C,0x02,0x00,0x00,0x03,0x00,0x00,0x07,0x0C,0x02,0x00,0x00,0x03,0x00,
0x00,0x00,0x00,0x00,0x0F,0x0F,0x0B,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0x10,0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0x10,
0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0x10,0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0x10,
0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0xA0,0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0xA0,
0x4B,0x4B,0x7B,0xCB,0x0B,0x6B,0x00,0x0B,0x40,0x40,0x70,0xC0,0x00,0x60,0x0B,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,
0x80,0x80,0x80,0x80,0x00,0x00,0x0B,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0B,0x00,
0xD0,0xD0,0xD0,0xD0,0x00,0x00,0x0B,0x00,0xD0,0xD0,0xD0,0xD0,0x00,0x00,0x0B,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x06,0x00,0x0F,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
}

◆ F08

int const F08 = 0x08

◆ F20

int const F20 = 0x20

◆ H10

int const H10 = 0x10

◆ N02

int const N02 = 0x02

◆ P04

int const P04 = 0x04

◆ S80

int const S80 = 0x80

◆ V04

int const V04 = 0x04

◆ Z40

int const Z40 = 0x40