Author Topic: Conveter 8 to 16/32 and opissit  (Read 3728 times)

nobody

  • Guest
Conveter 8 to 16/32 and opissit
« on: January 21, 2005, 08:59:57 PM »
Hi, lol question but how to conveter from 8 to 16/32 and opissit - ps are im spelling opissit right?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2437
  • Country: us
Re: Conveter 8 to 16/32 and opissit
« Reply #1 on: January 23, 2005, 05:19:54 AM »
I think you probably want "opposite". Don't worry about it - if you *try* to be clear, your English will probably be "good enough"! I hate it when people "apologize" for not speaking English - it isn't a "virtue", just "common". I speak *only* English - if you know your own language, and *any* English, you're way ahead of me!

However, I don't understand the question. 8 to 16/32 what? Bits, I assume? I doubt if any 8-bit code would run as 16/32 bit code, even if it were "converted"...

Maybe if you explain more about what you're trying to do, someone can help... or maybe not...

Best,
Frank

nobody

  • Guest
Re: Conveter 8 to 16/32 and opissit
« Reply #2 on: January 23, 2005, 02:24:53 PM »
Okay, I know my language(danish) but don't like the danish language, becuase there isn't a enough words, its a old language, and there doesn't come any new words to it, the only new words there is in danish is "f***" and "okay" and they are english, so lol I hate my own language, and I do almost anything to not speak my own language, and learn english... And also, im try explain, I have a interrupt, that gets a char from input(stdin) and so save it, but i need to conveter that(8 bit) to a 32 bit, for using it to a MessageBox API...

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2437
  • Country: us
Re: Conveter 8 to 16/32 and opissit
« Reply #3 on: January 24, 2005, 02:36:33 AM »
Okay, I guess I understand... The parameter(s) to "MessageBox" are addresses of buffers - they're already 32-bit (better be!). You've got one-or-more characters from STDIN... If you've used "ReadFile" on STDIN, they ought to already be in a buffer. Just call MessageBox something like...

push dword 0 ; box style
push dword caption_text
push dword my_input_buffer
push dword 0 ; or handle of parent window
call [Messagebox]

(the "dword" isn't required in recent versions of Nasm - I include it so earlier versions of Nasm would assemble it - but please upgrade to 0.98.39 - BUFFER OVERFLOW in all earlier versions!!!)

If you're using something more exotic than ReadFile to "get" your character, you may need to save it in a buffer yourself (pushing it on the stack and using esp as the buffer address should work). In any case, make sure your buffer is zero-terminated!

There's another possible issue (and perhaps this is what you mean)... MessageBox comes in two varieties, MessageBoxA for ascii and MessageBoxW for "wide" - unicode - characters. Unicode comes in several varieties... I *think* what Windows uses is 16-bit characters, and I *think* if the characters are plain ascii, you just want 'em interspersed with zeros. "movzx ax, al" or "movzx eax, al" may help, if this is what you need to do. "and (e)ax, 0FFh" would do the same thing.

Being an "English-only dinosaur", I don't know how to use unicode... But it's a changing world - ascii really doesn't cut it these days. We really *should* be using unicode for everything!

Hope that's some help...

Best,
Frank