From 077316eb68ea1dacdc6b57e54ac03a84540b907c Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Sun, 1 Jul 2018 10:38:31 +0000 Subject: [PATCH] Small extension to 86duino GPIO Demo git-svn-id: svn://kolibrios.org@7295 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/demos/gpio/gpio.asm | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/programs/demos/gpio/gpio.asm b/programs/demos/gpio/gpio.asm index 9f770d62d7..6f1db382db 100644 --- a/programs/demos/gpio/gpio.asm +++ b/programs/demos/gpio/gpio.asm @@ -67,14 +67,14 @@ key: ; Keypress event handler cmp ah, 'q' jne @f call read_gpio0 - or al, 1 ; Set bit 0 + or al, 1 shl 0 ; Set bit 0 call write_gpio0 jmp event_wait @@: cmp ah, 'w' jne @f call read_gpio0 - and al, not 1 ; Clear bit 0 + and al, not (1 shl 0) ; Clear bit 0 call write_gpio0 jmp event_wait @@: @@ -84,16 +84,30 @@ key: ; Keypress event handler mov ecx, eax mcall 47, 0x00040100,,25 shl 16 + 25, 0x40000000, 0x00ffffff ; 4 digits hex number in ecx jmp event_wait + @@: + cmp ah, 'a' + jne @f + call read_gpio0 + or al, 1 shl 2 ; Set bit 2 + call write_gpio0 + jmp event_wait + @@: + cmp ah, 's' + jne @f + call read_gpio0 + and al, not (1 shl 2) ; Clear bit 2 + call write_gpio0 + jmp event_wait @@: jmp event_wait ; Just read the key, ignore it and jump to event_wait. button: ; Buttonpress event handler - mov eax,17 ; The button number defined in window_draw + mov eax, 17 ; The button number defined in window_draw mcall ; is returned to ah. - cmp ah,1 ; button id=1 ? + cmp ah, 1 ; button id=1 ? jne noclose - mov eax,-1 ; Function -1 : close this program + mov eax, -1 ; Function -1 : close this program mcall noclose: