Post Reply 
Processor Instruction Sets
09-05-2021, 12:40 AM (This post was last modified: 09-05-2021 12:42 AM by teenix.)
Post: #5
RE: Processor Instruction Sets
(09-04-2021 04:03 PM)Mike T. Wrote:  Thank you!

I was starting to think I was losing it.

All I need to do now is get my head around the strange behaviour of the 'P' register...

You might by the time you finish, which never seems to happen ;-)

for HP67, HP-91, HP-97, HP29c, Spice
A bug in ARC chips cause a problem when the P register wraps around

This might help if you understand Pascal...

Code:

regP: Integer; // P register
Carry: Boolean; // Carry flag
aPCH: Array[0..2] of Integer;

Initialise aPCH = [0][0][0] at switch on

// for each instruction time before decoding instruction
aPCH[2] := aPCH[1]; 
aPCH[1] := aPCH[0];
aPCH[0] := 0;


// for [if P # N] instruction
Carry := not TestPCH(regP, N);

// for [if P = N] instruction
Carry = TestPCH(regP, N)

// for [p + 1 -> p] instruction
aPCH[0] := 1;

// for [p - 1 -> p] instruction
aPCH[0] := -1;

....

function TestPCHarray(P, N: Integer): Boolean;
begin
if (N = 0) and (aPCH[1] = 1) and (aPCH[2] = 1) then
begin
  if (P = 0) or (P = 1) then
    Result := False
  else
    Result := True;
end
else
if (N = 0) and (aPCH[1] = -1) and (aPCH[2] = -1) then
begin
  if (P = 0) or (P = 13) then
    Result := False
  else
    Result := True;
end
else
begin
  if P = N then
    Result := False
  else
    Result := True;
end;
end;

cheers

Tony
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Processor Instruction Sets - Mike T. - 09-03-2021, 11:05 PM
RE: Processor Instruction Sets - teenix - 09-04-2021, 12:57 AM
RE: Processor Instruction Sets - Mike T. - 09-04-2021, 04:03 PM
RE: Processor Instruction Sets - teenix - 09-05-2021 12:40 AM
RE: Processor Instruction Sets - Mike T. - 09-07-2021, 02:37 PM
RE: Processor Instruction Sets - Mike T. - 09-26-2021, 10:53 PM
RE: Processor Instruction Sets - teenix - 09-09-2021, 06:12 AM
RE: Processor Instruction Sets - teenix - 09-09-2021, 11:29 PM
RE: Processor Instruction Sets - Mike T. - 09-09-2021, 06:54 PM
RE: Processor Instruction Sets - teenix - 09-09-2021, 11:30 PM
RE: Processor Instruction Sets - teenix - 09-26-2021, 11:37 PM
RE: Processor Instruction Sets - brouhaha - 10-03-2021, 07:26 PM



User(s) browsing this thread: 2 Guest(s)