News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

left click interrupt proc or macro

Started by bcddd214, December 07, 2011, 09:18:19 PM

Previous topic - Next topic

dedndave

i see Michael is playing with similar code on the other thread   :P

he is right
your code does work
thing is - for it to exit via the mouse click, you then have to exit via a key stroke
that is because of the program flow

you call waitkey
then, you call mouse
then, you call getchar

if you look at the loop i wrote, it checks the mouse status, then checks for a key-press, then back to mouse status
it continues to loop until either one of them occurs

you just need to change your pogram flow a little bit
write a routine that checks both mouse and keyboard

bcddd214


bcddd214

I figured it out. wow, how encrypt of a release.
Whats the best way to clean it up?

dedndave

well - i am not sure what you want to happen

tell us exactly what you expect - exactly what you are trying to do

dedndave

i do see a problem
the curpos routine expects a parameter be passed on the stack
however, you have not passed one

dedndave

         mov          al,application.leftCol
         mov          ah,application.upperRow
         push         ax
         call         curpos

bcddd214


bcddd214

That fixed my cursor position, but still see no text when I type?

dedndave

that's because you do not make any function calls to get user input

bcddd214

YUP!
and now I remember, that what the unused putchar      PROC  was put there for.  :)
Do you have a template I can put into the proc?

dedndave

well - i suggest INT 21h, function AH = 0Ah

        .DATA

BufLen  db 20
RetLen  db 0
BufInp  db 21 dup(?)

        .CODE

        mov     dx,offset BufLen
        mov     ah,0Ah
        int     21h


the user cannot enter more than the number of characters specified by BufLen
when the function is done, RetLen has the number of characters entered by the user
it is not terminated with a 0 or $ - it is terminated with a 0Dh as i remember - which is a carriage return
notice that we allow one more character in the buffer than BufLen - that is for the carriage return

again - it has been a while since i used with this
my details may be off slightly and you may have to play with it a little to get the hang of it

also - we could make a structure out of the input buffer to make it pretty   :P


dedndave

that's because you have a program flow issue, again
that code is never executed

bcddd214

let me put together a crude logical so you can help me see my error.  brb

dedndave