296 lines
13 KiB
Plaintext
296 lines
13 KiB
Plaintext
|
Application 1: The table of reserved mnemonics.
|
|||
|
═════════════════════════════════════════════════
|
|||
|
|
|||
|
1)the directives
|
|||
|
──────────────
|
|||
|
|
|||
|
ORG EQU LINK DW ACCEPT INCLUDE MACRO
|
|||
|
|
|||
|
2)the commands
|
|||
|
────────────
|
|||
|
|
|||
|
BC1 and BP2
|
|||
|
ADD SUB OR AND XOR NAND NXOR
|
|||
|
|
|||
|
ED4
|
|||
|
JZ CJS JMAP CJP PUSH JSRP CJV JRP
|
|||
|
RFCT RPCT CRTN CJPP LDCT LOOP CONT TWB
|
|||
|
|
|||
|
BH1
|
|||
|
READ CLR SET RESET DI EI
|
|||
|
|
|||
|
external devices
|
|||
|
R W IN OUT EWH EWL EWA EWB
|
|||
|
|
|||
|
prohibition-permittion
|
|||
|
OEY CEM CEN CEM_C CEM_Z CEM_N CEM_V RLD CCE CI EV
|
|||
|
|
|||
|
the else
|
|||
|
LOAD FIELD
|
|||
|
|
|||
|
3)operands
|
|||
|
────────
|
|||
|
|
|||
|
operation in the ALU
|
|||
|
RQ Z R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 RA RB
|
|||
|
BUS_D NIL
|
|||
|
|
|||
|
inputting the type of the shift
|
|||
|
SR SL SRA SLA SRL SLL SRWA SLWA SRWL SLWL
|
|||
|
|
|||
|
inputting of the carry sign
|
|||
|
Z RM_C RN_C
|
|||
|
|
|||
|
inputting of the exit of the code of the conditions
|
|||
|
Z NZ ZO CO NO VO
|
|||
|
RN_Z RN_C RN_N RN_V
|
|||
|
RM_Z RM_C RM_N RM_V NXORV ZORC
|
|||
|
|
|||
|
command FIELD
|
|||
|
ABSOLUTE BUS_D BC1 BP2 REGS ALU BY4 BH1 CU MEM
|
|||
|
|
|||
|
operations in the device of the processing of the interruptions
|
|||
|
MR SR IR VR
|
|||
|
|
|||
|
operations of the boot of registers of marks
|
|||
|
RM RN FLAGS Z NZ
|
|||
|
|
|||
|
inputting of switchings of the conditions
|
|||
|
CT INT RDM RDD IRQ0 IRQ1 IRQ2 IRQ3 IRQ4 IRQ5 IRQ6 IRQ7 Z NZ
|
|||
|
|
|||
|
4)the else
|
|||
|
────────
|
|||
|
|
|||
|
CP NOT @ . , ; :
|
|||
|
|
|||
|
|
|||
|
Application 2: The Reports about errors.
|
|||
|
══════════════════════════════════════════
|
|||
|
|
|||
|
1) "," Is Expected;
|
|||
|
2) ";" Is Expected;
|
|||
|
3) "." Is Expected;
|
|||
|
4) ":" Is Expected;
|
|||
|
5) "," or ";" are Expected;
|
|||
|
6) The Mnemonics is not recognized;
|
|||
|
7) The Directive is not recognized;
|
|||
|
8) The Command is not recognized;
|
|||
|
9) The Mark is not determined;
|
|||
|
10) Double determination of marks;
|
|||
|
11) Inadmissible using of reserved mnemonics;
|
|||
|
12) Tne Number too big;
|
|||
|
13) Incidental end of file;
|
|||
|
14) Incorrect receiver of the result in ALU;
|
|||
|
15) Incorrect inputting of operand in ALU;
|
|||
|
16) Incorrect of operand of shift;
|
|||
|
17) Incorrect operand of carrying;
|
|||
|
18) For the operand of the condition the switching is not given;
|
|||
|
19) Incorrect operand of condition;
|
|||
|
20) Incorrect operand of the block of the interruptions;
|
|||
|
21) Incorrect operand of the booting of the register of marks;
|
|||
|
22) Incorrect operand of field;
|
|||
|
23) Invalid using of the operand of the modification;
|
|||
|
24) Repeated using of the data field;
|
|||
|
25) Overflow of the upper addresses of operative memory;
|
|||
|
26) "{" Is Expected;
|
|||
|
27) Incorrect operand of the directive LINK;
|
|||
|
28) Number of fakt. and formal operands of macro does not coincide;
|
|||
|
29) Incorrect operand of directive ACCEPT;
|
|||
|
30) The Cross determination of macros;
|
|||
|
31) Wrong parameter of the command line;
|
|||
|
32) is reserved for errors of file operations;
|
|||
|
33) Operand of the condition is Expected;
|
|||
|
34) Repeated accomodation of microinstructions;
|
|||
|
35) Address of accomodation of the microinstructions is more then limiting.
|
|||
|
|
|||
|
|
|||
|
Application 3: Inputting of fields of the microinstruction by default.
|
|||
|
══════════════════════════════════════════════════════════════════
|
|||
|
|
|||
|
1 )field of constants:
|
|||
|
- D = 0; (data bus-transmittion of the data in ALU: 0)
|
|||
|
- OED=1; (permittion of the presenting of the data from field D
|
|||
|
on data bus:is not allowed)
|
|||
|
|
|||
|
2)field of DPU (daya processing unit):
|
|||
|
BC1: - MI = 64; ( the microinstruction: NOP; R+S+CI; A,Q)
|
|||
|
- A = 0; ( address of RGU for writing in Rg A: R0)
|
|||
|
- B = 0; ( address of RGU for writing/reading Rg B: R0)
|
|||
|
- OE = 1; ( the permittion of the issue of the result on data
|
|||
|
niche:is not allowed)
|
|||
|
BP2: - MI = 0; ( microinstruction)
|
|||
|
- E.Z = 0; ( permittion of writing the marks in RM: resolved)
|
|||
|
- E.N = 0;
|
|||
|
- E.C = 0;
|
|||
|
- E.V = 0;
|
|||
|
- OECT= 1; (permittion of issue of code of condition:not resolved)
|
|||
|
- CEM = 1; (permittion of writing the marks in Rg M and N:
|
|||
|
not resolved)
|
|||
|
- CEN = 1;
|
|||
|
- SE = 1; (the permittion of performing the shift:not resolved)
|
|||
|
External registers of inputting of the operand of ALU:
|
|||
|
- MSA = 0; (selection of the sourse of operands in ALU (MIR or RA,
|
|||
|
RB): MIR)
|
|||
|
- MSB = 0;
|
|||
|
- EWA = 1; (recordimg in registers of selection of operands
|
|||
|
of ALU: no)
|
|||
|
- EWB = 1;
|
|||
|
3)field BMM and BPI:
|
|||
|
ED4: - MI = 14; (Microinstruction: CONT)
|
|||
|
- CCE = 1; (permittion of analysis of the condittion: prohibited)
|
|||
|
- COM = 1; (iverting of the entering of the condition: invert)
|
|||
|
- CI = 1; (forming the following address of the microinstruction)
|
|||
|
- RLD = 1; (the permittion of the recording in register of the
|
|||
|
address/counter:prohibited)
|
|||
|
Multiplexor of the selection of the signal of the condition:
|
|||
|
- MS = 0;
|
|||
|
BH1: - MI = 0; (Microinstruction: RESET)
|
|||
|
- EINS = 1; (The Permittion of acceptance of instruction:
|
|||
|
not resolved)
|
|||
|
- EV = 1; (The Permittion of issue of address of interruption of
|
|||
|
vector on DB from ROM: not resolved).
|
|||
|
4)field OM, ED, RA:
|
|||
|
ED: - I = 1; (the signal of the reading from external device:
|
|||
|
not resolved)
|
|||
|
- O = 1; (the signal of recording on external device:
|
|||
|
not resolved)
|
|||
|
MM: - R = 1; (the signal of the reading from memory: not resolved)
|
|||
|
- W = 1; (the signal of the recording in memory: not resolved)
|
|||
|
RgA - EWH = 1; (the signals of recording on register of the address of
|
|||
|
senior and younger digits: not resolved)
|
|||
|
- EWL = 1;
|
|||
|
|
|||
|
|
|||
|
Applications 4: Example of the program.
|
|||
|
══════════════════════════════════════
|
|||
|
|
|||
|
\ EXAMPLE.ESM
|
|||
|
\ Program executes the following actions:
|
|||
|
\ ---------------------------------------
|
|||
|
\ 1) Selection the command of the microprocessor from memory
|
|||
|
\ 2) Unpacking the command and making decision about execution
|
|||
|
\ 3) Executing the command when command corresponds to pattern
|
|||
|
\ 4) Forming the address of the following microinstruction
|
|||
|
|
|||
|
\ View of the command of the microprocessor
|
|||
|
\ -----------------------------------------------
|
|||
|
\ ┌────┬────┬────────┬────────────────┐
|
|||
|
\ │xxxx│xxxx│xxxxxxxx│xxxxxxxxxxxxxxxx│ - Length is 4 bytes
|
|||
|
\ └────┴────┴────────┴────────────────┘
|
|||
|
\
|
|||
|
\ │ │ │ │
|
|||
|
\ │ │ │ └─── 1..15 - a direct operand
|
|||
|
\ │ │ └──────────────── 16..23- is not in use
|
|||
|
\ │ └─────────────────────── 24..27- RGU,that keeps address of receiver
|
|||
|
\ └──────────────────────────── 28..31- code of operation
|
|||
|
|
|||
|
\ Exemples of the patterns of the command
|
|||
|
\ --------------------------------------
|
|||
|
\ ┌────┬────┬────────┬────────────────┐
|
|||
|
\ │0101│1xxx│........│xxxxxxxxxxxxxxxx│ - Length is 4 bytes
|
|||
|
\ └────┴────┴────────┴────────────────┘
|
|||
|
\
|
|||
|
\ │ │ │ │
|
|||
|
\ │ │ │ └─── any value
|
|||
|
\ │ │ └──────────────── is not in use
|
|||
|
\ │ └─────────────────────── any one of registers R8..R15 of the block ALU
|
|||
|
\ └──────────────────────────── operation of the adding
|
|||
|
|
|||
|
\ Initial adjustments
|
|||
|
\ --------------------
|
|||
|
EQU counter : R0 \ let R0 serves as command counter
|
|||
|
ACCEPT counter : 0FEh \ let the current command is located in memory by
|
|||
|
\ address 0FEh
|
|||
|
DW 0FEh : 5800h,0100h \ command of the processor
|
|||
|
ACCEPT R8 : 0123h \ by example of RGU, that keeps address of the
|
|||
|
\ receiver let this address will be 123h
|
|||
|
DW 0123h : 1111h \ let the cell-receiver contains number 1111h
|
|||
|
EQU com_reg1 : R1 \ let R1 serves as register of commands 1
|
|||
|
EQU com_reg2 : R2 \ let R2 serves as register of commands 2
|
|||
|
EQU result : R3 \ let R3 serves as buffer of result of operation
|
|||
|
LINK L[1] : RDM \ switching the signal of readiness of memory on
|
|||
|
\ the first entering of the Multiplexor of the Conditions
|
|||
|
LINK L[2] : CT \ switching the signal of the sign of the execution
|
|||
|
\ of operations in ALU
|
|||
|
EQU selection : 10 \ the address of the subprogram of the selection of
|
|||
|
\ the command of microprocessor from memory
|
|||
|
EQU unpacking : 20 \ similarly for s/p of unpackings
|
|||
|
EQU execution : 30 \ similarly for s/p of execution
|
|||
|
EQU fafc : 40 \ similarly for s/p of forming of the address of
|
|||
|
\ the following command
|
|||
|
EQU error : 50 \ s/p of processing the opcode that differs from
|
|||
|
\ exemple
|
|||
|
LINK RB : 8,9,10,11 \ adjust RB on lines 8..11 of DB, where
|
|||
|
\ the number of RGU, keeping the address of the receiver goes
|
|||
|
|
|||
|
\ Macros, used for usually repeated commands
|
|||
|
\ ---------------------------------------------
|
|||
|
MACRO MOV MOV receiver, the source:
|
|||
|
{ADD receiver, Z, source;}
|
|||
|
MACRO READ_MEM receiver :
|
|||
|
{R; MOV receiver, BUS_D; CJP RDM, CP;}
|
|||
|
MACRO WRITE_MEM source :
|
|||
|
{W; MOV NIL, source; OEY; CJP RDM, CP;}
|
|||
|
|
|||
|
\ subprogram of the selection of the command of microprocessor from memory
|
|||
|
\ -------------------------------------------------------------------
|
|||
|
ORG selection
|
|||
|
|
|||
|
{MOV NIL, counter; OEY; EWL;} \reading the first byte of the command
|
|||
|
{AND NIL, counter, Z; OEY; EWH;}
|
|||
|
{READ_MEM com_reg1;}
|
|||
|
|
|||
|
{ADD counter, 1;}
|
|||
|
{MOV NIL, counter; OEY; EWL;} \read the second and the third byte of the command
|
|||
|
{AND NIL, counter, Z; OEY; EWH;}
|
|||
|
{READ_MEM com_reg2;}
|
|||
|
{SUB counter, Z;}
|
|||
|
|
|||
|
{CJP NZ, unpackings;} \move to s/p of unpacking of the command
|
|||
|
|
|||
|
\ subprogram of the unpacking of the command of the microprocessor
|
|||
|
\ --------------------------------------------------------------
|
|||
|
ORG unpacking
|
|||
|
|
|||
|
{AND result, com_reg1, 1111000000000000%;}
|
|||
|
{XOR result, 0101000000000000%; LOAD RM, FLAGS;}
|
|||
|
{CJP not RM_Z, error;}
|
|||
|
|
|||
|
{MOV NIL, com_reg1; OEY; WB;} \ write the number of RGU, keeping address of
|
|||
|
\the receiver of the result in register RB
|
|||
|
{MOV NIL, RB; OEY; EWL;} \read the receiver of a result in RGU into a buffer
|
|||
|
{AND NIL, counter, Z; OEY; EWH;}
|
|||
|
{READ_MEM result;}
|
|||
|
|
|||
|
{CJP NZ, executions;} \move on s/p of the executing of the command
|
|||
|
|
|||
|
\ subprogram of the executing the command of the microprocessor
|
|||
|
\ ----------------------------------------------------------
|
|||
|
ORG execution
|
|||
|
|
|||
|
{ADD result, com_reg2;}\execute operation of the adding
|
|||
|
|
|||
|
{MOV NIL, RB; OEY; EWL;} \write the formed result into the
|
|||
|
{AND NIL, counter, Z; OEY; EWH;} \cell of memory, by adress of RB
|
|||
|
{WRITE_MEM result;}
|
|||
|
|
|||
|
{CJP NZ, ncaf;} \move to s/p of next command
|
|||
|
\address former
|
|||
|
|
|||
|
\ subprogram of next command address former of microprocessor
|
|||
|
\ ---------------------------------------------------------------------
|
|||
|
ORG ncaf
|
|||
|
|
|||
|
{ADD counter, 4;} \ the next command of the microprocessor is situated by
|
|||
|
\ address, on 4 bytes senior then previous
|
|||
|
{CJP NZ, select;}\ return to the stage of the selection of the command
|
|||
|
|
|||
|
\ The subprogram of processing the opcode different from exemple
|
|||
|
\ ------------------------------------------------------------
|
|||
|
ORG error
|
|||
|
|
|||
|
{CJP NZ, ncaf;}\ as processing of the error does not fall into the functions of given
|
|||
|
\ program, so then simply moves to s/p of
|
|||
|
\ next command address former
|
|||
|
\ end of the program EXAMPLE.ESM
|