mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2025-09-09 20:13:07 -04:00
Apps/genfiles: Rewrite from nasm to fasm
This commit is contained in:
parent
b39150ecea
commit
79d9f42085
@ -471,6 +471,7 @@ tup.append_table(img_files, {
|
|||||||
{"DEVELOP/COBJ", VAR_PROGS .. "/develop/cObj/trunk/cObj"},
|
{"DEVELOP/COBJ", VAR_PROGS .. "/develop/cObj/trunk/cObj"},
|
||||||
{"DEVELOP/ENTROPYV", VAR_PROGS .. "/develop/entropyview/entropyview"},
|
{"DEVELOP/ENTROPYV", VAR_PROGS .. "/develop/entropyview/entropyview"},
|
||||||
{"DEVELOP/FASM", VAR_PROGS .. "/develop/fasm/1.73/fasm"},
|
{"DEVELOP/FASM", VAR_PROGS .. "/develop/fasm/1.73/fasm"},
|
||||||
|
{"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"},
|
||||||
{"DEVELOP/H2D2B", VAR_PROGS .. "/develop/h2d2b/trunk/h2d2b"},
|
{"DEVELOP/H2D2B", VAR_PROGS .. "/develop/h2d2b/trunk/h2d2b"},
|
||||||
{"DEVELOP/HEED", VAR_PROGS .. "/develop/heed/trunk/heed"},
|
{"DEVELOP/HEED", VAR_PROGS .. "/develop/heed/trunk/heed"},
|
||||||
{"DEVELOP/KEYASCII", VAR_PROGS .. "/develop/keyascii/trunk/keyascii"},
|
{"DEVELOP/KEYASCII", VAR_PROGS .. "/develop/keyascii/trunk/keyascii"},
|
||||||
@ -649,7 +650,6 @@ end -- tup.getconfig('NO_FASM') ~= 'full'
|
|||||||
if tup.getconfig('NO_NASM') ~= 'full' then
|
if tup.getconfig('NO_NASM') ~= 'full' then
|
||||||
tup.append_table(img_files, {
|
tup.append_table(img_files, {
|
||||||
{"ACLOCK", VAR_PROGS .. "/demos/aclock/trunk/aclock"},
|
{"ACLOCK", VAR_PROGS .. "/demos/aclock/trunk/aclock"},
|
||||||
{"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"},
|
|
||||||
})
|
})
|
||||||
tup.append_table(extra_files, {
|
tup.append_table(extra_files, {
|
||||||
})
|
})
|
||||||
|
@ -103,15 +103,6 @@ THREAD_STATE_EXCEPT_TERMINATING = 4
|
|||||||
THREAD_STATE_WAIT_EVENT = 5
|
THREAD_STATE_WAIT_EVENT = 5
|
||||||
THREAD_STATE_SLOT_IS_FREE = 9
|
THREAD_STATE_SLOT_IS_FREE = 9
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
EM_REDRAW equ 1b
|
|
||||||
EM_KEY equ 10b
|
|
||||||
EM_BUTTON equ 100b
|
|
||||||
EM_RESERVED0 equ 1000b
|
|
||||||
EM_REDRAW_BACKGROUND equ 10000b
|
|
||||||
EM_MOUSE equ 100000b
|
|
||||||
EM_IPC equ 1000000b
|
|
||||||
EM_NETWORK equ 10000000b
|
|
||||||
EM_DEBUG equ 100000000b
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
@ -462,39 +453,39 @@ macro DrawEventMask {
|
|||||||
push eax ; for "call uint2str" below
|
push eax ; for "call uint2str" below
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
mov [tmpbuffer], byte 0
|
mov [tmpbuffer], byte 0
|
||||||
test ebx, EM_REDRAW
|
test ebx, EVM_REDRAW
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_redraw,tmpbuffer
|
stdcall StringConcatenate, sz_redraw,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_KEY
|
test ebx, EVM_KEY
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_key,tmpbuffer
|
stdcall StringConcatenate, sz_key,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_BUTTON
|
test ebx, EVM_BUTTON
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_button,tmpbuffer
|
stdcall StringConcatenate, sz_button,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_RESERVED0
|
test ebx, EVM_EXIT
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_reserved0,tmpbuffer
|
stdcall StringConcatenate, sz_reserved0,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_REDRAW_BACKGROUND
|
test ebx, EVM_BACKGROUND
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_redraw_background,tmpbuffer
|
stdcall StringConcatenate, sz_redraw_background,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_MOUSE
|
test ebx, EVM_MOUSE
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_mouse,tmpbuffer
|
stdcall StringConcatenate, sz_mouse,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_IPC
|
test ebx, EVM_IPC
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_ipc,tmpbuffer
|
stdcall StringConcatenate, sz_ipc,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_NETWORK
|
test ebx, EVM_STACK
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_network,tmpbuffer
|
stdcall StringConcatenate, sz_network,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
test ebx, EM_DEBUG
|
test ebx, EVM_DEBUG
|
||||||
jz @f
|
jz @f
|
||||||
stdcall StringConcatenate, sz_debug,tmpbuffer
|
stdcall StringConcatenate, sz_debug,tmpbuffer
|
||||||
@@:
|
@@:
|
||||||
@ -604,7 +595,7 @@ program.start:
|
|||||||
mov [window.left], eax
|
mov [window.left], eax
|
||||||
mov [window.top], edx
|
mov [window.top], edx
|
||||||
; set.event
|
; set.event
|
||||||
mcall SF_SET_EVENTS_MASK, EM_REDRAW or EM_BUTTON
|
mcall SF_SET_EVENTS_MASK, EVM_REDRAW or EVM_BUTTON
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
on_redraw:
|
on_redraw:
|
||||||
|
@ -2,36 +2,28 @@
|
|||||||
; path to folder in edit1 ;
|
; path to folder in edit1 ;
|
||||||
; count of files in edit2 ;
|
; count of files in edit2 ;
|
||||||
; to compile: nasm -f bin GenFiles.asm -o GenFiles ;
|
; to compile: nasm -f bin GenFiles.asm -o GenFiles ;
|
||||||
ORG 0
|
use32
|
||||||
BITS 32
|
org 0
|
||||||
|
db 'MENUET01'
|
||||||
|
version dd 1
|
||||||
|
dd program.start
|
||||||
|
dd program.end
|
||||||
|
dd program.memory
|
||||||
|
dd program.stack
|
||||||
|
dd 0,0
|
||||||
|
|
||||||
|
include '../../macros.inc'
|
||||||
|
include '../../proc32.inc'
|
||||||
|
include '../../KOSfuncs.inc'
|
||||||
|
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
STACK_SIZE equ 256
|
BUTTON_START = 2
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
EM_REDRAW equ 0b1
|
ED_DISABLED = 100000000000b
|
||||||
EM_KEY equ 0b10
|
|
||||||
EM_BUTTON equ 0b100
|
|
||||||
EM_MOUSE equ 0b100000
|
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
BUTTON_START equ 2
|
EDIT1_MAX_LENGTH = 1024
|
||||||
; ------------------------------------- ;
|
EDIT2_MAX_LENGTH = 10
|
||||||
ED_DISABLED equ 0b100000000000
|
FILE_NAME_LENGTH = 256
|
||||||
; ------------------------------------- ;
|
|
||||||
EDIT1_MAX_LENGTH equ 1024
|
|
||||||
EDIT2_MAX_LENGTH equ 10
|
|
||||||
FILE_NAME_LENGTH equ 256
|
|
||||||
; ------------------------------------- ;
|
|
||||||
text_buffer1 equ END + STACK_SIZE
|
|
||||||
text_buffer2 equ END + STACK_SIZE + (EDIT1_MAX_LENGTH + 2)
|
|
||||||
file_name equ END + STACK_SIZE + (EDIT1_MAX_LENGTH + 2) + (EDIT2_MAX_LENGTH + 2)
|
|
||||||
; ------------------------------------- ;
|
|
||||||
MENUET01 db 'MENUET01'
|
|
||||||
version dd 1
|
|
||||||
program.start dd START
|
|
||||||
program.end dd END
|
|
||||||
program.memory dd END + STACK_SIZE + (EDIT1_MAX_LENGTH + 2) + (EDIT2_MAX_LENGTH + 2) + FILE_NAME_LENGTH
|
|
||||||
program.stack dd END + STACK_SIZE
|
|
||||||
program.params dd 0
|
|
||||||
program.path dd 0
|
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
Events:
|
Events:
|
||||||
@ -67,7 +59,7 @@ edit1:
|
|||||||
.width dd 100
|
.width dd 100
|
||||||
.left dd 48
|
.left dd 48
|
||||||
.top dd 8
|
.top dd 8
|
||||||
.color dd 0X00FFFFFF
|
.color dd 0x00FFFFFF
|
||||||
.shift_color dd 0x94AECE
|
.shift_color dd 0x94AECE
|
||||||
.focus_border_color dd 0
|
.focus_border_color dd 0
|
||||||
.blur_border_color dd 0
|
.blur_border_color dd 0
|
||||||
@ -88,7 +80,7 @@ edit2:
|
|||||||
.width dd 60
|
.width dd 60
|
||||||
.left dd 216
|
.left dd 216
|
||||||
.top dd 8
|
.top dd 8
|
||||||
.color dd 0X00FFFFFF
|
.color dd 0x00FFFFFF
|
||||||
.shift_color dd 0x94AECE
|
.shift_color dd 0x94AECE
|
||||||
.focus_border_color dd 0
|
.focus_border_color dd 0
|
||||||
.blur_border_color dd 0
|
.blur_border_color dd 0
|
||||||
@ -139,57 +131,39 @@ sz_error db "error",0
|
|||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
digits db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
digits db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
START:
|
program.start:
|
||||||
; LoadLibrary:
|
; LoadLibrary:
|
||||||
mov eax, 68
|
mcall SF_SYS_MISC,SSF_LOAD_DLL, sz_box_lib
|
||||||
mov ebx, 19
|
|
||||||
mov ecx, sz_box_lib
|
|
||||||
int 64
|
|
||||||
mov [box_lib], eax
|
mov [box_lib], eax
|
||||||
|
|
||||||
push dword[box_lib]
|
stdcall GetProcAddress,sz_edit_box,[box_lib]
|
||||||
push sz_edit_box
|
|
||||||
call GetProcAddress
|
|
||||||
mov [edit_box_draw], eax
|
mov [edit_box_draw], eax
|
||||||
|
|
||||||
push dword[box_lib]
|
stdcall GetProcAddress,sz_edit_box_key,[box_lib]
|
||||||
push sz_edit_box_key
|
|
||||||
call GetProcAddress
|
|
||||||
mov [edit_box_key], eax
|
mov [edit_box_key], eax
|
||||||
|
|
||||||
push dword[box_lib]
|
stdcall GetProcAddress,sz_edit_box_mouse,[box_lib]
|
||||||
push sz_edit_box_mouse
|
|
||||||
call GetProcAddress
|
|
||||||
mov [edit_box_mouse], eax
|
mov [edit_box_mouse], eax
|
||||||
|
|
||||||
push dword[box_lib]
|
stdcall GetProcAddress,sz_edit_box_set_text,[box_lib]
|
||||||
push sz_edit_box_set_text
|
|
||||||
call GetProcAddress
|
|
||||||
mov [edit_box_set_text], eax
|
mov [edit_box_set_text], eax
|
||||||
|
|
||||||
push dword[box_lib]
|
stdcall GetProcAddress,sz_progressbar_draw,[box_lib]
|
||||||
push sz_progressbar_draw
|
|
||||||
call GetProcAddress
|
|
||||||
mov [progressbar_draw], eax
|
mov [progressbar_draw], eax
|
||||||
|
|
||||||
push dword[box_lib]
|
stdcall GetProcAddress,sz_progressbar_progress,[box_lib]
|
||||||
push sz_progressbar_progress
|
|
||||||
call GetProcAddress
|
|
||||||
mov [progressbar_progress], eax
|
mov [progressbar_progress], eax
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
; SetEventMask
|
; SetEventMask
|
||||||
mov eax, 40
|
mcall SF_SET_EVENTS_MASK, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_MOUSE
|
||||||
mov ebx, EM_REDRAW | EM_KEY | EM_BUTTON | EM_MOUSE
|
|
||||||
int 64
|
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
WaitEvent:
|
WaitEvent:
|
||||||
mov eax, 10
|
mcall SF_WAIT_EVENT
|
||||||
int 64
|
call dword[eax * 4 + Events]
|
||||||
call [eax * 4 + Events]
|
|
||||||
jmp WaitEvent
|
jmp WaitEvent
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
%macro CreateNextFile 0
|
macro CreateNextFile {
|
||||||
; Base36(count)
|
; Base36(count)
|
||||||
mov eax, [count]
|
mov eax, [count]
|
||||||
mov ecx, 36 ; because our base is 36
|
mov ecx, 36 ; because our base is 36
|
||||||
@ -197,14 +171,14 @@ WaitEvent:
|
|||||||
mov edi, esi
|
mov edi, esi
|
||||||
add esi, 7 ; base36(0xFFFFFFFF) = 1Z141Z3 : 7 simbols
|
add esi, 7 ; base36(0xFFFFFFFF) = 1Z141Z3 : 7 simbols
|
||||||
mov [esi], byte 0
|
mov [esi], byte 0
|
||||||
%%next:
|
@@:
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
div ecx
|
div ecx
|
||||||
dec esi
|
dec esi
|
||||||
mov dl, [edx + digits]
|
mov dl, [edx + digits]
|
||||||
mov [esi], dl
|
mov [esi], dl
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz %%next
|
jnz @b
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
sub eax, edi
|
sub eax, edi
|
||||||
mov ecx, 7 + 1
|
mov ecx, 7 + 1
|
||||||
@ -218,12 +192,11 @@ WaitEvent:
|
|||||||
push dword 0
|
push dword 0
|
||||||
push dword 0
|
push dword 0
|
||||||
push dword 0
|
push dword 0
|
||||||
push dword 2 ; SubFunction #2 Create/Rewrite file
|
push dword SSF_CREATE_FILE ; SubFunction #2 Create/Rewrite file
|
||||||
mov ebx, esp
|
mov ebx, esp
|
||||||
mov eax, 70 ; Function #70
|
mcall SF_FILE
|
||||||
int 64
|
|
||||||
add esp, 25 ; restore stack
|
add esp, 25 ; restore stack
|
||||||
%endmacro
|
}
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
DoAction:
|
DoAction:
|
||||||
@ -245,16 +218,12 @@ DoAction:
|
|||||||
mov [pb.max], ecx
|
mov [pb.max], ecx
|
||||||
mov [pb.value], dword 0
|
mov [pb.value], dword 0
|
||||||
; draw progressbar
|
; draw progressbar
|
||||||
push pb
|
stdcall [progressbar_draw], pb
|
||||||
call [progressbar_draw]
|
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
cmp [count], dword 0
|
cmp [count], dword 0
|
||||||
jz .done
|
jz .done
|
||||||
; SetCurrentDirectory
|
; SetCurrentDirectory
|
||||||
mov eax, 30
|
mcall SF_CURRENT_FOLDER,SSF_SET_CF, [edit1.text]
|
||||||
mov ebx, 1
|
|
||||||
mov ecx, [edit1.text]
|
|
||||||
int 64
|
|
||||||
;
|
;
|
||||||
mov [status_string], dword sz_doing
|
mov [status_string], dword sz_doing
|
||||||
call DrawStatus
|
call DrawStatus
|
||||||
@ -263,30 +232,23 @@ DoAction:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .error
|
jnz .error
|
||||||
; increase progress
|
; increase progress
|
||||||
push pb
|
stdcall [progressbar_progress], pb
|
||||||
call [progressbar_progress]
|
|
||||||
; CheckEvent
|
; CheckEvent
|
||||||
mov eax, 11
|
mcall SF_CHECK_EVENT
|
||||||
int 64
|
call dword[eax * 4 + Events]
|
||||||
call [eax * 4 + Events]
|
|
||||||
dec dword [count]
|
dec dword [count]
|
||||||
jnz .do
|
jnz .do
|
||||||
.done:
|
.done:
|
||||||
mov [status_string], dword sz_done
|
mov [status_string], dword sz_done
|
||||||
call DrawStatus
|
call DrawStatus
|
||||||
ret
|
ret
|
||||||
.error:
|
.error:
|
||||||
mov [status_string], dword sz_error
|
mov [status_string], dword sz_error
|
||||||
call DrawStatus
|
call DrawStatus
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
DrawStatus:
|
DrawStatus:
|
||||||
mov eax, 4
|
mcall SF_DRAW_TEXT, (297 shl 16) or 38, 0xD0000000, [status_string],, 0x00FFFFFF
|
||||||
mov ecx, 0xD0000000
|
|
||||||
mov ebx, (297 << 16) | 38
|
|
||||||
mov edx, [status_string]
|
|
||||||
mov edi, 0x00FFFFFF
|
|
||||||
int 64
|
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
@ -296,83 +258,54 @@ On_Idle:
|
|||||||
align 4
|
align 4
|
||||||
On_Redraw:
|
On_Redraw:
|
||||||
; RedrawStart
|
; RedrawStart
|
||||||
mov eax, 12
|
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||||
mov ebx, 1
|
|
||||||
int 64
|
|
||||||
; DrawWindow
|
; DrawWindow
|
||||||
xor eax, eax
|
|
||||||
mov ebx, (50 << 16) | 360
|
|
||||||
mov ecx, (50 << 16) | 88
|
|
||||||
mov edx, 0x34FFFFFF
|
|
||||||
mov edi, sz_caption
|
mov edi, sz_caption
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
int 64
|
mcall SF_CREATE_WINDOW, (50 shl 16) or 360, (50 shl 16) or 88, 0x34FFFFFF
|
||||||
; draw progressbar
|
; draw progressbar
|
||||||
push pb
|
stdcall [progressbar_draw], pb
|
||||||
call [progressbar_draw]
|
|
||||||
; draw edit1
|
; draw edit1
|
||||||
push edit1
|
stdcall [edit_box_draw], edit1
|
||||||
call [edit_box_draw]
|
|
||||||
; draw edit2
|
; draw edit2
|
||||||
push edit2
|
stdcall [edit_box_draw], edit2
|
||||||
call [edit_box_draw]
|
|
||||||
; DrawButton
|
; DrawButton
|
||||||
mov eax, 8
|
mcall SF_DEFINE_BUTTON, (288 shl 16) or 53, (8 shl 16) or 26, BUTTON_START, 0x00DDDDDD
|
||||||
mov ecx, (8 << 16) | 26
|
|
||||||
mov ebx, (288 << 16) | 53
|
|
||||||
mov edx, BUTTON_START
|
|
||||||
mov esi, 0x00DDDDDD
|
|
||||||
int 64
|
|
||||||
; DrawTexts
|
; DrawTexts
|
||||||
mov eax, 4
|
|
||||||
mov ecx, 0x90000000
|
|
||||||
; Path:
|
; Path:
|
||||||
mov ebx, (8 << 16) | 11
|
mcall SF_DRAW_TEXT, (8 shl 16) or 11, 0x90000000, sz_path
|
||||||
mov edx, sz_path
|
|
||||||
int 64
|
|
||||||
; Count:
|
; Count:
|
||||||
mov ebx, (168 << 16) | 11
|
mcall , (168 shl 16) or 11,, sz_count
|
||||||
mov edx, sz_count
|
|
||||||
int 64
|
|
||||||
; Start:
|
; Start:
|
||||||
mov ebx, (297 << 16) | 15
|
mcall , (297 shl 16) or 15,, sz_start
|
||||||
mov edx, sz_start
|
|
||||||
int 64
|
|
||||||
; draw status
|
; draw status
|
||||||
call DrawStatus
|
call DrawStatus
|
||||||
; RedrawFinish
|
; RedrawFinish
|
||||||
mov eax, 12
|
mcall SF_REDRAW,SSF_END_DRAW
|
||||||
mov ebx, 2
|
|
||||||
int 64
|
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
On_Key:
|
On_Key:
|
||||||
; GetKeyCode
|
; GetKeyCode
|
||||||
mov eax, 2
|
mcall SF_GET_KEY
|
||||||
int 64
|
|
||||||
; notify edit1 about key event
|
; notify edit1 about key event
|
||||||
push edit1
|
stdcall [edit_box_key], edit1
|
||||||
call [edit_box_key]
|
|
||||||
; notify edit2 about key event
|
; notify edit2 about key event
|
||||||
push edit2
|
stdcall [edit_box_key], edit2
|
||||||
call [edit_box_key]
|
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
On_Button:
|
On_Button:
|
||||||
; GetButtonNumber
|
; GetButtonNumber
|
||||||
mov eax, 17
|
mcall SF_GET_BUTTON
|
||||||
int 64
|
|
||||||
movzx eax, ah
|
movzx eax, ah
|
||||||
call [eax * 4 + ButtonEvents]
|
call dword[eax * 4 + ButtonEvents]
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
On_ButtonClose:
|
On_ButtonClose:
|
||||||
; Terminate
|
; Terminate
|
||||||
or eax, -1
|
mcall SF_TERMINATE_PROCESS
|
||||||
int 64
|
|
||||||
; ret is not needed here because we are not back after terminate
|
; ret is not needed here because we are not back after terminate
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
@ -381,31 +314,25 @@ On_ButtonStart:
|
|||||||
or [edit1.flags], dword ED_DISABLED ; disable edit1 | we will
|
or [edit1.flags], dword ED_DISABLED ; disable edit1 | we will
|
||||||
or [edit2.flags], dword ED_DISABLED ; disable edit2 | in Action
|
or [edit2.flags], dword ED_DISABLED ; disable edit2 | in Action
|
||||||
; redraw edit1 after change flag
|
; redraw edit1 after change flag
|
||||||
push edit1
|
stdcall [edit_box_draw], edit1
|
||||||
call [edit_box_draw]
|
|
||||||
; redraw edit2 after change flag
|
; redraw edit2 after change flag
|
||||||
push edit2
|
stdcall [edit_box_draw], edit2
|
||||||
call [edit_box_draw]
|
|
||||||
call DoAction
|
call DoAction
|
||||||
mov [ButtonEvents.2], dword On_ButtonStart ; enable ButtonStart
|
mov [ButtonEvents.2], dword On_ButtonStart ; enable ButtonStart
|
||||||
and [edit1.flags], dword ~ED_DISABLED ; enable edit1
|
and [edit1.flags], not ED_DISABLED ; enable edit1
|
||||||
and [edit2.flags], dword ~ED_DISABLED ; enable edit2
|
and [edit2.flags], not ED_DISABLED ; enable edit2
|
||||||
; redraw edit1 after change flag
|
; redraw edit1 after change flag
|
||||||
push edit1
|
stdcall [edit_box_draw], edit1
|
||||||
call [edit_box_draw]
|
|
||||||
; redraw edit2 after change flag
|
; redraw edit2 after change flag
|
||||||
push edit2
|
stdcall [edit_box_draw], edit2
|
||||||
call [edit_box_draw]
|
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
On_Mouse:
|
On_Mouse:
|
||||||
; notify edit1 about mouse event
|
; notify edit1 about mouse event
|
||||||
push edit1
|
stdcall [edit_box_mouse], edit1
|
||||||
call [edit_box_mouse]
|
|
||||||
; notify edit2 about mouse event
|
; notify edit2 about mouse event
|
||||||
push edit2
|
stdcall [edit_box_mouse], edit2
|
||||||
call [edit_box_mouse]
|
|
||||||
ret
|
ret
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
@ -436,4 +363,12 @@ GetProcAddress:
|
|||||||
ret 8
|
ret 8
|
||||||
; ------------------------------------- ;
|
; ------------------------------------- ;
|
||||||
align 4
|
align 4
|
||||||
END:
|
program.end:
|
||||||
|
; ------------------------------------- ;
|
||||||
|
text_buffer1 rb EDIT1_MAX_LENGTH+2
|
||||||
|
text_buffer2 rb EDIT2_MAX_LENGTH+2
|
||||||
|
file_name rb FILE_NAME_LENGTH
|
||||||
|
rb 256
|
||||||
|
align 16
|
||||||
|
program.stack:
|
||||||
|
program.memory:
|
@ -1,2 +1,2 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
tup.rule("GenFiles.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "GenFiles")
|
tup.rule("GenFiles.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "GenFiles")
|
||||||
|
3
programs/testing/genfiles/build.bat
Normal file
3
programs/testing/genfiles/build.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@fasm.exe -m 16384 GenFiles.asm GenFiles.kex
|
||||||
|
@kpack GenFiles.kex
|
||||||
|
pause
|
@ -1,3 +0,0 @@
|
|||||||
@del GenFiles
|
|
||||||
nasm -f bin GenFiles.asm -o GenFiles
|
|
||||||
pause
|
|
Loading…
x
Reference in New Issue
Block a user