简体   繁体   English

Intel 8086上的数字基本转换

[英]numerical base conversion on Intel 8086

I'm working on a numerical base conversion program and I've stumbled upon a problem in one part of the code: 我正在研究数字基本转换程序,我在代码的一部分偶然发现了一个问题:

    mov ax,36864
    mov bx,ax
    mov dx,0
    sub bx,4096
    jns ustawGr
    mov al,48
    int 29h
    jmp konwerter16

It works fine for numbers up to 36863, but for some reason it is not going into ustawGr and prints 0 for any higher number even though the register should be able to contain it. 它适用于高达36863的数字,但由于某种原因它不会进入ustawGr并为任何更高的数字打印0 ,即使寄存器应该能够包含它。

36864 - 4096 is 0x9000 - 0x1000 == 0x8000 . 36864 - 40960x9000 - 0x1000 == 0x8000 In two's complement representation 0x8000 is the greatest negative 16-bit number ( -32768 ). 二进制补码表示中, 0x8000是最大的负16位数( -32768 )。 And since the value is negative, your jns won't be taken. 由于该值为负,因此不会采用您的jns

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM