flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Getting input from 16 bit mode

Author
Thread Post new topic Reply to topic
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
Ive tried every bit of code i can think of, find, and try, and its still not working right, im sure you've seen this question before but how do you get keyboard input? what im looking for is, setting it up if keyboard press left, do specified thing, else if keyboard press right, do specified thing,.. if anyone can help its greatly appreciated!

thanks everyone







Redragon
Post 19 Jun 2005, 03:21
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Look up Terminate and Stay Resident (TSR) programming for DOS. Most TSRs have hooks into the keyboard through I think INT 9h (I can't recall the specifics at the moment).
Post 19 Jun 2005, 04:12
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
TSR is a DOS thing Very Happy

Just use BIOS INT 16h with ah=0 to read keyboard.
Ckeckout BIOS INT functions for help.

here is a small example from SolarOS 16 bit startup menu:

Code:
...
        ;-----------------------------
        ; BIOS wait for a key
        ;-----------------------------
        mov     ah,0
        int     16h
        mov     [user_key],ax

        ;---------------------------
        ; check special keys
        ;---------------------------    
        .IF ah==48h
                ;------------------
                ; up arrow
                ;------------------
                dec     [user_option]
                .IF SIGN?
                        mov     [user_option],0
                .endif
        .ELSEIF ah==50h
                ;--------------
                ;down arror
                ;--------------
                inc     [user_option]
                .IF [user_option]>11
                        mov     [user_option],11
                .endif
        .endif

...
        
    

_________________
"Any intelligent fool can make things bigger,
more complex, and more violent.
It takes a touch of genius -- and a lot of courage --
to move in the opposite direction."
Post 19 Jun 2005, 14:24
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
bogdanontanu wrote:
TSR is a DOS thing Very Happy


Hey Bogdan,

Long time... Yeah I know this is a DOS thing, but I thought since he was looking for specific scan codes he may be interested in a deeper look. From what I recall the TSRs latch into the interrupt vector and scan for left-shift-A or right-ctrl-]. These are generally linked into a software interrupt for at a moments-notice useage. But perhaps I misunderstood Red's needs.

There is always more than one way to skin a cat...some people like turpentine, others use a bazooka. And others too like to make a game out of it; here kitty-kitty! Wink
Post 19 Jun 2005, 17:21
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
It seems he is looking to make a bootable game like "CdPod" but for game, thats why he need to do keypressed.
@Redragon, Have you seen "Privalov" tetris game, from the 512b compo ?, that may help, as thats bootable,and enjoyable Wink.
Post 19 Jun 2005, 17:35
View user's profile Send private message Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
I just got it to work, i finally figured out what i was doing wrong..lol
Post 19 Jun 2005, 18:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.