Subversion Repositories Kolibri OS

Rev

Rev 1295 | Rev 1568 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1295 Rev 1327
Line 619... Line 619...
619
	sbb	al,0x69
619
	sbb	al,0x69
620
	das
620
	das
621
	stosb
621
	stosb
622
	retn
622
	retn
623
endp
623
endp
-
 
624
 
-
 
625
;;================================================================================================;;
-
 
626
proc libini._.ascii_to_scan ;_ascii_code ;////////////////////////////////////////////////////////;;
-
 
627
;;------------------------------------------------------------------------------------------------;;
-
 
628
;? Translate ASCII code of key to scancode using standard mapping from keymap.key                 ;;
-
 
629
;;------------------------------------------------------------------------------------------------;;
-
 
630
;> _ascii_code = [esp+4] = ASCII code to convert                                                  ;;
-
 
631
;;------------------------------------------------------------------------------------------------;;
-
 
632
;< eax = 0 (error) / scancode (success)                                                           ;;
-
 
633
;;================================================================================================;;
-
 
634
; /sys/keymap.key
-
 
635
	sub	esp, 256
-
 
636
	mov	eax, esp
-
 
637
	push	ebx
-
 
638
	push	'key'
-
 
639
	push	'map.'
-
 
640
	push	'/key'
-
 
641
	push	'/sys'
-
 
642
	push	eax	; buffer in the stack
-
 
643
	push	0x100	; read 0x100 bytes
-
 
644
	push	0
-
 
645
	push	0	; from position zero
-
 
646
	push	0	; subfunction: read
-
 
647
	mov	ebx, esp
-
 
648
	push	70
-
 
649
	pop	eax
-
 
650
	mcall
-
 
651
	add	esp, 36
-
 
652
	pop	ebx
-
 
653
	test	eax, eax
-
 
654
	jnz	.die
-
 
655
	mov	al, [esp+256+4]	; get ASCII code
-
 
656
	push	edi
-
 
657
; first keytable - no modifiers pressed
-
 
658
; check scancodes from 1 to 36h (inclusive)
-
 
659
	lea	edi, [esp+4+1]
-
 
660
	mov	edx, edi
-
 
661
	mov	ecx, 36h
-
 
662
	repnz	scasb
-
 
663
	jz	.found
-
 
664
; second keytable - Shift pressed
-
 
665
	lea	edi, [esp+4+128+1]
-
 
666
	mov	edx, edi
-
 
667
	mov	ecx, 36h
-
 
668
	repnz	scasb
-
 
669
	jz	.found
-
 
670
	pop	edi
-
 
671
.die:
-
 
672
	xor	eax, eax
-
 
673
	jmp	.ret
-
 
674
.found:
-
 
675
	mov	eax, edi
-
 
676
	sub	eax, edx
-
 
677
	pop	edi
-
 
678
.ret:
-
 
679
	add	esp, 256
-
 
680
	ret	4
-
 
681
endp