In DOS assembly.
I wanna know how am I to convert decimals to displayable strings?
Ie. 45 becomes "45"

BTW, how to create textbox in WASM?
Posted on 2002-04-03 06:30:26 by jian2587

In DOS assembly.
I wanna know how am I to convert decimals to displayable strings?
Ie. 45 becomes "45"


Have a look to the dwtoa proc from MASM32 lib...

BTW, how to create textbox in WASM?


WASM ? You mean win32asm ? Textbox = DialogBox or Message Box ?

Anyway, all about the basis (and more) of it is on the Iczelion's tutorials : http://www.win32asm.cjb.net

Bye...
Posted on 2002-04-03 06:38:25 by JCP
HEX... parse each seperate digit as an individual byte (45 becomes 0x04 and 0x05)... then add 0x30 to those individual bytes to make them corresponding ASCII decimal.

ASM Example:
-----------------
;Assuming you are in some sort of text mode (80x25x16 perhaps)
mov ax,0x0504 ;AH=0x05 (5), AL=0x04 (4)
add al,0x30 ;ADD 0x30 to AL
add ah,0x30 ;ADD 0x30 to AH
mov WORD,ax
mov ax,0x1301 ;INT 10, Mode 13 Sub-Mode 01 (move cursor after string write)
mov bx,0x0007 ;BH = Video Page, BL = Character Attributes (gray color in this case)
mov cx,0x0001 ;Length of string (subtract one for non null/zero-ending strings)
xor dx,dx ;Zero-out DX
mov bp,BUFFER ;BP hold address of string to use
int 0x10 ;BIOS "Video" Interrupt

I hope I got your question right ;)
Posted on 2002-04-03 06:45:01 by SpooK


WASM ? You mean win32asm ? Textbox = DialogBox or Message Box ?
or perhaps editbox?
Posted on 2002-04-03 17:05:18 by jademtech
Posted on 2002-04-03 17:16:24 by Hiroshimator
Thanx 2 ur reply.
About the decimal to string conversion, that's not what I want.

Let's say AH contains 20h (32 decimal)
MOV AH, 20h

I wanna print this value to the screen. Say,
Your age is 32.
The 32 is the value in AH.
Yeah, how to get the character 3 and character 2?
ASCII 51 and 50.

And also vice versa, that is the string character 3 and 2 convert
to a value 20h(32)

Thanx
About the textbox, umm...I'll check out Izelion's tutorial.
The textbox is actually a control where users could input strings in it. Like notepad...
Posted on 2002-04-04 05:37:19 by jian2587
If the number is less than 100 (0 - 99) you can use aam.
Otherwise you'll need a more complex algorithm, there are several out there, some are obvious (n mod 10, n div 10, repeat), others are slightly more optimised. There is an optimised algo in the MASM32 library (dwtoa).

To use aam do:


mov ax, number
aam
add ah, 30h
add al, 30h
mov string, al
mov string + 1, ah


As for creating a "textbox" it is an edit class. Use similar code to creating a button, except pass a pointer to the text "EDITCLASS" for the class name.

Mirno
Posted on 2002-04-04 06:03:06 by Mirno
thanx
u've been great help.:alright:
Posted on 2002-04-05 06:07:14 by jian2587