tags: Computer composition principle
Class A: Enter an array M that contains 10 integers (no signed number), output the number of outputs and the number of occurrences
Source file at the bottom
| Directive Missing |
Instruction format |
Features |
|||
| 15——12 |
11 10 |
9 8 |
7——0 |
||
| MOV Rd,im |
0001 |
XX |
Rd |
Im |
Enter equipment → RD |
| IN Rd |
0010 |
XX |
Rd |
XXXXXX |
input device → Rd |
| DEC Rd |
0011 |
XX |
Rd |
XXXXXX |
(RD) - 1 → RD, latched ZF, CF |
| SUB Rs Rd |
0100 |
Rs |
Rd |
XXXXXX |
(Rs) - (Rd) → RdLockZF、CF |
| JB |
0101 |
XX |
XX |
addr |
CF = 0 AddR → PC |
| JZ |
0110 |
XX |
XX |
addr |
ZF=0 thenaddr → PC |
| JMP |
0111 |
XX |
XX |
addr |
addr → PC |
| CMP |
1000 |
Rs |
Rd |
XXXXXX |
(Rs) – (Rd)LockZF、CF |
| ADD |
1001 |
Rs |
Rd |
XXXXXX |
(RS) + (RD) → RD, latched ZF, CF |
| OUT |
1010 |
Rs |
XX |
XXXXXX |
(Rs) → Output device |
| LAD |
1011 |
Rs |
(Rd) |
XXXXXX |
((Rs)) → Rd |
| STO |
1100 |
Rs |
(Rd) |
XXXXXX |
(Rs) → (Rd) |
| INC |
1101 |
XX |
Rd |
XXXXXX |
(RD) + 1 → Rd, latching ZF, CF |


| MOV R0,0H MOV R1,10 FLAG1:IN R2 STO R2,(R0) INC R0 CMP R0,R1 JB FLAG1 --------- The number of initialization --MOV R1,20 --MOV R2,1H FLAG2:ST0 R2,(R0) INC R0 CMP R0,R1 JB FALG2 --------- Recording MOV R1,0H FLAG3:MOV R0,1H ADD RO,R1 FLAG4:LAD (R1),R2 LAD (R0),R3 CMP R2,R3 JZ ADD_ONE FLAG5:INC RO MOV R2,10 CMP R0,R2 JB FLAG4 INC R1 CMP R1,R2 JB FLAG3 JMP FALG6 ADD_ONE:MOV R3,31 STO R1,(R3) MOV R3,10 ADD R1,R3 LAD (R1),R3 INC R3 STO R3,(R1) MOV R3,31 LAD (R3),R1 JMP FALG5
FALG6:MOV R0,0 MOV R1,20 MOV R2,29 LAD (R0),R3 STO R3,(R2) INC R2 MOV R3,10 ADD R0,R3 LAD (R0),R3 STO R3,(R2) MOV R0,0 FLAG7:INC R0 MOV R1,10 ADD R1,R0 LAD (R1),R2 CMP R3,R2 JB SAVE
MOV R1,9 CMP R0,R1 JB FLAG7 JMP END
SAVE:MOV R1,30 STO R2,(R1) LAD (R1),R3 LAD (R0),R2 MOV R1,29 STO R2,(R1) MOV R1,9 CMP R0,R1 JB FLAG7
END:MOV R0,29 LAD (R0) R2 INC R0 LAD ,(R0) R3 OUT R2 OUT R3 |
Link: https: //pan.baidu.com/s/19-nobtown7rwcfp3nj5taw
Extraction code: 1234
If you have any questions, please contact [email protected]
Beihang Computer College - Computer Composition Principle Course Design - 20121 Autumn PreProject-MIPS MIPS assembly program analysis All blogs, knowledge explanations, exercises, and answers are crea...
Feng, Neumann Computer: Operator as Core Operator Controller Memory Input Device Output Device Modern Computer: Memory is the core 1.CPU (central processing unit) core device (ALU) logic unit, CU (con...
1 computer hardware composition diagram Feng Ruyiman's computer concept is mainly based on the operator, the data transmission of the IO device and the main memory needs to pass through the arithmetic...
Representation of fixed point numbers and floating point numbers Fixed points: 1 signed fixed-point decimal: the decimal point is fixed after the sign bit 1( ).1111111 2 signed fixed-point integer: th...
Numerical data representation: 1 base: the number of counting symbols allowed on each digit 2 weights: each bit corresponds to a value indicating the position in the number For example: binary is not ...
Computer classification First, the computer can be divided into two major categories: analog computers and digital computers. 1 Analog computer: processing time and numerically continuous analog quant...
electronic calculator(electronic computer), commonly known as computer, referred to ascomputer(computer) is a machine that processes data based on a series of instructions. In the 1930s, the Bulgarian...
Data validation: 1 Parity: Add one parity bit so that the number of 1 is odd or even example: Information to be encoded 10110001 Odd parity code 101100011 -----5 ‘1’ Even parity code...
First, complement plus subtraction: (X + Y) complement = X complement + Y complement (X - Y) complement = X complement + (-Y) (-Y) Supplement = (Y complement) Complementary operation: no matter whethe...
Title: "Computer Composition Principle" bus tags: [computer] mathjax: false date: 2018-06-18 20:57:27 categories: - Computer keywords: description: top: bus history classification characteri...