fixing push/pop order in api_set_text & api_set_mode

This commit is contained in:
Frater 2026-02-27 22:23:18 +01:00
commit 14a5ec116a
4 changed files with 56 additions and 16 deletions

View file

@ -204,12 +204,19 @@ main_loop:
mov .value, 0xFADE mov .value, 0xFADE
.loop: .loop:
call gui_process_all
GUI OBJ_GET_VAL, .my_slider
mov .value, ax
cmp ax,.oldval ISADBG ISA_RIGHT, 0x11
je .loop
call gui_process_all
; --- TRACE 12 : GUI traitée ---
ISADBG ISA_RIGHT, 0x12
; GUI OBJ_GET_VAL, .my_slider
;mov .value, ax
;cmp ax,.oldval
;je .loop
; debug ; debug
;mov .oldval, ax ;mov .oldval, ax
@ -228,9 +235,9 @@ main_loop:
;mov al, 0x00 ;mov al, 0x00
;int 0x10 ;int 0x10
mov dx, CRTC_COLOR_DATA ;mov dx, CRTC_COLOR_DATA
and ax, 0x001F ;and ax, 0x001F
out dx, ax ;out dx, ax
jmp .loop jmp .loop
leave leave

View file

@ -291,6 +291,7 @@ isr_mouse_handler:
in al, i8042_PS2_DATA ; lire octet souris in al, i8042_PS2_DATA ; lire octet souris
movzx bx, byte [PTR_MOUSE + mouse.idx] movzx bx, byte [PTR_MOUSE + mouse.idx]
cmp bl,0 cmp bl,0
jne .read_packet jne .read_packet
@ -299,6 +300,7 @@ isr_mouse_handler:
jz .done_eoi ; allignement erroné jz .done_eoi ; allignement erroné
.read_packet: .read_packet:
mov byte [PTR_MOUSE + mouse.buffer + bx], al mov byte [PTR_MOUSE + mouse.buffer + bx], al
inc byte [PTR_MOUSE + mouse.idx] inc byte [PTR_MOUSE + mouse.idx]
@ -372,7 +374,6 @@ isr_mouse_handler:
.done: .done:
; update la position du curseur sur l'écran ; update la position du curseur sur l'écran
; en ce moment c'est commented out (debug) ; en ce moment c'est commented out (debug)
; call cga_mouse_cursor_move
GFX MOUSE_MOVE GFX MOUSE_MOVE
.done_eoi: .done_eoi:
mov al, 0x20 mov al, 0x20

View file

@ -133,17 +133,18 @@ endstruc
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; gui_api_slider_attr ; gui_api_slider_attr
; -----------------------------------------------------------------------------
%define .id word [bp+4] %define .id word [bp+4]
%define .min word [bp+6] %define .min word [bp+6]
%define .max word [bp+8] %define .max word [bp+8]
%define .val word [bp+10] %define .val word [bp+10]
%define .pct word [bp+12] %define .pct word [bp+12]
; -----------------------------------------------------------------------------
gui_api_slider_attr: gui_api_slider_attr:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push ax push ax
push si
mov ax, .id mov ax, .id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -161,23 +162,29 @@ gui_api_slider_attr:
call gui_slider_update_pixels call gui_slider_update_pixels
.err: .err:
pop si
pop ax pop ax
pop gs pop gs
leave leave
%undef .id
%undef .min
%undef .max
%undef .val
%undef .pct
ret ret
%undef .id
%undef .mode
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
; gui_api_set_mode ; gui_api_set_mode
; -----------------------------------------------------------------------------
%define .id word [bp+4] %define .id word [bp+4]
%define .mode word [bp+6] %define .mode word [bp+6]
; -----------------------------------------------------------------------------
gui_api_set_mode: gui_api_set_mode:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push ax push ax
push si
mov ax, .id mov ax, .id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -187,8 +194,9 @@ gui_api_set_mode:
mov byte [gs:si + widget.attr_mode], al mov byte [gs:si + widget.attr_mode], al
.err: .err:
pop gs pop si
pop ax pop ax
pop gs
leave leave
ret ret
%undef .id %undef .id
@ -205,6 +213,7 @@ gui_api_set_text:
mov bp, sp mov bp, sp
push gs push gs
push ax push ax
push si
mov ax, .id mov ax, .id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -216,8 +225,9 @@ gui_api_set_text:
mov word [gs:si + widget.text_ofs], ax mov word [gs:si + widget.text_ofs], ax
.err: .err:
pop gs pop si
pop ax pop ax
pop gs
leave leave
ret ret
%undef .id %undef .id
@ -288,6 +298,7 @@ gui_api_get_state:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push si
mov ax, .id mov ax, .id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -300,6 +311,7 @@ gui_api_get_state:
.err: .err:
mov ax, -1 mov ax, -1
.done: .done:
pop si
pop gs pop gs
leave leave
ret ret
@ -315,6 +327,7 @@ gui_api_get_type:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push si
mov ax,.id mov ax,.id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -327,6 +340,7 @@ gui_api_get_type:
.err: .err:
mov ax, -1 mov ax, -1
.done: .done:
pop si
pop gs pop gs
leave leave
ret ret
@ -342,6 +356,8 @@ gui_api_get_val:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push si
mov ax,.id mov ax,.id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -354,6 +370,7 @@ gui_api_get_val:
.err: .err:
mov ax, -1 mov ax, -1
.done: .done:
pop si
pop gs pop gs
leave leave
ret ret
@ -370,6 +387,7 @@ gui_api_set_val:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push si
mov ax,.id mov ax,.id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -379,6 +397,7 @@ gui_api_set_val:
mov [gs:si + widget.thumb_pos], ax mov [gs:si + widget.thumb_pos], ax
.err: .err:
pop si
pop gs pop gs
leave leave
ret ret
@ -396,6 +415,7 @@ gui_api_destroy:
push bp push bp
mov bp, sp mov bp, sp
push gs push gs
push si
mov ax,.id mov ax,.id
call gui_get_widget_ptr_internal call gui_get_widget_ptr_internal
@ -408,6 +428,7 @@ gui_api_destroy:
.err: .err:
mov ax, -1 mov ax, -1
.done: .done:
pop si
pop gs pop gs
leave leave
ret ret
@ -469,7 +490,7 @@ gui_get_widget_ptr_internal:
; Entrée : DS doit pointer vers SEG_GUI ; Entrée : DS doit pointer vers SEG_GUI
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------
gui_init_system: gui_init_system:
push eax push ax
push cx push cx
push es push es
push di push di
@ -486,7 +507,7 @@ gui_init_system:
pop di pop di
pop es pop es
pop cx pop cx
pop eax pop ax
ret ret
; ----------------------------------------------------------------------------- ; -----------------------------------------------------------------------------

View file

@ -37,9 +37,15 @@ gui_process_all:
cmp byte [gs:si + widget.state], GUI_STATE_FREE cmp byte [gs:si + widget.state], GUI_STATE_FREE
je .next_widget je .next_widget
mov ax, di
ISADBG ISA_LEFT, al
; --- Logique Widget --- ; --- Logique Widget ---
push bx ; Sauver état boutons souris push bx ; Sauver état boutons souris
ISADBG ISA_RIGHT, 0x20 ; Avant logic
call gui_update_logic ; Vérifier collision/clic call gui_update_logic ; Vérifier collision/clic
ISADBG ISA_RIGHT, 0x21 ; Avant logic
; Si AL=1 (Clic relâché validé), exécuter le callback ; Si AL=1 (Clic relâché validé), exécuter le callback
cmp al, 1 cmp al, 1
@ -63,10 +69,15 @@ gui_process_all:
; Dessiner (si l'état a changé ou pour refresh) ; Dessiner (si l'état a changé ou pour refresh)
ISADBG ISA_RIGHT, 0x22 ; Avant dessin
cmp al,ah cmp al,ah
je .next_widget ; Si != 0, le widget est à jour, on passe. je .next_widget ; Si != 0, le widget est à jour, on passe.
call gui_draw_single_widget call gui_draw_single_widget
ISADBG ISA_RIGHT, 0x23 ; Avant dessin
.next_widget: .next_widget:
add si, widget_size add si, widget_size
dec di dec di