Page 1 of 1

1 byte (int) --> 2 (char)

Posted: Wed Apr 10, 2002 11:00 pm
by Ben Hsu
Hello,
I've got an algorithm that changes 1 byte int
to 2 byte char...
pre-condition: al := converting content
post-condition: ah == higher byte, al == lower byte

---- this is the code ----
pusha
mov ah,0x00
mov al,a
aam
or al,0x30
mov a,al
or ah,0x30
mov b,ah
popa
---- END ----

Ben Hsu

RE:1 byte (int) --> 2 (char)

Posted: Wed Apr 10, 2002 11:00 pm
by Ben Hsu
oh, a and b are just desired position in memory,
i did this with my c++ compiler and they just went
into the variable (char)a and (char)b.

Ben

>On 2002-04-11 17:06:17, Ben Hsu wrote:
>Hello,
> I've got an algorithm that changes 1 byte int
>to 2 byte char...
>pre-condition: al := converting content
>post-condition: ah == higher byte, al == lower byte
>
>---- this is the code ----
>pusha
>mov ah,0x00
>mov al,a
>aam
>or al,0x30
>mov a,al
>or ah,0x30
>mov b,ah
>popa
>---- END ----
>
>Ben Hsu