revrite Lod from nasm to fasm

This commit is contained in:
2025-03-03 20:18:10 +02:00
parent c5bb1194fd
commit 15b40a7fcc
6 changed files with 45 additions and 59 deletions

View File

@@ -485,6 +485,7 @@ tup.append_table(img_files, {
{"DEVELOP/EXAMPLES/USE_MB", VAR_PROGS .. "/demos/use_mb/use_mb"}, {"DEVELOP/EXAMPLES/USE_MB", VAR_PROGS .. "/demos/use_mb/use_mb"},
{"File Managers/KFAR", VAR_PROGS .. "/fs/kfar/trunk/kfar"}, {"File Managers/KFAR", VAR_PROGS .. "/fs/kfar/trunk/kfar"},
{"File Managers/OPENDIAL", VAR_PROGS .. "/fs/opendial/opendial"}, {"File Managers/OPENDIAL", VAR_PROGS .. "/fs/opendial/opendial"},
{"LOD", VAR_PROGS .. "/fs/lod/lod"},
{"GAMES/15", VAR_PROGS .. "/games/15/15"}, {"GAMES/15", VAR_PROGS .. "/games/15/15"},
{"GAMES/DINO", VAR_PROGS .. "/games/dino/dino"}, {"GAMES/DINO", VAR_PROGS .. "/games/dino/dino"},
{"GAMES/FREECELL", VAR_PROGS .. "/games/freecell/freecell"}, {"GAMES/FREECELL", VAR_PROGS .. "/games/freecell/freecell"},
@@ -648,7 +649,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"},
{"LOD", VAR_PROGS .. "/fs/lod/lod"},
{"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"}, {"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"},
}) })
tup.append_table(extra_files, { tup.append_table(extra_files, {

View File

@@ -1,2 +1,2 @@
if tup.getconfig("NO_NASM") ~= "" then return end if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("lod.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "lod") tup.rule("lod.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "lod")

View File

@@ -0,0 +1,3 @@
@fasm.exe -m 16384 lod.asm lod.kex
@kpack lod.kex
pause

View File

@@ -8,11 +8,20 @@
; Author 0CodErr ; Author 0CodErr
; http://board.kolibrios.org/viewtopic.php?f=9&t=2486 ; http://board.kolibrios.org/viewtopic.php?f=9&t=2486
ORG 0 use32
BITS 32 org 0
; ---------------------------------------------------------------------------- ; db 'MENUET01'
PARAMS_SIZE equ 256 version dd 1
STACK_SIZE equ 256 dd program.start
dd program.end
dd program.memory
dd program.stack
dd program.params
dd 0
; ---------------------------- ;
include '../../macros.inc'
include '../../KOSfuncs.inc'
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
PROCINFO_SIZE equ 1024 PROCINFO_SIZE equ 1024
FILENAME_AREA_SIZE equ 256 FILENAME_AREA_SIZE equ 256
@@ -21,18 +30,10 @@ OPENFILE_PATH_SIZE equ 4096
FILTER_AREA_SIZE equ 256 FILTER_AREA_SIZE equ 256
FILTER_BRACKET equ "*" ; and for example: LOD *bmp,png,jpeg*/sys/media/kiv FILTER_BRACKET equ "*" ; and for example: LOD *bmp,png,jpeg*/sys/media/kiv
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
MENUET01 db 'MENUET01' align 4
version dd 1 program.start:
program.start dd START mov edi, program.params
program.end dd END cmp [edi], dword 0
program.memory dd END + PARAMS_SIZE + STACK_SIZE
program.stack dd END + PARAMS_SIZE + STACK_SIZE
program.params dd END
program.path dd 0
; ---------------------------------------------------------------------------- ;
START:
mov edi,[program.params]
cmp [edi],dword 0
je terminate je terminate
call FakeDrawWindow call FakeDrawWindow
@@ -43,19 +44,13 @@ START:
je terminate je terminate
mov [file_info.params], eax mov [file_info.params], eax
launch_program: launch_program:
mov eax, 70 mcall SF_FILE, file_info
mov ebx, file_info
int 64
terminate: terminate:
or eax, -1 mcall SF_TERMINATE_PROCESS
int 64
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
OpenDialogInit: OpenDialogInit:
; load.library ; load.library
mov eax, 68 mcall SF_SYS_MISC,SSF_LOAD_DLL, sz_proc_lib
mov ebx, 19
mov ecx, sz_proc_lib
int 64
mov [proclib], eax mov [proclib], eax
push dword[proclib] push dword[proclib]
@@ -68,10 +63,7 @@ OpenDialogInit:
call GetProcAddress call GetProcAddress
mov [opendialog_start], eax mov [opendialog_start], eax
; memory.allocate ; memory.allocate
mov eax, 68 mcall SF_SYS_MISC,SSF_MEM_ALLOC, PROCINFO_SIZE + FILENAME_AREA_SIZE + OPENDIR_PATH_SIZE + OPENFILE_PATH_SIZE
mov ebx, 12
mov ecx, PROCINFO_SIZE + FILENAME_AREA_SIZE + OPENDIR_PATH_SIZE + OPENFILE_PATH_SIZE
int 64
mov [od.procinfo], eax mov [od.procinfo], eax
add eax, PROCINFO_SIZE add eax, PROCINFO_SIZE
@@ -121,13 +113,9 @@ GetProcAddress:
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
FakeDrawWindow: FakeDrawWindow:
; redraw.start ; redraw.start
mov eax, 12 mcall SF_REDRAW,SSF_BEGIN_DRAW
mov ebx, 1
int 64
; get.screen.size ; get.screen.size
mov eax, 61 mcall SF_GET_GRAPHICAL_PARAMS,SSF_SCREEN_SIZE
mov ebx, 1
int 64
shr eax, 1 shr eax, 1
and eax, 0x7FFF7FFF and eax, 0x7FFF7FFF
; draw.window ; draw.window
@@ -136,17 +124,13 @@ FakeDrawWindow:
shr eax, 16 shr eax, 16
movzx ebx, ax movzx ebx, ax
shl ebx, 16 shl ebx, 16
mov edx, 0x01000000 mcall SF_CREATE_WINDOW,,, 0x01000000
xor eax, eax
int 64
; redraw.finish ; redraw.finish
mov eax, 12 mcall SF_REDRAW,SSF_END_DRAW
mov ebx, 2
int 64
ret ret
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
OpenDialogSetFilter: OpenDialogSetFilter:
mov edi, [program.params] mov edi, program.params
mov esi, filefilter + 4 mov esi, filefilter + 4
; skip spaces ; skip spaces
or ecx, -1 or ecx, -1
@@ -195,22 +179,17 @@ OpenDialogSetFilter:
LaunchProgram: LaunchProgram:
mov eax, [od.openfile_path] mov eax, [od.openfile_path]
mov [file_info.params], eax mov [file_info.params], eax
mov eax, 70 mcall SF_FILE, file_info
mov ebx, file_info
int 64
ret ret
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
file_info: file_info:
dd 7 dd SSF_START_APP,0
dd 0 .params dd 0,0,0
.params dd 0
dd 0
dd 0
db 0 db 0
.file_path dd 0 .file_path dd 0
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
filefilter dd 0 filefilter dd 0
resb FILTER_AREA_SIZE rb FILTER_AREA_SIZE
.end db 0 .end db 0
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
od: od:
@@ -242,4 +221,10 @@ proclib dd 0
opendialog_init dd 0 opendialog_init dd 0
opendialog_start dd 0 opendialog_start dd 0
; ---------------------------------------------------------------------------- ; ; ---------------------------------------------------------------------------- ;
END: align 4
program.end:
program.params rb 256
rb 256
align 16
program.stack:
program.memory:

View File

@@ -1,2 +0,0 @@
nasm -f bin LOD.asm -o LOD
pause

View File

@@ -23,7 +23,7 @@ rnd dd 0
align 4 align 4
program.start: program.start:
mov edi, points mov edi, points
mov esi, dword[program.params] mov esi, program.params
cmp [esi], dword "rnd" cmp [esi], dword "rnd"
jne .not_rnd jne .not_rnd
mov [points_count], dword POINTS_SIZE / 3 mov [points_count], dword POINTS_SIZE / 3