数字图像处理图像反转的实现
Problem statement:
问题陈述:
Write an assembly language program in 8086 microprocessor to reverse 16 bit number using 8 bits operation.
在8086微处理器中编写汇编语言程序,以使用8位操作反转16位数字。
Example: Assume 16 bit number is stored at memory location 2050 and 2051.
示例:假设16位数字存储在内存位置2050和2051中。
Algorithm:
算法:
Load contents of memory location 2050 in register AL
将存储单元2050中的内容加载到寄存器AL中
Load contents of memory location 2051 in register AH
将存储单元2051的内容加载到寄存器AH中
Assign 0004 to CX Register Pair
将0004分配给CX寄存器对
Rotate the contents of AL by executing ROL instruction using CX
通过使用CX执行ROL指令来旋转AL的内容
Rotate the contents of AH by executing ROL instruction using CX
通过使用CX执行ROL指令来旋转AH的内容
Store the content of AH in memory location 2050
将AH的内容存储在内存位置2050中
Store the content of AL in memory location 2051
将AL的内容存储在内存位置2051中
Program:
程序:
MEMORY ADDRESS | MNEMONICS | COMMENT |
---|---|---|
400 | MOV AL, [2050] | AL |
404 | MOV AH, [2051] | AH |
408 | MOV CX, 0004 | CX |
40B | ROL AL, CX | Rotate AL content left by 4 bits(value of CX) |
40D | ROL AH, CX | Rotate AH content left by 4 bits(value of CX) |
40F | MOV [2050], AH | [2050] |
413 | MOV [2051], AL | [2051] |
417 | HLT | Stop Execution |
内存地址 | 记忆 | 评论 |
---|---|---|
400 | MOV AL,[2050] | 铝 |
404 | MOV AH,[2051] | 啊 |
408 | MOV CX,0004 | CX |
40B | ROL AL,CX | 将AL内容左移4位(CX值) |
40D | ROL AH,CX | 将AH内容向左旋转4位(CX值) |
40楼 | MOV [2050],AH | [2050] |
413 | MOV [2051],AL | [2051] |
417 | HLT | 停止执行 |
Explanation
说明
MOV AL, [2050]: loads contents of memory location 2050 in AL
MOV AL,[2050] :将存储位置2050中的内容加载到AL中
MOV AH, [2051]: loads contents of memory location 2051 in AH
MOV AH,[2051] :在AH中加载存储位置2051的内容
MOV CX, 0004: assign 0004 to CX register pair
MOV CX,0004 :将0004分配给CX寄存器对
ROL AL, CX: rotate the content of AL register left by 4 bits i.e. value of CX register pair
ROL AL,CX :将AL寄存器的内容向左旋转4位,即CX寄存器对的值
ROL AH, CX: rotate the content of AH register left by 4 bits i.e. value of CX register pair
ROL AH,CX :将AH寄存器的内容向左旋转4位,即CX寄存器对的值
MOV [2050], AH: stores the content of AH in 2050 memory address
MOV [2050],AH :将AH的内容存储在2050的存储器地址中
MOV [2051], AL: stores the content of AL in 2051 memory address
MOV [2051],AL :将AL的内容存储在2051存储器地址中
HLT: stops executing the program
HLT :停止执行程序
翻译自: https://www.includehelp.com/embedded-system/reverse-a-16-bits-number-using-8086-microprocessor.aspx
数字图像处理图像反转的实现