1. 程式人生 > >將 ASCII 碼錶示的十進位制數轉換為二進位制數

將 ASCII 碼錶示的十進位制數轉換為二進位制數


<pre name="code" class="plain">SSTACK     SEGMENT STACK
           DW 64 DUP(?)
SSTACK     ENDS
DATA       SEGMENT
SADD       DB 30H,31H,32H,33H,34H ;十進位制數:01234
DATA       ENDS
CODE       SEGMENT
           ASSUME CS:CODE, DS:DATA
START:     MOV AX, DATA
MOV        DS, AX
MOV        AX, OFFSET SADD
MOV        SI, AX
MOV        BX, 000AH
MOV        CX, 0004H
MOV        AH, 00H
MOV        AL, [SI]
           SUB AL, 30H
A1:        IMUL BX
           MOV    DX, [SI+01]
           AND DX, 00FFH
           ADC AX, DX
           SBB AX, 31H
           INC SI
           LOOP A1
A2:         JMP A2
CODE     ENDS
              END START