# PLS help with 32 bit integer value read/write

Hi!
Can somebody help me with reading in a 32 bit integer number?
The problem is that I can use only the 16bit registers (AX,BX...), and cannot use the 32 bit ones. The function must give the number back in the DX:AX.
I've tried to make a 32 bit reading out of a 16 bit one, but it didn't work.
Here is the code:
[code]
push cx
push si
push di
xor cx, cx
mov ah, 0x01
int 0x21
cmp al, '-'
jne .pozitiv
mov si, 1
jmp .next
.pozitiv:
mov si, 0
cmp al, '+'
je .next
cmp al, '0'
jb .vege
cmp al, '9'
ja .vege
mov ah, 0
sub al, '0'
.next:
mov ah, 0x01
int 0x21
cmp al, '0'
jb .end
cmp al, '9'
ja .end
mov ah, 0
sub al, '0'
mov di, cx
shl di, 1
shl cx, 3
jmp .next
.end:
mov ax, cx
cmp si, 1
jne .end2
neg ax
.end2:
pop di
pop si
pop cx
retn
[/code]

• : Hi!
: Can somebody help me with reading in a 32 bit integer number?
: The problem is that I can use only the 16bit registers (AX,BX...),
: and cannot use the 32 bit ones. The function must give the number
: back in the DX:AX.
: I've tried to make a 32 bit reading out of a 16 bit one, but it
: didn't work.
: Here is the code:
: [code]:
: push cx
: push si
: push di
: xor cx, cx
: mov ah, 0x01
: int 0x21
: cmp al, '-'
: jne .pozitiv
: mov si, 1
: jmp .next
: .pozitiv:
: mov si, 0
: cmp al, '+'
: je .next
: cmp al, '0'
: jb .vege
: cmp al, '9'
: ja .vege
: mov ah, 0
: sub al, '0'
: .next:
: mov ah, 0x01
: int 0x21
: cmp al, '0'
: jb .end
: cmp al, '9'
: ja .end
: mov ah, 0
: sub al, '0'
: mov di, cx
: shl di, 1
: shl cx, 3
: jmp .next
: .end:
: mov ax, cx
: cmp si, 1
: jne .end2
: neg ax
: .end2:
: pop di
: pop si
: pop cx
: retn
: [/code]:
:

Just a taught for handling 32bit regs with a 16 bit assembler (target cpu is 386+ )
Assume that ax has the upper 16 bit and bx the lower 16 (ax:bx)

db 66h
shl ax,8 ;gets encoded as: shl eax,8
db 66h
shl ax,8
mov ax,bx ;now eax holds ax:bx

• : Just a taught for handling 32bit regs with a 16 bit assembler
: (target cpu is 386+ )
: Assume that ax has the upper 16 bit and bx the lower 16 (ax:bx)
:
: db 66h
: shl ax,8 ;gets encoded as: shl eax,8
: db 66h
: shl ax,8
: mov ax,bx ;now eax holds ax:bx
:
:
Thx, but I cannot use the 32bit registers, I must use the 16 ones to store a 32bit value in the DX:AX registers. This is my problem, that I don't know how to do it. I need to read a 32bit integer value, then a 32bit hexadecimal value, a 32bit binary value and then write them. These must be separate subprogramms and each must have a name ex: the 32bit integer reading must have the name ReadInt32.
Oh, I forgot to mention that I need to use the CPU in real mode...