Creating services.
Posted: Sun Apr 24, 2011 12:24 am
I'm trying to make up services... So, the first one is 'text service'; and I have a problem with it - text service doesn't work or crash the 'system'. When the same code was in keyboard handler it worked very well.
Keyboard handler saves in the first byte of 'keyb_state' scancode of the key, second byte is set to 0; Text service firstly checks whether was this scancode used (it's used when second byte in 'keyb_state' is set to 1),
The structure is like that
Function 'store_keyb_state' is used by keyboard handler:
And the last one: text service
All this crashes... perhaps I've just sealed up or haven't seen my stupid mistake.
Keyboard handler saves in the first byte of 'keyb_state' scancode of the key, second byte is set to 0; Text service firstly checks whether was this scancode used (it's used when second byte in 'keyb_state' is set to 1),
The structure is like that
Code: Select all
PM_32_ENTRY:
.............
call text_serv
Code: Select all
store_keyb_state: ;al - scancode
mov byte [keyb_state],al
mov byte [keyb_state+1],0
ret
Code: Select all
text_serv:
pusha
xor ax,ax
call .read_keyb_state
cmp al,0Eh
je .backsp
cmp al,75
je .cursor_left
cmp al,77
je .cursor_right
cmp al,72
je .cursor_up
cmp al,80
je .cursor_down
jmp .just_key
.backsp:
........
jmp .end
.just_key:
........
jmp .end
.cursor_left:
........
jmp .end
.cursor_right:
........
jmp .end
.cursor_up:
........
jmp .end
.cursor_down:
........
jmp .end
.read_keyb_state:
mov al,byte [keyb_state]
mov ah,byte [keyb_state+1]
cmp ah,1
je .end
mov byte [keyb_state+1],1
ret
.end:
call replace_cursor
push 18h ;reinitialize segment registers
pop es
push ss
pop ds
popa
jmp text_serv