Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
libretro-handy
Commits
aceb3ee1
Commit
aceb3ee1
authored
Jun 07, 2021
by
Libretro-Admin
Browse files
Cleanups
parent
99c7cb30
Pipeline
#36569
passed with stages
in 8 minutes and 15 seconds
Changes
9
Pipelines
37
Hide whitespace changes
Inline
Side-by-side
lynx/c6502mak.h
View file @
aceb3ee1
...
...
@@ -81,16 +81,16 @@
// UBYTE oldA=mA;\
// if(!mD)\
// {\
//
SWORD sum=(SWORD)((SBYTE)mA)+(SWORD)((SBYTE
)value)+(mC?1:0);\
//
int16_t sum=(int16_t)((int8_t)mA)+(int16_t)((int8_t
)value)+(mC?1:0);\
// mV=((sum > 127) || (sum < -128));\
// sum=(
SWORD)mA + (SWORD
)value + (mC?1:0);\
// sum=(
int16_t)mA + (int16_t
)value + (mC?1:0);\
// mA=(UBYTE)sum;\
// mC=(sum>0xff);\
// SET_NZ(mA);\
// }\
// else\
// {\
//
SWORD
sum=mBCDTable[0][mA]+mBCDTable[0][value]+(mC?1:0);\
//
int16_t
sum=mBCDTable[0][mA]+mBCDTable[0][value]+(mC?1:0);\
// mC=(sum > 99);\
// mA=mBCDTable[1][sum & 0xff];\
// SET_NZ(mA);\
...
...
@@ -667,9 +667,9 @@
// if(!mD)\
// {\
// UBYTE value=~(CPU_PEEK(mOperand));\
//
SWORD
difference=(
SWORD)((SBYTE)mA)+(SWORD)((SBYTE
)value)+(mC?1:0);\
//
int16_t
difference=(
int16_t)((int8_t)mA)+(int16_t)((int8_t
)value)+(mC?1:0);\
// mV=((difference>127)||(difference<-128));\
// difference=((
SWORD)mA)+((SWORD
)value)+ (mC?1:0);\
// difference=((
int16_t)mA)+((int16_t
)value)+ (mC?1:0);\
// mA=(UBYTE)difference;\
// mC=(difference>0xff);\
// SET_NZ(mA);\
...
...
@@ -677,7 +677,7 @@
// else\
// {\
// UBYTE value=CPU_PEEK(mOperand);\
//
SWORD
difference=mBCDTable[0][mA]-mBCDTable[0][value]-(mC?0:1);\
//
int16_t
difference=mBCDTable[0][mA]-mBCDTable[0][value]-(mC?0:1);\
// if(difference<0) difference+=100;\
// mA=mBCDTable[1][difference];\
// mC=(oldA>=(value+(mC?0:1)));\
...
...
lynx/c65c02.h
View file @
aceb3ee1
...
...
@@ -102,9 +102,6 @@ typedef struct
bool
NMI
;
bool
IRQ
;
bool
WAIT
;
#ifdef _LYNXDBG
int
cpuBreakpoints
[
MAX_CPU_BREAKPOINTS
];
#endif
}
C6502_REGS
;
//
...
...
@@ -127,10 +124,6 @@ class C65C02
mBCDTable
[
0
][
t
]
=
((
t
>>
4
)
*
10
)
+
(
t
&
0x0f
);
mBCDTable
[
1
][
t
]
=
(((
t
%
100
)
/
10
)
<<
4
)
|
(
t
%
10
);
}
#ifdef _LYNXDBG
for
(
int
loop
=
0
;
loop
<
MAX_CPU_BREAKPOINTS
;
loop
++
)
mPcBreakpoints
[
loop
]
=
0xfffffff
;
mDbgFlag
=
0
;
#endif
Reset
();
}
...
...
@@ -1641,51 +1634,6 @@ class C65C02
break
;
}
#ifdef _LYNXDBG
// Trigger breakpoint if required
for
(
int
loop
=
0
;
loop
<
MAX_CPU_BREAKPOINTS
;
loop
++
)
{
if
(
mPcBreakpoints
[
loop
]
==
mPC
)
{
gBreakpointHit
=
TRUE
;
mSystem
.
DebugTrace
(
0
);
}
}
// Check code level debug features
// back to back CPX ($Absolute)
// on the 2nd Occurance we do some debug
if
(
mOpcode
==
0xec
)
{
if
(
mDbgFlag
)
{
// We shoud do some debug now
if
(
!
mOperand
)
{
// Trigger a breakpoint
gBreakpointHit
=
TRUE
;
// Generate a debug trail output
mSystem
.
DebugTrace
(
0
);
}
else
{
// Generate a debug trail output
mSystem
.
DebugTrace
(
mOperand
);
}
mDbgFlag
=
0
;
}
else
{
if
(
mOperand
==
0x5aa5
)
mDbgFlag
=
1
;
else
mDbgFlag
=
0
;
}
}
else
{
mDbgFlag
=
0
;
}
#endif
}
// inline void SetBreakpoint(ULONG breakpoint) {mPcBreakpoint=breakpoint;};
...
...
@@ -1701,9 +1649,6 @@ class C65C02
mOperand
=
regs
.
Operand
;
mPC
=
regs
.
PC
;
gSystemCPUSleep
=
regs
.
WAIT
;
#ifdef _LYNXDBG
for
(
int
loop
=
0
;
loop
<
MAX_CPU_BREAKPOINTS
;
loop
++
)
mPcBreakpoints
[
loop
]
=
regs
.
cpuBreakpoints
[
loop
];
#endif
gSystemNMI
=
regs
.
NMI
;
gSystemIRQ
=
regs
.
IRQ
;
}
...
...
@@ -1719,9 +1664,6 @@ class C65C02
regs
.
Operand
=
mOperand
;
regs
.
PC
=
mPC
;
regs
.
WAIT
=
(
gSystemCPUSleep
)
?
true
:
false
;
#ifdef _LYNXDBG
for
(
int
loop
=
0
;
loop
<
MAX_CPU_BREAKPOINTS
;
loop
++
)
regs
.
cpuBreakpoints
[
loop
]
=
mPcBreakpoints
[
loop
];
#endif
regs
.
NMI
=
(
gSystemNMI
)
?
true
:
false
;
regs
.
IRQ
=
(
gSystemIRQ
)
?
true
:
false
;
}
...
...
@@ -1758,10 +1700,6 @@ class C65C02
int
mIRQActive
;
#ifdef _LYNXDBG
int
mPcBreakpoints
[
MAX_CPU_BREAKPOINTS
];
int
mDbgFlag
;
#endif
UBYTE
*
mRamPointer
;
// Associated lookup tables
...
...
lynx/machine.h
View file @
aceb3ee1
...
...
@@ -49,15 +49,12 @@
#include <stdint.h>
// Bytes should be 8-bits wide
typedef
int8_t
SBYTE
;
typedef
uint8_t
UBYTE
;
// Words should be 16-bits wide
typedef
int16_t
SWORD
;
typedef
uint16_t
UWORD
;
// Longs should be 32-bits wide
typedef
int32_t
SLONG
;
typedef
uint32_t
ULONG
;
// Read/Write Cycle definitions
...
...
lynx/mikie.cpp
View file @
aceb3ee1
...
...
@@ -479,8 +479,8 @@ bool CMikie::ContextSave(LSS_FILE *fp)
if
(
!
lss_write
(
&
mAUDIO_0_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_0_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_0_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_0_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
0
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_0_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
0
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_0_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_0_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -495,8 +495,8 @@ bool CMikie::ContextSave(LSS_FILE *fp)
if
(
!
lss_write
(
&
mAUDIO_1_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_1_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_1_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_1_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
1
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_1_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
1
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_1_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_1_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -511,8 +511,8 @@ bool CMikie::ContextSave(LSS_FILE *fp)
if
(
!
lss_write
(
&
mAUDIO_2_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_2_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_2_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_2_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
2
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_2_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
2
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_2_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_2_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -527,8 +527,8 @@ bool CMikie::ContextSave(LSS_FILE *fp)
if
(
!
lss_write
(
&
mAUDIO_3_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_3_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_3_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_3_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
3
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_3_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_OUTPUT
[
3
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_3_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_write
(
&
mAUDIO_3_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -683,8 +683,8 @@ bool CMikie::ContextLoad(LSS_FILE *fp)
if
(
!
lss_read
(
&
mAUDIO_0_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_0_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_0_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_0_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
0
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_0_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
0
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_0_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_0_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -699,8 +699,8 @@ bool CMikie::ContextLoad(LSS_FILE *fp)
if
(
!
lss_read
(
&
mAUDIO_1_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_1_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_1_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_1_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
1
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_1_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
1
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_1_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_1_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -715,8 +715,8 @@ bool CMikie::ContextLoad(LSS_FILE *fp)
if
(
!
lss_read
(
&
mAUDIO_2_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_2_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_2_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_2_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
2
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_2_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
2
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_2_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_2_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -731,8 +731,8 @@ bool CMikie::ContextLoad(LSS_FILE *fp)
if
(
!
lss_read
(
&
mAUDIO_3_BORROW_OUT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_3_LAST_LINK_CARRY
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_3_LAST_COUNT
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_3_VOLUME
,
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
3
],
sizeof
(
SBYTE
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_3_VOLUME
,
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_OUTPUT
[
3
],
sizeof
(
int8_t
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_3_INTEGRATE_ENABLE
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
if
(
!
lss_read
(
&
mAUDIO_3_WAVESHAPER
,
sizeof
(
ULONG
),
1
,
fp
))
return
0
;
...
...
@@ -1524,7 +1524,7 @@ void CMikie::Poke(ULONG addr,UBYTE data)
break
;
case
(
AUD0VOL
&
0xff
):
mAUDIO_0_VOLUME
=
(
SBYTE
)
data
;
mAUDIO_0_VOLUME
=
(
int8_t
)
data
;
break
;
case
(
AUD0SHFTFB
&
0xff
):
mAUDIO_0_WAVESHAPER
&=
0x001fff
;
...
...
@@ -1572,7 +1572,7 @@ void CMikie::Poke(ULONG addr,UBYTE data)
break
;
case
(
AUD1VOL
&
0xff
):
mAUDIO_1_VOLUME
=
(
SBYTE
)
data
;
mAUDIO_1_VOLUME
=
(
int8_t
)
data
;
break
;
case
(
AUD1SHFTFB
&
0xff
):
mAUDIO_1_WAVESHAPER
&=
0x001fff
;
...
...
@@ -1620,7 +1620,7 @@ void CMikie::Poke(ULONG addr,UBYTE data)
break
;
case
(
AUD2VOL
&
0xff
):
mAUDIO_2_VOLUME
=
(
SBYTE
)
data
;
mAUDIO_2_VOLUME
=
(
int8_t
)
data
;
break
;
case
(
AUD2SHFTFB
&
0xff
):
mAUDIO_2_WAVESHAPER
&=
0x001fff
;
...
...
@@ -1668,7 +1668,7 @@ void CMikie::Poke(ULONG addr,UBYTE data)
break
;
case
(
AUD3VOL
&
0xff
):
mAUDIO_3_VOLUME
=
(
SBYTE
)
data
;
mAUDIO_3_VOLUME
=
(
int8_t
)
data
;
break
;
case
(
AUD3SHFTFB
&
0xff
):
mAUDIO_3_WAVESHAPER
&=
0x001fff
;
...
...
@@ -1854,7 +1854,7 @@ void CMikie::Poke(ULONG addr,UBYTE data)
// CPU at the right time.
//
{
SLONG
cycles_used
=
(
SLONG
)
mSystem
.
PaintSprites
();
int32_t
cycles_used
=
(
int32_t
)
mSystem
.
PaintSprites
();
gCPUWakeupTime
=
gSystemCycleCount
+
cycles_used
;
SetCPUSleep
();
}
...
...
@@ -2404,8 +2404,8 @@ UBYTE CMikie::Peek(ULONG addr)
inline
void
CMikie
::
Update
(
void
)
{
SLONG
divide
;
SLONG
decval
;
int32_t
divide
;
int32_t
decval
;
ULONG
tmp
;
ULONG
mikie_work_done
=
0
;
...
...
@@ -3144,12 +3144,12 @@ inline void CMikie::Update(void)
mAUDIO_0_WAVESHAPER
=
GetLfsrNext
(
mAUDIO_0_WAVESHAPER
);
if
(
mAUDIO_0_INTEGRATE_ENABLE
)
{
SLONG
temp
=
mAUDIO_OUTPUT
[
0
];
int32_t
temp
=
mAUDIO_OUTPUT
[
0
];
if
(
mAUDIO_0_WAVESHAPER
&
0x0001
)
temp
+=
mAUDIO_0_VOLUME
;
else
temp
-=
mAUDIO_0_VOLUME
;
if
(
temp
>
127
)
temp
=
127
;
if
(
temp
<-
128
)
temp
=-
128
;
mAUDIO_OUTPUT
[
0
]
=
(
SBYTE
)
temp
;
mAUDIO_OUTPUT
[
0
]
=
(
int8_t
)
temp
;
}
else
{
if
(
mAUDIO_0_WAVESHAPER
&
0x0001
)
mAUDIO_OUTPUT
[
0
]
=
mAUDIO_0_VOLUME
;
else
mAUDIO_OUTPUT
[
0
]
=-
mAUDIO_0_VOLUME
;
...
...
@@ -3221,12 +3221,12 @@ inline void CMikie::Update(void)
mAUDIO_1_WAVESHAPER
=
GetLfsrNext
(
mAUDIO_1_WAVESHAPER
);
if
(
mAUDIO_1_INTEGRATE_ENABLE
)
{
SLONG
temp
=
mAUDIO_OUTPUT
[
1
];
int32_t
temp
=
mAUDIO_OUTPUT
[
1
];
if
(
mAUDIO_1_WAVESHAPER
&
0x0001
)
temp
+=
mAUDIO_1_VOLUME
;
else
temp
-=
mAUDIO_1_VOLUME
;
if
(
temp
>
127
)
temp
=
127
;
if
(
temp
<-
128
)
temp
=-
128
;
mAUDIO_OUTPUT
[
1
]
=
(
SBYTE
)
temp
;
mAUDIO_OUTPUT
[
1
]
=
(
int8_t
)
temp
;
}
else
{
if
(
mAUDIO_1_WAVESHAPER
&
0x0001
)
mAUDIO_OUTPUT
[
1
]
=
mAUDIO_1_VOLUME
;
else
mAUDIO_OUTPUT
[
1
]
=-
mAUDIO_1_VOLUME
;
...
...
@@ -3298,12 +3298,12 @@ inline void CMikie::Update(void)
mAUDIO_2_WAVESHAPER
=
GetLfsrNext
(
mAUDIO_2_WAVESHAPER
);
if
(
mAUDIO_2_INTEGRATE_ENABLE
)
{
SLONG
temp
=
mAUDIO_OUTPUT
[
2
];
int32_t
temp
=
mAUDIO_OUTPUT
[
2
];
if
(
mAUDIO_2_WAVESHAPER
&
0x0001
)
temp
+=
mAUDIO_2_VOLUME
;
else
temp
-=
mAUDIO_2_VOLUME
;
if
(
temp
>
127
)
temp
=
127
;
if
(
temp
<-
128
)
temp
=-
128
;
mAUDIO_OUTPUT
[
2
]
=
(
SBYTE
)
temp
;
mAUDIO_OUTPUT
[
2
]
=
(
int8_t
)
temp
;
}
else
{
if
(
mAUDIO_2_WAVESHAPER
&
0x0001
)
mAUDIO_OUTPUT
[
2
]
=
mAUDIO_2_VOLUME
;
else
mAUDIO_OUTPUT
[
2
]
=-
mAUDIO_2_VOLUME
;
...
...
@@ -3375,12 +3375,12 @@ inline void CMikie::Update(void)
mAUDIO_3_WAVESHAPER
=
GetLfsrNext
(
mAUDIO_3_WAVESHAPER
);
if
(
mAUDIO_3_INTEGRATE_ENABLE
)
{
SLONG
temp
=
mAUDIO_OUTPUT
[
3
];
int32_t
temp
=
mAUDIO_OUTPUT
[
3
];
if
(
mAUDIO_3_WAVESHAPER
&
0x0001
)
temp
+=
mAUDIO_3_VOLUME
;
else
temp
-=
mAUDIO_3_VOLUME
;
if
(
temp
>
127
)
temp
=
127
;
if
(
temp
<-
128
)
temp
=-
128
;
mAUDIO_OUTPUT
[
3
]
=
(
SBYTE
)
temp
;
mAUDIO_OUTPUT
[
3
]
=
(
int8_t
)
temp
;
}
else
{
if
(
mAUDIO_3_WAVESHAPER
&
0x0001
)
mAUDIO_OUTPUT
[
3
]
=
mAUDIO_3_VOLUME
;
else
mAUDIO_OUTPUT
[
3
]
=-
mAUDIO_3_VOLUME
;
...
...
lynx/mikie.h
View file @
aceb3ee1
...
...
@@ -337,7 +337,7 @@ class CMikie : public CLynxBase
ULONG
mAUDIO_0_BORROW_OUT
;
ULONG
mAUDIO_0_LAST_LINK_CARRY
;
ULONG
mAUDIO_0_LAST_COUNT
;
SBYTE
mAUDIO_0_VOLUME
;
int8_t
mAUDIO_0_VOLUME
;
ULONG
mAUDIO_0_INTEGRATE_ENABLE
;
ULONG
mAUDIO_0_WAVESHAPER
;
...
...
@@ -352,7 +352,7 @@ class CMikie : public CLynxBase
ULONG
mAUDIO_1_BORROW_OUT
;
ULONG
mAUDIO_1_LAST_LINK_CARRY
;
ULONG
mAUDIO_1_LAST_COUNT
;
SBYTE
mAUDIO_1_VOLUME
;
int8_t
mAUDIO_1_VOLUME
;
ULONG
mAUDIO_1_INTEGRATE_ENABLE
;
ULONG
mAUDIO_1_WAVESHAPER
;
...
...
@@ -367,7 +367,7 @@ class CMikie : public CLynxBase
ULONG
mAUDIO_2_BORROW_OUT
;
ULONG
mAUDIO_2_LAST_LINK_CARRY
;
ULONG
mAUDIO_2_LAST_COUNT
;
SBYTE
mAUDIO_2_VOLUME
;
int8_t
mAUDIO_2_VOLUME
;
ULONG
mAUDIO_2_INTEGRATE_ENABLE
;
ULONG
mAUDIO_2_WAVESHAPER
;
...
...
@@ -382,11 +382,11 @@ class CMikie : public CLynxBase
ULONG
mAUDIO_3_BORROW_OUT
;
ULONG
mAUDIO_3_LAST_LINK_CARRY
;
ULONG
mAUDIO_3_LAST_COUNT
;
SBYTE
mAUDIO_3_VOLUME
;
int8_t
mAUDIO_3_VOLUME
;
ULONG
mAUDIO_3_INTEGRATE_ENABLE
;
ULONG
mAUDIO_3_WAVESHAPER
;
SBYTE
mAUDIO_OUTPUT
[
4
];
int8_t
mAUDIO_OUTPUT
[
4
];
UBYTE
mAUDIO_ATTEN
[
4
];
ULONG
mSTEREO
;
ULONG
mPAN
;
...
...
lynx/susie.cpp
View file @
aceb3ee1
...
...
@@ -584,10 +584,10 @@ ULONG CSusie::PaintSprites(void)
// Setup screen start end variables
int
screen_h_start
=
(
SWORD
)
mHOFF
.
Word
;
int
screen_h_end
=
(
SWORD
)
mHOFF
.
Word
+
SCREEN_WIDTH
;
int
screen_v_start
=
(
SWORD
)
mVOFF
.
Word
;
int
screen_v_end
=
(
SWORD
)
mVOFF
.
Word
+
SCREEN_HEIGHT
;
int
screen_h_start
=
(
int16_t
)
mHOFF
.
Word
;
int
screen_h_end
=
(
int16_t
)
mHOFF
.
Word
+
SCREEN_WIDTH
;
int
screen_v_start
=
(
int16_t
)
mVOFF
.
Word
;
int
screen_v_end
=
(
int16_t
)
mVOFF
.
Word
+
SCREEN_HEIGHT
;
int
world_h_mid
=
screen_h_start
+
(
SCREEN_WIDTH
/
2
);
int
world_v_mid
=
screen_v_start
+
(
SCREEN_HEIGHT
/
2
);
...
...
@@ -606,8 +606,8 @@ ULONG CSusie::PaintSprites(void)
// Check ref is inside screen area
if
((
SWORD
)
mHPOSSTRT
.
Word
<
screen_h_start
||
(
SWORD
)
mHPOSSTRT
.
Word
>=
screen_h_end
||
(
SWORD
)
mVPOSSTRT
.
Word
<
screen_v_start
||
(
SWORD
)
mVPOSSTRT
.
Word
>=
screen_v_end
)
superclip
=
TRUE
;
if
((
int16_t
)
mHPOSSTRT
.
Word
<
screen_h_start
||
(
int16_t
)
mHPOSSTRT
.
Word
>=
screen_h_end
||
(
int16_t
)
mVPOSSTRT
.
Word
<
screen_v_start
||
(
int16_t
)
mVPOSSTRT
.
Word
>=
screen_v_end
)
superclip
=
TRUE
;
// Quadrant mapping is: SE NE NW SW
// 0 1 2 3
...
...
@@ -701,16 +701,17 @@ ULONG CSusie::PaintSprites(void)
static
int
vquadoff
=
0
;
static
int
hquadoff
=
0
;
if
(
render
)
{
if
(
render
)
{
// Set the vertical position & offset
voff
=
(
SWORD
)
mVPOSSTRT
.
Word
-
screen_v_start
;
voff
=
(
int16_t
)
mVPOSSTRT
.
Word
-
screen_v_start
;
// Zero the stretch,tilt & acum values
mTILTACUM
.
Word
=
0
;
// Perform the SIZOFF
if
(
vsign
==
1
)
mVSIZACUM
.
Word
=
mVSIZOFF
.
Word
;
else
mVSIZACUM
.
Word
=
0
;
else
mVSIZACUM
.
Word
=
0
;
// Take the sign of the first quad (0) as the basic
// sign, all other quads drawing in the other direction
...
...
@@ -749,13 +750,13 @@ ULONG CSusie::PaintSprites(void)
// Only allow the draw to take place if the line is visible
if
(
voff
>=
0
&&
voff
<
SCREEN_HEIGHT
)
{
// Work out the horizontal pixel start position, start + tilt
mHPOSSTRT
.
Word
+=
((
SWORD
)
mTILTACUM
.
Word
>>
8
);
mHPOSSTRT
.
Word
+=
((
int16_t
)
mTILTACUM
.
Word
>>
8
);
mTILTACUM
.
Byte
.
High
=
0
;
hoff
=
(
int
)((
SWORD
)
mHPOSSTRT
.
Word
)
-
screen_h_start
;
hoff
=
(
int
)((
int16_t
)
mHPOSSTRT
.
Word
)
-
screen_h_start
;
// Zero/Force the horizontal scaling accumulator
if
(
hsign
==
1
)
mHSIZACUM
.
Word
=
mHSIZOFF
.
Word
;
else
mHSIZACUM
.
Word
=
0
;
else
mHSIZACUM
.
Word
=
0
;
// Take the sign of the first quad (0) as the basic
// sign, all other quads drawing in the other direction
...
...
@@ -781,7 +782,7 @@ ULONG CSusie::PaintSprites(void)
if
(
hoff
>=
0
&&
hoff
<
SCREEN_WIDTH
)
{
ProcessPixel
(
hoff
,
pixel
);
onscreen
=
TRUE
;
everonscreen
=
TRUE
;
everonscreen
=
TRUE
;
}
else
{
if
(
onscreen
)
break
;
}
...
...
@@ -808,9 +809,12 @@ ULONG CSusie::PaintSprites(void)
// Update the line start for our next run thru the loop
mSPRDLINE
.
Word
+=
mSPRDOFF
.
Word
;
}
}
else
{
}
else
{
// Skip thru data to next quad
for
(;;)
{
for
(;;)
{
// Read the start of line offset
mSPRDOFF
.
Word
=
(
UWORD
)
LineInit
(
0
);
...
...
lynx/sysbase.h
View file @
aceb3ee1
...
...
@@ -66,10 +66,6 @@ class CSystemBase
virtual
UWORD
PeekW_RAM
(
ULONG
addr
)
=
0
;
virtual
UBYTE
*
GetRamPointer
(
void
)
=
0
;
#ifdef _LYNXDBG
virtual
void
DebugTrace
(
int
address
)
=
0
;
#endif
};
#endif
lynx/system.cpp
View file @
aceb3ee1
...
...
@@ -148,11 +148,6 @@ CSystem::CSystem(const char* gamefile, const char* romfile, bool useEmu)
mEEPROM
(
NULL
)
{
#ifdef _LYNXDBG
mpDebugCallback
=
NULL
;
mDebugCallbackObject
=
0
;
#endif
// Select the default filetype
UBYTE
*
filememory
=
NULL
;
UBYTE
*
howardmemory
=
NULL
;
...
...
@@ -415,10 +410,6 @@ void CSystem::Reset(void)
// memset(gAudioBuffer,128,HANDY_AUDIO_BUFFER_SIZE); // only for unsigned 8bit
memset
(
gAudioBuffer
,
0
,
HANDY_AUDIO_BUFFER_SIZE
);
// for unsigned 8/16 bit
#ifdef _LYNXDBG
gSystemHalt
=
TRUE
;
#endif
mMemMap
->
Reset
();
mCart
->
Reset
();
mEEPROM
->
Reset
();
...
...
@@ -601,48 +592,3 @@ bool CSystem::ContextLoad(LSS_FILE *fp)
return
status
;
}
#ifdef _LYNXDBG
void
CSystem
::
DebugTrace
(
int
address
)
{
char
message
[
1024
+
1
];
int
count
=
0
;
sprintf
(
message
,
"%08x - DebugTrace(): "
,
gSystemCycleCount
);
count
=
strlen
(
message
);
if
(
address
)
{
if
(
address
==
0xffff
)
{
C6502_REGS
regs
;
char
linetext
[
1024
];
// Register dump
GetRegs
(
regs
);
sprintf
(
linetext
,
"PC=$%04x SP=$%02x PS=0x%02x A=0x%02x X=0x%02x Y=0x%02x"
,
regs
.
PC
,
regs
.
SP
,
regs
.
PS
,
regs
.
A
,
regs
.
X
,
regs
.
Y
);
strcat
(
message
,
linetext
);
count
=
strlen
(
message
);
}
else
{
// The RAM address contents should be dumped to an open debug file in this function
do
{
message
[
count
++
]
=
Peek_RAM
(
address
);
}
while
(
count
<
1024
&&
Peek_RAM
(
address
++
)
!=
0
);
}
}
else
{
strcat
(
message
,
"CPU Breakpoint"
);
count
=
strlen
(
message
);
}
message
[
count
]
=
0
;
// Callback to dump the message
if
(
mpDebugCallback
)
{
(
*
mpDebugCallback
)(
mDebugCallbackObject
,
message
);
}
}
void
CSystem
::
DebugSetCallback
(
void
(
*
function
)(
ULONG
objref
,
char
*
message
),
ULONG
objref
)
{
mDebugCallbackObject
=
objref
;
mpDebugCallback
=
function
;
}
#endif
lynx/system.h
View file @
aceb3ee1
...
...
@@ -49,16 +49,6 @@
#pragma inline_depth (255)
#pragma inline_recursion (on)
#ifdef _LYNXDBG
//#ifdef _DEBUG
//#define new DEBUG_NEW
//#undef THIS_FILE
//static char THIS_FILE[] = __FILE__;
//#endif
#endif
#include "machine.h"
#define HANDY_SYSTEM_FREQ 16000000
...
...
@@ -67,14 +57,7 @@
#define HANDY_AUDIO_SAMPLE_PERIOD (HANDY_SYSTEM_FREQ/HANDY_AUDIO_SAMPLE_FREQ)
#define HANDY_AUDIO_WAVESHAPER_TABLE_LENGTH 0x200000
#ifdef SDL_PATCH
//#define HANDY_AUDIO_BUFFER_SIZE 4096 // Needed for SDL 8bit MONO
//#define HANDY_AUDIO_BUFFER_SIZE 8192 // Needed for SDL STEREO 8bit
#define HANDY_AUDIO_BUFFER_SIZE 16384 // Needed for SDL STEREO 16bit
#else
//#define HANDY_AUDIO_BUFFER_SIZE (HANDY_AUDIO_SAMPLE_FREQ/4)
#define HANDY_AUDIO_BUFFER_SIZE (HANDY_AUDIO_SAMPLE_FREQ)
#endif
#define HANDY_FILETYPE_LNX 0
...
...
@@ -222,16 +205,6 @@ class CSystem : public CSystemBase
mCpu
->
Update
();
// fprintf(stderr, "end cpu update\n");
#ifdef _LYNXDBG
// Check breakpoint
static
ULONG
lastcycle
=
0
;
if
(
lastcycle
<
mCycleCountBreakpoint
&&
gSystemCycleCount
>=
mCycleCountBreakpoint
)
gBreakpointHit
=
TRUE
;
lastcycle
=
gSystemCycleCount
;
// Check single step mode
if
(
gSingleStepMode
)
gBreakpointHit
=
TRUE
;
#endif
//
// If the CPU is asleep then skip to the next timer event
//
...
...
@@ -315,14 +288,6 @@ class CSystem : public CSystemBase
ULONG
GetButtonData
(
void
)
{
return
mSusie
->
GetButtonData
();};
void
SetCycleBreakpoint
(
ULONG
breakpoint
)
{
mCycleCountBreakpoint
=
breakpoint
;};
UBYTE
*
GetRamPointer
(
void
)
{
return
mRam
->
GetRamPointer
();};
#ifdef _LYNXDBG