《输入输出作业题目》由会员分享,可在线阅读,更多相关《输入输出作业题目(20页珍藏版)》请在金锄头文库上搜索。
1、Week1 Suppose a data is 376a8d43h in Hexadecimal, how to place it from the address that 20000h by little endian and big endian? 答:小端存储(little endian)20000H 到 20003H 地址分别存放的是 43H, 8DH,6AH和 37H 大端存储(big endian)20000H 到 20003H 地址分别存放的是 37H,6AH, 8DH 和 43H Convert the follow decimal integer into BCD and
2、packed BCD number. a) 9 b)76 c)251 答:BCD 码:a)09H b)0706H c)020501H 或 a)00001001 b)0000011100000110 c)000000100000010100000001 packed BCD: a)09H b)76H c)0251H或a)00001001 b)01110110 c)0000001001010001 Convert the follow packed BCD number into decimal number: a) 10001001 b) 00001001 c) 00110010 d)00000
3、001 答:a) 89 b) 9 c) 32 d) 1 Convert the follow binary number into signed decimal number: a)10000001 b)00110011 c)10010010 d)10001001 答:a) -127 b) 51 c) -110 d) -119 Week2 How many 8-bit, 16-bit and 32bit general-purpose registers are there in the IA-32 CPU? What are them? Right Answer is: 8 位通用寄存器有
4、AL,AH,BL,BH,CL,CH,DL,DH 共 8 个 16 位通用寄存器有AX,BX,CX,DX,SI,DI,BP,SP 共 8 个 32 位通用寄存器有EAX,EBX,ECX,EDX,ESI,EDI,EBP,ESP 共 8 个 In the real mode, find the memory address of the next instruction executed by the microprocessor for the following CS:IP combinations: a) CS = 1000H and IP = 2000H b) CS = 1900H and
5、IP = 0200H c) CS = 1900H and IP = 1000H D) CS = 5679H and IP = CDEFH Please give the physical memory address. Right Answer is: Physical memory address is: a) 12000H b) 19200H c) 1A000H d) 6357FH Will an overflow occur when signed FFH is added to a signed 01H? How about signed 70H add a singed 40H? R
6、ight Answer is: FFH+1, OF=0, 不产生溢出 70H+40H 会产生溢出,OF=1 Week3 Suppose that (DS)=2000H, (ES)=2100H, (SS)=1500H, (SI)=00A0H, (BX)=0100H, (BP)=0010H, the offset address of VAL is 0050H。Determine the physical address accessed by each of the following instructions, assuming real mode operation. (1)MOV AX,1
7、00H (2)MOV VAL,BH (3)MOV AX,BX (4)MOV AX,ES:BX (5)MOV AX,BP (6)MOV AX, SI (7)MOV AX,BX+50H (8)MOV VALBX,BP (9)MOV AH,BX+SI (10)MOV AL,VALBXSI Right Answer is: (1)20100H (2)20050H (3)20100H (4)21100H (5)15010H (6)200A0H (7)20150H (8)20150H (9)201A0H (10)201F0H Write the directive to define the follow
8、ing variable: 1) Declare an word array named buff which has 800 elements without initial. 2) Declare a string named STRING with initial value “MASM”,”1024” Right Answer is: buff word 800 dup(?) 或 buff dw 800 dup(?) STRING byte “MASM”, “1024” 或 STRING db “MASM”, “1024” Whats different between the EQU
9、 operator and = operator? Right Answer is: EQU 定义的常量不能再赋值,=定义的可以再次定义 Week4 What is the purpose of the .386, .486p, .model directive? Right Answer is: .386 表示该程序使用 386 指令 .486p 表示该程序使用 486 保护模式指令 Whats wrong with the following instructions: (l)MOV AH,BX (2)MOV BX,SI (3)MOV AX,SIDI (4)MOV MYDATBXSI,ES
10、:AX (5)MOV BL,1000 (6)MOV 2000,BX (7)MOV CS,AX Right Answer is: 1)目的操作数与源操作数不等宽 2)两个操作数不能都是存储器操作数 3)不能两个都是变址寄存器 4)寄存器不能用段超越 5)1000 超出 8 位数范围 6)立即数不能做目的操作数 7)CS 不能作为 MOV 的目的操作数 Write a short sequence of instructions that load the data segment register with 1000H Right Answer is: MOV AX, 1000H MOB DS,
11、 AX What is the difference between the LEA SI, NUMB instruction and the MOV SI, OFFSET NUMB instruction? Right Answer is: LEA 指令的源操作数可以是任意寻址方式的存储器操作数, OFFSET 形式的语句只能是变量名或标号名。OFFSET 形式是立即数寻址,速度快。 Suppose the data declared as follow: ORG 26H NUM1 BYTE 12H,13H NUM2 WORD $+3 ORG $+4 NUM3 WORD 325AH, 5A6
12、BH Question: How do the data store in memory? Please draw the memory map. Right Answer is: 按存储地址顺序从低到高,各字节分别是: 12H,13H,2BH,00,-,-,-,-,5AH,32H,6BH,5AH, Suppose the data declared as follow: ORG 100H NUM1 DB 7, 43H, AB NUM2 DW 1, ? NUM3 DB 2 DUP(1, 2 DUP(5) Question: How do the data store in memory? Pl
13、ease draw the memory map. Right Answer is: 按存储地址顺序从低到高,各字节分别是: 7,43H,A,B, 1,0,-,-,1,5,5,1,5,5 Week5 If AX=1001H and DX=20FFH, list the sum and the contents of each flag register bit (CF, AF, SF, ZF and OF). Right Answer is: SUM= 3100H, CF=0,AF=1,OF=0,SF=0,ZF=0 Explain the difference between the SUB
14、and CMP, AND and TEST. Right Answer is: CMP 和 SUB 做同样操作,但不保存结果;TEST 和 AND 做同样操作,但不保存结果 Programming in 16-bit assembly language 1) Add the data in AL, BL and CL, let the result in the DX 2) Add the data in AL and a BYTE data in memory which symbol address is NUMusing Base-Plus-Index addressing. The r
15、esult in the next address of NUM. Right Answer is: 1) MOV DX,0 ADD DL, AL ADC DH,0 ADD DL, BL ADC DH,0 ADD DL, CL ADC DH,0 2) MOV BX, OFFSET NUM (或 LEA BX, NUM) MOV SI, 0 ADD AL, BXSI INC SI MOV BXSI, AL Week6 How many way you know to clear the AX with 0? Please give the way. Right Answer is: 1)MOV
16、AX,0 2) AND AX,0 3) SUB AX,AX 4) XOR AX,AX 5) MOV BL,0 MUL BL Programming in 16-bit assembly language 1) Use shift instruction to calculate DX=3AX7BX,suppose the data are assigned and no carry. 2) Use logic instruction to implement the conversion from ASCII of 09 to unpacked BCD, and from unpacked BCD to ASCII. 3) Implement DX.AX shift right 4 bits. Right Answer is: 1) MOV CX, AX SHL AX, 1 ; AX*2 ADD AX, CX ; AX*3 MOV DX, BX MOV CL, 3 SHL DX, CL ; BX*8 SUB DX, BX ; BX*7 ADD DX, AX 2) MOV AL, 0 L