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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Ben Hsu

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

Post 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
Ben Hsu

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

Post 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
Post Reply