Trailing-Edge
-
PDP-10 Archives
-
klad_sources
-
klad.sources/mcode0.mac
There are no other files named mcode0.mac in the archive.
EDIT=0
VERSION=1
XLIST
DEFINE NAME (VSN,EDT),<
LALL
LIST
TITLE MCODE0 - DX20 MICRO-PROCESSOR DIAGNOSTIC VERSION EDT','VSN
>
NAME \VERSION,\EDIT
COMMENT ^
MCODE0 IS A MICRO-CODE DIAGNOSTIC OF THE DX20 MICRO-PROCESSOR.
THIS MICRO-DIAGNOSTIC IS THE FIRST PROGRAM OF ANY SIGNIFICANT SIZE
TO BE RUN BY THE DX20 MICRO-PROCESSOR. IT'S PURPOSE IS TO ESTABLISH
CONFIDENCE IN THE RELIABILITY OF THE MICRO-PROCESSOR.
THIS TEST IS NOT DESIGNED TO FIND ANY HARDWARE FAULTS IN THE DX20 EXCEPT
IN THE AREAS OF TIMING AND INSTRUCTION INTERACTION. ALL INSTRUCTIONS
HAVE BEEN FUNCTIONALLY TESTED PRIOR TO THE RUNNING OF THIS MICRO-
DIAGNOSTIC.
THIS MICRO-DIAGNOSTIC IS COMPOSED OF SEVERAL ROUTINES WHICH EXECUTE A
A SIMPLE PLAY ON NUMBERS AND THEN CHECK THE RESULT. THE INDIVIDUAL
ROUTINES WERE KEPT SIMPLE SO THAT THE FUNCTION UNDER TEST CAN BE
EASILY IDENTIFIED.
SINCE NO METHOD OF HALTING THE MICRO-PROCESSOR IS PROVIDED IN HARDWARE,
THE FOLLOWING METHOD OF HALTING HAS BEEN IMPLEMENTED FOR THIS TEST:
AC7 HAS BEEN LOADED WITH ALL ZEROS, INCLUDING THE PARITY
BIT (EVEN PARITY).
THE INSTRUCTION <MOV AC7> IS EXECUTED TO READ AC7, DETECT THE
BAD (EVEN) PARITY AND HALT.
THE MICRO-PROCESSOR HALTS WITH THE <MOV AC7> INSTRUCTION IN THE
IR, ALU A-INPUT PARITY ERROR BIT SET IN DRIVE REGISTER 37
(DXDR7) AND THE PC CONTAINING ONE GREATER THAN THE ADDRESS OF
THE CRAM LOCATION CONTAINING THE INSTRUCTION.
E.G. IF A <MOV AC7> INSTRUCTION IS EXECUTED FROM CRAM LOCATION 2
THE MICRO-PROCESSOR WILL STOP WITH:
PC CONTAINING 0003 ;HALT ADDRESS +1
IR CONTAINING 060170 ;MOV AC7
DXDR7 CONTAINING 004000 ;ALU A-INPUT PARITY ERROR
THESE HALT INSTRUCTIONS <MOV AC7> ARE SCATTERED THROUGHOUT THE CRAM.
A CONDITIONAL JUMP INSTRUCTION NORMALLY PRECEEDS THE HALT SO THAT IF
THE CODE IS BEING EXECUTED PROPERLY THE HALT INSTRUCTION SHOULD NOT
BE EXECUTED. THE HALT INSTRUCTIONS HAVE BEEN INDENTED 2 PLACES TO
INDICATE THE INSTRUCTION IS NOT NORMALLY EXECUTED.
E.G. JMPZ .+2 ;SKIP OVER HALT IF Z IS SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 0 ;LOAD ZEROS INTO BR
IF THE Z BIT IS SET, THE <JMPZ .+2> INSTRUCTION WILL CAUSE THE
<LDBR 0> INSTRUCTION TO BE EXECUTED NEXT. (THE <MOV AC7>
INSTRUCTION TO BE SKIPPED.)
ONLY ONE <MOV AC7> INSTRUCTION SHOULD BE EXECUTED NORMALLY. THIS
INSTRUCTION IS IN CRAM LOCATION 3776. THE SUCCESSFUL COMPLETION OF
THIS TEST IS INDICATED BY THE MICRO-PROCESSOR HALTING ON AN ALU A-INPUT
PARITY ERROR WITH THE PC CONTAINING 3777.
IF THE MICRO-PROCESSOR HALTS FOR ANY REASON OTHER THAN BECAUSE IT
EXECUTED THE HALT INSTRUCTION IN LOCATION 3776, AN ERROR IS REPORTED.
LOOPING ON ERROR WILL CAUSE THE MICRO-PROCESSOR TO BE RESTARTED AT
CRAM LOCATION 1. THE ERROR REPORT SHOULD BE ANALYZED TO DETERMINE THE
PC AT THE TIME OF THE HALT AND THE REASON FOR THE HALT:
FROM DRIVE REGISTER 37 (DXDR7):
ALU A-INPUT PARITY ERROR
ALU B-INPUT PARITY ERROR
IR PARITY ERROR
STACK OVER/UNDER FLOW ERROR
FROM DRIVE REGISTER 2 (DXERR):
UBUS PARITY ERROR
NONE OF THE ABOVE ERRORS:
TIME-OUT ERROR IN MICRO-PROCESSOR
IF NECESSARY, THE CONSOLE PACKAGE CAN BE USED TO ALTER CONTROL OF
THE MICRO-PROCESSOR LOOP AND TO EXAMINE MORE REGISTERS.
^
;MASSBUS INTERFACE REGISTER ASSIGNMENTS
MPSCR0= 0 ;STATUS AND CONTROL REGISTER 1
MPSCR1= 1 ;STATUS AND CONTROL REGISTER 2
MPECR= 2 ;ERROR CODE REGISTER
MPDTR= 3 ;DRIVE TYPE REGISTER
MPHVR= 4 ;HARDWARE VERSION REGISTER
MPDB0= 5 ;DATA BUFFER REGISTER 0
MPDB1= 6 ;DATA BUFFER REGISTER 1
MPDB2= 7 ;DATA BUFFER REGISTER 2
MPGP0= 10 ;GENERAL PURPOSE REGISTERS
MPGP1= 11
MPGP2= 12
MPGP3= 13
MPGP4= 14
MPGP5= 15
MPGP6= 16
MPGP7= 17
MPGP10=20
MPGP11=21
MPGP12=22
MPGP13=23
MPGP14=24
MPGP15=25
MPGP16=26
MPGP17=27
MPSTAT=36 ;MICRO-PROCESSOR STATUS REGISTER
IOSEL= 37 ;I/O SELECT REGISTER
SEARCH DX20CA ;READ IN CROSS-ASSEMBLER
.INIT ;INITIALIZE
;*TEST THAT A JMP INSTRUCTION CAN JUMP
START: JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*TEST THAT JMPZ CAN JUMP CONDITIONALLY ON THE Z BIT
NOP ;A NOP INSTRUCTION CLEARS Z
JMPZ .+2 ;SHOULD NOT JUMP
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR -1 ;SET Z
JMPZ .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*SELECT MEMORY ADDRESS 0.
;*CHECK ON OSB INSTRUCTION
LDMAR 0 ;SELECT MEMORY LOCATION 0
LDMARX 0
LDBR 0 ;PUT A ZERO IN BR
MOVB AC0 ;PUT A ZERO IN AC0
OSB AC0,MEM ;COMPARE, PUT RESULT IN MEMORY
JMPZ .+2 ;RESULT SHOULD HAVE BEEN -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR -1 ;PUT A -1 INTO BR
OSB AC0,MEM ;COMPARE, PUT RESULT IN MEMORY
JMPZ .+2 ;RESULT SHOULD NOT HAVE BEEN -1
JMP .+2 ;Z SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
MOV AC0,BR ;MOVE ZEROS FROM AC TO BR
OSB AC0,MEM ;COMPARE, PUT RESULT IN MEMORY
JMPZ .+2 ;RESULT SHOULD BE ZERO
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK JMP ON BR BIT CONDITIONS
LDBR 1 ;SET BR BIT 0
JMPB0 .+2 ;JMP ON BR BIT 0
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 376 ;SET ALL BUT BIT 0
JMPB0 .+2 ;JMP ON BIT ZERO
JMP .+2 ;SHOULD NOT HAVE JUMPED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 20 ;SET BR BIT 4
JMPB4 .+2 ;JMP ON BIT 4
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 357 ;SET ALL BUT BIT 4
JMPB4 .+2 ;JMP ON BIT 4
JMP .+2 ;SHOULD NOT HAVE JUMPED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 200 ;SET BR BIT 7
JMPB7 .+2 ;JMP ON BIT 7
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 177 ;SET ALL BUT BIT 7
JMPB7 .+2 ;JMPON BIT 7
JMP .+2 ;SHOULD NOT HAVE JUMPED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK OSM INSTRUCTION
LDBR -1 ;SET ALL BITS IN BR
MOVB AC0 ;PUT BITS IN AC0
LDMEM -1 ;SET ALL BITS IN MEMORY LOC 0
OSM AC0,BR ;COMPARE MEM WITH AC0, PUT RESULT IN BR
JMPZ .+2 ;SHOULD JUMP
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDMEM 0 ;LOAD ZEROS INTO MEMORY
OSM AC0,BR ;COMPARE MEM WITH AC0, PUT RESULT IN BR
JMPZ .+2 ;SHOULD NOT JMP
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK SUBTRACT FUNCTION WHILE FLOATING A ONE BIT THROUGH THE BR
LDBR 0 ;LOAD ZEROS INTO BR
MOVB AC0 ;MOVE ZEROS INTO AC0
LDBR 1 ;LOAD BR WITH 1
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT TO MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 2 ;LOAD BR WITH 2
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 4 ;LOAD BR WITH 4
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 10 ;LOAD BR WITH 10
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 20 ;LOAD BR WITH 20
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 40 ;LOAD BR WITH 40
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 100 ;LOAD BR WITH 100
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 200 ;LOAD BR WITH 200
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;SKIP OVER HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK MOVMEM INSTRUCTION
LDMEM -1 ;LOAD MEM WITH -1
MOVMEM AC0 ;MOVE FROM MEM TO AC0
OSM AC0,BR ;COMPARE MEM AND AC0, PUT RESULT IN BR
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDMEM 22 ;LOAD MEM WITH 22
MOVMEM AC0 ;MOVE FROM MEM TO AC0
OSM AC0,BR ;COMPARE MEM AND AC0, PUT RESULT IN BR
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK INCREMENT FUNCTION
;INCREMENT 0 TO 1 AND PUT IN MEMORY
LDBR 0 ;LOAD BR WITH 0
MOVB AC0 ;MOVE ZEROS TO AC0
INC AC0,MEM ;INCREMENT DATA IN AC0, PUT RESULT IN MEM
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD COMPARE, INC SHOULD NOT CHANGE AC0
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 0 TO 1 AND RETURN RESULT TO AC
INCR AC0 ;INCREMENT AC0, PUT RESULT IN AC0
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD NOT COMPARE
JMP .+2 ;INCR SHOULD HAVE CHANGED AC0
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 1 ;SET UP EXPECTED RESULT OF INCR
OSB AC0,MEM ;COMPARE BR AND AC0, PUT RESULT IN MEM
JMPZ .+2 ;SHOULD COMPARE
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 1 TO 2
INCR AC0 ;INCREMENT AC0
LDBR 2 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 3 TO 4
LDMEM 3 ;PUT A 3 IN MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
LDBR 4 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 7 TO 10
LDMEM 7 ;LOAD A 7 INTO MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
LDBR 10 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 17 TO 20
LDMEM 17 ;LOAD A 17 INTO MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
LDBR 20 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 37 TO 40
LDMEM 37 ;LOAD A 37 INTO MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCRMENT AC0
LDBR 40 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 77 TO 100
LDMEM 77 ;LOAD A 77 INTO MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
LDBR 100 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 177 TO 200
LDMEM 177 ;LOAD A 177 INTO MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
LDBR 200 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;INCREMENT 377 TO 0
LDMEM 377 ;LOAD A 377 INTO MEM
MOVMEM AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
LDBR 0 ;SET UP EXPECTED RESULT
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK DECREMENT FUNCTION
;DECREMENT 0 TO -1
LDBR 0 ;LOAD A 0 INTO BR
MOVB AC0 ;MOVE TO AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;DECR SHOULD HAVE CHANGED AC0
JMP .+2 ;BR AND AC0 SHOULD NOT COMPARE
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDMEM -1 ;SET UP EXPECTED RESULT
OSM AC0 ;COMPARE MEM AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 2 TO 1
LDBR 1 ;LOAD BR WITH 1
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 4 TO 3
LDBR 3 ;LOAD BR WITH 3
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 10 TO 7
LDBR 7 ;LOAD BR WITH 7
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 20 TO 17
LDBR 17 ;LOAD BR WITH 17
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 40 TO 37
LDBR 37 ;LOAD BR WITH 37
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMP .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 100 TO 77
LDBR 77 ;LOAD BR WITH 77
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMP .+2 ;SKIP IF NOT COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;DECREMENT 200 TO 177
LDBR 177 ;LOAD BR WITH 177
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
DECR AC0 ;DECREMENT AC0
OSB AC0 ;COMPARE BR AND AC0
JMPZ .+2 ;SKIP IF COMPARED
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK CARRY FLAG
LDBR -1 ;LOAD BR WITH -1
MOVB AC0 ;MOVE TO AC0
INCR AC0 ;INCREMENT AC0
JMPC .+2 ;JMP IF CARRY SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 0 ;LOAD BR WITH ZEROS, SHOULD NOT CHANGE CARRY BIT
JMPC .+2 ;JMP IF CARRY STILL SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
INCR AC0 ;INCREMENT AC0 TO A 1, SHOULD CLEAR CARRY BIT
JMPC .+2 ;JMP IF CARRY SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 0 ;LOAD BR WITH 0, SHOULD NOT CHANGE CARRY BIT
JMPC .+2 ;JMP IF CARRY SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
DECR AC0 ;DECREMENT AC0 TO A 0
JMPC .+2 ;JMP IF CARRY IS SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
DECR AC0 ;DECREMENT AC0 TO -1
JMPC .+2 ;JMP IF CARRY SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK AC 0 THROUGH 6
;PUT A 0 IN AC0
LDBR 0 ;CLEAR BR
MOVB AC0 ;MOVE TO AC0
;PUT A 1 IN AC1
INC AC0,BR ;INCREMENT TO 1, PUT IN BR
MOVB AC1 ;PUT THE 1 IN AC1
OSB AC1 ;COMPARE BR AND AC1
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;PUT A 2 IN AC2
INC AC1,BR ;INCREMENT TO 2, PUT IN BR
MOVB AC2 ;PUT THE 2 IN AC2
OSB AC2 ;COMPARE BR AND AC2
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;PUT A 3 IN AC3
INC AC2,BR ;INCREMENT TO 3, PUT IN BR
MOVB AC3 ;PUT THE 3 IN AC3
OSB AC3 ;COMPARE AC3 AND BR
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;PUT A 4 IN AC4
INC AC3,BR ;INCREMENT TO 4, PUT IN BR
MOVB AC4 ;PUT THE 4 IN AC4
OSB AC4 ;COMPARE AC4 AND BR
JMPZ .+2 ;SKIP IF A MACTH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;PUT A 5 IN AC5
INC AC4,BR ;INCREMENT TO 5, PUT IN BR
MOVB AC5 ;PUT THE 5 IN AC5
OSB AC5 ;COMPARE AC5 AND BR
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;PUT A 6 IN AC6
INC AC5,BR ;INCREMENT TO 6, PUT IN BR
MOVB AC6 ;PUT THE 6 IN AC6
OSB AC6 ;COMPARE AC6 AND BR
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC6 FOR 6
LDMEM 6 ;PUT A 6 IN MEMORY
OSM AC6 ;COMPARE WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC5 FOR 5
DEC AC6,MEM ;DECREMENT THE 6 TO 5, PUT IN MEM
OSM AC5 ;COMPARE WITH AC5
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC4 FOR 4
DEC AC5,MEM ;DECREMENT TO 4, PUT IN MEM
OSM AC4 ;COMPARE WITH AC4
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC3 FOR 3
DEC AC4,MEM ;DECREMENT TO 3, PUT IN MEM
OSM AC3 ;COMPARE WITH AC3
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC2 FOR 2
DEC AC3,MEM ;DECREMENT TO A 2, PUT IN MEM
OSM AC2 ;COMPARE WITH AC2
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC1 FOR 1
DEC AC2,MEM ;DECREMENT TO A 1, PUT IN MEM
OSM AC1 ;COMPARE WITH AC1
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CHECK AC0 FOR 0
DEC AC1,MEM ;DECREMENT TO A 0, PUT IN MEM
OSM AC0 ;COMPARE WITH AC0
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK ADC INSTRUCTION
LDBR -2 ;PUT A -2 INTO BR
MOVB AC3 ;MOVE TO AC3
INCR AC3 ;INCREMENT TO -1 TO CLEAR CARRY BIT
ADC AC3,BR ;ADD CARRY TO AC3, PUT RESULT IN BR
JMPZ .+2 ;SKIP IF RESULT WAS -1, CARRY WAS 0
MOV AC7 ; HALT ON PARITY ERROR IN AC7
INCR AC3 ;INCREMENT AC3 TO 0, SETS THE CARRY BIT
ADCR AC3 ;ADD CARRY TO AC3
LDBR 1 ;SET UP BR WITH EXPECTED VALUE OF 1
OSB AC3 ;COMPARE BR AND AC3
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK ADB AND SHL INSTRUCTIONS
;ADD 1 + 1
LDBR 1 ;LOAD A 1 IN BR
MOVB AC5 ;MOVE TO AC5
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 1 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR 2
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 2
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 2 + 2
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 2 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 4
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 4
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 4 + 4
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 4 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 10
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 10
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 10 + 10
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 10 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 20
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 20
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 20 + 20
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 20 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 40
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 40
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 40 + 40
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 40 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 100
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 100
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 100 + 100
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 100 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
JMP .+2 ;IT SHOULD NOT BE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 200
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 200
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;ADD 200 + 200
ADB AC5,BR ;ADD AC5 AND BR, PUT IN BR
JMPC .+2 ;CHECK IF THE CARRY BIT SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 200 LEFT
SHLR AC5 ;SHIFT AC5 LEFT ONE PLACE
JMPC .+2 ;CHECK IF THE CARRY BIT SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;COMPARE RESULTS FOR A 0
OSB AC5 ;NOW AC5 AND BR SHOULD CONTAIN A 0
JMPZ .+2 ;SKIP IF THEY MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK ADBC INSTRUCTION
LDBR -1 ;LOAD BR WITH A -1
MOVB AC2 ;MOVE TO AC2
INCR AC2 ;INCREMENT AC2 TO 0 TO SET CARRY
LDBR 333 ;LOAD BR WITH A 333
ADBCR AC2 ;ADD BR AND CARRY TO AC2
LDBR 334 ;SET UP BR WITH EXPECTED VALUE OF 334
OSB AC2 ;COMPARE AC2 AND BR
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK TWOS COMPLIMENT SUBTRACT FUNCTION
;SUBTRACT 12 FROM 207, CHECK FOR RESULT OF 175
LDBR 207 ;GET A 207
MOVB AC0 ;PUT IN AC0
LDBR 12 ;GET A 12
TSB AC0,MEM ;SUBTRACT BR FROM AC0, PUT RESULT IN MEM
MOVMEM AC1 ;MOVE RESULT TO AC1
LDMEM 175 ;SET UP EXPECTED RESULT IN MEM
JMPC .+2 ;SKIP IF CARRY BIT SET IN SUBTRACT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
OSM AC1 ;COMPARE RESULT IN AC1 WITH MEM
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SUBTRACT 24 FROM 207, CHECK FOR RESULT OF 163
LDBR 24 ;GET A 24
TSB AC0,MEM ;SUBTRACT BR FROM AC0, PUT RESULT IN MEM
MOVMEM AC1 ;MOVE RESULT TO AC1
LDMEM 163 ;SET UP EXPECTED RESULT IN MEM
JMPC .+2 ;SKIP IF CARRY BIT SET IN SUBTRACT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
OSM AC1 ;COMPARE RESULT IN AC1 WITH MEM
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SUBTRACT 50 FROM 207, CHECK FOR RESULT OF 137
LDBR 50 ;GET A 50
TSB AC0,MEM ;SUBTRACT BR FROM AC0, PUT RESULT IN MEM
MOVMEM AC1 ;MOVE RESULT TO AC1
LDMEM 137 ;SET UP EXPECTED RESULT IN MEM
JMPC .+2 ;SKIP IF CARRY BIT SET IN SUBTRACT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
OSM AC1 ;COMPARE RESULT IN AC1 WITH MEM
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SUBTRACT 120 FROM 207, CHECK FOR RESULT OF 67
LDBR 120 ;GET A 120
TSB AC0,MEM ;SUBTRACT BR FROM AC0, PUT RESULT IN MEM
MOVMEM AC1 ;MOVE RESULT TO MEM
LDMEM 67 ;SET UP EXPECTED RESULT IN MEM
JMPC .+2 ;SKIP IF A CARRY BIT SET IN SUBTRACT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
OSM AC1 ;COMPARE RESULT IN AC1 WITH MEM
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SUBTRACT 240 FROM 207, CHECK FOR RESULT OF -31
LDBR 240 ;GET A 240
TSB AC0,MEM ;SUBTRACT BR FROM AC0, PUT RESULT IN MEM
MOVMEM AC1 ;MOVE RESULT TO AC1
LDMEM -31 ;SET UP EXPECTED RESULT IN MEM
JMPC .+2 ;SKIP IF A CARRY BIT SET IN SUBTRACT
JMP .+2 ;CARRY SHOULD NOT HAVE SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
OSM AC1 ;COMPARE RESULT IN AC1 WITH MEM
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*TEST SHR INSTRUCTION
;SHIFT A 252 RIGHT, CHECK FOR RESULT OF 125
LDBR 252 ;LOAD BR WITH A 252
SHR ;SHIFT BR RIGHT ONE PLACE
LDMEM 125 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 125 RIGHT, CHECK FOR RESULT OF 52
SHR ;SHIFT BR RIGHT ONE PLACE
LDMEM 52 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 52 RIGHT, CHECK FOR RESULT OF 25
SHR ;SHIFT BR RIGHT ONE PLACE
LDMEM 25 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 25 RIGHT, CHECK FOR RESUTLT OF 12
SHR ;SHIFT BR RIGHT ONE PLACE
LDMEM 12 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 12 RIGHT AND SET BR 7, CHECK FOR RESULT OF 205
SHR 1 ;SHIFT BR RIGHT ONE PLACE AND SET BIT 7
LDMEM 205 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 205 RIGHT AND SET BR 7, CHECK FOR A RESULT OF 302
SHR 1 ;SHIFT BR RIGHT ONE PLACE AND SET BIT 7
LDMEM 302 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 302 RIGHT AND SET BR 7, CHECK FOR RESULT OF 341
SHR 1 ;SHIFT BR RIGHT ONE PLACE AND SET BIT 7
LDMEM 341 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SHIFT A 341 RIGHT AND SET BR 7, CHECK FOR RESULT OF 360
SHR 1 ;SHIFT BR RIGHT ONE PLACE AND SET BIT 7
LDMEM 360 ;LOAD MEM WITH EXPECTED RESULT
MOVMEM AC6 ;MOVE TO AC6
OSB AC6 ;COMPARE RESULT IN BR WITH AC6
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*TEST LOGICAL ALU FUNCTIONS
;AND 0 WITH 0, CHECK FOR RESULT OF 0
LDBR 0 ;LOAD ZEROS INTO BR
MOVB AC4 ;AND INTO AC4
LANDB AC4,MEM ;AND BR WITH AC4, PUT RESULT IN MEM
OSM AC4 ;COMPARE RESULT FOR ZEROS
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR 0 WITH 0, CHECK FOR RESULT OF 0
LORB AC4,MEM ;OR AC4 WITH BR, PUT RESULT IN MEM
OSM AC4 ;COMPARE RESULT FOR ZEROS
JMPZ .+2 ;SKIP IF A HALT
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;XOR 0 WITH 0, CHECK FOR RESULT OF 0
LXORB AC4,MEM ;XOR AC4 WITH BR, PUT RESULT IN MEM
OSM AC4 ;COMPARE RESULT FOR ZEROS
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR 0 WITH NOT 0, CHECK FOR RESULT OF -1
LORCB AC4,MEM ;OR AC4 WITH COMP OF BR, PUT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;AND 0 WITH -1, CHECK FOR RESULT OF 0
LDBR 0 ;LOAD ZEROS INTO BR
MOVB AC5 ;MOVE TO AC5
LDBR -1 ;LOAD ONES INTO BR
LANDB AC5,MEM ;AND AC5 WITH BR, PUT RESULT IN MEM
OSM AC5 ;COMPARE RESULT FOR ZEROS
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR 0 WITH -1, CHECK FOR RESULT OF -1
LORB AC5,MEM ;OR AC5 WITH BR, PUT RESULT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR 0 WITH NOT -1, CHECK FOR RESULT OF 0
LORCB AC5,MEM ;OR AC5 WITH COMP OF BR, PUT IN MEM
OSM AC5 ;COMPARE RESULT WITH ZEROS
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;XOR 0 WITH -1, CHECK FOR RESULT OF -1
LXORB AC5,MEM ;XOR AC5 WITH BR, PUT RESULT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;AND -1 WITH 0, CHECK FOR RESULT OF 0
LDBR -1 ;LOAD ONES INTO BR
MOVB AC6 ;MOVE TO AC6
LDBR 0 ;LOAD ZEROS INTO BR
MOVB AC0 ;ALSO PUT IN AC0
LANDB AC6,MEM ;AND AC6 WITH BR, PUT RESULT IN MEM
OSM AC0 ;COMPARE RESULT FOR ZEROS
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR -1 WITH 0, CHECK FOR RESULT OF -1
LORB AC6,MEM ;OR AC6 WITH BR, PUT RESULT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR -1 WITH NOT 0, CHECK FOR RESULT OF -1
LORCB AC6,MEM ;OR AC6 WITH COMP OF BR, PUT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;XOR -1 WITH 0, CHECK FOR RESULT OF -1
LXORB AC6,MEM ;XOR AC6 WITH BR, PUT RESULT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;AND -1 WITH -1, CHECK FOR RESULT OF -1
LDBR 0 ;LOAD ZEROS INTO BR
MOVB AC0 ;PUT INTO AC0
LDBR -1 ;LOAD ONES INTO BR
MOVB AC1 ;PUT IN AC1
LANDB AC1,MEM ;AND AC1 WITH BR, PUT RESULT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR -1 WITH -1, CHECK FOR RESULT OF -1
LORB AC1,MEM ;OR AC1 WITH BR, PUT RESULT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR -1 WITH NOT -1, CHECK FOR RESULT OF -1
LORCB AC1,MEM ;OR AC1 WITH COMP OF BR, PUT IN MEM
JMPZ .+2 ;SKIP IF RESULT WAS -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;XOR -1 WITH -1, CHECK FOR RESULT OF 0
LXORB AC1,MEM ;XOR AC1 WITH BR, PUT RESULT IN MEM
OSM AC0 ;COMPARE RESULT FOR ZEROS
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;AND 256 WITH 105, CHECK FOR RESULT OF 4
LDBR 256 ;LOAD BR WITH A 256
MOVB AC2 ;MOVE TO AC2
LDBR 105 ;LOAD BR WITH A 105
LANDB AC2,MEM ;AND AC2 WITH BR, PUT RESULT IN MEM
MOVMEM AC3 ;MOVE RESULT TO AC3
LDMEM 4 ;SET UP EXPECTED RESULT IN MEM
OSM AC3 ;COMPARE RESULT
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR 256 WITH 105, CHECK FOR RESULT OF 357
LORB AC2,MEM ;OR AC2 WITH BR, PUT RESULT IN MEM
MOVMEM AC3 ;MOVE RESULT TO AC3
LDMEM 357 ;SET UP EXPECTED RESULT IN MEM
OSM AC3 ;COMPARE RESULT
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;OR 256 WITH NOT 105, CHECK FOR RESULT OF 276
LORCB AC2,MEM ;OR AC2 WITH COMP OF BR, PUT IN MEM
MOVMEM AC3 ;MOVE RESULT TO AC3
LDMEM 276 ;SET UP EXPECTED RESULT IN MEM
OSM AC3 ;COMPARE RESULT
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;XOR 256 WITH 105, CHECK FOR RESULT OF 353
LXORB AC2,MEM ;XOR AC2 WITH BR, PUT RESULT IN MEM
MOVMEM AC3 ;MOVE RESULT TO AC3
LDMEM 353 ;SET UP EXPECTED RESULT IN MEM
OSM AC3 ;COMPARE RESULT
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK JUMP TO SUBROUTINE AND RETURN INSTRUCTIONS
LDBR 0 ;LOAD BR WITH A ZERO
MOVB AC0 ;MOVE TO AC0
JMPSUB COMPAC ;GO TO SUBROUTINE WHICH SHOULD VERITY THAT AC0
;CONTAINS A ZERO, THEN CHANGES IT
;TO -1 BEFORE RETURNING
SUBT1R: LDBR -1 ;SUBROUTINE SHOULD RETURN HERE
OSB AC0 ;COMPARE AC0 WITH A -1 IN BR
JMPZ .+2 ;SKIP IF AC0 IS NOW A -1
MOV AC7 ; HALT ON PARITY ERROR IN AC7
JMP SUBT2 ;GO AROUND THE SUBROUTINE
COMPAC: LDBR 0 ;LOAD A ZERO INTO BR
OSB AC0 ;COMPARE WITH AC0
JMPZ .+2 ;SKIP IF AC0 WAS ZERO
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR -1 ;GET A -1
MOVB AC0 ;PUT IT INTO AC0
RETURN ;RETURN TO SUBT1R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUBT2: LDBR 17 ;LOAD BR WITH A 17
MOVB AC2 ;MOVE TO AC2
JMPSUB COMPA2 ;GO TO SUBTN WHICH SHOULD VERITY THAT AC2
;CONTAINS A 17, THEN CHANGES IT
;TO 360 BEFORE RETURNING
SUBT2R: LDBR 360 ;SUBROUTINE SHOULD RETURN HERE
OSB AC2 ;COMPARE AC2 WITH A 360 IN BR
JMPZ .+2 ;SKIP IF AC2 IS NOW A 360
MOV AC7 ; HALT ON PARITY ERROR IN AC7
JMP SUBT3 ;GO AROUND THE SUBROUTINE
COMPA2: LDBR 17 ;LOAD A 17 INTO BR
OSB AC2 ;COMPARE WITH AC2
JMPZ .+2 ;SKIP IF AC2 WAS 17
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 360 ;GET A 360
MOVB AC2 ;PUT IT INTO AC2
RETURN ;RETURN TO SUBT2R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK THAT 15 SUBROUTINES CAN BE NESTED
;FLOW IS AS FOLLOWS:
; MAIN: LOAD 0 INTO AC4, GO TO SUB1
; SUB1: CHECK AC4 FOR 0, LOAD 1, GO TO SUB2
; SUB2: CHECK AC4 FOR 1, LOAD 2, GO TO SUB3
; SUB3: CHECK AC4 FOR 2, LOAD 3, GO TO SUB4
; SUB4: CHECK AC4 FOR 3, LOAD 4, GO TO SUB5
; SUB5: CHECK AC4 FOR 4, LOAD 5, GO TO SUB6
; SUB6: CHECK AC4 FOR 5, LOAD 6, GO TO SUB7
; SUB7: CHECK AC4 FOR 6, LOAD 7, GO TO SUB10
; SUB10: CHECK AC4 FOR 7, LOAD 10, GO TO SUB11
; SUB11: CHECK AC4 FOR 10, LOAD 11, GO TO SUB12
; SUB12: CHECK AC4 FOR 11, LOAD 12, GO TO SUB13
; SUB13: CHECK AC4 FOR 12, LOAD 13, GO TO SUB14
; SUB14: CHECK AC4 FOR 13, LOAD 14, GO TO SUB15
; SUB15: CHECK AC4 FOR 14, LOAD 15, GO TO SUB16
; SUB16: CHECK AC4 FOR 15, LOAD 16, GO TO SUB17
; SUB17: CHECK AC4 FOR 16, LOAD 117, RETURN
; SUB16: CHECK AC4 FOR 117, LOAD 116, RETURN
; SUB15: CHECK AC4 FOR 116, LOAD 115, RETURN
; SUB14: CHECK AC4 FOR 115, LOAD 114, RETURN
; SUB13: CHECK AC4 FOR 114, LOAD 113, RETURN
; SUB12: CHECK AC4 FOR 113, LOAD 112, RETURN
; SUB11: CHECK AC4 FOR 112, LOAD 111, RETURN
; SUB10: CHECK AC4 FOR 111, LOAD 110, RETURN
; SUB7: CHECK AC4 FOR 110, LOAD 107, RETURN
; SUB6: CHECK AC4 FOR 107, LOAD 106, RETURN
; SUB5: CHECK AC4 FOR 106, LOAD 105, RETURN
; SUB4: CHECK AC4 FOR 105, LOAD 104, RETURN
; SUB3: CHECK AC4 FOR 104, LOAD 103, RETURN
; SUB2: CHECK AC4 FOR 103, LOAD 102, RETURN
; SUB1: CHECK AC4 FOR 102, LOAD 101, RETURN
; MAIN: CHECK AC4 FOR 101
;END OF TEST
SUBT3: LDBR 0 ;LOAD BR WITH 0
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB1 ;GO TO SUBROUTINE 1
SUB0R: LDBR 101 ;ON RETURN, AC4 SHOULD CONTAIN 101
OSB AC4 ;COMPARE IT
JMPZ .+2 ;SKIP IF MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
JMP IOTST ;GO ON TO THE I/O TESTING
SUB1: LDBR 0 ;CHECK THAT AC4 CONTAINS A 0
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 1 ;LOAD BR WITH A 1
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB2 ;GO TO SUBROUTINE 2
SUB1R: LDBR 102 ;ON RETURN, AC4 SHOULD CONTAIN A 102
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 101 ;LOAD BR WITH A 101
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB0R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB2: LDBR 1 ;CHECK THAT AC4 CONTAINS A 1
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 2 ;LOAD BR WITH A 2
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB3 ;GO TO SUBROUTINE 3
SUB2R: LDBR 103 ;ON RETURN, AC4 SHOULD CONTAIN A 103
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 102 ;LOAD BR WITH A 102
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB1R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB3: LDBR 2 ;CHECK THAT AC4 CONTAINS A 2
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 3 ;LOAD BR WITH A 3
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB4 ;GO TO SUBROUTINE 4
SUB3R: LDBR 104 ;ON RETURN, AC4 SHOULD CONTAIN A 104
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 103 ;LOAD BR WITH A 103
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB2R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB4: LDBR 3 ;CHECK THAT AC4 CONTAINS A 3
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 4 ;LOAD BR WITH A 4
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB5 ;GO TO SUBROUTINE 5
SUB4R: LDBR 105 ;ON RETURN, AC4 SHOULD CONTAIN A 105
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 104 ;LOAD BR WITH A 104
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB3R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB5: LDBR 4 ;CHECK THAT AC4 CONTAINS A 4
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 5 ;LOAD BR WITH A 5
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB6 ;GO TO SUBROUTINE 6
SUB5R: LDBR 106 ;ON RETURN, AC4 SHOULD CONTAIN A 106
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 105 ;LOAD BR WITH A 105
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB4R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB6: LDBR 5 ;CHECK THAT AC4 CONTAINS A 5
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 6 ;LOAD BR WITH A 6
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB7 ;GO TO SUBROUTINE 7
SUB6R: LDBR 107 ;ON RETURN, AC4 SHOULD CONTAIN A 107
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 106 ;LOAD BR WITH A 106
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB5R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB7: LDBR 6 ;CHECK THAT AC4 CONTAINS A 6
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 7 ;LOAD BR WITH A 7
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB10 ;GO TO SUBROUTINE 10
SUB7R: LDBR 110 ;ON RETURN, AC4 SHOULD CONTAIN A 110
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 107 ;LOAD BR WITH A 107
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB6R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB10: LDBR 7 ;CHECK THAT AC4 CONTAINS A 7
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 10 ;LOAD BR WITH A 10
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB11 ;GO TO SUBROUTINE 11
SUB10R: LDBR 111 ;ON RETURN, AC4 SHOULD CONTAIN A 111
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 110 ;LOAD BR WITH A 110
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB7R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB11: LDBR 10 ;CHECK THAT AC4 CONTAINS A 10
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 11 ;LOAD BR WITH A 11
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB12 ;GO TO SUBROUTINE 12
SUB11R: LDBR 112 ;ON RETURN, AC4 SHOULD CONTAIN A 112
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 111 ;LOAD BR WITH A 111
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB10R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB12: LDBR 11 ;CHECK THAT AC4 CONTAINS A 11
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 12 ;LOAD BR WITH A 12
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB13 ;GO TO SUBROUTINE 13
SUB12R: LDBR 113 ;ON RETURN, AC4 SHOULD CONTAIN A 113
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 112 ;LOAD BR WITH A 112
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB11R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB13: LDBR 12 ;CHECK THAT AC4 CONTAINS A 12
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 13 ;LOAD BR WITH A 13
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB14 ;GO TO SUBROUTINE 14
SUB13R: LDBR 114 ;ON RETURN, AC4 SHOULD CONTAIN A 114
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 113 ;LOAD BR WITH A 113
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB12R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB14: LDBR 13 ;CHECK THAT AC4 CONTAINS A 13
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 14 ;LOAD BR WITH A 14
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB15 ;GO TO SUBROUTINE 15
SUB14R: LDBR 115 ;ON RETURN, AC4 SHOULD CONTAIN A 115
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 114 ;LOAD BR WITH A 114
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB13R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB15: LDBR 14 ;CHECK THAT AC4 CONTAINS A 14
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 15 ;LOAD BR WITH A 15
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB16 ;GO TO SUBROUTINE 16
SUB15R: LDBR 116 ;ON RETURN, AC4 SHOULD CONTAIN A 116
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 115 ;LOAD BR WITH A 115
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB14R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB16: LDBR 15 ;CHECK THAT AC4 CONTAINS A 15
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 16 ;LOAD BR WITH A 16
MOVB AC4 ;MOVE TO AC4
JMPSUB SUB17 ;GO TO SUBROUTINE 17
SUB16R: LDBR 117 ;ON RETURN, AC4 SHOULD CONTAIN A 117
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 116 ;LOAD BR WITH A 116
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB15R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
SUB17: LDBR 16 ;CHECK THAT AC4 CONTAINS A 16
OSB AC4 ;COMPARE
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 117 ;LOAD BR WITH A 117
MOVB AC4 ;MOVE TO AC4
RETURN ;RETURN TO SUB16R
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK THAT STATUS REGISTER CAN BE READ
;CLEAR THE Z BIT, CHECK FOR Z BIT TO BE CLEAR IN STATUS REGISTER
IOTST: LDBR 0 ;CLEAR THE BR
DATI MPSTAT,BR ;READ THE STATUS REGISTER
SHR ;SHIFT THE BR RIGHT
JMPB4 .+2 ;SKIP IF Z BIT IS SET
JMP .+2 ;IT SHOULD NOT BE
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SET THE Z BIT, CHECK FOR Z BIT TO BE SET IN STATUS REGISTER
LDBR -1 ;LOAD BR WITH A -1 TO SET Z BIT
DATI MPSTAT,BR ;READ THE STATUS REGISTER
SHR ;SHIFT THE BR RIGHT
JMPB4 .+2 ;SKIP IF Z BIT IS SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;CLEAR THE CARRY BIT, CHECK FOR CARRY TO BE CLEAR IN STATUS REGISTER
LDBR 0 ;LOAD BR WITH 0
MOVB AC0 ;MOVE TO AC0
INC AC0 ;INCREMENT AC0 TO CLEAR THE C BIT
DATI MPSTAT,BR ;READ THE STATUS REGISTER
JMPB4 .+2 ;SKIP IF C BIT IS SET
JMP .+2 ;IT SHOULD NOT BE
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SET THE CARRY BIT, CHECK FOR CARRY TO BE SET IN STATUS REGISTER
LDBR -1 ;LOAD BR WITH -1
MOVB AC0 ;MOVE TO AC0
INC AC0 ;INCREMENT AC0 TO SET C BIT
DATI MPSTAT,BR ;READ THE STATUS REGISTER
JMPB4 .+2 ;SKIP IF C BIT IS SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK I/O SELECT REGISTER
;WRITE 0 INTO I/O SELECT REGISTER, READ AND CHECK FOR 0
LDBR 0 ;LOAD BR WITH ZEROS
MOVB IOSEL ;WRITE INTO I/O SELECT REGISTER
DATI IOSEL,AC2 ;READ BACK INTO AC2
OSB AC2 ;COMPARE WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;WRITE 77 INTO STATUS REGISTER, READ AND CHECK FOR 77
LDBR 77 ;LOAD BR WITH 77
MOVB IOSEL ;WRITE INTO I/O SELECT REGISTER
DATI IOSEL,AC2 ;READ BACK INTO AC2
OSB AC2 ;COMPARE WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;WRITE 152 INTO STATUS REGISTER, READ AD CHECK FOR 152
LDBR 152 ;LOAD BR WITH 152
MOVB IOSEL ;WRITE INTO I/O SELECT REGISTER
DATI IOSEL,AC2 ;READ BACK INTO AC2
OSB AC2 ;COMPARE WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK STACK POINTER RESET IN I/O SELECT REGISTER
;PUSH 15 ADDRESSES ONTO THE STACK
LDBR 100 ;GET A 100
MOVB IOSEL ;RESET THE STACK POINTER
LDBR 0 ;CLEAR BR
MOVB IOSEL ;CLEAR THE RESET BIT
JMPSUB .+1 ;JUMP TO SUBROUTINES TO FILL THE STACK
JMPSUB .+1 ; DO IT 15 TIMES
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1
JMPSUB .+1 ;THESE JMPSUB INSTRUCTIONS SHOULD FILL THE STACK
;BUT SHOULD NOT OVERFLOW THE STACK
;RESET THE STACK POINTER
LDBR 100 ;RESET THE STACK POINTER AGAIN
MOVB IOSEL
LDBR 0
MOVB IOSEL ;NOW STACK SHOULD BE EMPTY
;NOW PUSH 3 MORE ADDRESSES ONTO THE STACK
JMPSUB .+1 ;NOW MORE JMPSUB INSTRUCTIONS
JMPSUB .+1 ;SHOULD BE PERMISSABLE AND
JMPSUB .+1 ;SHOULD NOT OVERFLOW THE STACK
LDBR 100 ;RESET THE STACK POINTER AGAIN
MOVB IOSEL
LDBR 0
MOVB IOSEL ;CLEAR THE RESET BIT
;*CHECK WRITING AND READING MPGP0
;WRITE 0 INTO MPGP0, READ AND CHECK FOR 0
LDBR 11 ;SELECT THE MASSBUS INTERFACE
MOVB IOSEL ;FOR INPUT AND OUTPUT
LDBR 0 ;GET A ZERO
MOVB MPGP0 ;WRITE INTO GP REG 0
DATI MPGP0,AC3 ;READ REG BACK INTO AC3
OSB AC3 ;COMPARE AC3 WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;WRITE 125 INTO MPGP0, READ AND CHECK FOR 125
LDBR 125 ;GET A 125
MOVB MPGP0 ;WRITE INTO GP REG 0
DATI MPGP0,AC3 ;READ REG BACK INTO AC3
OSB AC3 ;COMPARE AC3 WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;WRITE 252 INTO MPGP0, READ AND CHECK FOR 252
LDBR 252 ;GET A 252
MOVB MPGP0 ;WRITE INTO GP REG 0
DATI MPGP0,AC3 ;READ REG BACK INTO AC3
OSB AC3 ;COMPARE AC3 WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;SKIP OVER THE NEXT CRAM LOCATIONS AND CONTINUE IN NEXT 1K BANK
JUMP 2000 ;JUMP TO LOCATION 2000
;ALL UNUSED CRAM LOCATIONS ARE FILLED WITH A MOV AC7 INSTRUCTION
;TO STOP THE MICRO-PROCESSOR IF IT SHOULD GET LOST
XLIST
REPEAT 2000-.,<MOV AC7>
LIST
;*CHECK DATI/O INSTRUCTION
;WRITE A 2 IN MPGP0
;MOVE FROM MPGP0 TO MPGP1
;CHECK MPGP1 FOR A 2
LDBR 11 ;SELECT MASSBUS INTERFACE
MOVB IOSEL ;FOR INPUT AND OUTPUT
LDBR 2 ;GET A 2
MOVB MPGP0 ;WRITE INTO GP REG 0
DATI MPGP0,MPGP1 ;COPY DATA FROM REG 0 TO REG 1
DATI MPGP1,AC6 ;READ THE DATA IN MPGP1
OSB AC6 ;COMPARE AC6 WITH DATA WRITTEN
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*CHECK MULTIPLE DATI/O INSTRUCTIONS
;WRITE A 73 IN MPGP0
;MOVE FROM MPGP0 TO MPGP1, THEN FROM MPGP1 TO MPGP2, ETC. UNTIL
; MPGP17 IS WRITTEN
;CHECK MPGP17 FOR A 73
LDBR 11 ;SELECT MASSBUS INTERFACE
MOVB IOSEL ;FOR INPUT AND OUTPUT
LDBR 73 ;GET A 73
MOVB MPGP0 ;WRITE INTO GP REG 0
JMPSUB FILLGP ;FILL ALL GP REGISTERS WITH DATA FROM REG 0
DATI MPGP17,AC2 ;READ DATA IN GP REG 17
OSB AC2 ;COMPARE WITH DATA 73 IN BR
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;WRITE A 304 IN MPGP0
;MOVE FROM MPGP0 TO MPGP1, THEN FROM MPGP1 TO MPGP2, ETC. UNTIL
; MPGP17 IS WRITTEN
;CHECK MPGP17 FOR A 304
LDBR 304 ;GET A 304
MOVB MPGP0 ;WRITE INTO GP REG 0
JMPSUB FILLGP ;FILL ALL GP REGISTERS WITH DATA FROM REG 0
DATI MPGP17,AC2 ;READ DATA IN GP REG 17
OSB AC2 ;COMPARE WITH DATA 304 IN BR
JMPZ .+2 ;SKIP IF A MATCH
MOV AC7 ; HALT ON PARITY ERROR IN AC7
JMP RESTST ;GO AROUND THE SUBROUTINE
FILLGP: DATI MPGP0,MPGP1 ;COPY DATA FROM REG 0 TO REG 1
DATI MPGP1,MPGP2 ;COPY DATA FROM REG 1 TO REG 2
DATI MPGP2,MPGP3 ;COPY DATA FROM REG 2 TO REG 3
DATI MPGP3,MPGP4 ;COPY DATA FROM REG 3 TO REG 4
DATI MPGP4,MPGP5 ;COPY DATA FROM REG 4 TO REG 5
DATI MPGP5,MPGP6 ;COPY DATA FROM REG 5 TO REG 6
DATI MPGP6,MPGP7 ;COPY DATA FROM REG 6 TO REG 7
DATI MPGP7,MPGP10 ;COPY DATA FROM REG 7 TO REG 10
DATI MPGP10,MPGP11 ;COPY DATA FROM REG 10 TO REG 11
DATI MPGP11,MPGP12 ;COPY DATA FROM REG 11 TO REG 12
DATI MPGP12,MPGP13 ;COPY DATA FROM REG 12 TO REG 13
DATI MPGP13,MPGP14 ;COPY DATA FROM REG 13 TO REG 14
DATI MPGP14,MPGP15 ;COPY DATA FROM REG 14 TO REG 15
DATI MPGP15,MPGP16 ;COPY DATA FROM REG 15 TO REG 16
DATI MPGP16,MPGP17 ;COPY DATA FROM REG 16 TO REG 17
RETURN
;*CHECK INITIALIZE IN I/O SELECT REGISTER
;SET ATTENTION IN MPSCR1
;RESET THE DX20 USING I/O SELECT REGISTER
;CHECK THAT ATTENTION IS CLEAR
RESTST: LDBR 11 ;SELECT MASSBUS INTERFACE
MOVB IOSEL ;FOR INPUT AND OUTPUT
LDBR 200 ;SET ATA BIT
MOVB MPSCR1 ;BIT 7 IN REGISTER 1
DATI MPSCR1,AC4 ;READ INTO AC4
JMPB7 .+2 ;SKIP IF AT A BIT IS SET
MOV AC7 ; HALT ON PARITY ERROR IN AC7
LDBR 200 ;INITIALIZE THE INTERFACE
MOVB IOSEL ;SET INIT IN REG 37
LDBR 11 ;SELECT MASSBUS INTERFACE AGAIN
MOVB IOSEL ;FOR INPUT AND OUTPUT
DATI MPSCR1,AC4 ;READ REGISTER 1 AGAIN
JMPB7 .+2 ;SKIP IF ATA BIT IS STILL SET
JMP .+2 ;SHOULD NOT SKIP, INIT SHOULD HAVE CLEARED ATA
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;*END OF MICRO-DIAGNOSTIC, HALT WITH PC CONTAINING 3777
JMP 3776 ;GO TO END
;ALL UNUSED CRAM LOCATIONS ARE FILLED WITH A MOV AC7 INSTRUCTION
;TO STOP THE MICRO-PROCESSOR IF IT SHOULD GET LOST
XLIST
REPEAT 3776-.,<MOV AC7>
LIST
MOV AC7 ; HALT ON PARITY ERROR IN AC7
;THIS HALT IS THE NORMAL END OF THE PROGRAM
MOV AC7 ;UNSUED LOCATION
.END