flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
ManOfSteel 30 Oct 2007, 12:34
Quote: and thus move one byte over in video memory Actually it always moves two bytes (one for the character and one for the attribute). Quote: it continues on with putting the same character on the screen You should add 2 to your video memory pointer (base = 0xb8000) everytime you press a key. That way you will be able to see all the characters you type. You can also move your video cursor using the VGA ports 0x3D4 and 0x3D5 everytime accordingly. Quote: Is there any way around that without setting up the IDT for it The best way to do it is to set your IDT up, reprogram the PIC and enable at least IRQ line 1 (as keyboard). Everytime the user presses a key, IRQ1 fires up and then, you poll port 0x60 for the scancode and other data. EDIT: by the way, what do you mean by the video memory being full? |
|||
![]() |
|
rhyno_dagreat 30 Oct 2007, 20:43
Actually, I meant one WORD, not byte, I do add two naturally.
And what I mean by Video Memory being full, it repeats the same character on the screen multiple times until the screen is full with it. |
|||
![]() |
|
dosin 31 Oct 2007, 06:13
screen:
AAAAAAAAAAAAA AAAAAAAAAAAAA AAAAAAAAAAAAA AAAAAAAAAAAAA screen: BBBBBBBBBBBBB BBBBBBBBBBBBB BBBBBBBBBBBBB BBBBBBBBBBBBB you need to add to your keyboard code.... it just keeps looping until the screen is full! in al,60h just loops and wont wait for a keypress... Last edited by dosin on 05 Nov 2007, 07:21; edited 3 times in total |
|||
![]() |
|
Japheth 31 Oct 2007, 11:51
when polling the keyboard, before reading port 60h you should first check if "the input buffer is full", by reading port 64h and test if bit 0 is set.
Another issue with polling and reading port 60h is that a PS/2 mouse will also send its data to this port. True keyboard data will only be available if bit 5 of port 64h is 0. |
|||
![]() |
|
Dex4u 31 Oct 2007, 12:35
Some simple code like this should work OK, untill you have your IRQ set up.
Code: ;********************************* ; Main keyboard loop. ;********************************* NoKey: xor eax,eax ; you need this here in AL,60h |
|||
![]() |
|
vid 31 Oct 2007, 13:07
Code: xor eax,eax ; you need this here why does he need it there??? |
|||
![]() |
|
Dex4u 01 Nov 2007, 00:08
Because this is cut from some code i did, which latter does this:
Code: mov edi,eax and this: Code: mov al,[edi+normal_keymap] I was going to put the full code, but then i chopped most of it off. |
|||
![]() |
|
Hayden 01 Nov 2007, 05:46
Here is some code I wrote a while ago...
Code: ;------------------------------------- ; IBM8042 - donated to public domain ; Created by: Hayden Mckay ;------------------------------------- ;------------------------------------- align 4 ; send a command ps8042ccmd: call near ps8042waitr out 064h, al ret ;------------------------------ align 4 ; send data port ps8042send: call near ps8042waitr out 060h, al ret ;------------------------------ align 4 ; read data port ps8042read: call near ps8042waitd in al, 060h ret ;------------------------------------- ;------------------------------------- align 4 ps8042waitr: mov ah, al ; AL preserved @@: in al, 064h test al, 002h ; ( bit-d1 ) loopnz @b xchg al, ah ret align 4 ps8042waitd: mov ah, al @@: in al, 064h test al, 001h ; ( bit-d0 ) loopz @b xchg al, ah ret ; AH - holder for keyboard read status ;------------------------------------- hope it might be usefull _________________ New User.. Hayden McKay. |
|||
![]() |
|
rhyno_dagreat 02 Nov 2007, 04:57
Thank you all for the support!
PS... Hayden, maybe you should change your signature. You are no longer a new user, I'd say. ![]() |
|||
![]() |
|
dosin 04 Nov 2007, 20:17
I dont no if you have it working or not but add this to your code to get the scan code:
Code: WaitLoop: in al, 64h ; Read Status byte and al, 1b ; test byte 1 jz WaitLoop ; Wait for IBF = 1 in al, 60h ; Read input buffer jmp $+2 cmp al,0x..... ;key scan to comapre etc... This will wait for key_press! works like getch() in C/C++ I have tested it and it works! |
|||
![]() |
|
Hayden 05 Nov 2007, 09:49
I think the scancode comes down to the type of keyboard nad keyboard controller. ie: there is scancode table for XT keyboards and a different table for AT boards, plus an alternative scancode table, so it is left up to the application to decide/test and configure useing the basic keyboard functions.
_________________ New User.. Hayden McKay. |
|||
![]() |
|
edfed 07 Nov 2007, 00:52
bios keyboard interrupt are bad
dos keyboard interrupt are shit Code: inc byte[eax+keymap] jne @f mov byte[eax+keymap],255 @@: ;;;; ;;;; ;;;; mov al,[keymap+key.????] ;used to load the current keystatus ;if = 0 then key not pressed ;else , key pressed since timing with this simple code i hope to incorporate timing into keystrokes this will be usefull for various applications |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.