ok i am a beginner assembler programmer, teaching myself how to code asm. through tutorials etc. i thought i'd learn com based (consol) asm first so i can get the meat, before i go and use windows. as that way i am not clouded by loads of skeleton code to do with the window. i just have infront of me the code that does what i want it to.

i wrote a simple input code. based on information i had aquired from posts, and tutorials. and reading Hla.

now i want to advance the code, IF you don't hit the correct key, the code just loops and theres no way to exit, ok proberly ctrl+c and obviously closing the window.

but i was wondering how i could watch constantly for the enter key. if that key is pressed the code automatically stops.
how could i do this.
o if you hadn't realised i am using fasm.
Posted on 2005-09-25 03:16:45 by Damnation
Hi there!
I've wrote that example for you. There are several ways to generate 'hotkeys' in you applications. In this example ,i represent the eaysiest way to do it:

with WM_CHAR message ,after this message is catched ,the wParam will hold the keycode of the pressed key.
My suggestion is if you app is not a huge one or too compex to use this method.
The other one is most convinient for large program and use it in my programs all the time - Accelerator table. Read more about that if you whant to:

http://msdn.microsoft.com/library/en-us/wceshellui5/ html/wce50conLoadingandActivatinganAcceleratorTable.asp
Posted on 2005-09-25 04:40:03 by shaka_zulu
I decide to make an example with accelerator table too! Is a little bit comlex but this is the better option !!!
Greetings and thanks for reply !!!
Posted on 2005-09-25 07:49:22 by shaka_zulu
took alook at the first example. was stumped, i did mine in dos well com. but i didn't know where to post on here. so i am not sure if the code will automatically look for key input, i know i had to place certain values into ah, and then use interupts before, i guess i am using the wrong forum. but anyway all info for the future.
and i will now take alot at the other example you drew up.

thank you for both examples. they will prove to be very helpful.
Posted on 2005-09-25 08:25:01 by Damnation
Ok,i see,here is your code:

.model small
.stack 0100h

msg1 db 'Press Enter to Quit: ',10,13,"$"

lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,0dh
jne @B
end start

You can use it in .exe or .com 16 bit

And i've attached a 32bit console mode app,with the same task - Look it !
Bye for now and thanks for reply!
Posted on 2005-09-26 08:18:28 by shaka_zulu
thanx, i am going to take alook in abit, just catching up on things, got home from work
and got thrown in a bath by my gf, she hates the smell of raw meat (butcher).
and thanx for a re-write of my code.
i am going to study it and edit it.

the @@ and jne @B

i can't remembre what fasm docs said on the @@ labels.
but jne @B
the letters next to the @
how do they work, i have seen in a small source file
@B and @F
and didn't quite understand.

and why is there
@@: <- i supporse that jne @B, jumps to here to start again if a different key is pressed?

but why is there
@@: <- those here?
Posted on 2005-09-26 08:33:38 by Damnation
@@: is an anonymous label. @B means previous anonymous label and @F means anonymous label forward. Hope it makes some sense.
Posted on 2005-09-26 08:35:31 by roticv
perfect, are there any other @<enter character here>
that i should be aware of. as that makes perfect sense, and is very useful.
Posted on 2005-09-26 10:32:46 by Damnation
Nope not that I know of.
Posted on 2005-09-26 11:20:57 by roticv
good good, that information has shed alot of light on a fair amount of source code that i have gathered to study.
Posted on 2005-09-26 13:13:01 by Damnation