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.
http://board.flatassembler.net/topic.php?t=4122
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.
i wrote a simple input code. based on information i had aquired from posts, and tutorials. and reading Hla.
http://board.flatassembler.net/topic.php?t=4122
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.
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
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
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 !!!
;)
Greetings and thanks for reply !!!
;)
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.
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.
Ok,i see,here is your code:
.286
.model small
.stack 0100h
.data
msg1 db 'Press Enter to Quit: ',10,13,"$"
.code
start:
@@:
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,0dh
jne @B
@@:
ret
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!
:)
.286
.model small
.stack 0100h
.data
msg1 db 'Press Enter to Quit: ',10,13,"$"
.code
start:
@@:
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,0dh
jne @B
@@:
ret
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!
:)
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
start:
@@: <- i supporse that jne @B, jumps to here to start again if a different key is pressed?
but why is there
@@: <- those here?
ret
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
start:
@@: <- i supporse that jne @B, jumps to here to start again if a different key is pressed?
but why is there
@@: <- those here?
ret
@@: is an anonymous label. @B means previous anonymous label and @F means anonymous label forward. Hope it makes some sense.
perfect, are there any other @<enter character here>
that i should be aware of. as that makes perfect sense, and is very useful.
that i should be aware of. as that makes perfect sense, and is very useful.
Nope not that I know of.
good good, that information has shed alot of light on a fair amount of source code that i have gathered to study.