1
0
mirror of https://github.com/rzzzwilson/pymlac.git synced 2025-06-10 09:32:41 +00:00

Fiddling with DEIM/DSTS interia:wqctions

This commit is contained in:
Ross Wilson
2018-08-05 15:00:23 +07:00
parent 253ec3eeff
commit 1bd60ca4ac
5 changed files with 247 additions and 213 deletions

View File

@@ -24,40 +24,40 @@ loop dsn ; wait until display is off
;------------------------------- ;-------------------------------
dsub dsub
dhvc ; dhvc ;
; dsts 0 ; dsts 1 ;
; dlxa 004 ; dlxa 004 ;
; dlya 0500 ; dlya 0500 ;
; djms dlist0 ; djms dlist0 ;
; dsts 1 ; dsts 1 ;
; dlxa 0004 ; dlxa 0004 ;
; dlya 0400 ; dlya 0400 ;
; djms dlist1 ; djms dlist1 ;
; dsts 2 ; dsts 2 ;
; dlxa 0004 ; dlxa 0004 ;
; dlya 0300 ; dlya 0300 ;
; djms dlist2 ; djms dlist2 ;
; dsts 3 ; dsts 3 ;
; dlxa 0004 ; dlxa 0004 ;
; dlya 0200 ; dlya 0200 ;
; djms dlist3 ; djms dlist3 ;
; dsts 0 ; dsts 0 ;
; dlxa 0004 ; dlxa 0004 ;
; dlya 0100 ; dlya 0100 ;
; djms dlist4 ; djms dlist4 ;
;
dsts 1 ; ; dsts 1 ;
dlxa 020 ; ; dlxa 020 ;
dlya 0500 ; ; dlya 0500 ;
djms dlist0 ; ; djms dlist0 ;
dlxa 020 ; ; dlxa 020 ;
dlya 0400 ; ; dlya 0400 ;
djms dlist1 ; ; djms dlist1 ;
dlxa 020 ; ; dlxa 020 ;
dlya 0300 ; ; dlya 0300 ;
djms dlist2 ; ; djms dlist2 ;
dlxa 020 ; ; dlxa 020 ;
dlya 0200 ; ; dlya 0200 ;
djms dlist3 ; ; djms dlist3 ;
; dlxa 020 ; ; dlxa 020 ;
; dlya 0100 ; ; dlya 0100 ;
; djms dlist4 ; ; djms dlist4 ;
@@ -119,6 +119,18 @@ dlist0 ;
djms dot ; . djms dot ; .
djms slash ; / djms slash ; /
drjm ; drjm ;
dlistX ;
djms zero ; 0
djms one ; 1
djms two ; 2
djms three ; 3
djms four ; 4
djms five ; 5
djms six ; 6
djms seven ; 7
djms eight ; 8
djms nine ; 9
drjm ;
dlist1 ; dlist1 ;
djms zero ; 0 djms zero ; 0
djms one ; 1 djms one ; 1

View File

@@ -26,7 +26,7 @@ static WORD r_AC;
static WORD r_L; static WORD r_L;
static WORD r_PC; static WORD r_PC;
static WORD Prev_r_PC; static WORD Prev_r_PC;
static WORD r_DS; /* data switches */ static WORD r_DS; /* data switches */
/* 40Hz sync stuff */ /* 40Hz sync stuff */
static bool Sync40HzOn = false; static bool Sync40HzOn = false;
@@ -70,9 +70,9 @@ cpu_eff_address(WORD address, bool indirect)
/****************************************************************************** /******************************************************************************
Description : Function to start the main CPU. Description : Function to start the main CPU.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
void void
cpu_start(void) cpu_start(void)
@@ -83,9 +83,9 @@ cpu_start(void)
/****************************************************************************** /******************************************************************************
Description : Function to stop the main CPU. Description : Function to stop the main CPU.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
void void
cpu_stop(void) cpu_stop(void)
@@ -96,9 +96,9 @@ cpu_stop(void)
/****************************************************************************** /******************************************************************************
Description : Functions to get various registers and states. Description : Functions to get various registers and states.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
WORD WORD
cpu_get_AC(void) cpu_get_AC(void)
@@ -177,16 +177,16 @@ cpu_set_DS(WORD new_ds)
/****************************************************************************** /******************************************************************************
Description : Function to handle unrecognized instruction. Description : Function to handle unrecognized instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static void static void
illegal(void) illegal(void)
{ {
WORD oldPC = Prev_r_PC & MEMMASK; WORD oldPC = Prev_r_PC & MEMMASK;
/* memdump(LogOut, oldPC - 8, 16); */ // memdump(LogOut, oldPC - 8, 16);
error("INTERNAL ERROR: " error("INTERNAL ERROR: "
"unexpected main processor opcode %06.6o at address %06.6o", "unexpected main processor opcode %06.6o at address %06.6o",
@@ -198,7 +198,7 @@ illegal(void)
Description : Emulate the IMLAC LAW/LWC instructions. Description : Emulate the IMLAC LAW/LWC instructions.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Load AC with immediate value. Comments : Load AC with immediate value.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -226,7 +226,7 @@ i_LAW_LWC(bool indirect, WORD address)
Description : Emulate the JMP instruction. Description : Emulate the JMP instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : PC set to new address. Comments : PC set to new address.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -249,7 +249,7 @@ i_JMP(bool indirect, WORD address)
Description : Emulate the DAC instruction. Description : Emulate the DAC instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Deposit AC in MEM. Comments : Deposit AC in MEM.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -272,7 +272,7 @@ i_DAC(bool indirect, WORD address)
Description : Emulate the IMLAC XAM instruction. Description : Emulate the IMLAC XAM instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Exchange AC with MEM. Comments : Exchange AC with MEM.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -297,7 +297,7 @@ i_XAM(bool indirect, WORD address)
Description : Emulate the ISZ instruction. Description : Emulate the ISZ instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Increment MEM and skip if MEM == 0. Comments : Increment MEM and skip if MEM == 0.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -325,7 +325,7 @@ i_ISZ(bool indirect, WORD address)
Description : Emulate the IMLAC JMS instruction. Description : Emulate the IMLAC JMS instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Store PC in MEM, jump to MEM + 1. Comments : Store PC in MEM, jump to MEM + 1.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -349,7 +349,7 @@ i_JMS(bool indirect, WORD address)
Description : Emulate the IMLAC AND instruction. Description : Emulate the IMLAC AND instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : AND MEM with AC. Comments : AND MEM with AC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -372,7 +372,7 @@ i_AND(bool indirect, WORD address)
Description : Emulate the IMLAC IOR instruction. Description : Emulate the IMLAC IOR instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Inclusive OR MEM with AC. Comments : Inclusive OR MEM with AC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -395,7 +395,7 @@ i_IOR(bool indirect, WORD address)
Description : Emulate the IMLAC XOR instruction. Description : Emulate the IMLAC XOR instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : XOR AC and MEM. LINK unchanged. Comments : XOR AC and MEM. LINK unchanged.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -418,7 +418,7 @@ i_XOR(bool indirect, WORD address)
Description : Emulate the IMLAC LAC instruction. Description : Emulate the IMLAC LAC instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Load AC from MEM. Comments : Load AC from MEM.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -441,7 +441,7 @@ i_LAC(bool indirect, WORD address)
Description : Emulate the ADD instruction. Description : Emulate the ADD instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Add value at MEM to AC. Comments : Add value at MEM to AC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -469,7 +469,7 @@ i_ADD(bool indirect, WORD address)
Description : Emulate the IMLAC SUB instruction. Description : Emulate the IMLAC SUB instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Subtract MEM from AC. LINK complemented if carry. Comments : Subtract MEM from AC. LINK complemented if carry.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -498,7 +498,7 @@ i_SUB(bool indirect, WORD address)
Description : Emulate the IMLAC SAM instruction. Description : Emulate the IMLAC SAM instruction.
Parameters : indirect - TRUE if address is indirect, FALSE if immediate Parameters : indirect - TRUE if address is indirect, FALSE if immediate
: address - the memory address : address - the memory address
Returns : Returns :
Comments : Skip if AC same as MEM. Comments : Skip if AC same as MEM.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -520,13 +520,13 @@ i_SAM(bool indirect, WORD address)
/****************************************************************************** /******************************************************************************
Description : Decode the 'microcode' instructions. Description : Decode the 'microcode' instructions.
Parameters : instruction - the complete instruction word Parameters : instruction - the complete instruction word
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
microcode(WORD instruction) microcode(WORD instruction)
{ {
char trace_cpu_msg[20]; /* little buffer for opcode */ char trace_cpu_msg[20]; /* little buffer for opcode */
/* T1 */ /* T1 */
if (instruction & 001) if (instruction & 001)
@@ -584,10 +584,10 @@ microcode(WORD instruction)
{ {
/* bit 0 is clear, it's HLT */ /* bit 0 is clear, it's HLT */
cpu_on = false; cpu_on = false;
if (trace_cpu_msg[0] != 0) if (trace_cpu_msg[0] != 0)
strcat(trace_cpu_msg, "+HLT"); strcat(trace_cpu_msg, "+HLT");
else else
strcat(trace_cpu_msg, "HLT"); strcat(trace_cpu_msg, "HLT");
} }
strcat(trace_cpu_msg, " "); strcat(trace_cpu_msg, " ");
@@ -599,8 +599,8 @@ microcode(WORD instruction)
/****************************************************************************** /******************************************************************************
Description : Emulate the DSF instruction. Description : Emulate the DSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if display is ON. Comments : Skip if display is ON.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -617,8 +617,8 @@ i_DSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC HRB instruction. Description : Emulate the IMLAC HRB instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Read PTR value into AC. Comments : Read PTR value into AC.
: If PTR motor off return 0. : If PTR motor off return 0.
: If PTR motor on return byte from file. : If PTR motor on return byte from file.
@@ -636,8 +636,8 @@ i_HRB(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the DSN instruction. Description : Emulate the DSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if display is OFF. Comments : Skip if display is OFF.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -654,8 +654,8 @@ i_DSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC HSF instruction. Description : Emulate the IMLAC HSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if PTR has data. Comments : Skip if PTR has data.
Comments : No data until cycle counter >= 'char ready' number. Comments : No data until cycle counter >= 'char ready' number.
******************************************************************************/ ******************************************************************************/
@@ -673,8 +673,8 @@ i_HSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC HSN instruction. Description : Emulate the IMLAC HSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if PTR has no data. Comments : Skip if PTR has no data.
: There is no data until cycle counter >= 'char ready' number. : There is no data until cycle counter >= 'char ready' number.
******************************************************************************/ ******************************************************************************/
@@ -692,8 +692,8 @@ i_HSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC KCF instruction. Description : Emulate the IMLAC KCF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Clear the keyboard flag. Comments : Clear the keyboard flag.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -709,8 +709,8 @@ i_KCF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC KRB instruction. Description : Emulate the IMLAC KRB instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Read a character from the keyboard into bits 5-15 of AC. Comments : Read a character from the keyboard into bits 5-15 of AC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -726,8 +726,8 @@ i_KRB(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC KRC instruction. Description : Emulate the IMLAC KRC instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Combine the KCF and KRB instruction: Read keyboard and clear flag. Comments : Combine the KCF and KRB instruction: Read keyboard and clear flag.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -744,8 +744,8 @@ i_KRC(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC KSF instruction. Description : Emulate the IMLAC KSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if keyboard char available. Comments : Skip if keyboard char available.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -762,8 +762,8 @@ i_KSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC KSN instruction. Description : Emulate the IMLAC KSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if no keyboard char available. Comments : Skip if no keyboard char available.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -780,8 +780,8 @@ i_KSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC PPC instruction. Description : Emulate the IMLAC PPC instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Punch AC low byte to tape. Comments : Punch AC low byte to tape.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -797,8 +797,8 @@ i_PPC(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC PSF instruction. Description : Emulate the IMLAC PSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if PTP ready. Comments : Skip if PTP ready.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -816,7 +816,7 @@ i_PSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC RAL instruction. Description : Emulate the IMLAC RAL instruction.
Parameters : shift - the number of bits to shift by [1,3] Parameters : shift - the number of bits to shift by [1,3]
Returns : Returns :
Comments : Rotate AC+L left 'shift' bits. Comments : Rotate AC+L left 'shift' bits.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -839,7 +839,7 @@ i_RAL(int shift)
/****************************************************************************** /******************************************************************************
Description : Emulate the RAR instruction. Description : Emulate the RAR instruction.
Parameters : shift - number of bits to rotate [1,3] Parameters : shift - number of bits to rotate [1,3]
Returns : Returns :
Comments : Rotate right AC+L 'shift' bits. Comments : Rotate right AC+L 'shift' bits.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -861,8 +861,8 @@ i_RAR(int shift)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC RCF instruction. Description : Emulate the IMLAC RCF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Clear the TTY buffer flag. Comments : Clear the TTY buffer flag.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -878,8 +878,8 @@ i_RCF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC RRB instruction. Description : Emulate the IMLAC RRB instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Read a character from the TTY into bits 5-15 of AC. Comments : Read a character from the TTY into bits 5-15 of AC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -895,8 +895,8 @@ i_RRB(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC RRC instruction. Description : Emulate the IMLAC RRC instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Read a character from the TTY and clear buffer flag. Comments : Read a character from the TTY and clear buffer flag.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -913,8 +913,8 @@ i_RRC(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC RSF instruction. Description : Emulate the IMLAC RSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if TTY char available. Comments : Skip if TTY char available.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -931,8 +931,8 @@ i_RSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC RSN instruction. Description : Emulate the IMLAC RSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if no TTY char available. Comments : Skip if no TTY char available.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -950,7 +950,7 @@ i_RSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC SAL instruction. Description : Emulate the IMLAC SAL instruction.
Parameters : shift - the number of bits to shift by Parameters : shift - the number of bits to shift by
Returns : Returns :
Comments : Shift AC left n places. LINK unchanged. Comments : Shift AC left n places. LINK unchanged.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -970,7 +970,7 @@ i_SAL(int shift)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC SAR instruction. Description : Emulate the IMLAC SAR instruction.
Parameters : shift - the number of bits to shift by Parameters : shift - the number of bits to shift by
Returns : Returns :
Comments : Shift AC right n places. Comments : Shift AC right n places.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -991,8 +991,8 @@ i_SAR(int shift)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC SSF instruction. Description : Emulate the IMLAC SSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if 40Hz sync flip-flop is set. Comments : Skip if 40Hz sync flip-flop is set.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1009,8 +1009,8 @@ i_SSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC SSN instruction. Description : Emulate the IMLAC SSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if 40Hz sync flip-flop is NOT set. Comments : Skip if 40Hz sync flip-flop is NOT set.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1027,8 +1027,8 @@ i_SSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC TCF instruction. Description : Emulate the IMLAC TCF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Reset the TTY "output done" flag. Comments : Reset the TTY "output done" flag.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1044,8 +1044,8 @@ i_TCF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC TPC instruction. Description : Emulate the IMLAC TPC instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Transmit char in AC and clear TTY ready flag Comments : Transmit char in AC and clear TTY ready flag
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1062,8 +1062,8 @@ i_TPC(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC TPR instruction. Description : Emulate the IMLAC TPR instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Send low byte in AC to TTY output. Comments : Send low byte in AC to TTY output.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1079,8 +1079,8 @@ i_TPR(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC TSF instruction. Description : Emulate the IMLAC TSF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if TTY done sending Comments : Skip if TTY done sending
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1097,8 +1097,8 @@ i_TSF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC TSN instruction. Description : Emulate the IMLAC TSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if TTY not done sending Comments : Skip if TTY not done sending
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1115,8 +1115,8 @@ i_TSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the ASZ instruction. Description : Emulate the ASZ instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if AC == 0. Comments : Skip if AC == 0.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1133,8 +1133,8 @@ i_ASZ(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the ASN instruction. Description : Emulate the ASN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if AC != 0. Comments : Skip if AC != 0.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1151,8 +1151,8 @@ i_ASN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC ASP instruction. Description : Emulate the IMLAC ASP instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if AC is positive. Comments : Skip if AC is positive.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1169,8 +1169,8 @@ i_ASP(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the LSZ instruction. Description : Emulate the LSZ instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if LINK is zero. Comments : Skip if LINK is zero.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1187,8 +1187,8 @@ i_LSZ(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the LSN instruction. Description : Emulate the LSN instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if LINK isn't zero. Comments : Skip if LINK isn't zero.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1205,8 +1205,8 @@ i_LSN(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC ASM instruction. Description : Emulate the IMLAC ASM instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Skip if AC is negative. Comments : Skip if AC is negative.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1223,8 +1223,8 @@ i_ASM(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC DLA instruction. Description : Emulate the IMLAC DLA instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Load display CPU with a new PC. Comments : Load display CPU with a new PC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1240,8 +1240,8 @@ i_DLA(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC CTB instruction. Description : Emulate the IMLAC CTB instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Load display CPU with a new PC. Comments : Load display CPU with a new PC.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1255,8 +1255,8 @@ i_CTB(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC DOF instruction. Description : Emulate the IMLAC DOF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Turn the display processor off. Comments : Turn the display processor off.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1272,8 +1272,8 @@ i_DOF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC DON instruction. Description : Emulate the IMLAC DON instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Turn the display processor on. Comments : Turn the display processor on.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1290,8 +1290,8 @@ i_DON(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC HOF instruction. Description : Emulate the IMLAC HOF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Turn the PTR off. Comments : Turn the PTR off.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1307,8 +1307,8 @@ i_HOF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC HON instruction. Description : Emulate the IMLAC HON instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Turn the PTR on. Comments : Turn the PTR on.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1324,9 +1324,9 @@ i_HON(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC STB instruction. Description : Emulate the IMLAC STB instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_STB(void) i_STB(void)
@@ -1339,8 +1339,8 @@ i_STB(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC SCF instruction. Description : Emulate the IMLAC SCF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Clear the 40Hz "sync" flag. Comments : Clear the 40Hz "sync" flag.
******************************************************************************/ ******************************************************************************/
static int static int
@@ -1356,9 +1356,9 @@ i_SCF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC IOS instruction. Description : Emulate the IMLAC IOS instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOS(void) i_IOS(void)
@@ -1371,9 +1371,9 @@ i_IOS(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC IOT101 instruction. Description : Emulate the IMLAC IOT101 instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOT101(void) i_IOT101(void)
@@ -1386,9 +1386,9 @@ i_IOT101(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC IOT111 instruction. Description : Emulate the IMLAC IOT111 instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOT111(void) i_IOT111(void)
@@ -1400,9 +1400,9 @@ i_IOT111(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC i_IOT131 instruction. Description : Emulate the IMLAC i_IOT131 instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOT131(void) i_IOT131(void)
@@ -1415,9 +1415,9 @@ i_IOT131(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC i_IOT132 instruction. Description : Emulate the IMLAC i_IOT132 instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOT132(void) i_IOT132(void)
@@ -1430,9 +1430,9 @@ i_IOT132(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC IOT134 instruction. Description : Emulate the IMLAC IOT134 instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOT134(void) i_IOT134(void)
@@ -1445,9 +1445,9 @@ i_IOT134(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC IOT141 instruction. Description : Emulate the IMLAC IOT141 instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOT141(void) i_IOT141(void)
@@ -1460,9 +1460,9 @@ i_IOT141(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC IOF instruction. Description : Emulate the IMLAC IOF instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_IOF(void) i_IOF(void)
@@ -1475,9 +1475,9 @@ i_IOF(void)
/****************************************************************************** /******************************************************************************
Description : Emulate the IMLAC ION instruction. Description : Emulate the IMLAC ION instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
i_ION(void) i_ION(void)
@@ -1491,8 +1491,8 @@ i_ION(void)
/****************************************************************************** /******************************************************************************
Description : Further decode the initial '02' opcode instruction. Description : Further decode the initial '02' opcode instruction.
Parameters : instruction - the complete instruction word Parameters : instruction - the complete instruction word
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
page02(WORD instruction) page02(WORD instruction)
@@ -1517,17 +1517,18 @@ page02(WORD instruction)
case 0102200: return i_SSN(); case 0102200: return i_SSN();
case 0002400: return i_HSF(); case 0002400: return i_HSF();
case 0102400: return i_HSN(); case 0102400: return i_HSN();
default: illegal(); default:
illegal();
} }
return 0; /* CAN'T REACH */ return 0; /* CAN'T REACH */
} }
/****************************************************************************** /******************************************************************************
Description : Further decode the initial '00' opcode instruction. Description : Further decode the initial '00' opcode instruction.
Parameters : instruction - the complete instruction word Parameters : instruction - the complete instruction word
Returns : Returns :
Comments : Comments :
******************************************************************************/ ******************************************************************************/
static int static int
page00(WORD instruction) page00(WORD instruction)
@@ -1589,17 +1590,18 @@ page00(WORD instruction)
case 003062: return i_SAR(2); case 003062: return i_SAR(2);
case 003063: return i_SAR(3); case 003063: return i_SAR(3);
case 003100: return i_DON(); case 003100: return i_DON();
default: illegal(); default:
illegal();
} }
return 0; /* CAN'T REACH */ return 0; /* CAN'T REACH */
} }
/****************************************************************************** /******************************************************************************
Description : Function to execute one main processor instruction. Description : Function to execute one main processor instruction.
Parameters : Parameters :
Returns : Returns :
Comments : Perform initial decode of 5 bit opcode and either call Comments : Perform initial decode of 5 bit opcode and either call
: appropriate emulating function or call further decode function. : appropriate emulating function or call further decode function.
******************************************************************************/ ******************************************************************************/
@@ -1640,9 +1642,9 @@ cpu_execute_one(void)
++r_PC; ++r_PC;
r_PC = r_PC & MEMMASK; r_PC = r_PC & MEMMASK;
indirect = (bool) (instruction & 0100000); /* high bit set? */ indirect = (bool) (instruction & 0100000); /* high bit set? */
opcode = (instruction >> 11) & 017; /* high 5 bits */ opcode = (instruction >> 11) & 017; /* high 5 bits */
address = instruction & 03777; /* low 11 bits */ address = instruction & 03777; /* low 11 bits */
/****** /******
* Now decode it. * Now decode it.
@@ -1666,8 +1668,9 @@ cpu_execute_one(void)
case 015: return i_ADD(indirect, address); case 015: return i_ADD(indirect, address);
case 016: return i_SUB(indirect, address); case 016: return i_SUB(indirect, address);
case 017: return i_SAM(indirect, address); case 017: return i_SAM(indirect, address);
default: illegal(); default:
illegal();
} }
return 0; /* CAN'T REACH */ return 0; /* CAN'T REACH */
} }

View File

@@ -22,8 +22,8 @@
//#define LSBBITS 5 //#define LSBBITS 5
#define LSBBITS 4 #define LSBBITS 4
#define MSBMASK 0x7f0 #define MSBMASK 0x7e0
#define LSBMASK 0x0f #define LSBMASK 0x1f
// full 11 bits of display addressing // full 11 bits of display addressing
#define DMASK 03777 #define DMASK 03777
@@ -55,11 +55,15 @@ static WORD DRS[] = {0, 0, 0, 0, 0, 0, 0, 0}; // display CPU stack
static int DRSindex; // static int DRSindex; //
static int DX; // static int DX; //
static int DY; // static int DY; //
static int DScale = 1; // display scale (1, 2, 4, 8)
int DIB = 0; // ???? int DIB = 0; // ????
static BYTE Mode = MODE_NORMAL; // DEIM mode static BYTE Mode = MODE_NORMAL; // DEIM mode
static bool Running = false; // true if display processor is running static bool Running = false; // true if display processor is running
// array for DTSTS scale inc values
static int DSTS_Inc[] = {1, 2, 4, 6}; // from p59 of Programming Guide
static int DSTS_Value = 1; // index into DSTS_Inc[] [0..3]
static int DSTS_Scale = 2; // actual inv value to use
static char DEIM_result[100]; // holds DEIM_decode() result static char DEIM_result[100]; // holds DEIM_decode() result
@@ -110,7 +114,7 @@ illegal(void)
WORD oldPC = Prev_DPC & MEMMASK; WORD oldPC = Prev_DPC & MEMMASK;
error("INTERNAL ERROR: " error("INTERNAL ERROR: "
"unexpected main processor opcode %06.6o at address %06.6o", "unexpected display processor opcode %06.6o at address %06.6o",
mem_get(oldPC, false), oldPC); mem_get(oldPC, false), oldPC);
} }
@@ -208,7 +212,7 @@ char *doDEIMByte(BYTE byte, bool last)
{ {
char *trace = DEIMdecode(byte); char *trace = DEIMdecode(byte);
vlog("doDEIMByte: DX=%04x, DY=%04x,", DX, DY); vlog("doDEIMByte: before, DX=%04x, DY=%04x, DSTS_Scale=%d", DX, DY, DSTS_Scale);
if (byte & 0x80) if (byte & 0x80)
{ {
@@ -221,20 +225,20 @@ char *doDEIMByte(BYTE byte, bool last)
if (byte & 0x20) // get dx sign and move X if (byte & 0x20) // get dx sign and move X
{ {
DX -= dx * DScale; DX -= dx * DSTS_Scale;
} }
else else
{ {
DX += dx * DScale; DX += dx * DSTS_Scale;
} }
if (byte & 0x04) // get dy sign and move Y if (byte & 0x04) // get dy sign and move Y
{ {
DY -= dy * DScale; DY -= dy * DSTS_Scale;
} }
else else
{ {
DY += dy * DScale; DY += dy * DSTS_Scale;
} }
// ensure dislay X/Y in limits // ensure dislay X/Y in limits
@@ -266,8 +270,9 @@ char *doDEIMByte(BYTE byte, bool last)
if (byte & 0x10) // inc X MSB if (byte & 0x10) // inc X MSB
{ {
vlog("before inc X MSB, X=%04x", DX); vlog("before inc X MSB, X=%04x, (1 << LSBBITS) * DSTS_Scale=%04x", DX, (1 << LSBBITS) * DSTS_Scale);
DX += (1 << LSBBITS); DX += (1 << LSBBITS) * DSTS_Scale;
vlog("during inc X MSB, X=%04x", DX);
DX &= DMASK; DX &= DMASK;
vlog(" after inc X MSB, X=%04x", DX); vlog(" after inc X MSB, X=%04x", DX);
} }
@@ -282,7 +287,7 @@ char *doDEIMByte(BYTE byte, bool last)
if (byte & 0x02) // inc Y MSB if (byte & 0x02) // inc Y MSB
{ {
vlog("before inc Y MSB, Y=%04x", DY); vlog("before inc Y MSB, Y=%04x", DY);
DY += (1 << LSBBITS); DY += (1 << LSBBITS) * DSTS_Scale;
DY &= DMASK; DY &= DMASK;
vlog(" after inc Y MSB, Y=%04x", DY); vlog(" after inc Y MSB, Y=%04x", DY);
} }
@@ -295,6 +300,8 @@ char *doDEIMByte(BYTE byte, bool last)
} }
} }
vlog("doDEIMByte: after, DX=%04x, DY=%04x,", DX, DY);
return trace; return trace;
} }
@@ -483,16 +490,16 @@ int i_DSTB(int block)
static static
int i_DSTS(int scale) int i_DSTS(int scale)
{ {
if (scale == 0) if (0 <= scale && scale <= 3)
DScale = 1; {
else if (scale == 1) DSTS_Value = scale;
DScale = 2; DSTS_Scale = DSTS_Inc[scale];
else if (scale == 2) vlog("i_DSTS: DSTS_Value=%d, DSTS_Scale=%d", DSTS_Value, DSTS_Scale);
DScale = 4; }
else if (scale == 3)
DScale = 8;
else else
{
illegal(); illegal();
}
trace_dcpu("DSTS %d", scale); trace_dcpu("DSTS %d", scale);
return 1; // FIXME check # cycles used return 1; // FIXME check # cycles used
} }
@@ -534,7 +541,9 @@ int page00(WORD instruction)
else if (instruction == 006000) // DHVC else if (instruction == 006000) // DHVC
cycles = i_DHVC(); cycles = i_DHVC();
else else
{
illegal(); illegal();
}
return cycles; return cycles;
} }

View File

@@ -14,13 +14,14 @@ loop dsn ; wait until display is off
; Display list subroutine - show ASCII chars 'ABC' ; Display list subroutine - show ASCII chars 'ABC'
;------------------------------- ;-------------------------------
dsub dsub
dhvc ;
dsts 0 ; dsts 0 ;
dlxa 020 ; dlxa 020 ;
dlya 0100 ; dlya 0100 ;
djms upperf ; F djms upperf ; F
djms upperg ; G djms upperg ; G
djms upperh ; H djms upperh ; H
djms upperi ; I
djms upperj ; J
dhlt ; dhlt ;
;------------------------------- ;-------------------------------
upperf inc e,b03 ; F upperf inc e,b03 ; F
@@ -40,5 +41,14 @@ upperh inc e,b03 ; H
inc y,b03 ; inc y,b03 ;
inc 03,02 ; inc 03,02 ;
inc y,f ; inc y,f ;
upperi inc e,b30 ; I
inc 30,d-31 ;
inc b03,03 ;
inc d-31,b30 ;
inc 30,f ;
upperj inc e,d02 ; J
inc b2-2,20 ;
inc 22,03 ;
inc 03,f ;
;------------------------------- ;-------------------------------
end end

View File

@@ -78,7 +78,7 @@ trace_start_line(void)
void void
trace_end_line(void) trace_end_line(void)
{ {
fprintf(trace_fp, "%11.6f|%06o: %-16s%-13s|%06o: %-18s%-s\n", fprintf(trace_fp, "%11.6f |%06o: %-16s;%-15s|%06o: %-18s;%-s\n",
now, cpu_get_prev_PC(), CPU_trace, CPU_reg_trace, now, cpu_get_prev_PC(), CPU_trace, CPU_reg_trace,
dcpu_get_PC(), DCPU_trace, DCPU_reg_trace); dcpu_get_PC(), DCPU_trace, DCPU_reg_trace);
fflush(trace_fp); fflush(trace_fp);