Академический Документы
Профессиональный Документы
Культура Документы
A hypothetical computer that includes the hardware features most often found on real machines
SIC standard model SIC/XE
Upward compatible
Programs for SIC can run on SIC/XE
PC SW
8 9
SIC does not have any stack. It uses the linkage register to store the return address. It is difficult to write the recursive program. A programmer has to maintain memory for return addresses when he write more than one layer of function call.
Integers
24-bit binary numbers 2s complement for negative values
-N 2n N e.g., if n = 4, -1 24 1 = (1111)2.
Note that the memory size of SIC is 215 bytes X is to indicate index-address mode
Addressing modes
Mode Direct Indexed Indication x=0 x=1 Target address calculation TA = address TA = address + (X)
Arithmetic instruction
involve register A and a word in memory ADD, SUB, MUL, DIV Ex: ADD ALPHA (A) (A) + (ALPHA)
Comparison instruction
involves register A and a word in memory save result in the condition code (CC) of SW COMP Ex: COMP ALPHA CC (<,+,>) of (A)?(ALPHA)
RSUB
returns to the address in L
OUTLP
TEST OUTPUT DEVICE LOOP UNTIL DEVICE IS READY LOAD DATA BYTE INTO REGISTER A WRITE ONE BYTE TO OUTPUT DEVICE
XF1 X05 1
1 5 CZ 1
1 1 1 1 1 1
CTEST STRING 11
WORD 0 WORD 11
COMPARE NEW INDEX VALUE TO 300 LOOP IF INDEX IS LESS THAN 300 ONE-WORD VARIABLE FOR INDEX VALUE ARRAY VARIABLES100 WORDS EACH
Define storage
WORD/BYTE
Reserve one word/byte of storage
RESW/RESB
Reserve one or more words/bytes of storage
Example
ALPHA FIVE CHARZ C1 RESW WORD BYTE RESB 1 5 C`Z 1
Registers S and T are only for storing data. They can not use for accumulator
Ex: ADDR S, A COMPR X, T A A+S
sign bit s (0: +, 1: -) fraction f: a value between 0 and 1 exponent e: unsigned binary number between 0 and 2047 value: s * f * 2 (e-1024) Ex: 5 = 22+20=(2-1+2-3)*23= (2-1+2-3)*21027-1024 0,10000000011,1010000.0
! ! ! !
" "
When base relative mode is used, disp is a 12-bits unsigned integer When program-counter relative mode is used, disp is a 12-bits signed integer
2s complement
Direct addressing for formats 3 and 4 if b=p=0 These two addressing mode can combine with index addressing if x=1
Simple addressing
Indirect
Immediate
Input/Output
SIO, TIO, HIO: start, test, halt the operation of I/O device
1 1
STR1 STR2
CTEST STRING 11
ADDLP
SUBROUTINE TO READ 100-BYTE RECORD #0 INITIALIZE INDEX REGISTER TO 0 #100 INITIALIZE REGISTER T TO 100 INDEV TEST INPUT DEVICE RLOOP LOOP IF DEVICE IS BUSY INDEV READ ONE BYTE INTO REGISTER A RECORD,X STORE DATA BYTE INTO RECORD T ADD 1 TO INDEX AND COMPARE TO 100 LOOP IF INDEX IS LESS THAN 100 RLOOP EXIT FROM SUBROUTINE
XF1 100