PCjs Machines

Home of the original IBM PC emulator for browsers.

Logo

DEC PDP-10 KA10 Basic Instruction Diagnostic #12

The PDP-10 KA10 Basic Instruction Diagnostic #12 (MAINDEC-10-DAKAL) test code has been extracted from DAKALM.MAC [original] and DAKALT.MAC [original] for use with the PDP-10 Test Machine with Debugger below.

This diagnostic “TESTS THE MULTIPY, INTERGER MULIPLY, DIVIDE AND INTERGER DIVIDE INSTRUCTIONS.” Hopefully the tests work better than their spell-checking.

Information regarding this diagnostic includes:

[PCjs Machine "testka10"]

Waiting for machine "testka10" to load....

The Debugger’s assemble (“a”) command can be used to test the new built-in MACRO-10 Mini-Assembler, which supports a subset of the MACRO-10 assembly language.

This command:

a DAKAL.MAC

will automatically read the DAKAL.MAC source file (a slightly modified copy of DAKALM.MAC), assemble it, and then load the binary image at the location specified in the file.

Issues

The following DAKAL diagnostic test sequence produced correct results but still failed:

00=000000000000 01=000000000000 02=000000000000 03=000000000000 
04=000000000000 05=000000000000 06=000000000000 07=000000000000 
10=000000000000 11=000000000000 12=000000000001 13=000000000000 
14=777777777777 15=525252525252 16=000000000016 17=000000000000 
PC=030641 RA=00030626 EA=030626 PS=000000 OV=0 C0=0 C1=0 ND=0 PD=0 
030641: 200600 044434  MOVE    14,44434         ;cycles=1
>> tr
00=000000000000 01=000000000000 02=000000000000 03=000000000000 
04=000000000000 05=000000000000 06=000000000000 07=000000000000 
10=000000000000 11=000000000000 12=000000000001 13=000000000000 
14=525252525252 15=525252525252 16=000000000016 17=000000000000 
PC=030642 RA=00044434 EA=044434 PS=000000 OV=0 C0=0 C1=0 ND=0 PD=0 
030642: 200640 044435  MOVE    15,44435         ;cycles=1
>> tr
00=000000000000 01=000000000000 02=000000000000 03=000000000000 
04=000000000000 05=000000000000 06=000000000000 07=000000000000 
10=000000000000 11=000000000000 12=000000000001 13=000000000000 
14=525252525252 15=000000000000 16=000000000016 17=000000000000 
PC=030643 RA=00044435 EA=044435 PS=000000 OV=0 C0=0 C1=0 ND=0 PD=0 
030643: 200500 044440  MOVE    12,44440         ;cycles=1
>> tr
00=000000000000 01=000000000000 02=000000000000 03=000000000000 
04=000000000000 05=000000000000 06=000000000000 07=000000000000 
10=000000000000 11=000000000000 12=000000000002 13=000000000000 
14=525252525252 15=000000000000 16=000000000016 17=000000000000 
PC=030644 RA=00044440 EA=044440 PS=000000 OV=0 C0=0 C1=0 ND=0 PD=0 
030644: 224600 000012  MUL     14,12            ;cycles=1
>> tr
00=000000000000 01=000000000000 02=000000000000 03=000000000000 
04=000000000000 05=000000000000 06=000000000000 07=000000000000 
10=000000000000 11=000000000000 12=000000000002 13=000000000000 
14=777777777776 15=652525252524 16=000000000016 17=000000000000 
PC=030645 RA=00000012 EA=000012 PS=000000 OV=0 C0=0 C1=0 ND=0 PD=0 
030645: 312600 044441  CAME    14,44441         ;cycles=1
>> tr
00=000000000000 01=000000000000 02=000000000000 03=000000000000 
04=000000000000 05=000000000000 06=000000000000 07=000000000000 
10=000000000000 11=000000000000 12=000000000002 13=000000000000 
14=777777777776 15=652525252524 16=000000000016 17=000000000000 
PC=030647 RA=00044441 EA=044441 PS=000000 OV=0 C0=0 C1=0 ND=0 PD=0 
030647: 312640 044442  CAME    15,44442         ;cycles=1

The multiplication of 525252525252 * 2 produces 777777777776,652525252524, which is correct for the PDP-10’s 72-bit “dual sign” format. However, the first time I ran this test, it failed – not because the result was wrong, but because the value calculated for the expected result was wrong.

The source code for the test produces the expected results by performing 36-bit multiplication in the MACRO-10 Assembler:

775                 ;MULTIPLY A FLOATING 1 BY 1010...101010
776     525252  525252          V1=N1
777     652525  252524          V2=N1*XX

but the expected result my MACRO-10 Mini-Assembler calculated was different:

>> dw 44442 l1
044442: 252525 252524  

My result wasn’t really the wrong value; it was the correct (albeit truncated) value in the wrong format. My expression parser was performing simple JavaScript multiplication and then truncating the result to 36 bits; MACRO-10 performs a similar calculation, but it also adjusts the sign of the low 36 bits to match the sign of the high 36 bits – because that’s what the PDP-10 does, too.

My solution was to move the expression parser’s multiplication code to its own function, evalMUL(), and then change the PDP-10 Debugger to override evalMUL() with its own function that calls the PDP-10 CPU doMUL() function, guaranteeing that all multiplication results are performed with the same 72-bit precision and returned in the same PDP-10 72-bit format (before being truncated to 36 bits).

Unfortunately, this creates an incestuous relationship between CPU functionality being tested and the code testing it, because it increases the likelihood that the multiplication tests will succeed even if/when they calculate incorrect results, at least whenever the expected results are being calculated with the same multiplicands that the test itself uses.

So, as a precaution, I added some DEBUG code to the evalMUL() function that outputs all the instances where JavaScript multiplication and PDP-10 multiplication differ, so that I can verify that all my PDP-10 results match those in DEC’s MACRO-10 Listing, which I’m treating as “the gold standard.”

Here’s that output:

MUL(525252525252,000000000002) PDP-10: 652525252524 JavaScript: 252525252524 @030641
MUL(525252525252,000000000002) PDP-10: 652525252524 JavaScript: 252525252524 @030641
MUL(525252525252,000000000010) PDP-10: 652525252520 JavaScript: 252525252520 @030667
MUL(525252525252,000000000010) PDP-10: 652525252520 JavaScript: 252525252520 @030667
MUL(525252525252,000000000040) PDP-10: 652525252500 JavaScript: 252525252500 @030715
MUL(525252525252,000000000040) PDP-10: 652525252500 JavaScript: 252525252500 @030715
MUL(525252525252,000000000200) PDP-10: 652525252400 JavaScript: 252525252400 @030743
MUL(525252525252,000000000200) PDP-10: 652525252400 JavaScript: 252525252400 @030743
MUL(525252525252,000000001000) PDP-10: 652525252000 JavaScript: 252525252000 @030771
MUL(525252525252,000000001000) PDP-10: 652525252000 JavaScript: 252525252000 @030771
MUL(525252525252,000000004000) PDP-10: 652525250000 JavaScript: 252525250000 @031017
MUL(525252525252,000000004000) PDP-10: 652525250000 JavaScript: 252525250000 @031017
MUL(525252525252,000000020000) PDP-10: 652525240000 JavaScript: 252525240000 @031045
MUL(525252525252,000000020000) PDP-10: 652525240000 JavaScript: 252525240000 @031045
MUL(525252525252,000000100000) PDP-10: 652525200000 JavaScript: 252525200000 @031073
MUL(525252525252,000000100000) PDP-10: 652525200000 JavaScript: 252525200000 @031073
MUL(525252525252,000000400000) PDP-10: 652525000000 JavaScript: 252525000000 @031121
MUL(525252525252,000000400000) PDP-10: 652525000000 JavaScript: 252525000000 @031121
MUL(525252525252,000002000000) PDP-10: 652524000000 JavaScript: 252524000000 @031147
MUL(525252525252,000002000000) PDP-10: 652524000000 JavaScript: 252524000000 @031147
MUL(525252525252,000010000000) PDP-10: 652520000000 JavaScript: 252520000000 @031175
MUL(525252525252,000010000000) PDP-10: 652520000000 JavaScript: 252520000000 @031175
MUL(525252525252,000040000000) PDP-10: 652500000000 JavaScript: 252500000000 @031223
MUL(525252525252,000040000000) PDP-10: 652500000000 JavaScript: 252500000000 @031223
MUL(525252525252,000200000000) PDP-10: 652400000000 JavaScript: 252400000000 @031251
MUL(525252525252,000200000000) PDP-10: 652400000000 JavaScript: 252400000000 @031251
MUL(525252525252,001000000000) PDP-10: 652000000000 JavaScript: 252000000000 @031277
MUL(525252525252,001000000000) PDP-10: 652000000000 JavaScript: 252000000000 @031277
MUL(525252525252,004000000000) PDP-10: 650000000000 JavaScript: 250000000000 @031325
MUL(525252525252,004000000000) PDP-10: 650000000000 JavaScript: 250000000000 @031325
MUL(525252525252,020000000000) PDP-10: 640000000000 JavaScript: 240000000000 @031353
MUL(525252525252,020000000000) PDP-10: 640000000000 JavaScript: 240000000000 @031353
MUL(525252525252,100000000000) PDP-10: 600000000000 JavaScript: 200000000000 @031401
MUL(525252525252,100000000000) PDP-10: 600000000000 JavaScript: 200000000000 @031401
MUL(252525252525,000000000002) PDP-10: 125252525252 JavaScript: 525252525252 @031461
MUL(252525252525,000000000010) PDP-10: 125252525250 JavaScript: 525252525250 @031507
MUL(252525252525,000000000040) PDP-10: 125252525240 JavaScript: 525252525240 @031535
MUL(252525252525,000000000200) PDP-10: 125252525200 JavaScript: 525252525200 @031563
MUL(252525252525,000000001000) PDP-10: 125252525000 JavaScript: 525252525000 @031611
MUL(252525252525,000000004000) PDP-10: 125252524000 JavaScript: 525252524000 @031637
MUL(252525252525,000000020000) PDP-10: 125252520000 JavaScript: 525252520000 @031665
MUL(252525252525,000000100000) PDP-10: 125252500000 JavaScript: 525252500000 @031713
MUL(252525252525,000000400000) PDP-10: 125252400000 JavaScript: 525252400000 @031741
MUL(252525252525,000002000000) PDP-10: 125252000000 JavaScript: 525252000000 @031767
MUL(252525252525,000010000000) PDP-10: 125250000000 JavaScript: 525250000000 @032015
MUL(252525252525,000040000000) PDP-10: 125240000000 JavaScript: 525240000000 @032043
MUL(252525252525,000200000000) PDP-10: 125200000000 JavaScript: 525200000000 @032071
MUL(252525252525,001000000000) PDP-10: 125000000000 JavaScript: 525000000000 @032117
MUL(252525252525,004000000000) PDP-10: 124000000000 JavaScript: 524000000000 @032145
MUL(252525252525,020000000000) PDP-10: 120000000000 JavaScript: 520000000000 @032173
MUL(252525252525,100000000000) PDP-10: 100000000000 JavaScript: 500000000000 @032221
MUL(252525252525,000000000002) PDP-10: 125252525252 JavaScript: 525252525252 @032301
MUL(252525252525,000000000010) PDP-10: 125252525250 JavaScript: 525252525250 @032327
MUL(252525252525,000000000040) PDP-10: 125252525240 JavaScript: 525252525240 @032355
MUL(252525252525,000000000200) PDP-10: 125252525200 JavaScript: 525252525200 @032403
MUL(252525252525,000000001000) PDP-10: 125252525000 JavaScript: 525252525000 @032431
MUL(252525252525,000000004000) PDP-10: 125252524000 JavaScript: 525252524000 @032457
MUL(252525252525,000000020000) PDP-10: 125252520000 JavaScript: 525252520000 @032505
MUL(252525252525,000000100000) PDP-10: 125252500000 JavaScript: 525252500000 @032533
MUL(252525252525,000000400000) PDP-10: 125252400000 JavaScript: 525252400000 @032561
MUL(252525252525,000002000000) PDP-10: 125252000000 JavaScript: 525252000000 @032607
MUL(252525252525,000010000000) PDP-10: 125250000000 JavaScript: 525250000000 @032635
MUL(252525252525,000040000000) PDP-10: 125240000000 JavaScript: 525240000000 @032663
MUL(252525252525,000200000000) PDP-10: 125200000000 JavaScript: 525200000000 @032711
MUL(252525252525,001000000000) PDP-10: 125000000000 JavaScript: 525000000000 @032737
MUL(252525252525,004000000000) PDP-10: 124000000000 JavaScript: 524000000000 @032765
MUL(252525252525,020000000000) PDP-10: 120000000000 JavaScript: 520000000000 @033013
MUL(252525252525,100000000000) PDP-10: 100000000000 JavaScript: 500000000000 @033041
MUL(400000000000,400000000000) PDP-10: 400000000000 JavaScript: 000000000000 @033707	VERIFIED
MUL(400000000000,400000000000) PDP-10: 400000000000 JavaScript: 000000000000 @033707	VERIFIED
MUL(400000000000,400000000000) PDP-10: 400000000000 JavaScript: 000000000000 @033707	VERIFIED
MUL(400000000000,400000000000) PDP-10: 400000000000 JavaScript: 000000000000 @033707	VERIFIED
MUL(777777777776,777777777776) PDP-10: 000000000004 JavaScript: 000000000000 @033726
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033726
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033726
MUL(777777777775,777777777775) PDP-10: 000000000011 JavaScript: 000000000000 @033741
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033741
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033741
MUL(777777777773,777777777773) PDP-10: 000000000031 JavaScript: 000000000000 @033754
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033754
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033754
MUL(777777777767,777777777767) PDP-10: 000000000121 JavaScript: 000000000000 @033767
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033767
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @033767
MUL(777777777757,777777777757) PDP-10: 000000000441 JavaScript: 000000000000 @034002
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034002
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034002
MUL(777777777737,777777777737) PDP-10: 000000002101 JavaScript: 000000000000 @034015
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034015
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034015
MUL(777777777677,777777777677) PDP-10: 000000010201 JavaScript: 000000000000 @034030
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034030
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034030
MUL(777777777577,777777777577) PDP-10: 000000040401 JavaScript: 000000000000 @034043
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034043
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034043
MUL(777777777377,777777777377) PDP-10: 000000201001 JavaScript: 000000000000 @034056
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034056
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034056
MUL(777777776777,777777776777) PDP-10: 000001002001 JavaScript: 000002000000 @034071
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034071
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034071
MUL(777777775777,777777775777) PDP-10: 000004004001 JavaScript: 000004000000 @034104
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034104
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034104
MUL(777777773777,777777773777) PDP-10: 000020010001 JavaScript: 000020000000 @034117
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034117
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034117
MUL(777777767777,777777767777) PDP-10: 000100020001 JavaScript: 000100000000 @034132
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034132
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034132
MUL(777777757777,777777757777) PDP-10: 000400040001 JavaScript: 000400000000 @034145
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034145
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034145
MUL(777777737777,777777737777) PDP-10: 002000100001 JavaScript: 002000000000 @034160
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034160
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034160
MUL(777777677777,777777677777) PDP-10: 010000200001 JavaScript: 010000000000 @034173
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034173
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034173
MUL(777777577777,777777577777) PDP-10: 040000400001 JavaScript: 040000000000 @034206
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034206
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034206
MUL(777777377777,777777377777) PDP-10: 200001000001 JavaScript: 200002000000 @034221
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034221
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034221
MUL(777776777777,777776777777) PDP-10: 000002000001 JavaScript: 000002000000 @034234
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034234
MUL(000000777777,000000777777) PDP-10: 377776000001 JavaScript: 777776000001 @034234
MUL(777775777777,777775777777) PDP-10: 000004000001 JavaScript: 000004000000 @034247
MUL(000000777776,000000777776) PDP-10: 377774000004 JavaScript: 777774000004 @034247
MUL(000000777776,000000777776) PDP-10: 377774000004 JavaScript: 777774000004 @034247
MUL(777773777777,777773777777) PDP-10: 000010000001 JavaScript: 000010000000 @034262
MUL(000000777774,000000777774) PDP-10: 377770000020 JavaScript: 777770000020 @034262
MUL(000000777774,000000777774) PDP-10: 377770000020 JavaScript: 777770000020 @034262
MUL(777767777777,777767777777) PDP-10: 000020000001 JavaScript: 000020000000 @034275
MUL(000000777770,000000777770) PDP-10: 377760000100 JavaScript: 777760000100 @034275
MUL(000000777770,000000777770) PDP-10: 377760000100 JavaScript: 777760000100 @034275
MUL(777757777777,777757777777) PDP-10: 000040000001 JavaScript: 000040000000 @034310
MUL(000000777760,000000777760) PDP-10: 377740000400 JavaScript: 777740000400 @034310
MUL(000000777760,000000777760) PDP-10: 377740000400 JavaScript: 777740000400 @034310
MUL(777737777777,777737777777) PDP-10: 000100000001 JavaScript: 000100000000 @034323
MUL(000000777740,000000777740) PDP-10: 377700002000 JavaScript: 777700002000 @034323
MUL(000000777740,000000777740) PDP-10: 377700002000 JavaScript: 777700002000 @034323
MUL(777677777777,777677777777) PDP-10: 000200000001 JavaScript: 000200000000 @034336
MUL(000000777700,000000777700) PDP-10: 377600010000 JavaScript: 777600010000 @034336
MUL(000000777700,000000777700) PDP-10: 377600010000 JavaScript: 777600010000 @034336
MUL(777577777777,777577777777) PDP-10: 000400000001 JavaScript: 000400000000 @034351
MUL(000000777600,000000777600) PDP-10: 377400040000 JavaScript: 777400040000 @034351
MUL(000000777600,000000777600) PDP-10: 377400040000 JavaScript: 777400040000 @034351
MUL(777377777777,777377777777) PDP-10: 001000000001 JavaScript: 001000000000 @034364
MUL(000000777400,000000777400) PDP-10: 377000200000 JavaScript: 777000200000 @034364
MUL(000000777400,000000777400) PDP-10: 377000200000 JavaScript: 777000200000 @034364
MUL(776777777777,776777777777) PDP-10: 002000000001 JavaScript: 002000000000 @034377
MUL(000000777000,000000777000) PDP-10: 376001000000 JavaScript: 776001000000 @034377
MUL(000000777000,000000777000) PDP-10: 376001000000 JavaScript: 776001000000 @034377
MUL(775777777777,775777777777) PDP-10: 004000000001 JavaScript: 004000000000 @034412
MUL(000000776000,000000776000) PDP-10: 374004000000 JavaScript: 774004000000 @034412
MUL(000000776000,000000776000) PDP-10: 374004000000 JavaScript: 774004000000 @034412
MUL(773777777777,773777777777) PDP-10: 010000000001 JavaScript: 010000000000 @034425
MUL(000000774000,000000774000) PDP-10: 370020000000 JavaScript: 770020000000 @034425
MUL(000000774000,000000774000) PDP-10: 370020000000 JavaScript: 770020000000 @034425
MUL(767777777777,767777777777) PDP-10: 020000000001 JavaScript: 020000000000 @034440
MUL(000000770000,000000770000) PDP-10: 360100000000 JavaScript: 760100000000 @034440
MUL(000000770000,000000770000) PDP-10: 360100000000 JavaScript: 760100000000 @034440
MUL(757777777777,757777777777) PDP-10: 040000000001 JavaScript: 040000000000 @034453
MUL(000000760000,000000760000) PDP-10: 340400000000 JavaScript: 740400000000 @034453
MUL(000000760000,000000760000) PDP-10: 340400000000 JavaScript: 740400000000 @034453
MUL(737777777777,737777777777) PDP-10: 100000000001 JavaScript: 100000000000 @034466
MUL(000000740000,000000740000) PDP-10: 302000000000 JavaScript: 702000000000 @034466
MUL(000000740000,000000740000) PDP-10: 302000000000 JavaScript: 702000000000 @034466
MUL(677777777777,677777777777) PDP-10: 200000000001 JavaScript: 200000000000 @034501
MUL(000000700000,000000700000) PDP-10: 210000000000 JavaScript: 610000000000 @034501
MUL(000000700000,000000700000) PDP-10: 210000000000 JavaScript: 610000000000 @034501
MUL(577777777777,577777777777) PDP-10: 000000000001 JavaScript: 400000000000 @034514
MUL(000000600000,000000600000) PDP-10: 040000000000 JavaScript: 440000000000 @034514
MUL(377777777777,377777777777) PDP-10: 000000000001 JavaScript: 000000000000 @034527
MUL(777777377777,000001000000) PDP-10: 777777000000 JavaScript: 377777000000 @035347
MUL(777777377777,000001000000) PDP-10: 777777000000 JavaScript: 377777000000 @035347
MUL(000000000010,377777777777) PDP-10: 377777777770 JavaScript: 777777777770 @000000
MUL(000000000020,377777777777) PDP-10: 377777777760 JavaScript: 777777777760 @000000

DAKAL.TXT

MAINDEC-10-DAKAL.TXT






 
			IDENTIFICATION
			--------------

	PRODUCT CODE:   MAINDEC-10-DAKAL-B-D

	PRODUCT NAME:   DECSYSTEM10 PDP-10 KA10 BASIC
	                INSTRUCTION DIAGNOSTIC (12)

	FUNCTION:       MULTIPY & DIVIDE

	VERSION:        0.2

	DATE RELEASED:  JANUARY 1977

	MAINTAINED BY:  DIAGNOSTIC ENGINEERING GROUP

	AUTHOR:         JOHN R. KIRCHOFF

COPYRIGHT(C) 1976,1977
DIGITAL EQUIPMENT CORPORATION
MARLBORO, MASS. 01752

THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE,
OR ANY OTHER COPIES THEREOF, MAY NOT BE PROVIDED OR OTHERWISE
MADE AVAILABLE TO ANY OTHER PERSON EXECPT FOR USE ON SUCH SYSTEM
AND TO ONE WHO AGREES TO THESE LICENSE TERMS.  TITLE TO AND
OWNERSHIP OF THE SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.

THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT
NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL
EQUIPMENT CORPORATION.

DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

							MAINDEC-10-DAKAL.TXT
							PAGE 2

			TABLE OF CONTENTS
			-----------------

1.0	ABSTRACT

2.0	REQUIREMENTS

2.1	EQUIPMENT

2.2	STORAGE

2.3	PRELIMINARY PROGRAMS

3.0	PROGRAM PROCEDURES

3.1	LOADING PROCEDURE

3.2	STARTING PROCEDURE

3.3	OPERATING PROCEDURE

4.0	DATA SWITCH FUNCTIONS

5.0	ERRORS

6.0	ITERATION COUNTER

7.0	CYCLE TIME

8.0	OPERATIONAL VARIATIONS

9.0	MISCELLANEOUS

10.0	LISTING

							MAINDEC-10-DAKAL.TXT
							PAGE 3

1.0	ABSTRACT

	THIS PDP-10 KA10 BASIC INSTRUCTION DIAGNOSTIC IS THE
	TWELVTH IN A SERIES OF PDP-10 KA10 PROCESSOR DIAGNOSTICS.
	THE DIAGNOSTIC TESTS THE MULTIPY, INTERGER MULIPLY,
	DIVIDE AND INTERGER DIVIDE INSTRUCTIONS.

2.0	REQUIREMENTS

2.1	EQUIPMENT

	A PDP-10 KA10 EQUIPPED WITH A MINIMUM OF 32K OF MEMORY

	PAPER TAPE READER 
	CONSOLE TELETYPE
	DECTAPE
	LINE PRINTER (OPTIONAL)

2.2	STORAGE

	THE PROGRAM RUNS WITHIN 32K OF MEMORY.

2.3	PRELIMINARY PROGRAMS

	PREVIOUS PROCESSOR DIAGNOSTICS

3.0	PROGRAM PROCEDURES

3.1	LOADING PROCEDURE

	THIS DIAGNOSTIC REQUIRES THAT THE DECSYSTEM10 SUBROUTINE
	PROGRAM BE RESIDENT IN THE PDP-10.

	PAPER TAPE - HARDWARE READ-IN (READER DEVICE CODE 104)
	DECTAPE - LOAD WITH DIAMON (DECTAPE DEVICE CODE 320)
	TIME SHARING - RUN UNDER DIAMON.
	
							MAINDEC-10-DAKAL.TXT
							PAGE 4

3.2	STARTING PROCEDURE

	A.  SELECT OPERATIONAL CONSOLE DATA SWITCH SETTINGS (REFER TO
	    4.0 DATA SWITCH FUNCTIONS).

	B.  EXEC MODE

	    STAND-ALONE STARTING ADDRESS IS 30000.

	C.  USER MODE

	    RUN UNDER "DIAMON".
	    IN USER MODE THE FOLLOWING QUESTIONS WILL BE ASKED TO 
	    SELECT THE OPERATIONAL SWITCHES:

		    TELETYPE SWITCH CONTROL ? 0,S,Y OR N (CR) -

		    IF THE OPERATOR TYPES "N", THE ACTUAL CONSOLE
		    SWITCHES ARE USED.

		    IF THE OPERATOR TYPES "Y", THE FOLLOWING QUESTIONS
		    ARE ASKED AND THE OPERATOR RESPONDS BY TYPING
		    THE ANSWER AS SIX OCTAL DIGITS REPRESENTING
		    THE DESIRED SWITCH SETTINGS.

		    SPECIFY LH SWITCHES IN OCTAL-

		    SPECIFY RH SWITCHES IN OCTAL-

		    IF THE OPERATOR TYPES "0", ZERO'S ARE USED FOR
		    THE SWITCH SETTINGS.

		    IF THE OPERATOR TYPES "S", PREVIOUSLY SET SWITCHES
		    ARE USED.  THIS IS ONLY VALID UPON RESTARTING
		    OF AN INTERRUPTED PROGRAM.
		    
							MAINDEC-10-DAKAL.TXT
							PAGE 5

3.3	OPERATING PROCEDURE

	A.  TO THROUGHLY TEST ALL HARDWARE, ALL TEST CONTROL DATA 
	    SWITCHES SHOULD BE SET TO 0.

	B.  WHEN DEBUGGING HARDWARE, SET SWITCHES TO 0.  ALLOW THE 
	    TELETYPE TO PRINT THE ERROR MESSAGES.  THIS ALLOWS THE 
	    PROGRAM TO RUN A COMPLETE PASS AND THEN THE ERROR MESSAGES
	    MAY BE CORRELATED TO QUICKLY DIAGNOSE THE FAILURE.  IF A
	    HARDWARE PROBLEM IS SUCH THAT THE ERROR MESSAGES, AFTER THE
	    FIRST ONE, HAVE NO MEANING (FIRST ERROR CAUSES ALL FOLLOWING
	    TESTS TO FAIL) SET THE LOOP ON ERROR SWITCH AND RESTART THE
	    TEST FROM THE BEGINNING.  THE FIRST FAILURE WILL THEN CAUSE
	    THE PROGRAM TO ENTER A LOOP SUITABLE FOR SCOPING.

	    THE ERROR MESSAGE USED IN CONJUNCTION WITH THE LISTING AND
	    SCOPING IF NECESSARY SHOULD ALLOW THE FAILING CONPONENT 
	    TO BE ISOLATED AND REPLACED AND/OR REPAIRED.

	C.  WHEN TAKING MARGINS, SET DATA SWITCHES 'NOPNT' AND 'DING'.
	    THIS WILL INHIBIT PRINTOUT BUT WILL ALLOW THE TELETYPE
	    BELL TO BE RUNG WHEN A ERROR OCCURS.  IF THE MARGIN OBTAINED
	    IS UNACCEPTABLE, THE OPERATOR MAY REVERT TO STANDARD SWITCH
	    SETTINGS FOR DEBUGGING PURPOSES.

	D.  ERROR INFORMATION MAY BE OBTAINED QUICKLY BY PRINTING 
	    ERRORS ON THE LINE PRINTER.

	E.  IN THE EVENT OF A PRINT ROUTINE FAILURE THE 'NOPNT' SWITCH
	    AND THE 'ERSTOP' SWITCH MAY BE SET TO INHIBIT PRINTOUT 
	    BUT HALT THE PROGRAM POINTING TO THE ERROR.

							MAINDEC-10-DAKAL.TXT
							PAGE 6

4.0	DATA SWITCH FUNCTIONS

	SWITCH		STATE	FUNCTION
	------		-----	--------

	0    ABORT	0	NORMAL OPERATION
			1	ABORT AT END OF PASS

	1    RSTART		NOT USED

	2    TOTALS		NOT USED

	3    NOPNT	0	NORMAL TYPEOUT
			1	INHIBIT ALL PRINT/TYPEOUT
				(EXCEPT FORCED)

	4    PNTLPT	0	NORMAL OUTPUT TO TTY
			1	PRINT ALL DATA ON LPT
				(LOGICAL DEVICE, USER MODE)

	5    DING	0	NO FUNCTION
			1	RING TTY BELL ON ERROR

	6    LOOPER	0	PROCEED TO NEXT TEST
			1	ENTER SCOPE LOOP ON TEST ERROR

	7    ERSTOP	0	NO FUNCTION
			1	HALT ON TEST ERROR

	8    PALERS	0	PRINT ONLY FIRST ERROR WHEN LOOPING
			1	PRINT ALL ERRORS, EVEN IF SAME ERROR

	9    RELIAB		NOT USED

	10   TXTINH	0	PRINT FULL ERROR MESSAGES.
			1	INHIBIT COMMENT PORTION OF 
				ERROR MESSAGES.

	11   INHPAG	0	ALLOW PAGING AND TRAP ENABLE
			1	INHIBIT PAGING AND TRAPPING

	12   MODDVC		NOT USED

	13   INHCSH		NOT USED
	
							MAINDEC-10-DAKAL.TXT
							PAGE 7

5.0	ERRORS

	ERRORS ARE PRINTED ON THE TTY OR LINE PRINTER.  THE ERROR 
	PRINTOUT CONTAINS THE TEST TITLE, THE PC OF THE FAILURE, ERROR
	NUMBER AND THE CONTENTS OF AN APPLICABLE AC.

	THE PC VALUE IS USEFUL IN RELATING THE FAILURE TO THE LISTING.
	THE ERROR NUMBER IS PROVIDED SUCH THAT AN ERROR DICTIONARY MAY
	BE MADE AT SOME FUTURE DATE.

	WHEN THE SCOPE LOOP MODE IS USED THE MI REGISTER WILL COUNT 
	FOR EACH OCCURANCE OF AN ERROR.  IF AN AUDIO INDICATION OF
	A CONTINUING ERROR IS DESIRED THE 'DING' SWITCH MAY BE SET.

6.0	ITERATION COUNTER

	THE ITERATION COUNT OF THE PROGRAM IS DISPLAYED IN THE MEMORY
	INDICATORS (MI).  THIS COUNT IS A DECREMENTING COUNT AND 
	INITIALLY STARTS AT -1 IN STAND-ALONE OPERATION.

7.0	CYCLE TIME

	THE CYCLE TIME OF THE PROGRAM IS IN THE MILLISECOND RANGE AND
	IS THEREFORE SUITABLE FOR TAKING MARGINS, VIBRATION TESTS,
	ETC.
	
							MAINDEC-10-DAKAL.TXT
							PAGE 8

8.0	OPERATIONAL VARIATIONS

	A.  DIAGNOSTIC MONITOR

	    THE PROGRAM IS USABLE WITH THE DIAGNOSTIC MONITOR TO PROVIDE
	    RELIABILITY TESTS, ACCEPTANCE TESTS, AND/OR TO PROVIDE A
	    QUICK METHOD OF ISOLATION OF A FAULT TO A PARTICULAR AREA
	    OF THE PROCESSOR.  CERTAIN PROCEDURES ARE USED WHEN THE
	    PROGRAM IS USED IN THIS MANNER.  THEY ARE:

	    1.	THE DIAGNOSTIC MONITOR TRANSFERS CONTROL TO THE PROGRAM
		AND STARTS IT AT LOCATION 30002.

	    2.	MONCTL - LOCATION 30043 IS USED AS THE DIAGNOSTIC MONITOR
		CONTROL WORD.
			LH = 0, STAND-ALONE OPERATION
			    -1, RUNNING UNDER DIAGNOSTIC MONITOR

			RH = RIGHT HALF OF CONSOLE SWITCHES IF UNDER
			     DIAGNOSTIC MONITOR CONTROL.

	B.  USER MODE

	    TO OUTPUT THE PRINTED ERROR MESSAGES TO A USER SPECIFIED
	    DEVICE IN USER MODE, ASSIGN THE DESIRED OUTPUT DEVICE TO
	    DEVICE NAME 'DEV' AND SET SWITCH 'PNTLPT'.  THE PHYSICAL
	    DEVICE USED CAN BE ANY DEVICE THAT CAN ACCEPT ASCII OUTPUT
	    FORMAT SUCH AS LPT, DSK, DTA, ETC.  THE CORRESPONDING 
	    OUTPUT FILE IS 'DAKAL.TMP'

	    EXAMPLE DEVICE ASSIGNMENT:

	    .ASSIGN DSK DEV

	    IN USER MODE THE PROGRAM WILL MAKE 1000(8) PASSES AND THEN
	    RETURN TO DIAMON COMMAND MODE.
	    
							MAINDEC-10-DAKAL.TXT
							PAGE 9

8.0	OPERATIONAL VARIATIONS (CON'T)

	THE OUTPUT FILE (IF USED) MAY THEN BE LISTED BY USING THE
	NORMAL MONITOR COMMANDS (PRINT, LIST, TYPE, PIP, ETC.).

	IF THE PROGRAM IS ABORTED BEFORE COMPLETION (BY ^C, ETC.) THE
	OUTPUT FILE MAY BE CLOSED BY USING THE MONITOR 'REENTER' 
	COMMAND.

	C.  SYSTEM EXERCISER

	    START ADDRESS IS 30003.  DATA SWITCHES ARE PRESTORED IN
	    'SWTEXR' LOC 30023.

9.0	MISCELLANEOUS

	THE NON-EX-MEMORY AND PARITY STOP SWITCHES SHOULD BE RESET 
	(0).  THESE ERRORS, ILLEGAL UUO'S AND OTHER ERRORS OF THIS
	TYPE ARE HANDLED BY PRINTOUT ON THE TELETYPE.

10.0	LISTING

DAKAL.HST

THIS IS A HISTORY OF THE DEVELOPMENT OF MAINDEC-10-DAKAL

************************************************************************

PRODUCT CODE:       MAINDEC-10-DAKAL

PRODUCT NAME:       BASIC INSTRUCTION DIAGNOSTIC #12

DATE RELEASED:      JANUARY 1977

VERSION:            0.2

UPDATE AUTHOR:      JOHN R. KIRCHOFF

CHANGES MADE:

    1. UPGRADE TO ALLOW COMPATABILITY WITH THE SUBROUTINE PACKAGE.

************************************************************************

ORIGINAL VERSION:   0.1

ORIGINAL AUTHOR:    RICHARD MALISKA

ORIGINAL RELEASE:   16-MAR-72

************************************************************************

DAKAL.MAC

[Download]

;ACCUMULATOR ASSIGNMENTS

;CONTROL WORDS

AROV=400000		;ARITHMETIC OVERFLOW
CRY0=200000		;CARRY 0
CRY1=100000		;CARRY 1
FOV=40000		;FLOATING OVERFLOW
BIS=20000		;BYTE INTERRUPT
USERF=10000		;USER MODE FLAG
EXIOT=4000		;USER PRIV I/O FLAG
FXU=100			;FLOATING UNDERFLOW
DCK=40			;DIVIDE CHECK

;DAKAL


	MCNVER==0
	DECVER==2


	XLIST
DEFINE	NAME	(MCNVER,DECVER)<

TITLE	DAKAL PDP-10  KI10 BASIC INSTRUCTION DIAGNOSTIC (12) MCNVER,DECVER
>
	LIST
	LALL

	NAME	\MCNVER,\DECVER

;(MULTIPY, INTERGER MULTIPLY, DIVIDE, INTERGER DIVIDE)

;COPYRIGHT 1975,1977
;DIGITAL EQUIPMENT CORPORATION
;MARLBORO, MASS. 01752

;JOHN R. KIRCHOFF

	LOC	137
	MCNVER,,DECVER

;	.DIRECTIVE	.OKOVL
	NOSYM
SUBTTL	DIAGNOSTIC PARAMETERS

;OPERATOR DEFINITIONS

OPDEF	ER1	[1B8]
OPDEF	ER2	[2B8]
OPDEF	ER3	[3B8]
OPDEF	ER4	[4B8]
OPDEF	ER5	[5B8]
OPDEF	ER6	[6B8]
OPDEF	ER7	[7B8]
OPDEF	ER10	[10B8]
OPDEF	ER11	[11B8]
OPDEF	ER12	[12B8]
OPDEF	ER13	[13B8]

LUUO1=ERRMES
LUUO2=ERRMES
LUUO3=ERRMES
LUUO4=ERRMES
LUUO5=ERRMES
LUUO6=ERRMES
LUUO7=ERRMES
LUUO10=ERRMES
LUUO11=ERRMES
LUUO12=ERRMES
LUUO13=ERRMES
;SUBROUTINE ASSEMBLY DEFINITIONS

DEBUG=40
EXCASB=1
USRASB=1
KA10=1
KLOLD==1
PGMEND=1
ERDIAG=1

;SPECIAL FEATURE DEFINITIONS

SADR1=BEGIN
SADR2=BEGIN
SADR3=BEGIN
SADR4=BEGIN
SADR5=JRST BEGIN
SADR6=JRST BEGIN
SADR7=JRST BEGIN
SADR8=JRST BEGIN
SADR9=JRST BEGIN
SADR10=JRST BEGIN
SADR11=JRST BEGIN

;SPECIAL FEATURE PARAMETERS

PAREA0=0
PAREA1=0
PAREA2=0
PAREA3=SIXBIT/DAKAL/
PAREA4=SIXBIT/TMP/
PAREA5=0
PAREA6=0
ITERAT==1000

;MACROS

DEFINE	SAVEAC	(A,B)<
	MOVEI	AC+2,.		;SAVE TEST PC
	MOVEM	AC+2,TESTPC
	MOVEI	AC+2,<AC+2>&17	;INFORM ERROR ROUTINE WHICH
	MOVEM	AC+2,ERRLOP#	;AC IS USED FOR ITERATION>
DEFINE	MOP1	(T,A1,A2,EE,R1,R2)<
;THIS MACRO INITIALIZES AC,AC+1 AND E WITH [A1],[A2] AND
;[EE] RESPECTIVELY, PERFORMS 'MUL AC,E' AND COMPARES AC,AC+1
;AND E AGAINST [R1], [R2] AND [EE] RESPECTIVELY.
;IF ANY OF THE ABOVE COMPARISONS FAIL, AN ERROR IS REPORTED

F'T'0:	AA1=A1				;INITIAL C(AC)
	MOVE	AC,[A1]			;PRELOAD AC (MULTIPLIER)
	AA2=A2				;INITIAL C(AC+1)
	MOVE	AC+1,[A2]		;PRELOAD AC+1
	AEE=EE				;INITIAL C(E)
	MOVE	E,[EE]			;PRELOAD E (MULTIPLICAND)
	MUL	AC,E			;*MULTIPLY C(E) BY C(AC)
	AR1=R1				;EXPECTED RESULT IN AC
	CAME	AC,[R1]			;IS HIGH PRODUCT CORRECT?
	ER3	AC,T'1		;HIGH PRODUCT FAILED
	AR2=R2				;EXPECTED RESULT IN AC+1
	CAME	AC+1,[R2]		;IS LOW PRODUCT CORRECT?
	ER4	AC+1,T'2		;LOW PRODUCT FAILED
	AEE=EE				;INITIAL C(E)
	CAME	E,[EE]			;WAS C(E) CLOBBERED?
	ER5	E,T'3			;C(E) WAS CLOBBERED
	JUMPL	AC+2,F'T'0		;LOOP ON ERROR SWITCH>

SUBTTL	DIAGNOSTIC SECTION

EXIT:	;DROPDV		;CLOSE LOGICAL OUTPUT FILE
	;EXIT

PGMNAM:	ASCIZ/
PDP-10  KI10 BASIC INSTRUCTION DIAGNOSTIC (12) [DAKAL]
/

TESTPC:	0		;SUBTEST PC

	LOC	30621

START:	;PGMINT
	;MOVE	[ASCIZ/AL/]
	;MOVEM	TLET		;INITIALIZE TEST LETTER

STARTA:	JRST	F00		;GO PERFORM DIAGNOSTIC
SUBTTL	MAIN TESTING

	ADR=3000
F00:	AC=14
	E=<AC-2>&17
	N1=525252525252
	N2=252525252525
	SAVEAC	(1,1)
	WW=^D36
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	WW=WW-1
	XX=XX+XX
	IFE	XX,<XX=1>

;MULTIPLY A FLOATING 1 BY 1010...101010
	V1=N1
	V2=N1*XX
	IFL	XX,<V3=N2+1>
	IFG	XX,<V3=<<-1B<WW>>!<N1_<-WW>>>>
	MOP1	(\ADR,V1,0,XX,V3,V2)>
	AC=14
	E=<AC-2>&17
	SAVEAC	(1,1)

	WW=^D36

	XX=0

	REPEAT	^D35,<	;LAST CASE DIFFERENT
	ADR=ADR+1
	WW=WW-1
	XX=XX+XX
	IFE	XX,<XX=1>

;MULTIPLY 0101...0101 BY A FLOATING 1
	V1=N2
	V2=N2*XX
	IFG	XX,<V3=<N2_<-WW>>>
	IFL	XX,<V3=N1+1>
	MOP1	(\ADR,XX,0,V1,V3,V2)>
	ADR=ADR+1
;MULTIPLY A 1010...1010 BY A 400000,,0
	XX=400000000000
	V1=252525252525

	MOP1	(\ADR,XX,0,V1,V1,0)
	AC=13
	E=<AC-2>&17
	SAVEAC	(1,1)
	WW=^D36
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	WW=WW-1
	XX=XX+XX
	IFE	XX,<XX=1>

;MULTIPLY A FLOATING 1 BY 0101...0101
	V1=N2
	V2=N2*XX
	IFG	XX,<V3=<N2_<-WW>>>
	IFL	XX,<V3=N1+1>
	MOP1	(\ADR,V1,0,XX,V3,V2)>
	AC=12
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	XX=XX+XX
	IFE	XX,<XX=1>

;MULTIPLY A FLOATING 1 BY ITSELF FOR A SQUARE PRODUCT
	V1=XX*XX
	IFG	XX,<V2=<<<XX_-22>*<XX_-22>>_1>>
	IFL	XX,<V2=XX*XX>
	MOP1	(\ADR,XX,-1,XX,V2,V1)>
	AC=11
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0

	REPEAT	^D36,<
	ADR=ADR+1
	XX=XX+XX+1
	IFE	<XX-1>,<XX=-2>

;MULTIPLY A FLOATING 0 BY ITSELF FOR A SQUARE PRODUCT
	V1=XX*XX
	IFE	<XX&1B1>,<V2A=1>
	IFN	<XX&1B1>,<V2A=0>
	IFL	XX,<V2=<<<<<-<XX+1>>_-22>*<<-<XX+1>>_-22>>_1>+V2A>>
	IFG	XX,<V2=XX-1>
	MOP1	(\ADR,XX,-1,XX,V2,V1)>
	AC=10
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0
	YY=0

	REPEAT	^D36,<
	ADR=ADR+1
	XX=XX+XX
	YY=YY+YY+1
	IFE	XX,<XX=1>
	IFE	<YY-1>,<YY=-2>

;MULTIPLY A FLOATING 1 BY A FLOATING 0
	V1=XX*YY
	IFE	<XX_-22>,<V2A=-1>
	IFN	<XX_-22>,<V2A=<<<<YY_-22>+<YY_22>>*<XX_-21>>+<XX_-21>-1>>
	IFG	XX,<V2=V2A>
	IFL	XX,<V2=XX+1>
	MOP1	(\ADR,YY,0,XX,V2,V1)>
	AC=7
	E=<AC-2>&17
	SAVEAC	(1,1)
	XX=0
	YY=0

	REPEAT	^D35,<	;LAST CASE DIFFERENT
	ADR=ADR+1
	XX=XX+XX
	YY=YY+YY+1
	IFE	XX,<XX=1>
	IFE	<YY-1>,<YY=-2>

;MULTIPLY A FLOATING 0 BY A FLOATING 1
	V1=XX*YY
	IFE	<XX_-22>,<V2A=-1>
	IFN	<XX_-22>,<V2A=<<<<YY_-22>+<YY_22>>*<XX_-21>>+<XX_-21>-1>>
	IFG	XX,<V2=V2A>
	IFL	XX,<V2=XX+1>
	MOP1	(\ADR,XX,0,YY,V2,V1)>
	ADR=ADR+1
;MULTIPLY A 400000,,0 BY A 377777,,-1
	YY=377777777777
	XX=400000000000

	MOP1	(\ADR,XX,0,YY,YY,0)
;MULTIPLIER = 2,4
;MULTIPLICAND = 377777 777777

	AC=14
	SAVEAC	(1,1)

SN=300
	XX=-1
	YY=2
	ZZ=1

F300:	REPEAT	^D2,<
SN=SN+1
	XX=XX+2
	YY=YY-2
	IFE	YY,<YY=377777777776>
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	HRLOI	AC-1,377777	;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY ZZ X 377777777777
	CAME	AC,[XX]		;TEST HIGH PROD
	ER3	AC,SN
	CAME	AC+1,[YY]	;TEST LOW PROD
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST MQ FINAL SHIFT
;MULTIPLIER = 200000 000000
;MULTIPLICAND = 5,7

	AC=7
	SAVEAC	(1,1)

SN=500
	XX=1
	ZZ=3

		;TEST MQSHRT FAILING
F500:	REPEAT	^D2,<
SN=SN+1
	XX=XX+1
	ZZ=ZZ+2
	MOVSI	AC-2,200000	;SETUP FOR COMPARISON
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MUL 200000 000000 X ZZ
	CAME	AC+1,AC-2	;TEST LOW PROD
	ER4	AC+1,SN
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	CAME	AC,AC-2		;TEST HIGH PROD
	ER3	AC,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 10,20
;MULTIPLICAND = 377777 777777

	AC=11
	SAVEAC	(1,1)

SN=700
	XX=-1
	ZZ=4

		;TEST ARSHRT FAILING
F700:	REPEAT	^D2,<
SN=SN+1
	XX=XX+10
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	HRLOI	AC-1,377777	;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MUL. ZZ X 377777 777777
	CAME	AC+1,[ZZ*377777777777]		;TEST LOW PROD
	ER4	AC+1,SN		;ARSHRT ASSERTED
	CAME	AC,[XX]		;TEST HIGH PROD = PLIER
	ER3	AC,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 0
;MULTIPLICAND = -15,-13

	AC=10
	SAVEAC	(1,1)

SN=1000
	ZZ=-17

		;TEST MQSHRT FAILING
F1000:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+2
	SETZ	AC,		;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY 0 X -ZZ
	SKIPE	AC+1		;TEST LOW PROD
	ER4	AC+1,SN
	SKIPE	AC		;TEST HIGH PROD
	ER3	AC,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
PAGE
;MULTIPLIER = -2,-4
;MULTIPLICAND = 0

	AC=7
	SAVEAC	(1,1)

SN=1100
	XX=0
	ZZ=-1

F1100:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	IFE	XX,<XX=-1>
	HRROI	AC,ZZ		;SETUP MULTIPLIER
	SETZ	AC-1,		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY ZZ X 0
	SKIPE	AC+1		;TEST LOW PROD
	ER4	AC+1,SN
	SKIPE	AC		;TEST HIGH PROD
	ER3	AC,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 2,4
;MULTIPLICAND = 5

	AC=14
	SAVEAC	(1,1)

SN=1400
	XX=5
	ZZ=1

	F1400:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	HRRZI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	MOVEI	AC-1,5		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY ZZ X 5
	CAME	AC+1,AC-2	;TEST LOW PROD
	ER4	AC+1,SN
	SETO	AC-2,		;SET FOR COMPARISON
	SKIPE	AC				;TEST HIGH PROD
	ER3	AC,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 200000 000000,100000 000000
;MULTIPLICAND = 25

	AC=11
	SAVEAC	(1,1)

SN=2000
	XX=377777
	YY=24
	ZZ=0

F2000:	REPEAT	^D2,<
SN=SN+1
	XX=XX/2
	YY=YY/2
	ZZ=ZZ/2
	IFE	ZZ,<ZZ=200000>
	MOVSI	AC-2,ZZ		;SETUP FOR COMPARISON
	MOVSI	AC,ZZ		;SETUP MULTIPLIER
	MOVEI	AC-1,25		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY ZZ X 25
	CAME	AC+1,AC-2	;TEST LOW PROD
	ER4	AC+1,SN
	MOVEI	AC-2,YY		;SET FOR COMPARISON
	CAME	AC,AC-2		;TEST HIGH PROD
	ER3	AC,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;INPUT ONE'S-
;MULTIPLIER = 400000 000000
;MULTIPLICAND = -20,-40

	AC=6
	SAVEAC	(1,1)

SN=2200
	ZZ=-10
	XX=10

F2200:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	XX=XX+XX
	MOVSI	AC,400000	;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MUL.400000 000000 X ZZ
	CAME	AC,[ZZ]		;TEST HI PRODUCT
	ER3	AC,SN
	CAME	<AC+1>&17,[1B0]	;TEST LO PROD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D7	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 10,20
;MULTIPLICAND = 4

	AC=5
	SAVEAC	(1,1)

SN=2400
	XX=20
	ZZ=4
F2400:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	MOVEI	AC-1,4		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY ZZ X 4
	CAME	AC+1,AC-2	;TEST LOW PROD
	ER4	AC+1,SN
	SKIPE	AC		;TEST HIGH PRODUCT
	ER3	AC,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 1,2
;MULTIPLICAND = 200000 000000,100000 000000

	AC=14
	SAVEAC	(1,1)

SN=3300
	XX=0
	ZZ=0

F3300:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ/2
	IFE	XX,<XX=1>
	IFE	ZZ,<ZZ=200000>
	MOVSI	AC-2,200000	;SETUP FOR COMPARISON
	SETO	AC+1,		;INITIALIZE AC+1
	MOVEI	AC,XX		;SETUP MULTIPLIER
	MOVSI	AC-1,ZZ		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY TWO VARIABLES
	SKIPE	AC		;TEST HIGH PROD
	ER3	AC,SN
	CAME	AC+1,AC-2	;TEST LOW PRODUCT
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;MUL
;MULTIPLIER = 400000 000000
;MULTIPLICAND = -1,-2

	AC=12
	SAVEAC

SN=4000
	XX=0
	ZZ=0

F4000:	REPEAT	^D2,<
SN=SN+1
	XX=XX+1
	ZZ=ZZ-1
	MOVSI	AC,400000	;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	MUL	AC,AC-1		;MULTIPLY TWO NEGATIVES
	CAME	AC,[ZZ]		;TEST HI PROD
	ER3	AC,SN
	CAME	<AC+1>&17,[1B0]	;TEST LO PROD
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST MUL-IMMEDIATE MODE
;TEST THE ABILITY TO MULTIPLY WITH
;EFFECTIVE ADDRESS AS MULTIPLICAND
;MULTIPLIER = 1
;MULTIPLICAND = E

SN=4200
	AC=11

		;TEST IMMEDIATE MODE
F4200:	REPEAT	^D2,<
SN=SN+1
	AC=AC-1
	SAVEAC	(1,1)		;SAVE AC FOR ITERATION
	MOVEI	AC-2,AC-1	;SETUP FOR COMPARISON
	MOVEI	AC,1		;SETUP MULTIPLIER
	HRROI	AC-1,-1		;SETUP AC-1
	MULI	AC,AC-1		;MULTIPLY 1 X E
	CAME	AC+1,AC-2	;TEST LOW PROD
	ER4	AC+1,SN		;MULTIPLIED BY C(E) VICE E
	SKIPE	AC		;TEST HIGH PROD
	ER3	AC,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST MUL-MEMORY MODE
;TEST SC(E), PRODUCT HIGH ORDER PART
;TEST ABILITY TO ASSERT SAC INH
;TEST ABILITY TO INHIBIT SAC2-PRODUCT LOW
;ORDER PART IS LOST
;MULTIPLIER = 200000 000000
;MULTIPLICAND = 2,4

	AC=7
	SAVEAC

SN=4300
	ZZ=1

		;TEST SCE
F4300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVSI	AC-2,200000	;SETUP FOR COMPARISON
	SETZM	AC+1		;SETUP AC+1
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	MULM	AC,AC-1		;MUL 200000 000000 X ZZ
	CAME	AC,AC-2		;TEST AC
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	SKIPE	AC+1		;TEST AC+1
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	CAIE	AC-1,ZZ/2	;TEST PRODUCT
	ER5	AC-1,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
PAGE
SN=4400
	ZZ=1

		;TEST SAC INH
F4400:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	MULM	AC,AC-1		;MUL 200000 000000 X ZZ
	TLNN	AC,200000	;TEST FOR ORIGINAL CONTENTS
	ER3	AC,SN
	JUMPL	AC+2,.-5	;LOOP ON ERROR SWITCH
>
PAGE
SN=4500
	ZZ=1

		;TEST SAC2 ASSERTED
F4500:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	SETZ	AC+1,		;CLEAR AC+1
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	MULM	AC,AC-1		;MUL 200000 000000 X ZZ
	SKIPE	AC+1		;TEST FOR ORIGINAL CONTENTS
	ER4	AC+1,SN
	JUMPL	AC+2,.-6	;LOOP ON ERROR SWITCH
>
;TEST MUL-BOTH MODE
;TEST ABILITY TO STORE PRODUCT HIGH ORDER
;PART IN AC,E
;TEST ABILITY TO STORE PRODUCT LOW ORDER
;PART IN AC+1
;MULTIPLIER = 200000 000000
;MULTIPLICAND = 5,7

	AC=6
	SAVEAC	(1,1)

SN=4600
	XX=1
	ZZ=3

F4600:	REPEAT	^D2,<
SN=SN+1
	XX=XX+1
	ZZ=ZZ+2
	MOVSI	AC-2,200000	;SETUP FOR COMPARISON
	SETZM	AC+1		;SETUP FOR COMPARISON
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	MULB	AC,AC-1		;MUL 200000 000000 X ZZ
	CAME	AC,AC-1		;TEST C(AC) = C (E)
	ER3	AC,SN		;SCE FAILED
	CAME	AC+1,AC-2	;TEST LOW PROD
	ER4	AC+1,SN
	CAIE	AC-1,XX		;TEST LOW PROD
	ER5	AC-1,SN
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;TEST AROV SET-MUL
;MULTIPLIER = 400000 000000
;MULTIPLICAND = 400000 000000
;PRODUCT = 400000 000000 400000 000000
;AROV IS SET

F4710:	JRSTF	@[.+1]		;CLEAR ALL FLAGS
	MOVSI	AC,400000	;SETUP MULTIPLIER
	MOVSI	AC-2,400000	;SETUP MULTIPLICAND
	MUL	AC,AC-2
	JSP	AC-3,.+1	;SAVE FLAGS
	CAME	AC,[1B0]	;TEST HIGH PRODUCT
	ER3	AC,4711
	CAME	AC+1,[1B0]	;TEST LOW PRODUCT
	ER4	AC+1,4711
	JOV	.+2		;TEST AROV
	ER13	AC-3,4711	;FAIL IF AROV NOT SET
	JUMPL	AC+2,F4710	;LOOP ON ERROR SWITCH

;TEST AROV SET-MULB
;MULTIPLIER = 400000 000000
;MULTIPLICAND = 400000 000000
;PRODUCT = 400000 000000 400000 000000
;AROV IS SET

F4720:	JRSTF	@[.+1]		;CLEAR ALL FLAGS
	MOVSI	AC,400000	;SETUP MULTIPLIER
	MOVSI	AC-2,400000	;SETUP MULTIPLICAND
	MULB	AC,AC-2
	JSP	AC-3,.+1	;SAVE FLAGS
	CAME	AC,[1B0]	;TEST HIGH PRODUCT
	ER3	AC,4721
	CAME	AC+1,[1B0]	;TEST LOW PRODUCT
	ER4	AC+1,4721
	CAME	AC-2,[1B0]	;TEST HIGH PRODUCT
	ER5	AC-2,4721
	JOV	.+2		;TEST AROV
	ER13	AC-3,4721	;FAIL IF AROV NOT SET
	JUMPL	AC+2,F4720	;LOOP ON ERROR SWITCH
SUBTTL	DIAGNOSTIC SECTION - INTEGER MPY TEST

;MULTIPLIER =400000 000000
;MULTIPLICAND = 2,4

	AC=10
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=5000
	ZZ=1

	F5000:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVSI	AC,400000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	IMUL	AC,AC-1		;MUL 400000 000000 X ZZ
	SKIPE	AC		;TEST PROD = 0
	ER3	AC,SN
	JUMPL	AC+2,.-5	;LOOP ON ERROR SWITCH
>
;TEST AROV SET
;TEST ABILITY TO SET AROV FLAG
;NUMBERS OF LIKE SIGNS ARE MULTIPLIED
;AND TESTED FOR OVERFLOW/OVERFLOW NOT
;NUMBERS OF UNLIKE SIGNS ARE MULTIPLIED
;AND TESTED FOR OVERFLOW NOT

	AC=14
	SAVEAC	(1,1)

SN=5100
	XX=200000
	ZZ=1

		;TEST 2 POSITS-OVERFLOW NOT
F5100:	REPEAT	^D2,<
SN=SN+1
	XX=XX+200000
	ZZ=ZZ+1
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	MOVEI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	IMUL	AC,AC-1		;MUL 000000 200000 X ZZ
	JSP	AC+1,.+1
	CAIE	AC,XX
	ER3	AC,SN
	JOV	.+2		;TEST FOR SET COND
	JRST	.+2		;FLAG IS NOT SET
	ER13	AC+1,SN		;FLAG IS SET
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
PAGE
SN=5200
	XX=40000
	ZZ=1

		;TEST 2 POSITS-OVERFLOW
F5200:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+1
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP MULTIPLICAND
	MOVSI	AC-2,XX&200000
	IMUL	AC,AC-1		;MUL 200000 000000 X ZZ
	JSP	AC+1,.+1
	CAME	AC,AC-2
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2		;TEST FOR SET CONDITION
	ER13	AC+1,SN		;FLAG DID NOT SET
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
SN=5300
	XX=1
	ZZ=0

		;TEST 2 NEGATS-OVERFLOW NOT
F5300:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ-1
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	HRROI	AC,-2		;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	IMUL	AC,AC-1		;MULTIPLY -2 X ZZ
	JSP	AC+1,.+1
	CAIE	AC,XX
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2		;TEST FOR SET NOT CONDITION
	JRST	,.+2		;FLAG NOT SET
	ER13	AC+1,SN		;FLAG IS SET
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
PAGE
SN=5400
	ZZ=-1

		;TEST 2 NEGATS-OVERFLOW
F5400:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ-1
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	MOVSI	AC,400000	;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	IMUL	AC,AC-1		;MUL 400000 000000 X ZZ
	JSP	AC+1,.+1
	CAME	AC,[1B0]	;TEST PROD
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2		;TEST FOR SET CONDITION
	ER13	AC+1,SN		;FLAG DID NOT SET
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
SN=5500
	XX=1000000
	ZZ=-1

		;TEST UNLIKE,OVERFLOW NOT
F5500:	REPEAT	^D2,<
SN=SN+1
	XX=XX/2
	ZZ=ZZ-1
	JRSTF	@[.+1]		;CLR ALL FLAGS,EXEC NEXT INST
	MOVEI	AC,200000	;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	HRROI	AC-2,XX
	IMUL	AC,AC-1		;MUL 000000 200000 X ZZ
	JSP	AC+1,.+1
	CAME	AC,AC-2
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2		;TEST FOR SET NOT COND
	JRST	,.+2		;FLAG NOT SET
	ER13	AC+1,SN		;FLAG IS SET
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;PLIER = -1
;PLICAND = 1,2

	AC=11
	SAVEAC	(1,1)

SN=5600
	XX=1000000
	ZZ=0

F5600:	REPEAT	^D2,<
SN=SN+1
	XX=XX-1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=1>
	JRSTF	@[.+1]		;CLR ALL FLAGS,EXEC NEXT INST
	SETO	AC,		;SETUP MULTIPLIER
	HRROI	AC-1,ZZ		;SETUP MULTIPLICAND
	IMUL	AC,AC-1		;MULTIPLY -1 X ZZ
	JSP	AC+1,.+1
	CAIE	AC,XX
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2
	JRST	,.+2
	ER13	AC+1,SN
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
PAGE
;MULTIPLIER = -1
;PLICAND = 200000 000000,200000 000010

	AC=13
	SAVEAC	(1,1)

SN=5700
	XX=600010
	ZZ=177770

F5700:	REPEAT	^D2,<
SN=SN+1
	XX=XX-10
	ZZ=ZZ+10
	JRSTF	@[.+1]		;CLR ALL FLAGS,EXEC NEXT INST
	SETO	AC,		;SETUP MULTIPLIER
	MOVSI	AC-1,ZZ		;SETUP MULTIPLICAND
	MOVSI	AC-2,XX
	IMUL	AC,AC-1		;MULTIPLY -1 X ZZ
	JSP	AC+1,.+1
	CAME	AC,AC-2
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2
	ER13	AC+1,SN
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;MULTIPLIER = 0,1
;MULTIPLICAND = 400000 000000

	AC=12
	SAVEAC	(1,1)

SN=6000
	XX=100000
	ZZ=-1

F6000:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+1
	JRSTF	@[.+1]		;CLR ALL FLAGS,EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	MOVSI	AC-1,400000	;SETUP MULTIPLICAND
	MOVSI	AC-2,XX&400000
	IMUL	AC,AC-1		;MUL ZZ X 400000 000000
	JSP	AC+1,.+1
	CAME	AC,AC-2
	ER3	AC,SN		;C(AC) FAILED
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2		;BOTH CLEARS ASSERTED
	ER13	AC+1,SN		;EITHER CLEAR FAILED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
PAGE
F6010:	JRSTF	@[.+1]		;CLEAR ALL FLAGS
	MOVSI	AC,200000	;SETUP MULTIPLIER
	MOVEI	AC-1,2		;SETUP MULTIPLICAND
	IMULB	AC,AC-1
	JSP	AC+1,.+1	;SAVE FLAGS
	CAIE	AC,0
	ER3	AC,6011		;C(AC) FAILED
	CAIE	AC-1,0
	ER5	AC-1,6011	;C(E) FAILED
	JOV	.+2
	ER13	AC+1,6011	;AROV DID NOT SET
	JUMPL	AC+2,F6010	;LOOP ON ERROR SWITCH
;TEST IMUL-IMMEDIATE MODE
;TEST ABILITY TO MULTIPLY WITH THE
;EFFECTIVE ADDRESS AS THE MULTIPLICAND
;THE PROD WILL EQUAL THE EFFECTIVE
;ADDRESS
;A FAILURE INDICATES MULTIPLYING
;BY C(E) VICE E

	AC=10
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=6100
	ZZ=1

		;TEST IMMEDIATE MODE
F6100:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC-2,AC-1	;SETUP FOR COMPARISON
	MOVEI	AC,1		;SETUP MULTIPLIER
	MOVEI	AC-1,ZZ		;SETUP AC-1
	IMULI	AC,AC-1		;EFFECTIVE ADDRESS=7
	CAME	AC,AC-2		;TEST PROD = ZZ
	ER3	AC,SN		;MULTIPLIED BY C(E) VICE E
	JUMPL	AC+2,.-6	;LOOP ON ERROR SWITCH
>
;TEST IMUL-MEMORY MODE

	AC=7
	SAVEAC	(1,1)

SN=6300
	ZZ=1

F6300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC-2,ZZ		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	MOVEI	AC-1,7		;SETUP MULTIPLICAND
	IMULM	AC,AC-1		;MULTIPLY ZZ X 7
	CAME	AC,AC-2		;TEST FOR PRODUCT IN AC
	ER3	AC,SN
	CAIE	AC-1,ZZ*7	;TEST FOR PROD IN E
	ER5	AC-1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST IMUL-BOTH MODE
;TEST ABILITY TO STORE PRODUCT IN AC,E
;AC, AC-1 ARE COMPARED FOLLOWING
;MULTIPLY
;AN ERROR WILL OCCUR IF AC DIFFERS FROM
;AC-1
	AC=6
	SAVEAC	(1,1)
SN=6500
	ZZ=4
		;TEST STORING AC,E
F6500:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP MULTIPLIER
	MOVEI	AC-1,2		;SETUP MULTIPLICAND
	IMULB	AC,AC-1		;MULTIPLY ZZ X 2
	CAME	AC,AC-1		;COMPARE AC,AC-1
	ER3	AC,SN
	JUMPL	AC+2,.-5	;LOOP ON ERROR SWITCH
>

SUBTTL	DIAGNOSTIC SECTION - INTEGER DIVIDE TEST

;TEST FETCH,STORE AND DECODE
;TEST ABILITY TO FETCH CONTENTS OF E
;TEST ABILITY TO STORE AC,AC+1
;DVND = 000000 777777,000000 777776
;DVSR = 000000 777777,000000 777776
;DVND = 000000 3400000
;DVSR = 2

	AC=7
	SAVEAC	(1,1)

SN=6600
	ZZ=0

		;TEST SAC,SAC2 FAILING
F6600:	REPEAT	^D2,<
SN=SN+1
	ZZ=<ZZ+ZZ>&777777
	IFE	ZZ,<ZZ=777777>
	JRSTF	@[.+1]		;CLR ALL FLGS,EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC+1,ZZ		;SETUP DVSR
	IDIV	AC,AC+1		;DIVIDE ZZ BY ZZ
	JSP	AC-3,.+1
	JOV	.+2		;TEST FOR OVFL
	JRST	.+2
	ER13	AC-3,SN
	CAIE	AC,1		;TEST AC FOR QUOTIENT = 1
	ER3	AC,SN
	CAIE	AC+1,0		;TEST AC+1 FOR REMAINDER = 0
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D13	;LOOP ON ERROR SWITCH
	JRSTF	@[.+1]		;CLEAR ALL FLAGS
>
PAGE
				;TEST FCE FAILING
F6700:	MOVEI	AC-2,160000	;SETUP FOR COMPARISON
	MOVEI	AC,340000	;SETUP DVND
	MOVEI	AC+1,2		;SETUP DVSR
	IDIV	AC,AC+1		;DIV 000000 340000 BY 2
	CAME	AC,AC-2		;TEST QUOT = 000000 020000
	ER3	AC,6701
	JUMPL	AC+2,F6700	;LOOP ON ERROR SWITCH
;DVND = 4,10
;DVSR = 2
;FAILURE RESULTS IN A QUOT = 0,
;A REMD = DVND (SIGN IS NEGATIVE)

	AC=7
	SAVEAC	(1,1)

SN=7000
	ZZ=2
F7000:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 2
	SKIPE	AC+1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST AROV SET
;DVND = 4,10
;DVSR = 0 (DIVIDE CHECK CONDITION)

	AC=14
	SAVEAC	(1,1)

SN=7100
	ZZ=2

		;TEST OVERFLOW COND
F7100:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	JRSTF	@[.+1]		;CLR ALL FLGS,EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC+1,ZZ
	SETZ	AC-1,		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY 0
	JSP	AC-3,.+1
	CAIE	AC,ZZ
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	CAIE	AC+1,ZZ
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	JOV	.+2		;TEST FOR OVERFLOW
	ER13	AC-3,.+1	;AROV FAILED TO SET
	TLNN	AC-3,DCK
	ER13	AC-3,SN		;DCK NOT SET
	JUMPL	AC+2,.-^D14	;LOOP ON ERROR SWITCH
>
PAGE
;DVND = 4,10
;DVSR = 4,10

	AC=11
	SAVEAC	(1,1)

SN=7400
	ZZ=2

F7400:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	JRSTF	@[.+1]		;CLR ALL FLGS, EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,ZZ		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY ZZ
	JSP	AC-2,.+1
	CAIE	AC,1
	ER3	AC,SN		;C(AC) FAILED
	CAIE	AC+1,0
	ER4	AC+1,SN		;C(AC+1) FAILED
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2
	ER13	AC-2,SN
	JUMPL	AC+2,.-^D12
>
;DVND = 2,4
;DVSR = 400000 000000

	AC=7
	SAVEAC	(1,1)

SN=7500
	ZZ=1

F7500:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	JRSTF	@[.+1]		;CLR ALL FLGS, EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP DVND
	MOVSI	AC-1,400000	;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY (-N)
	JSP	AC-2,.+1
	CAIE	AC,0
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	CAIE	AC+1,ZZ
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2
	ER13	AC-2,SN
	JUMPL	AC+2,.-^D12
>
PAGE
;DVND = 7,13
;DVSR = 2

	AC=6
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=7600
	ZZ=3

F7600:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+4
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY 2
	CAIE	AC,ZZ/2		;TEST QUOT
	ER3	AC,SN
	CAIE	AC+1,1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;DVND = 2,4
;DVSR = 2,4

	AC=5
	SAVEAC	(1,1)

SN=7700
	XX=0
	ZZ=1

F7700:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	IFE	XX,<XX=1>
	SETOM	AC+1		;INITIALIZE REMAINDER
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,ZZ		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY (ZZ)
	CAIE	AC,1		;TEST QUOT
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;DVND = 177777 777777,0777777 777777
;DVSR = 1

	AC=4
	SAVEAC	(1,1)

SN=10000
	ZZ=377777

F10000:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ/2
	HRLOI	AC-2,ZZ		;SETUP FOR COMPARISON
	HRLOI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,1		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 1
	CAME	AC,AC-2		;TEST QUOTIENT
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMAINDER
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST ABILITY TO SWAP REMD
;AND QUOT
;DVND = 5,13
;DVSR - 3
;FAILURE RESULTS IN A QUOT
;EQUAL TO THE REMD

	AC=14
	SAVEAC	(1,1)

SN=10300
	ZZ=-1

F10300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+6
	MOVEI	AC-2,2
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,3		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 3
	CAIE	AC,ZZ/3		;TEST QUOT
	ER3	AC,SN
	CAME	AC+1,AC-2	;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;DVND = 2,4
;DVSR = 1
;DVND = 377777 777777,177777 777777
;DVSR = 1

	AC=13
	SAVEAC	(1,1)

SN=10400
	ZZ=1

F10400:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,1		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 1
	CAIE	AC,ZZ		;TEST QUOT
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
PAGE
SN=10500
	ZZ=0

F10500:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ/2
	IFE	ZZ,<ZZ=377777>
	HRLOI	AC-2,ZZ		;SETUP FOR COMPARISON
	HRLOI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,1		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 1
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;DVND = 100
;DVSR = 2,4
;FAILURE RESULTS IN A QUOT = 252525 252525

	AC=4
	SAVEAC	(1,1)

SN=11300
	ZZ=1

F11300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC,100		;SETUP DVND
	MOVEI	AC-1,ZZ		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE 100 BY (ZZ)
	CAIE	AC,100/ZZ	;TEST QUOT
	ER3	AC,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;DVND = 4,10
;DVSR = -2
;FAILURE OF EITHER RESULTS IN A QUOT
;= 2'S COMP ACTUAL,A REMD = 0

	AC=11
	SAVEAC	(1,1)

SN=11400
	XX=-1
	ZZ=2

F11400:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	HRROI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP DVND
	HRROI	AC-1,-2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY -2
	SKIPE	AC+1		;TEST REMD = 0
	ER4	AC+1,SN
	CAME	AC,AC-2		;TEST QUOTIENT
	ER3	AC,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;DVND = 377777 777777,177777 777777
;DVSR = 2

	AC=12
	SAVEAC	(1,1)

SN=12000
	XX=377777
	ZZ=0

F12000:	REPEAT	^D2,<
SN=SN+1
	XX=XX/2
	ZZ=ZZ/2
	IFE	ZZ,<ZZ=377777>
	HRLOI	AC-2,XX		;SETUP FOR COMPARISON
	HRLOI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY 2
	CAIE	AC+1,1
	ER4	AC+1,SN
	CAME	AC,AC-2		;TEST QUOT = 1/2 DVND
	ER3	AC,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;DVND = 4,10
;DVSR = 400000 000000

SN=12300
	ZZ=2

F12300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP DVND
	MOVSI	AC-1,400000	;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (ZZ) BY (-N)
	SKIPE	AC		;TEST QUOT
	ER3	AC,SN
	CAIE	AC+1,ZZ		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;DVND = -40,-20
;DVSR = 2

	AC=6
	SAVEAC	(1,1)

SN=12600
	ZZ=-100

F12600:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ/2
	HRROI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 2
	CAME	AC,[ZZ/2]	;TEST QUOT = 0
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;DVND = -100,-40
;DVSR = 2

	AC=4
	SAVEAC	(1,1)

SN=13000
	ZZ=-200

F13000:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ/2
	HRROI	AC-2,ZZ/2	;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (-ZZ) BY 2
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;FAILURE RESULTS IN A QUOT AND
;REMD WHICH ARE THE TWO'S
;COMPLEMENT OF ACTUAL
;DVND = -7,-17
;DVSR = 4

	AC=14
	SAVEAC	(1,1)

SN=13200
	ZZ=1

F13200:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ-10
	HRROI	AC-2,ZZ/4	;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,4		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (-ZZ) BY 4
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN
	HRROI	AC-2,-3		;SETUP FOR COMPARISON
	CAME	AC+1,AC-2	;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;DVND = -77,-37
;DVSR = 2

	AC=13
	SAVEAC	(1,1)

SN=13300
	ZZ=-177

F13300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ/2
	HRROI	AC-2,-1		;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (-ZZ) BY 2
	CAME	AC+1,AC-2	;TEST REMD
	ER4	AC+1,SN
	HRROI	AC-2,ZZ/2	;SETUP FOR COMPARISON
	CAME	AC,AC-2		;TEST QUOTIENT
	ER3	AC,AC-2
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;DVND = -4,-10
;DVSR = 2

	AC=12
	SAVEAC	(1,1)

SN=13500
	ZZ=-2

F13500:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	HRROI	AC-2,ZZ/2	;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (-ZZ) BY 2
	CAME	AC,AC-2		;TEST QUOTIENT
	ER3	AC,SN
	SKIPE	AC+1		;TEST REMAINDER
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST IDIV- TWO NEGATIVES
;TEST ABILITY TO DIVIDE TWO
;NEGATIVE NUMBERS
;TEST EXERCISES MAJORITY
;OF IDIV LOGIC GATES
;DVND = -2,-4
;DVSR = -2,-4

	AC=7
	SAVEAC	(1,1)

SN=14000
	ZZ=-1

		;DIVIDE TWO NEGATIVES
F14000:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	HRROI	AC,ZZ		;SETUP DVND
	HRROI	AC-1,ZZ		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE (-ZZ) BY (-ZZ)
	CAIE	AC,1		;TEST QUOT (POSITIVE)
	ER3	AC,SN		;INCORRECT SIGN
	SKIPE	AC+1		;TEST REMAINDER
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST IDIV -IMMEDIATE MODE
;TEST ABILITY TO DIVIDE BY E VICE C(E)
;DVND = 2,4
;DVSR = E (C(E)=0)

SN=14100
	AC=12
	ZZ=1

		;TEST IDIV-IMM MODE
F14100:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	AC=AC-1
	SAVEAC	(1,1)		;SAVE ERROR AC
	JRSTF	@[.+1]		;CLR ALL FLGS, EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP DVND
	SETZ	AC-1,		;SETUP OVFL CONDITION
	IDIVI	AC,AC-1		;DIVIDE (ZZ) BY E
	JSP	AC-1,.+1
	CAIE	AC,0
	ER3	AC,SN		;C(AC) FAILED
	CAIE	AC+1,ZZ
	ER4	AC+1,SN		;C(AC+1) FAILED
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2		;DIVIDED (ZZ) BY E
	ER13	AC-1,SN		;DIVIDED (ZZ) BY C(E)
	JUMPL	AC+2,.-^D14	;LOOP ON ERROR SWITCH
>
PAGE
;TEST IDIV-MEMORY MODE
;DVND = 10,20
;DVSR = 2

	AC=14
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=14200
	ZZ=4

		;TEST IDIV-MEMORY MODE
F14200:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC+1,ZZ		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIVM	AC,AC-1		;DIVIDE (ZZ) BY 2
	CAME	AC,AC+1
	ER3	AC,SN
	CAIE	AC-1,ZZ/2	;TEST SCE
	ER5	AC-1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST IDIV-BOTH MODE
;TEST ABILITY TO STORE QUOT
;IN AC AND E
;TEST ABILITY TO STORE REMD
;IN AC+1

	AC=13
	SAVEAC	(1,1)

SN=14300
	ZZ=1

		;TEST IDIV-BOTH MODE
F14300:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+2
	SETZ	AC+1,		;CLEAR AC+1
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIVB	AC,AC-1		;DIVIDE (ZZ) BY 2
	CAME	AC,AC-1		;TEST QUOT (C(AC)=C(E))
	ER3	AC,SN		;STORE QUOTIENT FAILED
	CAIE	AC+1,1		;TEST REMD(=1)
	ER4	AC+1,SN		;STORE REMAINDER FAILED
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
PAGE
;TEST IDIV
;DVND = 400000000000
;DVSR = 2
;QUOT = 600000000000
;REMND = 0

	AC=13
	SAVEAC	(1,1)

	ZZ=400000
	XX=600000

F14400:	SETO	AC+1,		;INITIALIZE REMAINDER STORAGE
	MOVSI	AC-2,XX		;SET UP COMPARISON FOR QUOTIENT
	SETZ	AC-3,		;SET UP COMPARISON FOR REMAINDER
	MOVSI	AC,ZZ		;SET UP DIVIDEND
	MOVEI	AC-1,2		;SET UP DIVISOR
	IDIV	AC,AC-1		;DIVIDE 400000000000 BY 2
	CAME	AC,AC-2		;TEST QUOTIENT
	ER3	AC,14401	;STORE QUOTIENT FAILED
	CAME	AC+1,AC-3	;TEST REMAINDER
	ER4	AC+1,14401	;STORE REMAINDER FAILED
	JUMPL	AC+2,F14400	;LOOP ON ERROR SWITCH
;TEST IDIVB (DIVIDE CHECK)

F14410:	JRSTF	@[.+1]		;CLEAR ALL FLAGS
	MOVEI	AC,4		;SETUP DIVIDEND
	MOVEI	AC+1,4		;SETUP REMAINDER
	SETZ	AC-1,		;SETUP DIVISOR
	IDIVB	AC,AC-1
	JSP	AC-2,.+1	;SAVE FLAGS
	CAIE	AC,4
	ER3	AC,14411	;C(AC) WAS CLOBBERED
	CAIE	AC+1,4
	ER4	AC+1,14411	;C(AC+1) WAS CLOBBERED
	CAIE	AC-1,0
	ER5	AC-1,14411	;C(E) WAS CLOBBERED
	JOV	.+2
	ER13	AC-2,14411	;ARCV FAILED TO SET
	TLNN	AC-2,DCK
	ER13	AC-2,14411	;'DCK' FAILED TO SET
	JUMPL	AC+2,F14410	;LOOP ON ERROR SWITCH
SUBTTL	DIAGNOSTIC SECTION - FRACTIONAL DIVIDE TEST

;TEST FAC2 AND DECODE
;TEST OF ABILITY TO ASSERT IRDIV
;TEST ABILITY TO FETCH C(AC+1)

	AC=13
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=14500
	XX=4000000001
	ZZ=2

		;TEST FAC2 FAILING(IRDIV)
F14500:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX-1
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP HIGH DVND
	MOVEI	AC+1,200	;SETUP LOW DVND
	MOVEI	AC-1,200	;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE (N) BY 200
	CAME	AC,[XX]		;TEST BIT 35(1) (ODD QUOT)
	ER3	AC,SN
	SKIPE	<AC+1>&17	;TEST REMD = 0
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;HIGH DVND = 2,4
;LOW DVND = 0
;DVSR = 2,4

	AC=6
	SAVEAC	(1,1)

SN=14600
	ZZ=1

F14600:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	MOVEI	AC,ZZ		;SETUP HIGH DVND
	SETZ	AC+1,		;SETUP LOW DVND
	MOVEI	AC-1,ZZ		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE ZZ BY ZZ
	JSP	AC-2,.+1
	JOV	.+2		;TEST AROV FLAG
	ER13	AC-2,SN
	TLNN	AC-2,DCK
	ER13	AC-2,SN		;DCK FAILED TO SET
	CAIE	AC,ZZ		;EXAMINE QUOTIENT
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	SKIPE	<AC+1>&17	;EXAMINE REMAINDER
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	JUMPL	AC+2,.-^D14	;LOOP ON ERROR SWITCH
>
PAGE
;=2
;HIGH DVND = 4
;LOW DVND = 4
;DVSR = 10,20

	AC=5
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=14700
	ZZ=4

F14700:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC-2,4		;SETUP FOR COMPARISON
	MOVEI	AC,4		;SETUP HIGH DVND
	MOVEI	AC+1,4		;SETUP LOW DVND
	MOVEI	AC-1,ZZ		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE (N) BY ZZ
	CAME	AC+1,AC-2	;TEST REMD = 2
	ER4	AC+1,SN
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;HIGH DVND = -1
;LOW DVND = -4,-10
;DVSR = 2

	AC=13
	SAVEAC	(1,1)

SN=15000
	XX=-1
	ZZ=-2

F15000:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	HRROI	AC-2,XX		;SETUP FOR COMPARISON
	SETO	AC,		;SETUP HIGH DVND
	HRROI	AC+1,ZZ		;SETUP LOW DVND
	MOVEI	AC-1,2		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE ZZ BY 2
	SKIPE	AC+1		;TEST REMD = 0
	ER4	AC+1,SN
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;HIGH DVND = -1
;LOW DVND = 2,4
;DVSR = -2,-4

	AC=14
	SAVEAC	(1,1)

SN=15100
	XX=-1
	YY=377777
	ZZ=1

F15100:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	YY=YY/2
	ZZ=ZZ+ZZ
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	SETO	AC,		;SETUP HIGH DVND
	MOVEI	AC+1,ZZ		;SETUP LOW DVND
	HRROI	AC-1,XX		;SETUP DVSR
	HRLOI	AC-3,YY
	DIV	AC,AC-1		;DIVIDE (-N) BY (XX)
	JSP	AC-2,.+1
	CAME	AC,<AC-3>&17
	ER3	AC,SN		;C(AC) FAILED
	CAIE	AC+1,0
	ER4	AC+1,SN		;C(AC+1) FAILED
	JOV	.+2		;TEST AROV FLAG
	JRST	,.+2
	ER13	AC-2,SN		;AROV SET
	TLNE	AC-2,DCK
	ER13	AC-2,SN		;DCK SET
	JUMPL	AC+2,.-^D16	;LOOP ON ERROR SWITCH
>
;HIGH  DVND = -2,-4
;LOW DVND = -1
;DVSR = 2,4

	AC=12
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=15200
	XX=1
	YY=1B0
	ZZ=-1

F15200:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	YY=YY_-1
	ZZ=ZZ+ZZ
	HRROI	AC,ZZ		;SETUP HIGH DVND
	SETO	AC+1,		;SETUP LOW DVND
	MOVEI	AC-1,XX		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE (-N) BY (XX)
	CAME	AC,[1B0+YY]	;TEST FOR ODD NUMBER QUOTIENT
	ER3	AC,SN
	CAME	AC+1,[-1]	;TEST REMD
	ER4	AC+1,SN
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;OPERANDS SELECTED SHOULD RESULT
;IN OVERFLOW
;HIGH DVND = -100,-40
;LOW DVND = 0
;DVSR = 100,40

	AC=6
	SAVEAC	(1,1)

SN=15600
	WW=-200
	XX=200
	ZZ=-200

F15600:	REPEAT	^D2,<
SN=SN+1
	WW=WW/2
	XX=XX/2
	ZZ=ZZ/2
	JRSTF	@[.+1]		;CLR ALL FLAGS, EXEC NEXT INST
	HRROI	AC-2,WW		;SETUP AC-2 FOR COMPARISON
	HRROI	AC,ZZ		;SETUP HIGH DVND
	SETZ	AC+1,		;SETUP LOW DVND
	MOVEI	AC-1,XX		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE (-N) BY (N)
	JSP	AC-3,.+1
	JOV	.+2		;TEST FOR OVERFLOW
	ER13	AC-3,SN
	TLNN	AC-3,DCK
	ER13	AC-3,SN		;DCK NOT SET
	CAME	AC,AC-2		;TEST FOR UNIQUE QUOTIENT
	ER3	AC,SN
	CAIE	AC+1,0
	ER4	AC+1,SN		;C(AC+1) FAILED
	JUMPL	AC+2,.-^D16	;LOOP ON ERROR SWITCH
>
;OPERANDS SELECTED SHOULD RESULT IN OVERFLOW
;HIGH DVND = -2,-4
;LOW DVND = 0
;DVSR = 2

	AC=5
	SAVEAC	(1,1)

SN=15700
	XX=-1
	ZZ=-1

F15700:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	JRSTF	@[.+1]		;CLR ALL FLGS, EXEC NEXT INST
	HRROI	AC,ZZ		;SETUP HIGH DVND
	SETZ	AC+1,		;SETUP LOW DVND
	MOVEI	AC-1,2		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE (-N) BY 2
	JSP	AC-2,.+1
	JOV	.+2		;TEST FOR OVERFLOW
	ER13	AC-2,SN
	CAME	AC,[XX]		;TEST QUOT
	ER3	AC,SN
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
;OPERANDS SELECTED WILL NOT OVERFLOW
;HIGH DVND = -1,-2
;LOW DVND = -1
;DVSR = -1,-2

	AC=14
	SAVEAC	(1,1)

SN=16100
	ZZ=0

F16100:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=-1>
	JRSTF	@[.+1]		;CLR ALL FLGS, EXEC NEXT INST
	HRROI	AC,ZZ		;SETUP HIGH DVND
	SETO	AC+1,		;SETUP LOW DVND
	HRROI	AC-1,ZZ		;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE (-N) BY (-N)
	JSP	AC-3,.+1
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2
	ER13	AC-3,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;TEST DIV-IMMEDIATE MODE
;TEST ABILITY TO DIVIDE BY E
;VICE C(E)
;TEST ABILITY TO INHIBIT ASSERTION
;OF IRMDFCE

SN=16200
	AC=7
	ZZ=17

		;TEST DIV-IMM MODE
F16200:	REPEAT	^D2,<
SN=SN+1
	AC=AC-1
	ZZ=ZZ-1
	SAVEAC	(1,1)		;SAVE ERROR AC
	JRSTF	@[.+1]		;CLR ALL FLGS, EXEC NEXT INST
	MOVEI	AC,4		;SETUP HIGH DVND
	SETZ	AC+1,		;SETUP LOW DVND
	MOVEI	AC-1,2		;SETUP OVERFLOW CONDITION
	DIVI	AC,ZZ		;DIVIDE (N) BY E
	JSP	AC-3,.+1
	JOV	.+2		;TEST FOR OVERFLOW
	JRST	,.+2		;DIVIDED BY E
	ER13	AC-3,SN		;DIVIDED BY C(E)
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;TEST DIV-MEMORY MODE
;TEST ABILITY TO ASSERT IRMDSCE
;TEST ABILITY TO ASSERT IRMDSACINH

	AC=5
	SAVEAC	(1,1)
	JRSTF	@[.+1]		;CLEAR ALL FLAGS

SN=16300
	XX=10000
	ZZ=2

		;TEST DIV-MEM MODE
F16300:	REPEAT	^D2,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	MOVSI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP HIGH DVND
	MOVEI	AC+1,ZZ		;SETUP LOW DVND
	MOVEI	AC-1,100	;SETUP DVSR
	DIVM	AC,AC-1		;DIVIDE (+N) BY 100
	CAME	AC-1,AC-2	;TEST SCE
	ER5	AC-1,SN
	CAME	AC,AC+1		;TEST SAC INH
	ER3	AC,SN
	JUMPL	AC+2,.-^D9	;LOOP ON ERROR SWITCH
>
;TEST DIV-BOTH MODE
;TEST ABILITY TO STORE QUOT
;IN AC,E
;TEST ABILITY TO STORE REMD
;IN AC+1

	AC=14
	SAVEAC	(1,1)

SN=16400
	ZZ=2

		;TEST DIV-BOTH MODE
F16400:	REPEAT	^D2,<
SN=SN+1
	ZZ=ZZ+ZZ
	MOVEI	AC,ZZ		;SETUP HIGH DVND
	MOVEI	AC+1,100	;SETUP LOW DVND
	MOVEI	AC-1,100	;SETUP DVSR
	DIVB	AC,AC-1		;DIVIDE (+N) BY 100
	CAME	AC,AC-1		;TEST STORE QUOTIENT
	ER3	AC,SN		;STORE QUOTIENT FAILED
	SKIPE	AC+1		;TEST STORE REMAINDER
	ER4	AC+1,SN		;STORE REMAINDER FAILED
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
PAGE
;TEST DIVB (DIVIDE CHECK)

F16410:	JRSTF	@[.+1]		;CLEAR ALL FLAGS
	MOVEI	AC,4		;SETUP HIGH DIVIDEND
	MOVEI	AC+1,1		;SETUP LOW DIVIDEND
	MOVEI	AC-1,1		;SETUP DIVISOR
	DIVB	AC,AC-1
	JSP	AC-2,.+1	;SAME FLAGS
	CAIE	AC,4
	ER3	AC,16411	;C(AC) WAS CLOBBERED
	CAIE	AC+1,1
	ER4	AC+1,16411	;C(AC+1) WAS CLOBBERED
	CAIE	AC-1,1
	ER5	AC-1,16411	;C(E) WAS CLOBBERED
	JOV	.+2
	ER13	AC-2,16411	;AROV FAILED TO SET
	TLNN	AC-2,DCK	;DCK FAILED TO SET
	ER13	AC-2,16411
	JUMPL	AC+2,F16410

SUBTTL	DIAGNOSTIC SECTION - GENERAL MPY/DIV TEST

;TEST MUL DIRECT - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;0500000000000 BY A DECREASING MULTIPLIER
;PLIER=200000000000, 100000000000 (1/2, 1/4) ETC
;PLICAND=050000000000
;HIGH PROD=024000000000, 012000000000 ETC
;LOW PROD=0

	AC=13
	SAVEAC	(1,1)

SN=17100
	XX=050000
	ZZ=0

F17100:	REPEAT	^D10,<
SN=SN+1
	XX=XX/2
	ZZ=ZZ/2
	IFE	ZZ,<ZZ=200000>
	MOVSI	AC-2,XX		;SETUP FOR COMPARISON
	MOVSI	AC,ZZ		;SETUP PLIER
	MOVSI	AC-1,050000	;SETUP PLICAND
	MUL	AC,AC-1		;MULTIPLY ZZ X 050000000000
	SKIPE	AC+1		;TEST LOW PROD=0
	ER4	AC+1,SN
	CAME	AC,AC-2		;TEST HIGH PROD=XX
	ER3	AC,SN		;MUL FAILED
	CAME	AC-1,[050000,,0];WAS C(E) MODIFIED ?
	ER5	AC-1,SN		;C(E) WAS CLOBBERED
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
;TEST MUL IMMEDIATE - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;E BY AND DECREASING MULTIPLIER
;PLIER=200000000000, 100000000000 (1/2, 1/4) ETC
;PLICAND=E (005001)
;HIGH PROD=2400,1200,500,240,120
;LOW PROD=PLIER

	AC=12
	SAVEAC	(1,1)

SN=17200
	XX=005000
	ZZ=0

F17200:	REPEAT	^D5,<
SN=SN+1
	XX=XX/2
	ZZ=ZZ/2
	IFE	ZZ,<ZZ=200000>
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVSI	AC,ZZ		;SETUP PLIER
	MULI	AC,005001	;MULTIPLY E BY ZZ
	CAME	AC,AC-2		;TEST HIGH PROD=XX
	ER3	AC,SN		;HIGH PROD ERROR
	MOVSI	AC-2,ZZ		;SETUP FOR COMPARISON
	CAME	AC+1,AC-2	;TEST LOW PROD=PLIER
	ER4	AC+1,SN		;LOW PROD ERROR
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST MUL MEMORY - TWO NEGATIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;AN INCREASING NEGATIVE NUMBER BY -1
;PLIER=-1
;PLICAND=-1,-2,-4,-10,-20
;HIGH PROD=0

	AC=11
	SAVEAC	(1,1)

SN=17300
	ZZ=0

F17300:	REPEAT	^D5,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=-1>
	SETO	AC,		;SETUP PLIER
	HRROI	AC-1,ZZ		;SETUP PLICAND
	MULM	AC,AC-1		;MULTIPLY ZZ BY -1
	SKIPE	AC-1		;TEST HIGH PROD = 0
	ER5	AC,SN		;MULM FAILED
	JUMPL	AC+2,.-5	;LOOP ON ERROR SWITCH
>
;TEST MUL BOTH - TWO NEGATIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;-1 BY AN INCREASING NEGATIVE NUMBER
;PLIER=-1,-2,-4,-10,-20
;PLICAND=-1
;HIGH PROD=0
;LOW PROD=1,2,4,10,20

	AC=10
	SAVEAC	(1,1)

SN=17400
	XX=0
	ZZ=0

F17400:	REPEAT	^D5,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	IFE	XX,<XX=1>
	IFE	ZZ,<ZZ=-1>
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP PLIER
	SETO	AC-1,		;SETUP PLICAND
	MULB	AC,AC-1		;MULTIPLY -1 BY ZZ
	SKIPE	AC		;TEST HIGH PROD=0
	ER3	AC,SN
	SKIPE	AC-1		;TEST C(AC) = C(E)
	ER5	AC-1,SN
	CAME	AC+1,AC-2	;TEST LOW PROD=XX
	ER4	AC+1,SN		;MULB FAILED
	JUMPL	AC+2,.-^D10	;LOOP ON ERR SWITCH
>
;TEST MUL MEMORY - TWO NEGATIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;-5001 BY AN INCREASING NEGATIVE PLIER
;PLIER=600000000000, 700000000000 ETC.
;PLICAND=-5001
;HIGH PROD=2400,1200,500,240,120

	AC=7
	SAVEAC	(1,1)

SN=17500
	XX=005000
	ZZ=0

F17500:	REPEAT	^D5,<
SN=SN+1
	XX=XX/2
	ZZ=ZZ/2
	IFE	ZZ,<ZZ=-200000>
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVSI	AC,ZZ		;SETUP PLIER
	HRROI	AC-1,-5001	;SETUP PLICAND
	MOVE	AC-3,<AC+1>&17	;SAVE C(AC+1)
	MULM	AC,AC-1		;MULTIPLY ZZ X -5001
	CAME	AC-1,AC-2	;TEST HIGH PROD = XX
	ER5	AC-1,SN		;MULM FAILED
	CAME	AC,[ZZ,,0]	;WAS C(AC) MODIFIED ?
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	CAME	AC+1,<AC-3>&17	;WAS C(AC+1) MODIFIED ?
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>

;TEST IMUL DIRECT - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;A NUMBER BY ITSELF
;PLIER=2,4,10,20,40
;PLICAND=2,4,10,20,40
;PROD=4,20,100,400,2000

	AC=6
	SAVEAC	(1,1)

SN=17600
	XX=1
	ZZ=1

F17600:	REPEAT	^D5,<
SN=SN+1
	XX=XX*4
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=-200000>
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP PLIER
	MOVEI	AC-1,ZZ		;SETUP PLICAND
	IMUL	AC,AC-1		;MULTIPLY ZZ BY ZZ
	CAME	AC,AC-2		;TEST PROD=XX
	ER3	AC,SN		;IMUL FAILED
	CAIE	AC-1,ZZ		;WAS C(E) MODIFIED ?
	ER5	AC-1,SN		;C(E) WAS CLOBBERED
	JUMPL	AC+2,.-^D8	;LOOP ON ERROR SWITCH
>
;TEST IMUL IMMEDIATE - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;3 X E
;PLIER=3
;PLICAND=E
;PROD=6,11,14,17,22

	AC=5
	SAVEAC	(1,1)

SN=17700
	XX=3
	ZZ=1

F17700:	REPEAT	^D5,<
SN=SN+1
	XX=XX+3
	ZZ=ZZ+1
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,3		;SETUP PLIER
	IMULI	AC,ZZ		;MULTIPLY 3 X E
	CAME	AC,AC-2		;TEST PROD = XX
	ER3	AC,SN		;IMULI FAILED
	JUMPL	AC+2,.-5	;LOOP ON ERROR SWITCH
>
;TEST IMUL MEMORY - TWO NEGATIVES
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;A NEGATIVE NUMBER BY ITSELF
;PLIER=-2,-4,-10,-20,-40
;PLICAND=-2,-4,-10,-20,-40
;PROD=4,20,100,400,2000

	AC=4
	SAVEAC	(1,1)

SN=20000
	XX=1
	ZZ=-1

F20000:	REPEAT	^D5,<
SN=SN+1
	XX=XX*4
	ZZ=ZZ+ZZ
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP PLIER
	HRROI	AC-1,ZZ		;SETUP PLICAND
	MOVE	AC-3,<AC+1>&17	;SAVE C(AC+1)
	IMULM	AC,AC-1		;MULTIPLY ZZ BY ZZ
	CAME	AC-1,AC-2	;TEST PROD=XX
	ER5	AC-1,SN		;IMULM FAILED
	CAME	AC,[-1,,ZZ]	;WAS C(AC) MODIFIED ?
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	CAME	AC+1,<AC-3>&17	;WAS C(AC+1) MODIFIED ?
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;TEST IMUL BOTH - MULTIPLY BY 0
;TESTING IS ACCOMPLISHED BY MULTIPLYING
;A NEGATIVE NUMBER BY 0
;PLIER=0
;PLICAND=-1,-2,-4,-10,-20
;PROD=0

	AC=5
	SAVEAC	(1,1)

SN=20100
	ZZ=0

F20100:	REPEAT	^D5,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=-1>
	SETZ	AC,		;SETUP PLIER
	HRROI	AC-1,ZZ		;SETUP PLICAND
	IMULB	AC,AC-1		;MULTIPLY ZZ BY 0
	SKIPE	AC		;TEST PROD=0
	ER3	AC,SN
	SKIPE	AC-1		;TEST C(AC) = C(E)
	ER5	AC-1,SN		;IMULB FAILED
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST IDIV DIRECT - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY
;DIVIDING A NUMBER BY ITSELF
;DVND=1,2,4, ETC
;DVSR=1,2,4, ETC
;AN ERROR WILL OCCUR IF QUOT
;DIFFERS FROM 1
;AN ERROR WILL OCCUR IF REMD
;DIFFERS FROM 0

	AC=5
	SAVEAC	(1,1)

SN=20200
	ZZ=0

F20200:	REPEAT	^D18,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=1>
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,ZZ		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY ZZ
	CAIE	AC,1		;TEST QUOT=1
	ER3	AC,SN
	JUMPE	AC+1,.+2	;TEST REMD=0
	ER4	AC+1,SN		;IDIV FAILED
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
SN=20300
	ZZ=0

F20300:	REPEAT	^D17,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=1>
	MOVSI	AC,ZZ		;SETUP DVND
	MOVSI	AC-1,ZZ		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY ZZ
	CAIE	AC,1		;TEST QUOT=1
	ER3	AC,SN
	JUMPE	AC+1,.+2	;TEST REMD=0
	ER4	AC+1,SN		;IDIV FAILED
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST IDIV DIRECT - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY
;DIVIDING AN EVEN NUMBER BY 1
;DVND=1,2,4 ETC
;DVSR=1
;AN ERROR WILL OCCUR IF QUOT
;DIFFERS FROM DVND
;AN ERROR WILL OCCUR IF REMD
;DIFFERS FROM 0

	AC=13
	SAVEAC	(1,1)

SN=20400
	ZZ=0

F20400:	REPEAT	^D18,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=1>
	MOVEI	AC-2,ZZ		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,1		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 1
	CAME	AC,AC-2		;TEST QUOT=DVND
	ER3	AC,SN
	JUMPE	AC+1,.+2	;TEST REMD=0
	ER4	AC+1,SN		;IDIV FAILED
	CAIE	AC-1,1		;WAS C(E) MODIFIED ?
	ER5	AC-1,SN		;C(E) WAS CLOBBERED
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
SN=20500
	ZZ=0

F20500:	REPEAT	^D17,<
SN=SN+1
	ZZ=ZZ+ZZ
	IFE	ZZ,<ZZ=1>
	MOVSI	AC-2,ZZ		;SETUP FOR COMPARISON
	MOVSI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,1		;SETUP DVSR
	IDIV	AC,AC-1		;DIVIDE ZZ BY 1
	CAME	AC,AC-2		;TEST QUOT=DVND
	ER3	AC,SN
	JUMPE	AC+1,.+2	;TEST REMD=0
	ER4	AC+1,SN		;IDIV FAILED
	CAIE	AC-1,1		;WAS C(E) MODIFIED ?
	ER5	AC-1,SN		;C(E) WAS CLOBBERED
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
;TEST IDIV IMMEDIATE - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY DIVIDING
;AN ODD NUMBER BY E
;DVND=3,5,7,11 ETC
;DVSR=E (2)
;QUOT=1,2,4, ETC
;REMD=1

	AC=14
	SAVEAC	(1,1)

SN=20600
	XX=0
	ZZ=1

F20600:	REPEAT	^D10,<
SN=SN+1
	XX=XX+1
	ZZ=ZZ+2
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP DVND
	IDIVI	AC,2		;DIVIDE ZZ BY 2
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN
	CAIE	AC+1,1		;TEST REMD=1
	ER4	AC+1,SN		;IDIVI FAILED
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST IDIV MEMORY - TWO NEGATIVES
;TESTING IS ACCOMPLISHED BY DIVIDING
;A NEGATIVE NUMBER BY -1
;DVND=-1,-2,-4,-10,-20
;DVSR=-1
;QUOT=1,2,4,10,20
;REMD=0

	AC=12
	SAVEAC	(1,1)

SN=20700
	XX=0
	ZZ=0

F20700:	REPEAT	^D5,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	IFE	XX,<XX=1>
	IFE	ZZ,<ZZ=-1>
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP DVND
	SETO	AC-1,		;SETUP DVSR
	MOVE	AC-3,<AC+1>&17	;SAVE C(AC+1)
	IDIVM	AC,AC-1		;DIVIDE ZZ BY -1
	CAME	AC-1,AC-2	;TEST QUOT
	ER5	AC-1,SN		;IDIVM FAILED
	CAME	AC,[-1,,ZZ]	;WAS C(AC) MODIFIED ?
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	CAME	AC+1,<AC-3>&17	;WAS C(AC+1) ALTERED ?
	ER4	AC+1,SN		;C(AC+1] WAS CLOBBERED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;TEST IDIV BOTH - TWO POSITIVES
;TESTING IS ACCOMPLISHED BY DIVIDING
;AN INCREASING ODD NUMBER BY 2
;DVND=15,17,21,23,25
;DVSR=2
;QUOT=6,7,10,11,12
;REMD=1

	AC=11
	SAVEAC	(1,1)

SN=21000
	XX=5
	ZZ=13

F21000:	REPEAT	^D5,<
SN=SN+1
	XX=XX+1
	ZZ=ZZ+2
	MOVEI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP DVND
	MOVEI	AC-1,2		;SETUP DVSR
	IDIVB	AC,AC-1		;DIVIDE ZZ BY 2
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN		;QUOT ERROR
	CAME	AC,AC-1		;C(AC) = C(E)
	ER5	AC-1,SN
	CAIE	AC+1,1		;TEST REMD=1
	ER4	AC+1,SN		;IDIVB FAILED
	JUMPL	AC+2,.-^D10	;LOOP ON ERROR SWITCH
>
;TEST DIV DIRECT - TWO POSITIVES
;HIGH DVND=4,10,20,40,100
;LOW DVND=0
;DVSR=2000
;QUOT=001000000000, 00200000000 ETC
;REMD=0

	AC=10
	SAVEAC	(1,1)

SN=21100
	XX=000400
	ZZ=2

F21100:	REPEAT	^D5,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	MOVSI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP HIGH DVND
	SETZ	AC+1,		;SETUP LOW DVND
	MOVEI	AC-1,2000	;SETUP DVSR
	DIV	AC,AC-1		;DIVIDE ZZ BY 2000
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN
	JUMPE	AC+1,.+2	;TEST REMD
	ER4	AC+1,SN		;DIV FAILED
	CAIE	AC-1,2000	;WAS C(E) MODIFIED ?
	ER5	AC-1,SN		;C(E) WAS CLOBBERED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;TEST DIV IMMEDIATE - TWO POSITIVES
;HIGH DVND=0
;LOW DVND=3,4,5,6,7
;DVSR=E (2,3,4,5,6)
;QUOT=1
;REMD=1

	AC=7
	SAVEAC	(1,1)

SN=21200
	XX=1
	ZZ=2
F21200:	REPEAT	^D5,<
SN=SN+1
	XX=XX+1
	ZZ=ZZ+1
	SETZ	AC,		;SETUP HIGH DVND
	MOVEI	AC+1,ZZ		;SETUP LOW DVND
	DIVI	AC,XX		;SETUP DVSR
	CAIE	AC,1		;TEST QUOT=1
	ER3	AC,SN
	CAIE	AC+1,1		;TEST QUOT=REMD
	ER4	AC+1,SN		;DIVI FAILED
	JUMPL	AC+2,.-7	;LOOP ON ERROR SWITCH
>
;TEST DIV MEMORY - TWO NEGATIVES
;HI DVND = -2,-4,-10,-20,-40
;LO DVND=0
;DVSR=-200
;QUOT=00400000000, 010000000000 ETC
;REMD=0

	AC=6
	SAVEAC	(1,1)

SN=21300
	XX=002000
	ZZ=-1

F21300:	REPEAT	^D5,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	MOVSI	AC-2,XX		;SETUP FOR COMPARISON
	HRROI	AC,ZZ		;SETUP HIGH DVND
	SETZ	AC+1,		;SETUP LOW DVND
	HRROI	AC-1,-200	;SETUP DVSR
	DIVM	AC,AC-1		;DIVIDE ZZ BY -200
	CAME	AC-1,AC-2	;TEST QUOT
	ER5	AC-1,SN		;DIVM FAILED
	CAME	AC,[-1,,ZZ]	;WAS C(AC) MODIFIED ?
	ER3	AC,SN		;C(AC) WAS CLOBBERED
	SKIPE	<AC+1>&17	;WAS C(AC+1) MODIFIED ?
	ER4	AC+1,SN		;C(AC+1) WAS CLOBBERED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>
;TEST DIV BOTH - TWO POSITIVES
;HIGH DVND 2,4,10,20,40
;LOW DVND 2,4,10,20,40
;DVSR=200
;QUOT=00400000000, 010000000000 ETC
;REMD=2,4,10,20,40

	AC=5
	SAVEAC	(1,1)

SN=21400
	XX=002000
	ZZ=1

F21400:	REPEAT	^D5,<
SN=SN+1
	XX=XX+XX
	ZZ=ZZ+ZZ
	MOVSI	AC-2,XX		;SETUP FOR COMPARISON
	MOVEI	AC,ZZ		;SETUP HIGH DVND
	MOVEI	AC+1,ZZ		;SETUP LOW DVND
	MOVEI	AC-1,200	;SETUP DVSR
	DIVB	AC,AC-1		;DIVIDE ZZ BY 200
	CAME	AC,AC-2		;TEST QUOT
	ER3	AC,SN		;QUOT ERROR
	CAME	AC-1,AC-2	;TEST C(AC) = C(E)
	ER5	AC-1,SN
	CAIE	AC+1,ZZ		;TEST REMD
	ER4	AC+1,SN		;DIVB FAILED
	JUMPL	AC+2,.-^D11	;LOOP ON ERROR SWITCH
>

LAST1:	;JRST	BEGEND		;REPEAT DIAGNOSTIC

	END	START