在寄存器中存储最高有效/最低有效半字节 [英] Storing most significant/least significant nibble in registers

查看:163
本文介绍了在寄存器中存储最高有效/最低有效半字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对汇编编程非常陌生,并且在分配方面遇到一些问题.我正在尝试在AL中存储一个十六进制值(94h),并在DH中存储最高有效的半字节(MSN),而在DL中存储最低的有效半字节(LSN).我知道我可以使用向左移动和向右移动(按4)来隔离MSN和LSN,但是我不知道如何将结果存储在DL和DH中.

I am very new to assembly programming, and I am having some issues with an assignment. I am trying to store a hex value (94h) in AL and store the most significant nibble (MSN) in DH and least significant nibble (LSN) in DL. I know I can use shift left and shift right (by 4) to isolate the MSN and LSN, but I dont know how to store the result in DL and DH.

例如: 如果AL包含数字94h 1)我想在DH中存储39h(字符"9"的ASCII码) 2)我要在DL中存储34h(字符"4"的ASCII码) 3)我需要显示字符"9","4","h",换行符"和回车".

As an example: If AL contains the number 94h 1)I want to store 39h (ASCII code of the character ‘9’) in DH 2)I want to store 34h (ASCII code of the character ‘4’) in DL 3)I need to display the characters ‘9’, ‘4’, ‘h’, ‘linefeed’, and ‘carriage return’.

MOV AL, 94h ; AL <-- 94h / 1001 0100
MOV CL, 4
SHR AL, 4 ; AL = 0000 1001 = 9 
; How do i store this into DH

在这一点上,我很困惑.

At this point, I'm stumped..

推荐答案

众多解决方案之一:

mov al, 94h
mov dh, al
shr dx, 4
shr dl, 4

这篇关于在寄存器中存储最高有效/最低有效半字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆