mirror of
https://github.com/Dennis1000/mos6502-delphi.git
synced 2025-07-24 19:24:21 +00:00
Bugfix, compatibility Memory changed from pointer to array of byte
This commit is contained in:
@@ -48,7 +48,7 @@ type
|
||||
function KeyRead: Byte;
|
||||
protected
|
||||
KeyMatrix: Array[0 .. 7, 0 .. 7] of Byte;
|
||||
Memory: PByte;
|
||||
Memory: array of Byte;
|
||||
InterruptRequest: Boolean;
|
||||
public
|
||||
WndHandle: THandle;
|
||||
@@ -77,7 +77,7 @@ var
|
||||
begin
|
||||
C64 := TC64(dwUser);
|
||||
|
||||
if C64.Status and $04 = 0 then // if IRQ allowed then set irq
|
||||
if C64.Status and INTERRUPT_FLAG = 0 then // if IRQ allowed then set irq
|
||||
C64.InterruptRequest := True;
|
||||
end;
|
||||
|
||||
@@ -118,7 +118,7 @@ begin
|
||||
inherited Create(BusRead, BusWrite);
|
||||
|
||||
// create 64kB memory table
|
||||
GetMem(Memory, 65536);
|
||||
SetLength(Memory, 65536);
|
||||
|
||||
Thread := TC64Thread.Create(Self);
|
||||
end;
|
||||
@@ -130,7 +130,7 @@ begin
|
||||
Thread.Terminate;
|
||||
Thread.WaitFor;
|
||||
Thread.Free;
|
||||
FreeMem(Memory);
|
||||
SetLength(Memory,0);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
|
@@ -33,22 +33,23 @@ unit MOS6502;
|
||||
|
||||
interface
|
||||
|
||||
const
|
||||
// Status bits
|
||||
NEGATIVE_FLAG = $80;
|
||||
OVERFLOW_FLAG = $40;
|
||||
CONSTANT = $20;
|
||||
BREAK_CMD = $10;
|
||||
DECIMAL_FLAG = $08;
|
||||
INTERRUPT_FLAG = $04;
|
||||
ZERO_FLAG = $02;
|
||||
CARRY_FLAG = $01;
|
||||
|
||||
type
|
||||
|
||||
{ TMOS6502 }
|
||||
|
||||
TMOS6502 = class
|
||||
const
|
||||
// Status bits
|
||||
NEGATIVE_FLAG = $80;
|
||||
OVERFLOW_FLAG = $40;
|
||||
CONSTANT = $20;
|
||||
BREAK_CMD = $10;
|
||||
DECIMAL_FLAG = $08;
|
||||
INTERRUPT_FLAG = $04;
|
||||
ZERO_FLAG = $02;
|
||||
CARRY_FLAG = $01;
|
||||
|
||||
// IRQ, reset, NMI vectors
|
||||
IRQVECTORH: Word = $FFFF;
|
||||
IRQVECTORL: Word = $FFFE;
|
||||
@@ -77,7 +78,7 @@ type
|
||||
procedure SET_CONSTANT(const Value: Boolean); inline;
|
||||
procedure SET_BREAK(const Value: Boolean); inline;
|
||||
procedure SET_DECIMAL(const Value: Boolean); inline;
|
||||
procedure SET_INTERRUPT(const Value: Boolean); inline;
|
||||
procedure SET_INTERRUPT(const Value: Boolean);// inline;
|
||||
procedure SET_ZERO(const Value: Boolean); inline;
|
||||
procedure SET_CARRY(const Value: Boolean); inline;
|
||||
function IF_NEGATIVE: Boolean; inline;
|
||||
@@ -187,7 +188,7 @@ type
|
||||
|
||||
protected
|
||||
// consumed clock cycles
|
||||
FCycles: Cardinal;
|
||||
FCycles: UInt64;
|
||||
|
||||
InstrTable: Array [0 .. 255] of TInstr;
|
||||
|
||||
@@ -252,7 +253,7 @@ type
|
||||
property ResetSP : Byte read FResetSP write FResetSP;
|
||||
property ResetStatus : Byte read FResetStatus write FResetStatus;
|
||||
property IllegalOpcode: Boolean read FIllegalOpcode write FIllegalOpcode;
|
||||
|
||||
property Cycles : UInt64 read FCycles;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@@ -1820,7 +1821,7 @@ begin
|
||||
|
||||
SET_ZERO((Tmp and $FF) = 0);
|
||||
|
||||
SET_OVERFLOW( (((FA xor Tmp) and $80) <> 0) and (((FA xor M) and $80) <> 0));
|
||||
SET_OVERFLOW( (((FA xor Tmp) and $80) <> 0) and (((FA xor M) and $80) <> 0));
|
||||
|
||||
if IF_DECIMAL then
|
||||
begin
|
||||
|
@@ -132,7 +132,7 @@ type
|
||||
function GetMemKind(AMemAddr : Word) : TVC20MemKind;
|
||||
protected
|
||||
KeyMatrix: Array[0 .. 7, 0 .. 7] of Byte;
|
||||
Memory: PByte;
|
||||
Memory: array of Byte;
|
||||
InterruptRequest: Boolean;
|
||||
procedure SetupMemoryMap;virtual;
|
||||
function GetMemoryMapItemCount : Integer;
|
||||
@@ -171,7 +171,7 @@ var
|
||||
begin
|
||||
VC20 := TVC20(dwUser);
|
||||
|
||||
if VC20.Status and VC20.INTERRUPT_FLAG = 0 then // if IRQ allowed then set irq
|
||||
if VC20.Status and INTERRUPT_FLAG = 0 then // if IRQ allowed then set irq
|
||||
VC20.InterruptRequest := True;
|
||||
end;
|
||||
|
||||
@@ -223,7 +223,7 @@ begin
|
||||
inherited Create(OnBusRead, OnBusWrite);
|
||||
|
||||
// create 64kB memory table
|
||||
GetMem(Memory, 65536);
|
||||
SetLength(Memory, 65536);
|
||||
|
||||
SetupMemoryMap;
|
||||
|
||||
@@ -237,7 +237,7 @@ begin
|
||||
Thread.Terminate;
|
||||
Thread.WaitFor;
|
||||
Thread.Free;
|
||||
FreeMem(Memory);
|
||||
SetLength(Memory,0);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@@ -255,7 +255,7 @@ begin
|
||||
Cols := Memory[CIA1];
|
||||
for Col := 0 to 7 do
|
||||
begin
|
||||
if Cols and (1 shl Col) = 0 then // FA 0 indicates FA column FBusRead
|
||||
if Cols and (1 shl Col) = 0 then // a 0 indicates a column read
|
||||
begin
|
||||
for Row := 0 to 7 do
|
||||
begin
|
||||
|
Reference in New Issue
Block a user