debug sliders
This commit is contained in:
parent
182d8a36c3
commit
a976416822
2 changed files with 41 additions and 21 deletions
37
src/boot.asm
37
src/boot.asm
|
|
@ -110,20 +110,37 @@ entrycode:
|
||||||
call gui_init_system
|
call gui_init_system
|
||||||
call build_interface
|
call build_interface
|
||||||
|
|
||||||
main_loop:
|
call main_loop
|
||||||
call gui_process_all
|
|
||||||
|
|
||||||
GUI OBJ_GET_VAL, 5 ; slider
|
|
||||||
|
|
||||||
;GFX GOTOXY, 5, 20
|
|
||||||
;call print_word_hex
|
|
||||||
|
|
||||||
jmp main_loop
|
|
||||||
|
|
||||||
; --- Callbacks (Fonctions appelées par le moteur) ---
|
; --- Callbacks (Fonctions appelées par le moteur) ---
|
||||||
on_click_quit:
|
on_click_quit:
|
||||||
hlt
|
hlt
|
||||||
jmp on_click_quit
|
jmp on_click_quit
|
||||||
|
ret
|
||||||
|
|
||||||
|
%define .oldval word [bp-2]
|
||||||
|
main_loop:
|
||||||
|
push bp
|
||||||
|
push bx
|
||||||
|
mov bp, sp
|
||||||
|
sub sp, 2
|
||||||
|
|
||||||
|
mov .oldval, -1
|
||||||
|
|
||||||
|
.loop:
|
||||||
|
call gui_process_all
|
||||||
|
GUI OBJ_GET_VAL, 6 ; slider
|
||||||
|
|
||||||
|
cmp ax,.oldval
|
||||||
|
je .loop
|
||||||
|
|
||||||
|
mov .oldval, ax
|
||||||
|
GFX RECTANGLE_FILL,0,148,50,166, PATTERN_WHITE
|
||||||
|
GFX GOTOXY, 8, 150
|
||||||
|
|
||||||
|
call print_word_hex
|
||||||
|
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
|
||||||
build_interface:
|
build_interface:
|
||||||
|
|
@ -154,7 +171,7 @@ build_interface:
|
||||||
|
|
||||||
GUI OBJ_CREATE, OBJ_TYPE_SLIDER, 400, 10, 16, 150
|
GUI OBJ_CREATE, OBJ_TYPE_SLIDER, 400, 10, 16, 150
|
||||||
GUI OBJ_SET_MODE, ax, SLIDER_VERTICAL
|
GUI OBJ_SET_MODE, ax, SLIDER_VERTICAL
|
||||||
GUI OBJ_SLIDER_SET_ATTR, ax, 10, 140, 140, 20
|
GUI OBJ_SLIDER_SET_ATTR, ax, 0, 15, 15, 20
|
||||||
|
|
||||||
.mem_full:
|
.mem_full:
|
||||||
ret
|
ret
|
||||||
|
|
|
||||||
|
|
@ -774,7 +774,6 @@ cga_line_horizontal:
|
||||||
%define .x2 word [bp+8]
|
%define .x2 word [bp+8]
|
||||||
%define .y2 word [bp+10]
|
%define .y2 word [bp+10]
|
||||||
%define .color byte [bp+12]
|
%define .color byte [bp+12]
|
||||||
|
|
||||||
cga_line:
|
cga_line:
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
|
|
@ -815,7 +814,8 @@ cga_line:
|
||||||
jge .calc_dx
|
jge .calc_dx
|
||||||
neg ax
|
neg ax
|
||||||
neg bx ; sx = -1
|
neg bx ; sx = -1
|
||||||
.calc_dx:
|
|
||||||
|
.calc_dx:
|
||||||
mov .dx, ax ; save dx
|
mov .dx, ax ; save dx
|
||||||
mov .sx, bx ; save sx
|
mov .sx, bx ; save sx
|
||||||
|
|
||||||
|
|
@ -826,7 +826,8 @@ cga_line:
|
||||||
jge .calc_dy
|
jge .calc_dy
|
||||||
neg ax
|
neg ax
|
||||||
neg bx ; sy = -1
|
neg bx ; sy = -1
|
||||||
.calc_dy:
|
|
||||||
|
.calc_dy:
|
||||||
mov .dy, ax ; save dy
|
mov .dy, ax ; save dy
|
||||||
mov .sy, bx ; save sy
|
mov .sy, bx ; save sy
|
||||||
|
|
||||||
|
|
@ -839,7 +840,7 @@ cga_line:
|
||||||
mov cx, .x1
|
mov cx, .x1
|
||||||
mov dx, .y1
|
mov dx, .y1
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
; Plot pixel (CX, DX)
|
; Plot pixel (CX, DX)
|
||||||
push cx
|
push cx
|
||||||
push dx
|
push dx
|
||||||
|
|
@ -850,10 +851,12 @@ cga_line:
|
||||||
je .plot_black
|
je .plot_black
|
||||||
or byte [es:di], ah
|
or byte [es:di], ah
|
||||||
jmp .plot_next
|
jmp .plot_next
|
||||||
.plot_black:
|
|
||||||
|
.plot_black:
|
||||||
not ah
|
not ah
|
||||||
and byte [es:di], ah
|
and byte [es:di], ah
|
||||||
.plot_next:
|
|
||||||
|
.plot_next:
|
||||||
pop dx
|
pop dx
|
||||||
pop cx
|
pop cx
|
||||||
|
|
||||||
|
|
@ -863,7 +866,7 @@ cga_line:
|
||||||
cmp dx, .y2
|
cmp dx, .y2
|
||||||
je .done
|
je .done
|
||||||
|
|
||||||
.step:
|
.step:
|
||||||
mov ax, .err ; e2 = err
|
mov ax, .err ; e2 = err
|
||||||
shl ax, 1 ; e2 = 2*err
|
shl ax, 1 ; e2 = 2*err
|
||||||
|
|
||||||
|
|
@ -875,7 +878,7 @@ cga_line:
|
||||||
add .err, bx ; err += -dy
|
add .err, bx ; err += -dy
|
||||||
add cx, .sx ; x += sx
|
add cx, .sx ; x += sx
|
||||||
|
|
||||||
.check_y:
|
.check_y:
|
||||||
mov bx, .dx ; dx
|
mov bx, .dx ; dx
|
||||||
cmp ax, bx
|
cmp ax, bx
|
||||||
jge .loop ; if e2 >= dx, skip y step
|
jge .loop ; if e2 >= dx, skip y step
|
||||||
|
|
@ -884,12 +887,12 @@ cga_line:
|
||||||
add dx, .sy ; y += sy
|
add dx, .sy ; y += sy
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
call cga_mouse_show
|
call cga_mouse_show
|
||||||
add sp, 10 ; Libération variables locales
|
add sp, 10 ; Libération variables locales
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.do_horiz:
|
.do_horiz:
|
||||||
push word [bp+12] ; color
|
push word [bp+12] ; color
|
||||||
push word [bp+6] ; y
|
push word [bp+6] ; y
|
||||||
push word [bp+8] ; x2
|
push word [bp+8] ; x2
|
||||||
|
|
@ -898,7 +901,7 @@ cga_line:
|
||||||
add sp, 8
|
add sp, 8
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.do_vert:
|
.do_vert:
|
||||||
push word [bp+12] ; color
|
push word [bp+12] ; color
|
||||||
push word [bp+10] ; y2
|
push word [bp+10] ; y2
|
||||||
push word [bp+6] ; y1
|
push word [bp+6] ; y1
|
||||||
|
|
@ -906,7 +909,7 @@ cga_line:
|
||||||
call cga_line_vertical
|
call cga_line_vertical
|
||||||
add sp, 8
|
add sp, 8
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
pop es
|
pop es
|
||||||
popa
|
popa
|
||||||
pop bp
|
pop bp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue