Linux的移动NASM在AL高达AX的值 [英] linux nasm move a value in AL up to AX

查看:136
本文介绍了Linux的移动NASM在AL高达AX的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的方式由10多次除以整数和收集剩余物,然后打印它们打印多个位整数。这里是有问题的code段:

I am working on a way to print multiple digit integers by dividing the integer by 10 repeatedly and collecting the remainders, then printing them. Here is a code segment that has the problem:

鸿沟:

    ; initial division
    mov ax, 111   ; number we want to print
    mov ch, 10    ; we divide by ten to siphon digits
    div ch        ; divide our number by 10

    ; al now has 11, ah has 1
    mov dh, ah ; save the remainder in dh
  1 mov bx, al ; these lines refill ax with the number to 
    mov ax, bx ; divide
    mov ch, 10 ; refill ch with the divisor
    div ch     ; al now has 1, ah now has 1

标有1所述的线路有问题。我需要在8位寄存器AL到16位寄存器AX移动值。我怎样才能得到价值有这样我就可以把它?

The line marked with 1 has the problem. I need to move a value in 8 bit register AL to a 16 bit register AX. How can I get that value there so I can divide it?

推荐答案

刚刚清除注册代替。在寄存器包含了它的高和低的部分 - 啊:人

Just clear the ah register instead. The ax register consists of it's high and low part - ah:al

这同样适用于 BX (BH,BL) CX (CH,CL)和 DX (DH,DL)寄存器

The same applies to bx (bh,bl) cx (ch,cl) and dx (dh,dl) registers

这篇关于Linux的移动NASM在AL高达AX的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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