Rewrite NASM programs to FASM #116
@@ -407,6 +407,7 @@ tup.append_table(img_files, {
|
|||||||
{"@SS", VAR_PROGS .. "/system/scrsaver/scrsaver"},
|
{"@SS", VAR_PROGS .. "/system/scrsaver/scrsaver"},
|
||||||
{"@VOLUME", VAR_PROGS .. "/media/volume/volume"},
|
{"@VOLUME", VAR_PROGS .. "/media/volume/volume"},
|
||||||
{"HACONFIG", VAR_PROGS .. "/other/ha/HACONFIG"},
|
{"HACONFIG", VAR_PROGS .. "/other/ha/HACONFIG"},
|
||||||
|
{"ACLOCK", VAR_PROGS .. "/demos/aclock/aclock"},
|
||||||
{"APM", VAR_PROGS .. "/system/apm/apm"},
|
{"APM", VAR_PROGS .. "/system/apm/apm"},
|
||||||
{"CALC", VAR_PROGS .. "/other/calc/trunk/calc"},
|
{"CALC", VAR_PROGS .. "/other/calc/trunk/calc"},
|
||||||
{"CALENDAR", VAR_PROGS .. "/system/calendar/trunk/calendar"},
|
{"CALENDAR", VAR_PROGS .. "/system/calendar/trunk/calendar"},
|
||||||
@@ -441,6 +442,8 @@ tup.append_table(img_files, {
|
|||||||
{"TERMINAL", VAR_PROGS .. "/system/terminal/terminal"},
|
{"TERMINAL", VAR_PROGS .. "/system/terminal/terminal"},
|
||||||
{"TEST", VAR_PROGS .. "/testing/protection/trunk/test"},
|
{"TEST", VAR_PROGS .. "/testing/protection/trunk/test"},
|
||||||
{"TINYPAD", VAR_PROGS .. "/develop/tinypad/trunk/tinypad"},
|
{"TINYPAD", VAR_PROGS .. "/develop/tinypad/trunk/tinypad"},
|
||||||
|
{"TINFO", VAR_PROGS .. "/system/tinfo/tinfo"},
|
||||||
|
{"TIMER", VAR_PROGS .. "/other/Timer/Timer"},
|
||||||
{"UNZ", VAR_PROGS .. "/fs/unz/unz"},
|
{"UNZ", VAR_PROGS .. "/fs/unz/unz"},
|
||||||
{"ZKEY", VAR_PROGS .. "/system/zkey/trunk/ZKEY"},
|
{"ZKEY", VAR_PROGS .. "/system/zkey/trunk/ZKEY"},
|
||||||
{"3D/3DWAV", VAR_PROGS .. "/demos/3dwav/trunk/3dwav"},
|
{"3D/3DWAV", VAR_PROGS .. "/demos/3dwav/trunk/3dwav"},
|
||||||
@@ -469,10 +472,12 @@ 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"},
|
||||||
{"DEVELOP/MTDBG", VAR_PROGS .. "/develop/mtdbg/mtdbg"},
|
{"DEVELOP/MTDBG", VAR_PROGS .. "/develop/mtdbg/mtdbg"},
|
||||||
|
{"DEVELOP/MSTATE", VAR_PROGS .. "/develop/mstate/mstate"},
|
||||||
{"DEVELOP/SCANCODE", VAR_PROGS .. "/develop/scancode/trunk/scancode"},
|
{"DEVELOP/SCANCODE", VAR_PROGS .. "/develop/scancode/trunk/scancode"},
|
||||||
{"DEVELOP/EXAMPLES/CIRCLE", VAR_PROGS .. "/develop/examples/circle/trunk/circle"},
|
{"DEVELOP/EXAMPLES/CIRCLE", VAR_PROGS .. "/develop/examples/circle/trunk/circle"},
|
||||||
{"DEVELOP/EXAMPLES/COLORREF", VAR_PROGS .. "/demos/colorref/trunk/colorref"},
|
{"DEVELOP/EXAMPLES/COLORREF", VAR_PROGS .. "/demos/colorref/trunk/colorref"},
|
||||||
@@ -482,6 +487,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"},
|
||||||
@@ -498,6 +504,7 @@ tup.append_table(img_files, {
|
|||||||
{"GAMES/SW", VAR_PROGS .. "/games/sw/sw"},
|
{"GAMES/SW", VAR_PROGS .. "/games/sw/sw"},
|
||||||
{"GAMES/TANKS", VAR_PROGS .. "/games/tanks/tanks"},
|
{"GAMES/TANKS", VAR_PROGS .. "/games/tanks/tanks"},
|
||||||
{"GAMES/TETRIS", VAR_PROGS .. "/games/tetris/tetris"},
|
{"GAMES/TETRIS", VAR_PROGS .. "/games/tetris/tetris"},
|
||||||
|
{"GAMES/C4", VAR_PROGS .. "/games/c4/c4"},
|
||||||
{"LIB/ARCHIVER.OBJ", VAR_PROGS .. "/fs/kfar/trunk/kfar_arc/kfar_arc.obj"},
|
{"LIB/ARCHIVER.OBJ", VAR_PROGS .. "/fs/kfar/trunk/kfar_arc/kfar_arc.obj"},
|
||||||
{"LIB/BOX_LIB.OBJ", VAR_PROGS .. "/develop/libraries/box_lib/trunk/box_lib.obj"},
|
{"LIB/BOX_LIB.OBJ", VAR_PROGS .. "/develop/libraries/box_lib/trunk/box_lib.obj"},
|
||||||
{"LIB/BUF2D.OBJ", VAR_PROGS .. "/develop/libraries/buf2d/trunk/buf2d.obj"},
|
{"LIB/BUF2D.OBJ", VAR_PROGS .. "/develop/libraries/buf2d/trunk/buf2d.obj"},
|
||||||
@@ -517,6 +524,7 @@ tup.append_table(img_files, {
|
|||||||
{"LIB/SORT.OBJ", VAR_PROGS .. "/develop/libraries/sorter/sort.obj"},
|
{"LIB/SORT.OBJ", VAR_PROGS .. "/develop/libraries/sorter/sort.obj"},
|
||||||
{"LIB/TINYGL.OBJ", VAR_PROGS .. "/develop/libraries/TinyGL/asm_fork/tinygl.obj"},
|
{"LIB/TINYGL.OBJ", VAR_PROGS .. "/develop/libraries/TinyGL/asm_fork/tinygl.obj"},
|
||||||
{"MEDIA/ANIMAGE", VAR_PROGS .. "/media/animage/trunk/animage"},
|
{"MEDIA/ANIMAGE", VAR_PROGS .. "/media/animage/trunk/animage"},
|
||||||
|
{"MEDIA/FILLSCR", VAR_PROGS .. "/media/FillScr/fillscr"},
|
||||||
{"MEDIA/KIV", VAR_PROGS .. "/media/kiv/trunk/kiv"},
|
{"MEDIA/KIV", VAR_PROGS .. "/media/kiv/trunk/kiv"},
|
||||||
{"MEDIA/LISTPLAY", VAR_PROGS .. "/media/listplay/trunk/listplay"},
|
{"MEDIA/LISTPLAY", VAR_PROGS .. "/media/listplay/trunk/listplay"},
|
||||||
{"MEDIA/MIDAMP", VAR_PROGS .. "/media/midamp/trunk/midamp"},
|
{"MEDIA/MIDAMP", VAR_PROGS .. "/media/midamp/trunk/midamp"},
|
||||||
@@ -639,22 +647,6 @@ if build_type == "ru_RU" then tup.append_table(extra_files, {
|
|||||||
|
|
||||||
end -- tup.getconfig('NO_FASM') ~= 'full'
|
end -- tup.getconfig('NO_FASM') ~= 'full'
|
||||||
|
|
||||||
-- Programs that require NASM to compile.
|
|
||||||
if tup.getconfig('NO_NASM') ~= 'full' then
|
|
||||||
tup.append_table(img_files, {
|
|
||||||
{"ACLOCK", VAR_PROGS .. "/demos/aclock/trunk/aclock"},
|
|
||||||
{"LOD", VAR_PROGS .. "/fs/lod/lod"},
|
|
||||||
{"TIMER", VAR_PROGS .. "/other/Timer/timer"},
|
|
||||||
{"TINFO", VAR_PROGS .. "/system/tinfo/tinfo"},
|
|
||||||
{"DEVELOP/MSTATE", VAR_PROGS .. "/develop/mstate/mstate"},
|
|
||||||
{"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"},
|
|
||||||
{"GAMES/C4", VAR_PROGS .. "/games/c4/c4"},
|
|
||||||
{"MEDIA/FILLSCR", VAR_PROGS .. "/media/FillScr/fillscr"},
|
|
||||||
})
|
|
||||||
tup.append_table(extra_files, {
|
|
||||||
})
|
|
||||||
end -- tup.getconfig('NO_NASM') ~= 'full'
|
|
||||||
|
|
||||||
-- Programs that require JWASM to compile.
|
-- Programs that require JWASM to compile.
|
||||||
if tup.getconfig('NO_JWASM') ~= 'full' then
|
if tup.getconfig('NO_JWASM') ~= 'full' then
|
||||||
tup.append_table(img_files, {
|
tup.append_table(img_files, {
|
||||||
|
2
programs/demos/aclock/Tupfile.lua
Normal file
2
programs/demos/aclock/Tupfile.lua
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
|
tup.rule("aclock.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "aclock")
|
@@ -16,44 +16,42 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
bits 32
|
use32
|
||||||
%include 'mos.inc'
|
org 0
|
||||||
section .text
|
db 'MENUET01'
|
||||||
|
dd 1,main,image_end,memory_end,stacktop,cmdLine,0
|
||||||
|
|
||||||
|
include '../../macros.inc'
|
||||||
|
include '../../proc32.inc'
|
||||||
|
include '../../KOSfuncs.inc'
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
; configuration stuff
|
; configuration stuff
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
|
; skinned window borders
|
||||||
%define APPNAME "Clock"
|
MOS_WND_SKIN_BORDER_LEFT = 5
|
||||||
%define STACKSIZE 1024
|
MOS_WND_SKIN_BORDER_RIGHT = 5
|
||||||
|
MOS_WND_SKIN_BORDER_BOTTOM = 5
|
||||||
|
|
||||||
; default window position/dimensions (work area)
|
; default window position/dimensions (work area)
|
||||||
%define DEFAULT_XPOS -20
|
DEFAULT_XPOS =-20
|
||||||
%define DEFAULT_YPOS 20
|
DEFAULT_YPOS =20
|
||||||
%define DEFAULT_WIDTH 110
|
DEFAULT_WIDTH =110
|
||||||
%define DEFAULT_HEIGHT 110
|
DEFAULT_HEIGHT =110
|
||||||
|
|
||||||
; minimal size (horizontal and vertical) of work area
|
; minimal size (horizontal and vertical) of work area
|
||||||
%define MIN_WIDTH 100
|
MIN_WIDTH =100
|
||||||
%define MIN_HEIGHT 100
|
MIN_HEIGHT =100
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
|
||||||
; header
|
|
||||||
;********************************************************************
|
|
||||||
|
|
||||||
MOS_HEADER01 main,image_end,memory_end,stacktop-4,cmdLine,0
|
|
||||||
|
|
||||||
; these includes introduce code and thus mustn't stand
|
; these includes introduce code and thus mustn't stand
|
||||||
; before the menuet header =)
|
; before the menuet header =)
|
||||||
%include 'dbgboard.inc'
|
include 'dbgboard.inc'
|
||||||
%include 'strlen.inc'
|
include 'strfunct.inc'
|
||||||
%include 'str2dwrd.inc'
|
include 'cmdline.inc'
|
||||||
%include 'strtok.inc'
|
include 'adjstwnd.inc'
|
||||||
%include 'cmdline.inc'
|
include 'draw.inc'
|
||||||
%include 'adjstwnd.inc'
|
|
||||||
%include 'draw.inc'
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
; main program
|
; main program
|
||||||
@@ -89,20 +87,18 @@ main:
|
|||||||
; call drawClock
|
; call drawClock
|
||||||
|
|
||||||
; wait up to a second for next event
|
; wait up to a second for next event
|
||||||
mov eax,MOS_SC_WAITEVENTTIMEOUT
|
mcall SF_WAIT_EVENT_TIMEOUT,100
|
||||||
mov ebx,100
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jne .event_occured
|
jne .event_occured
|
||||||
call drawClock
|
call drawClock
|
||||||
|
|
||||||
.event_occured:
|
.event_occured:
|
||||||
cmp eax,MOS_EVT_REDRAW
|
cmp eax,EV_REDRAW
|
||||||
je .redraw
|
je .redraw
|
||||||
cmp eax,MOS_EVT_KEY
|
cmp eax,EV_KEY
|
||||||
je .key
|
je .key
|
||||||
cmp eax,MOS_EVT_BUTTON
|
cmp eax,EV_BUTTON
|
||||||
je .button
|
je .button
|
||||||
jmp .msgpump
|
jmp .msgpump
|
||||||
|
|
||||||
@@ -110,12 +106,10 @@ main:
|
|||||||
call drawWindow
|
call drawWindow
|
||||||
jmp .msgpump
|
jmp .msgpump
|
||||||
.key:
|
.key:
|
||||||
mov eax,MOS_SC_GETKEY
|
mcall SF_GET_KEY
|
||||||
int 0x40
|
|
||||||
jmp .msgpump
|
jmp .msgpump
|
||||||
.button:
|
.button:
|
||||||
mov eax,MOS_SC_EXIT
|
mcall SF_TERMINATE_PROCESS
|
||||||
int 0x40
|
|
||||||
jmp .msgpump
|
jmp .msgpump
|
||||||
|
|
||||||
|
|
||||||
@@ -128,11 +122,7 @@ main:
|
|||||||
getDefaultWindowColors:
|
getDefaultWindowColors:
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
pushfd
|
||||||
mov eax,MOS_SC_WINDOWPROPERTIES
|
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,wndColors,sizeof.system_colors
|
||||||
mov ebx,3
|
|
||||||
mov ecx,wndColors
|
|
||||||
mov edx,MOS_WNDCOLORS_size
|
|
||||||
int 0x40
|
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
@@ -149,29 +139,24 @@ drawWindow:
|
|||||||
pusha
|
pusha
|
||||||
|
|
||||||
; start window redraw
|
; start window redraw
|
||||||
mov eax,MOS_SC_REDRAWSTATUS
|
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||||
mov ebx,1
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; create window
|
; create window
|
||||||
mov eax,MOS_SC_DEFINEWINDOW
|
|
||||||
mov ebx,[wndXPos]
|
mov ebx,[wndXPos]
|
||||||
shl ebx,16
|
shl ebx,16
|
||||||
or ebx,[wndWidth]
|
or ebx,[wndWidth]
|
||||||
mov ecx,[wndYPos]
|
mov ecx,[wndYPos]
|
||||||
shl ecx,16
|
shl ecx,16
|
||||||
or ecx,[wndHeight]
|
or ecx,[wndHeight]
|
||||||
mov edx,[wndColors+MOS_WNDCOLORS.work]
|
mov edx,[wndColors.work]
|
||||||
or edx,0x53000000
|
or edx,0x53000000
|
||||||
mov edi,label
|
mov edi,w_label
|
||||||
int 0x40
|
mcall SF_CREATE_WINDOW
|
||||||
|
|
||||||
call drawClock
|
call drawClock
|
||||||
|
|
||||||
; end window redraw
|
; end window redraw
|
||||||
mov eax,MOS_SC_REDRAWSTATUS
|
mcall SF_REDRAW,SSF_END_DRAW
|
||||||
mov ebx,2
|
|
||||||
int 0x40
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -188,32 +173,29 @@ wndWidth dd DEFAULT_WIDTH
|
|||||||
wndHeight dd DEFAULT_HEIGHT
|
wndHeight dd DEFAULT_HEIGHT
|
||||||
|
|
||||||
; window label
|
; window label
|
||||||
label db APPNAME,0
|
w_label: db "Clock",0
|
||||||
LABEL_LEN equ ($-label-1)
|
.end:
|
||||||
|
LABEL_LEN equ (w_label.end-w_label-1)
|
||||||
|
|
||||||
; token delimiter list for command line
|
; token delimiter list for command line
|
||||||
delimiters db 9,10,11,12,13,32,0
|
delimiters db 9,10,11,12,13,32,0
|
||||||
|
|
||||||
; don't insert anything after this label
|
|
||||||
image_end:
|
image_end:
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
; uninitialized data
|
; uninitialized data
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
section .bss align=4
|
align 4
|
||||||
|
wndColors system_colors
|
||||||
wndColors resb MOS_WNDCOLORS_size
|
procInfo process_information
|
||||||
procInfo resb MOS_PROCESSINFO_size
|
|
||||||
|
|
||||||
; space for command line. at the end we have an additional
|
; space for command line. at the end we have an additional
|
||||||
; byte for a terminating zero, just to be sure...
|
; byte for a terminating zero, just to be sure...
|
||||||
cmdLine resb 257
|
cmdLine rb 257
|
||||||
|
|
||||||
alignb 4
|
align 4
|
||||||
stack resb STACKSIZE
|
rb 1024
|
||||||
stacktop:
|
stacktop:
|
||||||
|
|
||||||
; don't insert anything after this label
|
|
||||||
memory_end:
|
memory_end:
|
||||||
|
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -20,8 +20,6 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
;
|
;
|
||||||
%ifndef _ADJSTWND_INC
|
|
||||||
%define _ADJSTWND_INC
|
|
||||||
|
|
||||||
|
|
||||||
;window types
|
;window types
|
||||||
@@ -72,8 +70,7 @@ adjustWindowDimensions:
|
|||||||
|
|
||||||
; clamp window dimensions
|
; clamp window dimensions
|
||||||
.clamp:
|
.clamp:
|
||||||
mov eax,MOS_SC_GETSCREENMAX ; get screen dimensions
|
mcall SF_GET_SCREEN_SIZE ; get screen dimensions
|
||||||
int 0x40
|
|
||||||
mov edi,eax ; edi = screen width
|
mov edi,eax ; edi = screen width
|
||||||
shr edi,16
|
shr edi,16
|
||||||
mov ebp,eax ; ebp = screen height
|
mov ebp,eax ; ebp = screen height
|
||||||
@@ -136,12 +133,10 @@ adjustWindowDimensions:
|
|||||||
add edx,MOS_WND_SKIN_BORDER_LEFT+MOS_WND_SKIN_BORDER_RIGHT
|
add edx,MOS_WND_SKIN_BORDER_LEFT+MOS_WND_SKIN_BORDER_RIGHT
|
||||||
; adjust height (esi). we need the skin height to do this.
|
; adjust height (esi). we need the skin height to do this.
|
||||||
push ebx
|
push ebx
|
||||||
mov eax,MOS_SC_WINDOWPROPERTIES
|
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
|
||||||
mov ebx,4
|
|
||||||
int 0x40
|
|
||||||
lea esi,[esi+eax+MOS_WND_SKIN_BORDER_BOTTOM]
|
lea esi,[esi+eax+MOS_WND_SKIN_BORDER_BOTTOM]
|
||||||
pop ebx
|
pop ebx
|
||||||
jmp .clamp
|
jmp .clamp
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
3
programs/demos/aclock/build.bat
Normal file
3
programs/demos/aclock/build.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@fasm.exe -m 16384 aclock.asm aclock.kex
|
||||||
|
@kpack aclock.kex
|
||||||
|
pause
|
@@ -17,8 +17,6 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
;
|
;
|
||||||
%ifndef _CMDLINE_INC
|
|
||||||
%define _CMDLINE_INC
|
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
@@ -105,8 +103,7 @@ parseCommandLine:
|
|||||||
; output : eax contains position
|
; output : eax contains position
|
||||||
; destroys : nothing
|
; destroys : nothing
|
||||||
parsePositionParam:
|
parsePositionParam:
|
||||||
push ebx
|
push ebx esi
|
||||||
push esi
|
|
||||||
pushfd
|
pushfd
|
||||||
|
|
||||||
; is the second char of the parameter a '-' ?
|
; is the second char of the parameter a '-' ?
|
||||||
@@ -129,8 +126,7 @@ parsePositionParam:
|
|||||||
.rotationshyperboloid:
|
.rotationshyperboloid:
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
pop esi
|
pop esi ebx
|
||||||
pop ebx
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; parse dimension parameter
|
; parse dimension parameter
|
||||||
@@ -147,5 +143,4 @@ parseSizeParam:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
@@ -19,20 +19,34 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
;
|
;
|
||||||
%ifndef _DBGBOARD_INC
|
|
||||||
%define _DBGBOARD_INC
|
|
||||||
|
|
||||||
|
|
||||||
%ifdef DEBUG
|
if DEBUG eq
|
||||||
|
|
||||||
|
macro DBG_BOARD_PRINTNEWLINE {
|
||||||
|
}
|
||||||
|
|
||||||
|
macro DBG_BOARD_PRINTCHAR c1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
macro DBG_BOARD_PRINTDWORD w1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
macro DBG_BOARD_PRINTSTRINGLITERAL p1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
macro DBG_BOARD_PRINTSTRING s1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
; print newline
|
; print newline
|
||||||
; no input
|
; no input
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
%macro DBG_BOARD_PRINTNEWLINE 0
|
macro DBG_BOARD_PRINTNEWLINE {
|
||||||
call dbg_board_printnewline
|
call dbg_board_printnewline
|
||||||
%endm
|
}
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
@@ -44,12 +58,12 @@
|
|||||||
; DBG_BOARD_PRINTCHAR [esi]
|
; DBG_BOARD_PRINTCHAR [esi]
|
||||||
; DBG_BOARD_PRINTCHAR [somevariable]
|
; DBG_BOARD_PRINTCHAR [somevariable]
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
%macro DBG_BOARD_PRINTCHAR 1
|
macro DBG_BOARD_PRINTCHAR c1 {
|
||||||
push ecx
|
push ecx
|
||||||
mov cl,byte %1
|
mov cl,byte c1
|
||||||
call dbg_board_printchar
|
call dbg_board_printchar
|
||||||
pop ecx
|
pop ecx
|
||||||
%endm
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -60,10 +74,10 @@
|
|||||||
; DBG_BOARD_PRINTDWORD 0xdeadbeef
|
; DBG_BOARD_PRINTDWORD 0xdeadbeef
|
||||||
; DBG_BOARD_PRINTDWORD [somevariable]
|
; DBG_BOARD_PRINTDWORD [somevariable]
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
%macro DBG_BOARD_PRINTDWORD 1
|
macro DBG_BOARD_PRINTDWORD w1 {
|
||||||
push dword %1
|
push dword w1
|
||||||
call dbg_board_printdword
|
call dbg_board_printdword
|
||||||
%endm
|
}
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
@@ -73,13 +87,14 @@
|
|||||||
; examples DBG_BOARD_PRINTSTRINGLITERAL "foo",0
|
; examples DBG_BOARD_PRINTSTRINGLITERAL "foo",0
|
||||||
; DBG_BOARD_PRINTSTRINGLITERAL "bar",10,13,0
|
; DBG_BOARD_PRINTSTRINGLITERAL "bar",10,13,0
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
%macro DBG_BOARD_PRINTSTRINGLITERAL 1+
|
macro DBG_BOARD_PRINTSTRINGLITERAL p1 {
|
||||||
jmp %%bar
|
local .foo
|
||||||
%%foo db %1, 0 ; terminate string, just to be sure
|
jmp @f
|
||||||
%%bar:
|
.foo db p1, 0 ; terminate string, just to be sure
|
||||||
push dword %%foo
|
@@:
|
||||||
|
push dword .foo
|
||||||
call dbg_board_printstring
|
call dbg_board_printstring
|
||||||
%endm
|
}
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
@@ -89,22 +104,18 @@
|
|||||||
; DBG_BOARD_PRINTSTRING esi
|
; DBG_BOARD_PRINTSTRING esi
|
||||||
; DBG_BOARD_PRINTSTRING [ebx]
|
; DBG_BOARD_PRINTSTRING [ebx]
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
%macro DBG_BOARD_PRINTSTRING 1
|
macro DBG_BOARD_PRINTSTRING s1 {
|
||||||
push dword %1
|
push dword s1
|
||||||
call dbg_board_printstring
|
call dbg_board_printstring
|
||||||
%endm
|
}
|
||||||
|
|
||||||
|
|
||||||
; no input
|
; no input
|
||||||
dbg_board_printnewline:
|
dbg_board_printnewline:
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
pushfd
|
||||||
mov eax,MOS_SC_DEBUGBOARD
|
mcall SF_BOARD,SSF_DEBUG_WRITE,10
|
||||||
mov ebx,1
|
mcall ,,13
|
||||||
mov ecx,10
|
|
||||||
int 0x40
|
|
||||||
mov ecx,13
|
|
||||||
int 0x40
|
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
@@ -114,10 +125,8 @@ dbg_board_printnewline:
|
|||||||
dbg_board_printchar:
|
dbg_board_printchar:
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
pushfd
|
||||||
mov eax,MOS_SC_DEBUGBOARD
|
|
||||||
mov ebx,1
|
|
||||||
and ecx,0xff
|
and ecx,0xff
|
||||||
int 0x40
|
mcall SF_BOARD,SSF_DEBUG_WRITE
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
@@ -127,20 +136,17 @@ dbg_board_printchar:
|
|||||||
dbg_board_printdword:
|
dbg_board_printdword:
|
||||||
enter 0,0
|
enter 0,0
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
pushfd
|
||||||
mov eax,MOS_SC_DEBUGBOARD
|
; print 0x prefix
|
||||||
mov ebx,1
|
mcall SF_BOARD,SSF_DEBUG_WRITE,'0'
|
||||||
mov ecx,'0' ; print 0x prefix
|
mcall ,,'x'
|
||||||
int 0x40
|
|
||||||
mov ecx,'x'
|
|
||||||
int 0x40
|
|
||||||
mov edx,[ebp + 8] ; get dword to print
|
mov edx,[ebp + 8] ; get dword to print
|
||||||
mov esi,8 ; iterate through all nibbles
|
mov esi,8 ; iterate through all nibbles
|
||||||
.loop:
|
.loop:
|
||||||
mov ecx,edx ; display hex digit
|
mov ecx,edx ; display hex digit
|
||||||
shr ecx,28
|
shr ecx,28
|
||||||
movzx ecx,byte [dbg_board_printdword_digits + ecx]
|
movzx ecx,byte [dbg_board_printdword_digits + ecx]
|
||||||
int 0x40
|
mcall
|
||||||
shl edx,4 ; next nibble
|
shl edx,4 ; next nibble
|
||||||
dec esi
|
dec esi
|
||||||
jnz .loop
|
jnz .loop
|
||||||
@@ -166,35 +172,13 @@ dbg_board_printstring:
|
|||||||
or al,al ; zero ?
|
or al,al ; zero ?
|
||||||
je .done ; yeah -> get outta here
|
je .done ; yeah -> get outta here
|
||||||
movzx ecx,al ; nope -> display character
|
movzx ecx,al ; nope -> display character
|
||||||
mov eax,MOS_SC_DEBUGBOARD
|
mcall SF_BOARD
|
||||||
int 0x40
|
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
leave
|
leave
|
||||||
ret 4
|
ret 4
|
||||||
|
|
||||||
%else
|
|
||||||
|
|
||||||
|
end if
|
||||||
%macro DBG_BOARD_PRINTNEWLINE 0
|
|
||||||
%endm
|
|
||||||
|
|
||||||
%macro DBG_BOARD_PRINTCHAR 1
|
|
||||||
%endm
|
|
||||||
|
|
||||||
%macro DBG_BOARD_PRINTDWORD 1
|
|
||||||
%endm
|
|
||||||
|
|
||||||
%macro DBG_BOARD_PRINTSTRINGLITERAL 1+
|
|
||||||
%endm
|
|
||||||
|
|
||||||
%macro DBG_BOARD_PRINTSTRING 1
|
|
||||||
%endm
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
@@ -17,8 +17,6 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
;
|
;
|
||||||
%ifndef _DRAW_INC
|
|
||||||
%define _DRAW_INC
|
|
||||||
|
|
||||||
|
|
||||||
TMR1_FACTOR dd 0.45
|
TMR1_FACTOR dd 0.45
|
||||||
@@ -50,45 +48,36 @@ monthNames:
|
|||||||
; output : nothing
|
; output : nothing
|
||||||
; destroys : nothing
|
; destroys : nothing
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
drawClock:
|
proc drawClock
|
||||||
%push drawClock_context
|
locals
|
||||||
%stacksize flat
|
i dd ?
|
||||||
%assign %$localsize 0
|
TMR1X dd ?
|
||||||
|
TMR1Y dd ?
|
||||||
%local i:dword, \
|
TMR2X dd ?
|
||||||
TMR1X:dword, \
|
TMR2Y dd ?
|
||||||
TMR1Y:dword, \
|
SECRX dd ?
|
||||||
TMR2X:dword, \
|
SECRY dd ?
|
||||||
TMR2Y:dword, \
|
MINRX dd ?
|
||||||
SECRX:dword, \
|
MINRY dd ?
|
||||||
SECRY:dword, \
|
HOURRX dd ?
|
||||||
MINRX:dword, \
|
HOURRY dd ?
|
||||||
MINRY:dword, \
|
workwidth dd ?
|
||||||
HOURRX:dword, \
|
workheight dd ?
|
||||||
HOURRY:dword, \
|
foo dd ?
|
||||||
workwidth:dword, \
|
endl
|
||||||
workheight:dword, \
|
|
||||||
foo:dword
|
|
||||||
|
|
||||||
enter %$localsize,0
|
|
||||||
pushad
|
pushad
|
||||||
pushfd
|
pushfd
|
||||||
|
|
||||||
; get window dimensions
|
; get window dimensions
|
||||||
mov eax,MOS_SC_GETPROCESSINFO
|
mcall SF_THREAD_INFO,procInfo,-1
|
||||||
mov ebx,procInfo
|
|
||||||
mov ecx,-1
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; calculate work area size (width/height = ecx/edx)
|
; calculate work area size (width/height = ecx/edx)
|
||||||
; if the work area is too small (maybe the window is shaded)
|
; if the work area is too small (maybe the window is shaded)
|
||||||
; we don't draw anything.
|
; we don't draw anything.
|
||||||
mov eax,MOS_SC_WINDOWPROPERTIES
|
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT ; get skin height (eax)
|
||||||
mov ebx,4 ; get skin height (eax)
|
mov ecx,[procInfo.box.width]
|
||||||
int 0x40
|
|
||||||
mov ecx,[procInfo + MOS_PROCESSINFO.wndWidth]
|
|
||||||
sub ecx,MOS_WND_SKIN_BORDER_LEFT+MOS_WND_SKIN_BORDER_RIGHT
|
sub ecx,MOS_WND_SKIN_BORDER_LEFT+MOS_WND_SKIN_BORDER_RIGHT
|
||||||
mov edx,[procInfo + MOS_PROCESSINFO.wndHeight]
|
mov edx,[procInfo.box.height]
|
||||||
sub edx,eax
|
sub edx,eax
|
||||||
sub edx,MOS_WND_SKIN_BORDER_BOTTOM
|
sub edx,MOS_WND_SKIN_BORDER_BOTTOM
|
||||||
cmp ecx,0 ; width too small ?
|
cmp ecx,0 ; width too small ?
|
||||||
@@ -102,9 +91,9 @@ drawClock:
|
|||||||
mov [workheight],edx
|
mov [workheight],edx
|
||||||
|
|
||||||
; calculate center of clock (x/y = esi/edi)
|
; calculate center of clock (x/y = esi/edi)
|
||||||
mov esi,[procInfo + MOS_PROCESSINFO.wndWidth]
|
mov esi,[procInfo.box.width]
|
||||||
shr esi,1
|
shr esi,1
|
||||||
mov edi,[procInfo + MOS_PROCESSINFO.wndHeight]
|
mov edi,[procInfo.box.height]
|
||||||
sub edi,MOS_WND_SKIN_BORDER_BOTTOM
|
sub edi,MOS_WND_SKIN_BORDER_BOTTOM
|
||||||
sub edi,eax
|
sub edi,eax
|
||||||
shr edi,1
|
shr edi,1
|
||||||
@@ -119,9 +108,8 @@ drawClock:
|
|||||||
shl ecx,16 ; (=skin height)
|
shl ecx,16 ; (=skin height)
|
||||||
or ecx,edx ; height
|
or ecx,edx ; height
|
||||||
inc ecx
|
inc ecx
|
||||||
mov edx,[wndColors + MOS_WNDCOLORS.work]
|
mov edx,[wndColors.work]
|
||||||
mov eax,MOS_SC_DRAWBAR
|
mcall SF_DRAW_RECT
|
||||||
int 0x40
|
|
||||||
popad
|
popad
|
||||||
|
|
||||||
; calculate second hand radii
|
; calculate second hand radii
|
||||||
@@ -163,8 +151,7 @@ drawClock:
|
|||||||
fstp dword [TMR2Y]
|
fstp dword [TMR2Y]
|
||||||
|
|
||||||
; get system clock (edx)
|
; get system clock (edx)
|
||||||
mov eax,MOS_SC_GETSYSCLOCK
|
mcall SF_GET_SYS_TIME
|
||||||
int 0x40
|
|
||||||
mov edx,eax
|
mov edx,eax
|
||||||
|
|
||||||
; draw second hand
|
; draw second hand
|
||||||
@@ -173,21 +160,14 @@ drawClock:
|
|||||||
shr eax,16
|
shr eax,16
|
||||||
call bcdbin
|
call bcdbin
|
||||||
mov ecx,eax ; save seconds for later
|
mov ecx,eax ; save seconds for later
|
||||||
push ecx
|
; 2*pi/60
|
||||||
push eax
|
stdcall getHandCoords,edi,esi,[SECRY],[SECRX],0.104719755,eax,ecx
|
||||||
fpush32 0.104719755 ; 2*pi/60
|
|
||||||
push dword [SECRX]
|
|
||||||
push dword [SECRY]
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
call getHandCoords
|
|
||||||
mov eax,MOS_SC_DRAWLINE
|
|
||||||
shl ebx,16
|
shl ebx,16
|
||||||
or ebx,esi
|
or ebx,esi
|
||||||
shl ecx,16
|
shl ecx,16
|
||||||
or ecx,edi
|
or ecx,edi
|
||||||
mov edx,[wndColors + MOS_WNDCOLORS.workText]
|
mov edx,[wndColors.work_text]
|
||||||
int 0x40
|
mcall SF_DRAW_LINE
|
||||||
pop ecx
|
pop ecx
|
||||||
pop edx
|
pop edx
|
||||||
|
|
||||||
@@ -200,21 +180,14 @@ drawClock:
|
|||||||
mul edx
|
mul edx
|
||||||
add eax,ecx
|
add eax,ecx
|
||||||
mov ecx,eax ; save for later
|
mov ecx,eax ; save for later
|
||||||
push ecx
|
; 2*pi/60/60
|
||||||
push eax
|
stdcall getHandCoords,edi,esi,[MINRY],[MINRX],0.001745329,eax,ecx
|
||||||
fpush32 0.001745329 ; 2*pi/60/60
|
|
||||||
push dword [MINRX]
|
|
||||||
push dword [MINRY]
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
call getHandCoords
|
|
||||||
mov eax,MOS_SC_DRAWLINE
|
|
||||||
shl ebx,16
|
shl ebx,16
|
||||||
or ebx,esi
|
or ebx,esi
|
||||||
shl ecx,16
|
shl ecx,16
|
||||||
or ecx,edi
|
or ecx,edi
|
||||||
mov edx,[wndColors + MOS_WNDCOLORS.workText]
|
mov edx,[wndColors.work_text]
|
||||||
int 0x40
|
mcall SF_DRAW_LINE
|
||||||
pop ecx
|
pop ecx
|
||||||
pop edx
|
pop edx
|
||||||
|
|
||||||
@@ -229,55 +202,39 @@ drawClock:
|
|||||||
mov edx,60*60
|
mov edx,60*60
|
||||||
mul edx
|
mul edx
|
||||||
add eax,ecx
|
add eax,ecx
|
||||||
push eax
|
; 2*pi/60/60/12
|
||||||
fpush32 0.000145444 ; 2*pi/60/60/12
|
stdcall getHandCoords,edi,esi,[HOURRY],[HOURRX],0.000145444,eax
|
||||||
push dword [HOURRX]
|
|
||||||
push dword [HOURRY]
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
call getHandCoords
|
|
||||||
mov eax,MOS_SC_DRAWLINE
|
|
||||||
shl ebx,16
|
shl ebx,16
|
||||||
or ebx,esi
|
or ebx,esi
|
||||||
shl ecx,16
|
shl ecx,16
|
||||||
or ecx,edi
|
or ecx,edi
|
||||||
mov edx,[wndColors + MOS_WNDCOLORS.workText]
|
mov edx,[wndColors.work_text]
|
||||||
int 0x40
|
mcall SF_DRAW_LINE
|
||||||
pop edx
|
pop edx
|
||||||
|
|
||||||
; draw tick marks
|
; draw tick marks
|
||||||
mov dword [i],11 ; draw 12 marks
|
mov dword [i],11 ; draw 12 marks
|
||||||
.drawtickmarks:
|
.drawtickmarks:
|
||||||
push dword [i] ; calculate start point
|
; calculate start point
|
||||||
fpush32 0.523598776 ; 2*pi/12
|
; 2*pi/12
|
||||||
push dword [TMR1X]
|
stdcall getHandCoords,edi,esi,[TMR1Y],[TMR1X],0.523598776,[i]
|
||||||
push dword [TMR1Y]
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
call getHandCoords
|
|
||||||
mov eax,ebx ; save in eax and edx
|
mov eax,ebx ; save in eax and edx
|
||||||
mov edx,ecx
|
mov edx,ecx
|
||||||
push dword [i]
|
; 2*pi/12
|
||||||
fpush32 0.523598776 ; 2*pi/12
|
stdcall getHandCoords,edi,esi,[TMR2Y],[TMR2X],0.523598776,[i]
|
||||||
push dword [TMR2X]
|
|
||||||
push dword [TMR2Y]
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
call getHandCoords
|
|
||||||
shl eax,16
|
shl eax,16
|
||||||
shl edx,16
|
shl edx,16
|
||||||
or ebx,eax ; ebx = x start and end
|
or ebx,eax ; ebx = x start and end
|
||||||
or ecx,edx ; ecx = y start and end
|
or ecx,edx ; ecx = y start and end
|
||||||
mov edx,[wndColors + MOS_WNDCOLORS.workText]
|
mov edx,[wndColors.work_text]
|
||||||
mov eax,MOS_SC_DRAWLINE
|
mcall SF_DRAW_LINE
|
||||||
int 0x40
|
|
||||||
dec dword [i]
|
dec dword [i]
|
||||||
jns .drawtickmarks
|
jns .drawtickmarks
|
||||||
|
|
||||||
%define DATE_WIDTH 48
|
DATE_WIDTH =48
|
||||||
|
|
||||||
; calculate text start position
|
; calculate text start position
|
||||||
mov eax,[procInfo+MOS_PROCESSINFO.wndWidth]
|
mov eax,[procInfo.box.width]
|
||||||
sub eax,DATE_WIDTH ; x = (wndwidth-textwidth)/2
|
sub eax,DATE_WIDTH ; x = (wndwidth-textwidth)/2
|
||||||
shr eax,1 ; eax = x
|
shr eax,1 ; eax = x
|
||||||
fild dword [workheight] ; y = DATE_FACTOR*workheight...
|
fild dword [workheight] ; y = DATE_FACTOR*workheight...
|
||||||
@@ -292,7 +249,7 @@ drawClock:
|
|||||||
jb .goodbye
|
jb .goodbye
|
||||||
mov ecx,ebx ; text too high ?
|
mov ecx,ebx ; text too high ?
|
||||||
add ecx,10-1
|
add ecx,10-1
|
||||||
mov edx,[procInfo+MOS_PROCESSINFO.wndHeight]
|
mov edx,[procInfo.box.height]
|
||||||
sub edx,MOS_WND_SKIN_BORDER_BOTTOM
|
sub edx,MOS_WND_SKIN_BORDER_BOTTOM
|
||||||
cmp ecx,edx
|
cmp ecx,edx
|
||||||
jnae .yousuck
|
jnae .yousuck
|
||||||
@@ -306,8 +263,7 @@ drawClock:
|
|||||||
or ebx,eax
|
or ebx,eax
|
||||||
|
|
||||||
; get date (edi)
|
; get date (edi)
|
||||||
mov eax,MOS_SC_GETDATE
|
mcall SF_GET_SYS_DATE
|
||||||
int 0x40
|
|
||||||
mov edi,eax
|
mov edi,eax
|
||||||
|
|
||||||
; display month
|
; display month
|
||||||
@@ -315,44 +271,41 @@ drawClock:
|
|||||||
shr eax,8
|
shr eax,8
|
||||||
call bcdbin
|
call bcdbin
|
||||||
; ebx contains already position
|
; ebx contains already position
|
||||||
mov ecx,[wndColors+MOS_WNDCOLORS.workText]
|
mov ecx,[wndColors.work_text]
|
||||||
lea edx,[monthNames-3+eax*2+eax]; -3 because eax = 1..12 =]
|
lea edx,[monthNames-3+eax*2+eax]; -3 because eax = 1..12 =]
|
||||||
mov esi,3 ; text length
|
mov esi,3 ; text length
|
||||||
mov eax,MOS_SC_WRITETEXT
|
mcall SF_DRAW_TEXT
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; display date
|
; display date
|
||||||
add ebx,MOS_DWORD(3*6+3,0)
|
add ebx,(3*6+3) shl 16
|
||||||
mov eax,edi ; get date
|
mov eax,edi ; get date
|
||||||
shr eax,16
|
shr eax,16
|
||||||
call bcdbin
|
call bcdbin
|
||||||
mov edx,ebx ; position must be in edx
|
mov edx,ebx ; position must be in edx
|
||||||
mov ebx,0x00020000 ; number, display two digits
|
mov ebx,0x00020000 ; number, display two digits
|
||||||
mov ecx,eax ; number to display
|
mov ecx,eax ; number to display
|
||||||
mov esi,[wndColors+MOS_WNDCOLORS.workText]
|
mov esi,[wndColors.work_text]
|
||||||
mov eax,MOS_SC_WRITENUMBER
|
mcall SF_DRAW_NUMBER
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; display year. the way we avoid the y2k bug is even
|
; display year. the way we avoid the y2k bug is even
|
||||||
; simpler, yet much better than in the last version:
|
; simpler, yet much better than in the last version:
|
||||||
; now we simply display the last two digits and let the
|
; now we simply display the last two digits and let the
|
||||||
; user decide wether it's the year 1903 or 2003 =]
|
; user decide wether it's the year 1903 or 2003 =]
|
||||||
add edx,MOS_DWORD(2*6+3,0)
|
add edx,(2*6+3) shl 16
|
||||||
mov eax,edi ; get year
|
mov eax,edi ; get year
|
||||||
call bcdbin
|
call bcdbin
|
||||||
mov ebx,0x00020000 ; number, display two digits
|
mov ebx,0x00020000 ; number, display two digits
|
||||||
mov ecx,eax ; number to display
|
mov ecx,eax ; number to display
|
||||||
; edx contains already position
|
; edx contains already position
|
||||||
mov esi,[wndColors+MOS_WNDCOLORS.workText]
|
mov esi,[wndColors.work_text]
|
||||||
mov eax,MOS_SC_WRITENUMBER
|
mcall SF_DRAW_NUMBER
|
||||||
int 0x40
|
|
||||||
|
|
||||||
.byebye:
|
.byebye:
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
leave
|
;leave
|
||||||
ret
|
ret
|
||||||
%pop
|
endp
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
@@ -397,36 +350,26 @@ bcdbin:
|
|||||||
; destroys:
|
; destroys:
|
||||||
; nothing
|
; nothing
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
getHandCoords:
|
proc getHandCoords CENTERY:dword, CENTERX:dword, RADIUSY:dword, RADIUSX:dword, DEG2RAD:dword, ANGLE:dword
|
||||||
|
|
||||||
ANGLE equ 28
|
|
||||||
DEG2RAD equ 24
|
|
||||||
RADIUSX equ 20
|
|
||||||
RADIUSY equ 16
|
|
||||||
CENTERX equ 12
|
|
||||||
CENTERY equ 8
|
|
||||||
|
|
||||||
enter 0,0
|
|
||||||
pushfd
|
pushfd
|
||||||
|
|
||||||
fild dword [ebp+ANGLE] ; get angle
|
fild dword [ANGLE] ; get angle
|
||||||
fmul dword [ebp+DEG2RAD] ; convert to radians
|
fmul dword [DEG2RAD] ; convert to radians
|
||||||
fsincos
|
fsincos
|
||||||
fmul dword [ebp+RADIUSY] ; -y * radius + clockcy
|
fmul dword [RADIUSY] ; -y * radius + clockcy
|
||||||
fchs
|
fchs
|
||||||
fiadd dword [ebp+CENTERY]
|
fiadd dword [CENTERY]
|
||||||
fistp dword [ebp+CENTERY]
|
fistp dword [CENTERY]
|
||||||
fmul dword [ebp+RADIUSX] ; x * radius + clockcx
|
fmul dword [RADIUSX] ; x * radius + clockcx
|
||||||
fiadd dword [ebp+CENTERX]
|
fiadd dword [CENTERX]
|
||||||
fistp dword [ebp+CENTERX]
|
fistp dword [CENTERX]
|
||||||
|
|
||||||
mov ebx,[ebp+CENTERX]
|
mov ebx,[CENTERX]
|
||||||
mov ecx,[ebp+CENTERY]
|
mov ecx,[CENTERY]
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
leave
|
;leave
|
||||||
ret 4*6
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
@@ -1,5 +1,3 @@
|
|||||||
; some strtok-like function
|
|
||||||
;
|
|
||||||
; Copyright (c) 2003 Thomas Mathys
|
; Copyright (c) 2003 Thomas Mathys
|
||||||
; killer@vantage.ch
|
; killer@vantage.ch
|
||||||
;
|
;
|
||||||
@@ -17,8 +15,94 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
;
|
;
|
||||||
%ifndef _STRTOK_INC
|
|
||||||
%define _STRTOK_INC
|
|
||||||
|
;********************************************************************
|
||||||
|
; returns the length of an asciiz string
|
||||||
|
; input : esi = pointer to string
|
||||||
|
; output : eax = string length
|
||||||
|
; destroys : nothing
|
||||||
|
;********************************************************************
|
||||||
|
strlen:
|
||||||
|
push ecx edi
|
||||||
|
pushfd
|
||||||
|
cld ; !
|
||||||
|
mov ecx,-1
|
||||||
|
mov edi,esi ; find terminating zero
|
||||||
|
xor al,al
|
||||||
|
repne scasb
|
||||||
|
mov eax,edi ; calculate string length
|
||||||
|
sub eax,esi
|
||||||
|
dec eax
|
||||||
|
popfd
|
||||||
|
pop edi ecx
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;********************************************************************
|
||||||
|
; converts an asciiz string into an unsigned doubleword.
|
||||||
|
; (base 10 is assumed)
|
||||||
|
;
|
||||||
|
; - first, leading whitespaces are skipped
|
||||||
|
; - then the function converts the string, until it
|
||||||
|
; finds the terminating zero, another character it
|
||||||
|
; cannot convert or the number becomes too large.
|
||||||
|
;
|
||||||
|
; input : esi = pointer to string
|
||||||
|
; output : eax = unsigned doubleword
|
||||||
|
; the function tries to convert as
|
||||||
|
; many digits as possible, before it
|
||||||
|
; stops. if the value of the dword
|
||||||
|
; becomes too large, 0xffffffff is
|
||||||
|
; returned.
|
||||||
|
; destroys : nothing
|
||||||
|
;********************************************************************
|
||||||
|
string2dword:
|
||||||
|
push ebx ecx edx esi
|
||||||
|
pushfd
|
||||||
|
|
||||||
|
xor ebx,ebx ; ebx : dword
|
||||||
|
|
||||||
|
; skip leading whitespaces
|
||||||
|
.skipspaces:
|
||||||
|
lodsb
|
||||||
|
cmp al,32 ; space
|
||||||
|
je .skipspaces
|
||||||
|
cmp al,12 ; ff
|
||||||
|
je .skipspaces
|
||||||
|
cmp al,10 ; lf
|
||||||
|
je .skipspaces
|
||||||
|
cmp al,13 ; cr
|
||||||
|
je .skipspaces
|
||||||
|
cmp al,9 ; ht
|
||||||
|
je .skipspaces
|
||||||
|
cmp al,11 ; vt
|
||||||
|
je .skipspaces
|
||||||
|
|
||||||
|
; convert string
|
||||||
|
dec esi ; esi -> 1st non-whitespace
|
||||||
|
.convert:
|
||||||
|
xor eax,eax ; get character
|
||||||
|
lodsb
|
||||||
|
sub al,'0' ; convert to digit
|
||||||
|
cmp al,9 ; is digit in range [0,9] ?
|
||||||
|
ja .done ; nope -> stop conversion
|
||||||
|
mov ecx,eax ; save new digit
|
||||||
|
mov eax,10 ; dword = dword * 10
|
||||||
|
mul ebx
|
||||||
|
jc .overflow
|
||||||
|
add eax,ecx ; + new digit
|
||||||
|
jc .overflow
|
||||||
|
mov ebx,eax
|
||||||
|
jmp .convert
|
||||||
|
|
||||||
|
.overflow:
|
||||||
|
mov ebx,0xffffffff
|
||||||
|
.done:
|
||||||
|
mov eax,ebx
|
||||||
|
popfd
|
||||||
|
pop esi edx ecx ebx
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
;********************************************************************
|
||||||
@@ -121,5 +205,3 @@ strtok:
|
|||||||
ret
|
ret
|
||||||
.adx dd 0
|
.adx dd 0
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
|
||||||
tup.rule("aclock.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "aclock")
|
|
@@ -1,3 +0,0 @@
|
|||||||
@rem nasm -t -f bin -o aclock -l aclock.lst aclock.asm -DDEBUG
|
|
||||||
nasmw -t -f bin -o aclock aclock.asm
|
|
||||||
@pause
|
|
@@ -1,334 +0,0 @@
|
|||||||
; mos.inc 0.03
|
|
||||||
; Copyright (c) 2002 Thomas Mathys
|
|
||||||
; killer@vantage.ch
|
|
||||||
;
|
|
||||||
; This program is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2 of the License, or
|
|
||||||
; (at your option) any later version.
|
|
||||||
;
|
|
||||||
; This program is distributed in the hope that it will be useful,
|
|
||||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
; GNU General Public License for more details.
|
|
||||||
;
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with this program; if not, write to the Free Software
|
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
;
|
|
||||||
%ifndef _MOS_INC
|
|
||||||
%define _MOS_INC
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; generates a menuetos 01 header
|
|
||||||
; takes 6 parameters:
|
|
||||||
;
|
|
||||||
; MOS_HEADER01 start, end, appmem, esp, i_param, i_icon
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
%macro MOS_HEADER01 6
|
|
||||||
org 0x0
|
|
||||||
db 'MENUET01' ; 8 byte id
|
|
||||||
dd 0x01 ; header version
|
|
||||||
dd %1 ; start of code
|
|
||||||
dd %2 ; image size
|
|
||||||
dd %3 ; application memory
|
|
||||||
dd %4 ; esp
|
|
||||||
dd %5 ; i_param
|
|
||||||
dd %6 ; i_icon
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; MOS_DWORD
|
|
||||||
; packs 2 words into a double word
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
%define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff))
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; MOS_RGB
|
|
||||||
; creates a menuet os compatible color (0x00RRGGBB)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
%define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255))
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; window stuff
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; default window colors
|
|
||||||
struc MOS_WNDCOLORS
|
|
||||||
.frame: resd 1
|
|
||||||
.grab: resd 1
|
|
||||||
.grabButton: resd 1
|
|
||||||
.grabButtonText: resd 1
|
|
||||||
.grabText: resd 1
|
|
||||||
.work: resd 1
|
|
||||||
.workButton: resd 1
|
|
||||||
.workButtonText: resd 1
|
|
||||||
.workText: resd 1
|
|
||||||
.workGraphics: resd 1
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
; skinned window borders
|
|
||||||
MOS_WND_SKIN_BORDER_LEFT equ 5
|
|
||||||
MOS_WND_SKIN_BORDER_RIGHT equ 5
|
|
||||||
MOS_WND_SKIN_BORDER_BOTTOM equ 5
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; process info structure
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
struc MOS_PROCESSINFO
|
|
||||||
.CPUUsage: resd 1
|
|
||||||
.windowStackPos: resw 1
|
|
||||||
.windowStackVal: resw 1
|
|
||||||
.reserved1: resw 1
|
|
||||||
.processName: resb 12
|
|
||||||
.memStart: resd 1
|
|
||||||
.memUsed: resd 1
|
|
||||||
.pid: resd 1
|
|
||||||
.wndXPos resd 1
|
|
||||||
.wndYPos resd 1
|
|
||||||
.wndWidth resd 1
|
|
||||||
.wndHeight resd 1
|
|
||||||
.reserved2: resb (1024 - 50)
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; system call numbers
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_SC_EXIT equ -1
|
|
||||||
MOS_SC_DEFINEWINDOW equ 0
|
|
||||||
MOS_SC_PUTPIXEL equ 1
|
|
||||||
MOS_SC_GETKEY equ 2
|
|
||||||
MOS_SC_GETSYSCLOCK equ 3
|
|
||||||
MOS_SC_WRITETEXT equ 4
|
|
||||||
MOS_SC_DELAY equ 5
|
|
||||||
MOS_SC_OPENFILEFLOPPY equ 6 ; obsolete
|
|
||||||
MOS_SC_PUTIMAGE equ 7
|
|
||||||
MOS_SC_DEFINEBUTTON equ 8
|
|
||||||
MOS_SC_GETPROCESSINFO equ 9
|
|
||||||
MOS_SC_WAITEVENT equ 10
|
|
||||||
MOS_SC_CHECKEVENT equ 11
|
|
||||||
MOS_SC_REDRAWSTATUS equ 12
|
|
||||||
MOS_SC_DRAWBAR equ 13
|
|
||||||
MOS_SC_GETSCREENMAX equ 14
|
|
||||||
MOS_SC_SETBACKGROUND equ 15
|
|
||||||
MOS_SC_GETPRESSEDBUTTON equ 17
|
|
||||||
MOS_SC_SYSTEMSERVICE equ 18
|
|
||||||
MOS_SC_STARTPROGRAM equ 19 ; obsolete
|
|
||||||
MOS_SC_MIDIINTERFACE equ 20
|
|
||||||
MOS_SC_DEVICESETUP equ 21
|
|
||||||
MOS_SC_WAITEVENTTIMEOUT equ 23
|
|
||||||
MOS_SC_CDAUDIO equ 24
|
|
||||||
MOS_SC_SB16MIXER1 equ 25
|
|
||||||
MOS_SC_GETDEVICESETUP equ 26
|
|
||||||
MOS_SC_WSS equ 27
|
|
||||||
MOS_SC_SB16MIXER2 equ 28
|
|
||||||
MOS_SC_GETDATE equ 29
|
|
||||||
MOS_SC_READHD equ 30 ; obsolete
|
|
||||||
MOS_SC_STARTPROGRAMHD equ 31 ; obsolete
|
|
||||||
MOS_SC_DELETEFILEFLOPPY equ 32
|
|
||||||
MOS_SC_SAVEFILERAMDISK equ 33 ; obsolete
|
|
||||||
MOS_SC_READDIRRAMDISK equ 34 ; obsolete
|
|
||||||
MOS_SC_GETSCREENPIXEL equ 35
|
|
||||||
MOS_SC_GETMOUSEPOSITION equ 37
|
|
||||||
MOS_SC_DRAWLINE equ 38
|
|
||||||
MOS_SC_GETBACKGROUND equ 39
|
|
||||||
MOS_SC_SETEVENTMASK equ 40
|
|
||||||
MOS_SC_GETIRQOWNER equ 41
|
|
||||||
MOS_SC_GETDATAREADBYIRQ equ 42
|
|
||||||
MOS_SC_SENDDATATODEVICE equ 43
|
|
||||||
MOS_SC_PROGRAMIRQS equ 44
|
|
||||||
MOS_SC_RESERVEFREEIRQ equ 45
|
|
||||||
MOS_SC_RESERVEFREEPORTS equ 46
|
|
||||||
MOS_SC_WRITENUMBER equ 47
|
|
||||||
MOS_SC_WINDOWPROPERTIES equ 48
|
|
||||||
MOS_SC_SHAPEDWINDOWS equ 50
|
|
||||||
MOS_SC_CREATETHREAD equ 51
|
|
||||||
MOS_SC_STACKDRIVERSTATE equ 52
|
|
||||||
MOS_SC_SOCKETINTERFACE equ 53
|
|
||||||
MOS_SC_SOUNDINTERFACE equ 55
|
|
||||||
MOS_SC_WRITEFILEHD equ 56 ; obsolete
|
|
||||||
MOS_SC_DELETEFILEHD equ 57
|
|
||||||
MOS_SC_SYSTREEACCESS equ 58
|
|
||||||
MOS_SC_SYSCALLTRACE equ 59
|
|
||||||
MOS_SC_IPC equ 60
|
|
||||||
MOS_SC_DIRECTGRAPHICS equ 61
|
|
||||||
MOS_SC_PCI equ 62
|
|
||||||
MOS_SC_DEBUGBOARD equ 63
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; event numbers
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_EVT_NONE equ 0
|
|
||||||
MOS_EVT_REDRAW equ 1
|
|
||||||
MOS_EVT_KEY equ 2
|
|
||||||
MOS_EVT_BUTTON equ 3
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; event bits
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_EVTBIT_REDRAW equ (1 << 0)
|
|
||||||
MOS_EVTBIT_KEY equ (1 << 1)
|
|
||||||
MOS_EVTBIT_BUTTON equ (1 << 2)
|
|
||||||
MOS_EVTBIT_ENDREQUEST equ (1 << 3)
|
|
||||||
MOS_EVTBIT_BGDRAW equ (1 << 4)
|
|
||||||
MOS_EVTBIT_MOUSECHANGE equ (1 << 5)
|
|
||||||
MOS_EVTBIT_IPCEVENT equ (1 << 6)
|
|
||||||
MOS_EVTBIT_IRQ0 equ (1 << 16)
|
|
||||||
MOS_EVTBIT_IRQ1 equ (1 << 17)
|
|
||||||
MOS_EVTBIT_IRQ2 equ (1 << 18)
|
|
||||||
MOS_EVTBIT_IRQ3 equ (1 << 19)
|
|
||||||
MOS_EVTBIT_IRQ4 equ (1 << 20)
|
|
||||||
MOS_EVTBIT_IRQ5 equ (1 << 21)
|
|
||||||
MOS_EVTBIT_IRQ6 equ (1 << 22)
|
|
||||||
MOS_EVTBIT_IRQ7 equ (1 << 23)
|
|
||||||
MOS_EVTBIT_IRQ8 equ (1 << 24)
|
|
||||||
MOS_EVTBIT_IRQ9 equ (1 << 25)
|
|
||||||
MOS_EVTBIT_IRQ10 equ (1 << 26)
|
|
||||||
MOS_EVTBIT_IRQ11 equ (1 << 27)
|
|
||||||
MOS_EVTBIT_IRQ12 equ (1 << 28)
|
|
||||||
MOS_EVTBIT_IRQ13 equ (1 << 29)
|
|
||||||
MOS_EVTBIT_IRQ14 equ (1 << 30)
|
|
||||||
MOS_EVTBIT_IRQ15 equ (1 << 31)
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; exit application (syscall -1)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; exit application
|
|
||||||
%macro MOS_EXIT 0
|
|
||||||
mov eax,MOS_SC_EXIT
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; exit application, smaller version
|
|
||||||
%macro MOS_EXIT_S 0
|
|
||||||
xor eax,eax
|
|
||||||
dec eax
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; wait event stuff
|
|
||||||
; (MOS_SC_WAITEVENT, syscall 10)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; wait for event
|
|
||||||
; destroys : nothing
|
|
||||||
; returns : eax = event type
|
|
||||||
%macro MOS_WAITEVENT 0
|
|
||||||
mov eax,MOS_SC_WAITEVENT
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; wait for event, smaller version
|
|
||||||
; destroys : flags
|
|
||||||
; returns : eax = event type
|
|
||||||
%macro MOS_WAITEVENT_S 0
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_WAITEVENT
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; window redraw status stuff
|
|
||||||
; (MOS_SC_REDRAWSTATUS, syscall 12)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_RS_STARTREDRAW equ 1
|
|
||||||
MOS_RS_ENDREDRAW equ 2
|
|
||||||
|
|
||||||
; start window redraw
|
|
||||||
; destroys: eax,ebx
|
|
||||||
%macro MOS_STARTREDRAW 0
|
|
||||||
mov ebx,MOS_RS_STARTREDRAW
|
|
||||||
mov eax,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; start window redraw, smaller version
|
|
||||||
; destroys: eax,ebx,flags
|
|
||||||
%macro MOS_STARTREDRAW_S 0
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; end window redraw
|
|
||||||
; destroys: eax,ebx
|
|
||||||
%macro MOS_ENDREDRAW 0
|
|
||||||
mov ebx,MOS_RS_ENDREDRAW
|
|
||||||
mov eax,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; end window redraw, smaller version
|
|
||||||
; destroys: eax,ebx,flags
|
|
||||||
%macro MOS_ENDREDRAW_S 0
|
|
||||||
xor ebx,ebx
|
|
||||||
mov bl,MOS_RS_ENDREDRAW
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; get screen max stuff (syscall 14)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; get screen dimensions in eax
|
|
||||||
; destroys: nothing
|
|
||||||
%macro MOS_GETSCREENMAX 0
|
|
||||||
mov eax,MOS_SC_GETSCREENMAX
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; get screen dimensions in eax, smaller version
|
|
||||||
; destroys: flags
|
|
||||||
%macro MOS_GETSCREENMAX_S 0
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_GETSCREENMAX
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
|
||||||
; opcode hacks
|
|
||||||
;********************************************************************
|
|
||||||
|
|
||||||
; nasm refuses to assemble stuff like
|
|
||||||
; push dword 4.44
|
|
||||||
; with the following macro this becomes possible:
|
|
||||||
; fpush32 9.81
|
|
||||||
; don't forget to use a decimal point. things like
|
|
||||||
; fpush32 1
|
|
||||||
; will probably not do what you expect. instead, write:
|
|
||||||
; fpush32 1.0
|
|
||||||
%macro fpush32 1
|
|
||||||
db 0x68 ; push imm32
|
|
||||||
dd %1
|
|
||||||
%endm
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
@@ -1,92 +0,0 @@
|
|||||||
; string2dword - a useless string to double word conversion routine
|
|
||||||
;
|
|
||||||
; Copyright (c) 2003 Thomas Mathys
|
|
||||||
; killer@vantage.ch
|
|
||||||
;
|
|
||||||
; This program is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2 of the License, or
|
|
||||||
; (at your option) any later version.
|
|
||||||
;
|
|
||||||
; This program is distributed in the hope that it will be useful,
|
|
||||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
; GNU General Public License for more details.
|
|
||||||
;
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with this program; if not, write to the Free Software
|
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
|
||||||
; converts an asciiz string into an unsigned doubleword.
|
|
||||||
; (base 10 is assumed)
|
|
||||||
;
|
|
||||||
; - first, leading whitespaces are skipped
|
|
||||||
; - then the function converts the string, until it
|
|
||||||
; finds the terminating zero, another character it
|
|
||||||
; cannot convert or the number becomes too large.
|
|
||||||
;
|
|
||||||
; input : esi = pointer to string
|
|
||||||
; output : eax = unsigned doubleword
|
|
||||||
; the function tries to convert as
|
|
||||||
; many digits as possible, before it
|
|
||||||
; stops. if the value of the dword
|
|
||||||
; becomes too large, 0xffffffff is
|
|
||||||
; returned.
|
|
||||||
; destroys : nothing
|
|
||||||
;********************************************************************
|
|
||||||
string2dword:
|
|
||||||
push ebx
|
|
||||||
push ecx
|
|
||||||
push edx
|
|
||||||
push esi
|
|
||||||
pushfd
|
|
||||||
|
|
||||||
xor ebx,ebx ; ebx : dword
|
|
||||||
|
|
||||||
; skip leading whitespaces
|
|
||||||
.skipspaces:
|
|
||||||
lodsb
|
|
||||||
cmp al,32 ; space
|
|
||||||
je .skipspaces
|
|
||||||
cmp al,12 ; ff
|
|
||||||
je .skipspaces
|
|
||||||
cmp al,10 ; lf
|
|
||||||
je .skipspaces
|
|
||||||
cmp al,13 ; cr
|
|
||||||
je .skipspaces
|
|
||||||
cmp al,9 ; ht
|
|
||||||
je .skipspaces
|
|
||||||
cmp al,11 ; vt
|
|
||||||
je .skipspaces
|
|
||||||
|
|
||||||
; convert string
|
|
||||||
dec esi ; esi -> 1st non-whitespace
|
|
||||||
.convert:
|
|
||||||
xor eax,eax ; get character
|
|
||||||
lodsb
|
|
||||||
sub al,'0' ; convert to digit
|
|
||||||
cmp al,9 ; is digit in range [0,9] ?
|
|
||||||
ja .done ; nope -> stop conversion
|
|
||||||
mov ecx,eax ; save new digit
|
|
||||||
mov eax,10 ; dword = dword * 10
|
|
||||||
mul ebx
|
|
||||||
jc .overflow
|
|
||||||
add eax,ecx ; + new digit
|
|
||||||
jc .overflow
|
|
||||||
mov ebx,eax
|
|
||||||
jmp .convert
|
|
||||||
|
|
||||||
.overflow:
|
|
||||||
mov ebx,0xffffffff
|
|
||||||
.done:
|
|
||||||
mov eax,ebx
|
|
||||||
popfd
|
|
||||||
pop esi
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
ret
|
|
||||||
|
|
@@ -1,49 +0,0 @@
|
|||||||
; strlen function
|
|
||||||
;
|
|
||||||
; Copyright (c) 2003 Thomas Mathys
|
|
||||||
; killer@vantage.ch
|
|
||||||
;
|
|
||||||
; This program is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2 of the License, or
|
|
||||||
; (at your option) any later version.
|
|
||||||
;
|
|
||||||
; This program is distributed in the hope that it will be useful,
|
|
||||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
; GNU General Public License for more details.
|
|
||||||
;
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with this program; if not, write to the Free Software
|
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
;
|
|
||||||
%ifndef _STRLEN_INC
|
|
||||||
%define _STRLEN_INC
|
|
||||||
|
|
||||||
|
|
||||||
;********************************************************************
|
|
||||||
; returns the length of an asciiz string
|
|
||||||
; input : esi = pointer to string
|
|
||||||
; output : eax = string length
|
|
||||||
; destroys : nothing
|
|
||||||
;********************************************************************
|
|
||||||
strlen:
|
|
||||||
push ecx
|
|
||||||
push edi
|
|
||||||
pushfd
|
|
||||||
cld ; !
|
|
||||||
mov ecx,-1
|
|
||||||
mov edi,esi ; find terminating zero
|
|
||||||
xor al,al
|
|
||||||
repne scasb
|
|
||||||
mov eax,edi ; calculate string length
|
|
||||||
sub eax,esi
|
|
||||||
dec eax
|
|
||||||
popfd
|
|
||||||
pop edi
|
|
||||||
pop ecx
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
@@ -1,2 +1,4 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
tup.rule("mstate.asm", "nasm -t -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "mstate")
|
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||||
|
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||||
|
tup.rule("mstate.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o " .. tup.getconfig("KPACK_CMD"), "mstate")
|
||||||
|
3
programs/develop/mstate/build.bat
Normal file
3
programs/develop/mstate/build.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@fasm.exe -m 16384 mstate.asm mstate.kex
|
||||||
|
@kpack mstate.kex
|
||||||
|
pause
|
@@ -1 +0,0 @@
|
|||||||
nasm -f bin mstate.asm -o mstate
|
|
@@ -1,246 +1,227 @@
|
|||||||
; This program shows state of mouse buttons ;
|
; SPDX-License-Identifier: GPL-2.0-only
|
||||||
; to compile: nasm -f bin mstate.asm -o mstate ;
|
; SPDX-FileCopyrightText: 2024 KolibriOS-NG Team
|
||||||
ORG 0
|
|
||||||
BITS 32
|
format binary as ""
|
||||||
; ---------------------------------------------------------------------------- ;
|
use32
|
||||||
PATH_SIZE equ 256
|
org 0
|
||||||
PARAMS_SIZE equ 256
|
db 'MENUET01' ; signature
|
||||||
STACK_SIZE equ 256
|
dd 1 ; header version
|
||||||
; ---------------------------------------------------------------------------- ;
|
dd start ; entry point
|
||||||
TEXT_WIDTH equ 6
|
dd _image_end ; end of image
|
||||||
TEXT_HEIGHT equ 9
|
dd _memory ; required memory size
|
||||||
; ---------------------------------------------------------------------------- ;
|
dd _stacktop ; address of stack top
|
||||||
MOUSE_LEFT_BUTTON_MASK equ 1b
|
dd 0 ; buffer for command line arguments
|
||||||
MOUSE_RIGHT_BUTTON_MASK equ 10b
|
dd 0 ; buffer for path
|
||||||
MOUSE_MIDDLE_BUTTON_MASK equ 100b
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
include '../../macros.inc'
|
||||||
EM_REDRAW equ 1b
|
include '../../KOSfuncs.inc'
|
||||||
EM_KEY equ 10b
|
|
||||||
EM_BUTTON equ 100b
|
TEXT_WIDTH = 8
|
||||||
EM_RESERVED0 equ 1000b
|
TEXT_HEIGHT = 16
|
||||||
EM_REDRAW_BACKGROUND equ 10000b
|
|
||||||
EM_MOUSE equ 100000b
|
MOUSE_LEFT_BUTTON_MASK = 1b
|
||||||
EM_IPC equ 1000000b
|
MOUSE_RIGHT_BUTTON_MASK = 10b
|
||||||
EM_NETWORK equ 10000000b
|
MOUSE_MIDDLE_BUTTON_MASK = 100b
|
||||||
EM_DEBUG equ 100000000b
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
WINDOW_STYLE_SKINNED_FIXED = 0x4000000
|
||||||
WINDOW_STYLE_SKINNED_FIXED equ 0x4000000
|
WINDOW_STYLE_COORD_CLIENT = 0x20000000
|
||||||
WINDOW_STYLE_COORD_CLIENT equ 0x20000000
|
WINDOW_STYLE_CAPTION = 0x10000000
|
||||||
WINDOW_STYLE_CAPTION equ 0x10000000
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
WINDOW_BORDER_SIZE = 5
|
||||||
WINDOW_BORDER_SIZE equ 5
|
WINDOW_STYLE = (WINDOW_STYLE_SKINNED_FIXED or WINDOW_STYLE_COORD_CLIENT or WINDOW_STYLE_CAPTION)
|
||||||
; ---------------------------------------------------------------------------- ;
|
|
||||||
WINDOW_STYLE equ WINDOW_STYLE_SKINNED_FIXED | WINDOW_STYLE_COORD_CLIENT | WINDOW_STYLE_CAPTION
|
MOUSE_BODY_COLOR = 0x007C7C96
|
||||||
; ---------------------------------------------------------------------------- ;
|
MOUSE_LEFT_BUTTON_COLOR = 0x008293A4
|
||||||
MOUSE_BODY_COLOR equ 0x007C7C96
|
MOUSE_RIGHT_BUTTON_COLOR = 0x008293A4
|
||||||
MOUSE_LEFT_BUTTON_COLOR equ 0x008293A4
|
MOUSE_MIDDLE_BUTTON_COLOR = 0x00A48293
|
||||||
MOUSE_RIGHT_BUTTON_COLOR equ 0x008293A4
|
MOUSE_LEFT_BUTTON_PRESSED_COLOR = 0x00568EC7
|
||||||
MOUSE_MIDDLE_BUTTON_COLOR equ 0x00A48293
|
MOUSE_RIGHT_BUTTON_PRESSED_COLOR = 0x00568EC7
|
||||||
MOUSE_LEFT_BUTTON_PRESSED_COLOR equ 0x00568EC7
|
MOUSE_MIDDLE_BUTTON_PRESSED_COLOR = 0x00C7568E
|
||||||
MOUSE_RIGHT_BUTTON_PRESSED_COLOR equ 0x00568EC7
|
WINDOW_BACK_COLOR = 0x00EFEFEF
|
||||||
MOUSE_MIDDLE_BUTTON_PRESSED_COLOR equ 0x00C7568E
|
|
||||||
WINDOW_BACK_COLOR equ 0x00EFEFEF
|
MOUSE_WIDTH = 180
|
||||||
; ---------------------------------------------------------------------------- ;
|
MOUSE_HEIGHT = 240
|
||||||
MOUSE_WIDTH equ 120
|
MOUSE_MARGIN = 4
|
||||||
MOUSE_HEIGHT equ 240
|
BUTTONS_MARGIN = 2
|
||||||
MOUSE_MARGIN equ 4
|
|
||||||
BUTTONS_MARGIN equ 2
|
MOUSE_LEFT = MOUSE_MARGIN
|
||||||
; ---------------------------------------------------------------------------- ;
|
MOUSE_TOP = MOUSE_MARGIN
|
||||||
MOUSE_LEFT equ MOUSE_MARGIN
|
WINDOW_WIDTH = MOUSE_WIDTH + WINDOW_BORDER_SIZE * 2 + MOUSE_MARGIN * 2
|
||||||
MOUSE_TOP equ MOUSE_MARGIN
|
MOUSE_BODY_HEIGHT = (MOUSE_HEIGHT - BUTTONS_MARGIN) / 2
|
||||||
WINDOW_WIDTH equ MOUSE_WIDTH + WINDOW_BORDER_SIZE * 2 + MOUSE_MARGIN * 2
|
MOUSE_BODY_TOP = MOUSE_HEIGHT - MOUSE_BODY_HEIGHT + MOUSE_TOP
|
||||||
MOUSE_BODY_HEIGHT equ (MOUSE_HEIGHT - BUTTONS_MARGIN) / 2
|
LEFT_BUTTON_HEIGHT = MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
|
||||||
MOUSE_BODY_TOP equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT + MOUSE_TOP
|
RIGHT_BUTTON_HEIGHT = MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
|
||||||
LEFT_BUTTON_HEIGHT equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
|
LEFT_BUTTON_WIDTH = (MOUSE_WIDTH - BUTTONS_MARGIN) / 2
|
||||||
RIGHT_BUTTON_HEIGHT equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
|
RIGHT_BUTTON_WIDTH = MOUSE_WIDTH - LEFT_BUTTON_WIDTH - BUTTONS_MARGIN
|
||||||
LEFT_BUTTON_WIDTH equ (MOUSE_WIDTH - BUTTONS_MARGIN) / 2
|
LEFT_BUTTON_LEFT = MOUSE_LEFT
|
||||||
RIGHT_BUTTON_WIDTH equ MOUSE_WIDTH - LEFT_BUTTON_WIDTH - BUTTONS_MARGIN
|
RIGHT_BUTTON_LEFT = LEFT_BUTTON_LEFT + LEFT_BUTTON_WIDTH + BUTTONS_MARGIN
|
||||||
LEFT_BUTTON_LEFT equ MOUSE_LEFT
|
MIDDLE_BUTTON_WIDTH = MOUSE_WIDTH / 10
|
||||||
RIGHT_BUTTON_LEFT equ LEFT_BUTTON_LEFT + LEFT_BUTTON_WIDTH + BUTTONS_MARGIN
|
MIDDLE_BUTTON_HEIGHT = MOUSE_HEIGHT / 6
|
||||||
MIDDLE_BUTTON_WIDTH equ MOUSE_WIDTH / 10
|
MIDDLE_BUTTON_LEFT = (MOUSE_WIDTH - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_LEFT
|
||||||
MIDDLE_BUTTON_HEIGHT equ MOUSE_HEIGHT / 6
|
MIDDLE_BUTTON_TOP = (MOUSE_WIDTH / 2 - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_TOP
|
||||||
MIDDLE_BUTTON_LEFT equ (MOUSE_WIDTH - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_LEFT
|
|
||||||
MIDDLE_BUTTON_TOP equ (MOUSE_WIDTH / 2 - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_TOP
|
; data:
|
||||||
; ---------------------------------------------------------------------------- ;
|
mouse_left_button_color dd MOUSE_LEFT_BUTTON_COLOR
|
||||||
%define SZ_BUTTONS_STATE "Buttons state:"
|
mouse_right_button_color dd MOUSE_RIGHT_BUTTON_COLOR
|
||||||
%define SZ_BIN "bin:"
|
mouse_middle_button_color dd MOUSE_MIDDLE_BUTTON_COLOR
|
||||||
%define SZ_HEX "hex:0x"
|
|
||||||
%strlen LEN_SZ_BUTTONS_STATE SZ_BUTTONS_STATE
|
mouse_button dd 0
|
||||||
%strlen LEN_SZ_BIN SZ_BIN
|
sz_caption db "MouseState", 0
|
||||||
%strlen LEN_SZ_HEX SZ_HEX
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
sz_button_state db "Buttons state:", 0
|
||||||
STATE_VALUES_HEIGHT equ 3 * TEXT_HEIGHT ; we have three lines of text
|
STATE_VALUES_WIDTH = ($ - sz_button_state - 1)*TEXT_WIDTH
|
||||||
STATE_VALUES_WIDTH equ LEN_SZ_BUTTONS_STATE * TEXT_WIDTH
|
sz_bin db "bin: ", 0
|
||||||
STATE_VALUES_TOP equ (MOUSE_BODY_HEIGHT - STATE_VALUES_HEIGHT) / 2 + MOUSE_BODY_TOP
|
LEN_SZ_BIN = $ - sz_bin - 1
|
||||||
STATE_VALUES_LEFT equ (MOUSE_WIDTH - STATE_VALUES_WIDTH) / 2 + MOUSE_LEFT
|
sz_hex db "hex: 0x", 0
|
||||||
; ---------------------------------------------------------------------------- ;
|
LEN_SZ_HEX = $ - sz_hex - 1
|
||||||
MENUET01 db 'MENUET01'
|
|
||||||
version dd 1
|
STATE_VALUES_HEIGHT = 3*TEXT_HEIGHT ; we have three lines of text
|
||||||
program.start dd START
|
STATE_VALUES_TOP = ((MOUSE_BODY_HEIGHT - STATE_VALUES_HEIGHT) / 2 + MOUSE_BODY_TOP)
|
||||||
program.end dd _END
|
STATE_VALUES_LEFT = ((MOUSE_WIDTH - STATE_VALUES_WIDTH) / 2 + MOUSE_LEFT)
|
||||||
program.memory dd _END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
|
|
||||||
program.stack dd _END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
|
|
||||||
program.params dd _END + PATH_SIZE
|
|
||||||
program.path dd _END
|
align 4
|
||||||
; ---------------------------------------------------------------------------- ;
|
draw_mouse_buttons:
|
||||||
mouse_body_color dd MOUSE_BODY_COLOR
|
mov eax, SF_DRAW_RECT
|
||||||
mouse_left_button_color dd MOUSE_LEFT_BUTTON_COLOR
|
|
||||||
mouse_right_button_color dd MOUSE_RIGHT_BUTTON_COLOR
|
mov ebx, (LEFT_BUTTON_LEFT shl 16) or LEFT_BUTTON_WIDTH
|
||||||
mouse_middle_button_color dd MOUSE_MIDDLE_BUTTON_COLOR
|
mov ecx, (MOUSE_TOP shl 16) or LEFT_BUTTON_HEIGHT
|
||||||
; ---------------------------------------------------------------------------- ;
|
mov edx, [mouse_left_button_color]
|
||||||
mouse.button dd 0
|
mcall
|
||||||
; ---------------------------------------------------------------------------- ;
|
|
||||||
sz_caption db "MouseState",0
|
mov ebx, (RIGHT_BUTTON_LEFT shl 16) or RIGHT_BUTTON_WIDTH
|
||||||
; ---------------------------------------------------------------------------- ;
|
mov ecx, (MOUSE_TOP shl 16) or RIGHT_BUTTON_HEIGHT
|
||||||
sz_button_state db SZ_BUTTONS_STATE,0
|
mov edx, [mouse_right_button_color]
|
||||||
sz_bin db SZ_BIN,0
|
mcall
|
||||||
sz_hex db SZ_HEX,0
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
mov ebx, (MIDDLE_BUTTON_LEFT shl 16) or MIDDLE_BUTTON_WIDTH
|
||||||
%macro DrawMouseBody 0
|
mov ecx, (MIDDLE_BUTTON_TOP shl 16) or MIDDLE_BUTTON_HEIGHT
|
||||||
; draw.rectangle
|
mov edx, [mouse_middle_button_color]
|
||||||
mov eax, 13
|
mcall
|
||||||
mov ebx, MOUSE_LEFT << 16 | MOUSE_WIDTH
|
; draw state values
|
||||||
mov ecx, MOUSE_BODY_TOP << 16 | MOUSE_BODY_HEIGHT
|
mov eax, SF_DRAW_NUMBER
|
||||||
mov edx, [mouse_body_color]
|
mov esi, (0101b shl 28) or WINDOW_BACK_COLOR
|
||||||
int 64
|
mov ecx, [mouse_button]
|
||||||
; texts
|
mov edi, MOUSE_BODY_COLOR
|
||||||
mov eax, 4
|
|
||||||
mov ecx, 1100b << 28 | WINDOW_BACK_COLOR
|
mov ebx, (10 shl 16) or (2 shl 8) ; 10 digits, base2
|
||||||
mov edi, [mouse_body_color]
|
mov edx, ((LEN_SZ_BIN * TEXT_WIDTH + STATE_VALUES_LEFT) shl 16) or (STATE_VALUES_TOP + TEXT_HEIGHT)
|
||||||
; draw.text
|
mcall
|
||||||
mov ebx, (STATE_VALUES_LEFT << 16) | STATE_VALUES_TOP
|
|
||||||
mov edx, sz_button_state
|
mov ebx, (8 shl 16) or (1 shl 8) ; 8 digits, base16
|
||||||
int 64
|
mov edx, ((LEN_SZ_HEX * TEXT_WIDTH + STATE_VALUES_LEFT) shl 16) or (STATE_VALUES_TOP + TEXT_HEIGHT * 2)
|
||||||
; draw.text
|
mcall
|
||||||
add ebx, TEXT_HEIGHT
|
ret
|
||||||
mov edx, sz_bin
|
|
||||||
int 64
|
|
||||||
; draw.text
|
align 4
|
||||||
add ebx, TEXT_HEIGHT
|
start:
|
||||||
mov edx, sz_hex
|
mcall SF_GET_GRAPHICAL_PARAMS, SSF_SCREEN_SIZE
|
||||||
int 64
|
mov edx, eax
|
||||||
%endmacro
|
movzx ecx, ax
|
||||||
; ---------------------------------------------------------------------------- ;
|
shr edx, 16
|
||||||
align 4
|
|
||||||
DrawMouseButtons:
|
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
|
||||||
mov eax, 13
|
add eax, MOUSE_HEIGHT + WINDOW_BORDER_SIZE + MOUSE_MARGIN * 2 - 1
|
||||||
; draw.rectangle
|
mov esi, eax
|
||||||
mov ebx, LEFT_BUTTON_LEFT << 16 | LEFT_BUTTON_WIDTH
|
sub edx, (WINDOW_WIDTH - 1)
|
||||||
mov ecx, MOUSE_TOP << 16 | LEFT_BUTTON_HEIGHT
|
sub ecx, eax
|
||||||
mov edx, [mouse_left_button_color]
|
shr edx, 1
|
||||||
int 64
|
shr ecx, 1
|
||||||
; draw.rectangle
|
|
||||||
mov ebx, RIGHT_BUTTON_LEFT << 16 | RIGHT_BUTTON_WIDTH
|
mov eax, SF_SET_EVENTS_MASK
|
||||||
mov ecx, MOUSE_TOP << 16 | RIGHT_BUTTON_HEIGHT
|
mov ebx, EVM_REDRAW or EVM_BUTTON or EVM_MOUSE
|
||||||
mov edx, [mouse_right_button_color]
|
mcall
|
||||||
int 64
|
|
||||||
; draw.rectangle
|
|
||||||
mov ebx, MIDDLE_BUTTON_LEFT << 16 | MIDDLE_BUTTON_WIDTH
|
align 4
|
||||||
mov ecx, MIDDLE_BUTTON_TOP << 16 | MIDDLE_BUTTON_HEIGHT
|
on_redraw:
|
||||||
mov edx, [mouse_middle_button_color]
|
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||||
int 64
|
xor eax, eax ; SF_CREATE_WINDOW
|
||||||
; Draw State Values
|
mov ebx, edx ; window.left
|
||||||
mov eax, 47
|
; ecx = window.top
|
||||||
mov esi, 0100b << 28 | WINDOW_BACK_COLOR
|
shl ebx, 16
|
||||||
mov ecx, [mouse.button]
|
shl ecx, 16
|
||||||
mov edi, [mouse_body_color]
|
or ebx, (WINDOW_WIDTH - 1)
|
||||||
; draw.number
|
or ecx, esi ; window.height
|
||||||
mov ebx, (10 << 16) | (2 << 8) ; 10 digits, base2
|
mov edx, WINDOW_STYLE or WINDOW_BACK_COLOR
|
||||||
mov edx, (LEN_SZ_BIN * TEXT_WIDTH + STATE_VALUES_LEFT) << 16 | (STATE_VALUES_TOP + TEXT_HEIGHT)
|
mov edi, sz_caption
|
||||||
int 64
|
xor esi, esi
|
||||||
; draw.number
|
mcall
|
||||||
mov ebx, (8 << 16) | (1 << 8) ; 8 digits, base16
|
|
||||||
mov edx, (LEN_SZ_HEX * TEXT_WIDTH + STATE_VALUES_LEFT) << 16 | (STATE_VALUES_TOP + TEXT_HEIGHT * 2)
|
mcall SF_REDRAW, SSF_END_DRAW
|
||||||
int 64
|
; draw mouse body:
|
||||||
ret
|
mov eax, SF_DRAW_RECT
|
||||||
; ---------------------------------------------------------------------------- ;
|
mov ebx, (MOUSE_LEFT shl 16) or MOUSE_WIDTH
|
||||||
align 4
|
mov ecx, (MOUSE_BODY_TOP shl 16) or MOUSE_BODY_HEIGHT
|
||||||
START:
|
mov edx, MOUSE_BODY_COLOR
|
||||||
; get.screen.size
|
mcall
|
||||||
mov eax, 61
|
|
||||||
mov ebx, 1
|
mov eax, SF_DRAW_TEXT
|
||||||
int 64
|
mov ecx, (1101b shl 28) or WINDOW_BACK_COLOR
|
||||||
mov edx, eax
|
mov edi, MOUSE_BODY_COLOR
|
||||||
movzx ecx, ax
|
|
||||||
shr edx, 16
|
mov ebx, (STATE_VALUES_LEFT shl 16) or STATE_VALUES_TOP
|
||||||
; skin.height
|
mov edx, sz_button_state
|
||||||
mov eax, 48
|
mcall
|
||||||
mov ebx, 4
|
|
||||||
int 64
|
add ebx, TEXT_HEIGHT
|
||||||
add eax, MOUSE_HEIGHT + WINDOW_BORDER_SIZE + MOUSE_MARGIN * 2 - 1
|
mov edx, sz_bin
|
||||||
mov esi, eax
|
mcall
|
||||||
sub edx, (WINDOW_WIDTH - 1)
|
|
||||||
sub ecx, eax
|
add ebx, TEXT_HEIGHT
|
||||||
shr edx, 1
|
mov edx, sz_hex
|
||||||
shr ecx, 1
|
mcall
|
||||||
; set.event
|
call draw_mouse_buttons
|
||||||
mov eax, 40
|
|
||||||
mov ebx, EM_REDRAW | EM_BUTTON | EM_MOUSE
|
|
||||||
int 64
|
align 4
|
||||||
; ---------------------------------------------------------------------------- ;
|
wait_event:
|
||||||
align 4
|
mcall SF_WAIT_EVENT
|
||||||
on_redraw:
|
cmp eax, EV_REDRAW
|
||||||
; redraw.start
|
je on_redraw
|
||||||
mov eax, 12
|
cmp eax, EV_BUTTON
|
||||||
mov ebx, 1
|
je on_button
|
||||||
int 64
|
; otherwise mouse:
|
||||||
; draw.window
|
|
||||||
xor eax, eax
|
mcall SF_MOUSE_GET, SSF_BUTTON
|
||||||
mov ebx, edx ; window.left
|
cmp [mouse_button], eax ; if equal, then no need update
|
||||||
; ecx = window.top
|
je wait_event
|
||||||
shl ebx, 16
|
mov ebx, dword MOUSE_LEFT_BUTTON_COLOR
|
||||||
shl ecx, 16
|
mov ecx, dword MOUSE_RIGHT_BUTTON_COLOR
|
||||||
or ebx, (WINDOW_WIDTH - 1)
|
mov edx, dword MOUSE_MIDDLE_BUTTON_COLOR
|
||||||
or ecx, esi ; window.height
|
.left:
|
||||||
mov edx, WINDOW_STYLE | WINDOW_BACK_COLOR
|
test eax, MOUSE_LEFT_BUTTON_MASK
|
||||||
mov edi, sz_caption
|
jz .right
|
||||||
xor esi, esi
|
mov ebx, dword MOUSE_LEFT_BUTTON_PRESSED_COLOR
|
||||||
int 64
|
.right:
|
||||||
; redraw.finish
|
test eax, MOUSE_RIGHT_BUTTON_MASK
|
||||||
mov eax, 12
|
jz .middle
|
||||||
mov ebx, 2
|
mov ecx, dword MOUSE_RIGHT_BUTTON_PRESSED_COLOR
|
||||||
int 64
|
.middle:
|
||||||
DrawMouseBody
|
test eax, MOUSE_MIDDLE_BUTTON_MASK
|
||||||
call DrawMouseButtons
|
jz .other
|
||||||
align 4
|
mov edx, dword MOUSE_MIDDLE_BUTTON_PRESSED_COLOR
|
||||||
wait.event:
|
.other:
|
||||||
mov eax, 10 ; redraw = 001b; 001b & 110b = 000b
|
mov [mouse_left_button_color], ebx
|
||||||
int 64 ; button = 011b; 011b & 110b = 010b
|
mov [mouse_right_button_color], ecx
|
||||||
test eax, 110b ; mouse = 110b; 110b & 110b = 110b
|
mov [mouse_middle_button_color], edx
|
||||||
jz on_redraw
|
mov [mouse_button], eax
|
||||||
jnp on_button
|
call draw_mouse_buttons
|
||||||
; get.mouse.button
|
jmp wait_event
|
||||||
mov eax, 37
|
|
||||||
mov ebx, 2
|
align 4
|
||||||
int 64
|
on_button:
|
||||||
cmp [mouse.button], eax ; if equal
|
; terminate because we have only one button (close)
|
||||||
je wait.event ; then no need update
|
mcall SF_TERMINATE_PROCESS
|
||||||
mov ebx, dword MOUSE_LEFT_BUTTON_COLOR
|
|
||||||
mov ecx, dword MOUSE_RIGHT_BUTTON_COLOR
|
align 16
|
||||||
mov edx, dword MOUSE_MIDDLE_BUTTON_COLOR
|
_image_end:
|
||||||
.left:
|
|
||||||
test eax, MOUSE_LEFT_BUTTON_MASK
|
; reserve for stack:
|
||||||
jz .right
|
rb 256
|
||||||
mov ebx, dword MOUSE_LEFT_BUTTON_PRESSED_COLOR
|
align 16
|
||||||
.right:
|
_stacktop:
|
||||||
test eax, MOUSE_RIGHT_BUTTON_MASK
|
_memory:
|
||||||
jz .middle
|
|
||||||
mov ecx, dword MOUSE_RIGHT_BUTTON_PRESSED_COLOR
|
|
||||||
.middle:
|
|
||||||
test eax, MOUSE_MIDDLE_BUTTON_MASK
|
|
||||||
jz .other
|
|
||||||
mov edx, dword MOUSE_MIDDLE_BUTTON_PRESSED_COLOR
|
|
||||||
.other:
|
|
||||||
mov [mouse_left_button_color], ebx
|
|
||||||
mov [mouse_right_button_color], ecx
|
|
||||||
mov [mouse_middle_button_color], edx
|
|
||||||
mov [mouse.button], eax
|
|
||||||
call DrawMouseButtons
|
|
||||||
jmp wait.event
|
|
||||||
align 4
|
|
||||||
on_button: ; terminate because we have only one button(close button)
|
|
||||||
or eax, -1
|
|
||||||
int 64
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
|
||||||
align 4
|
|
||||||
_END:
|
|
||||||
|
@@ -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")
|
||||||
|
3
programs/fs/lod/build.bat
Normal file
3
programs/fs/lod/build.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@fasm.exe -m 16384 lod.asm lod.kex
|
||||||
|
@kpack lod.kex
|
||||||
|
pause
|
@@ -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:
|
@@ -1,2 +0,0 @@
|
|||||||
nasm -f bin LOD.asm -o LOD
|
|
||||||
pause
|
|
@@ -1,7 +1,7 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
-- tup.rule is too unmannerly to %define
|
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||||
tup.definerule{
|
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||||
command = "echo %%define lang '" .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. "'> %o",
|
add_include(tup.getvariantdir())
|
||||||
outputs = {"lang_nasm.inc"}
|
|
||||||
}
|
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
|
||||||
tup.rule({"c4.asm", extra_inputs = {"lang_nasm.inc"}}, "nasm -I" .. tup.getvariantdir() .. "/ -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "c4")
|
tup.rule({"c4.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "c4")
|
||||||
|
@@ -18,16 +18,11 @@
|
|||||||
; along with C4; if not, write to the Free Software
|
; along with C4; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
%ifndef _AI_INC
|
|
||||||
%define _AI_INC
|
|
||||||
|
|
||||||
|
|
||||||
INFTY equ 1000000000
|
INFTY equ 1000000000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
section .data
|
|
||||||
|
|
||||||
; table used to perform some primitive move "ordering":
|
; table used to perform some primitive move "ordering":
|
||||||
; middle columns which are usually more important are
|
; middle columns which are usually more important are
|
||||||
; searched first.
|
; searched first.
|
||||||
@@ -46,18 +41,10 @@ evaltable: dd 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|||||||
dd 0, 0, 0, 0, 0, 0, 0, 0, 0
|
dd 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
cpulevel rd 1 ; level of current cpu player
|
||||||
section .bss
|
bestval rd 1 ; value of best move found so far
|
||||||
|
nbestmoves rd 1 ; # of best moves found so far
|
||||||
cpulevel resd 1 ; level of current cpu player
|
bestmoves rd 7 ; array to hold all best moves
|
||||||
bestval resd 1 ; value of best move found so far
|
|
||||||
nbestmoves resd 1 ; # of best moves found so far
|
|
||||||
bestmoves resd 7 ; array to hold all best moves
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
section .text
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
@@ -148,15 +135,16 @@ aiGetMove:
|
|||||||
; output : eax = move value
|
; output : eax = move value
|
||||||
; destroys : everything
|
; destroys : everything
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
|
align 4
|
||||||
alphabeta:
|
alphabeta:
|
||||||
|
|
||||||
%define ply (ebp+20)
|
ply equ (ebp+20)
|
||||||
%define player (ebp+16)
|
player equ (ebp+16)
|
||||||
%define alpha (ebp+12)
|
alpha equ (ebp+12)
|
||||||
%define beta (ebp+ 8)
|
beta equ (ebp+ 8)
|
||||||
|
|
||||||
enter 0,0
|
|
||||||
|
|
||||||
|
push ebp
|
||||||
|
mov ebp,esp
|
||||||
; win for other player -> end search
|
; win for other player -> end search
|
||||||
mov eax,[player]
|
mov eax,[player]
|
||||||
BOARDGETOTHERPLAYER eax
|
BOARDGETOTHERPLAYER eax
|
||||||
@@ -262,9 +250,8 @@ alphabeta:
|
|||||||
leave ; eax contains static value
|
leave ; eax contains static value
|
||||||
ret 4*4
|
ret 4*4
|
||||||
|
|
||||||
%undef ply
|
purge ply
|
||||||
%undef player
|
purge player
|
||||||
%undef alpha
|
purge alpha
|
||||||
%undef beta
|
purge beta
|
||||||
|
|
||||||
%endif
|
|
||||||
|
@@ -18,9 +18,6 @@
|
|||||||
; along with C4; if not, write to the Free Software
|
; along with C4; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
%ifndef _BOARD_INC
|
|
||||||
%define _BOARD_INC
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
; magic numbers
|
; magic numbers
|
||||||
@@ -36,27 +33,15 @@ BHEIGHT equ 8
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
board rd BHEIGHT*BWIDTH ; the board
|
||||||
; uninitialized data
|
free rd BWIDTH ; # of free fields for each column
|
||||||
;**********************************************************
|
totalfree rd 1 ; total # of free fields
|
||||||
|
currentplayer rd 1 ; player to make next move
|
||||||
section .bss
|
lastmove rd 1 ; last move done on the board
|
||||||
|
|
||||||
board resd BHEIGHT*BWIDTH ; the board
|
|
||||||
free resd BWIDTH ; # of free fields for each column
|
|
||||||
totalfree resd 1 ; total # of free fields
|
|
||||||
currentplayer resd 1 ; player to make next move
|
|
||||||
lastmove resd 1 ; last move done on the board
|
|
||||||
; (0 if no last move available)
|
; (0 if no last move available)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; code
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
section .text
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
; boardReset
|
; boardReset
|
||||||
@@ -102,9 +87,9 @@ boardReset:
|
|||||||
; zero flag clear -> move is valid
|
; zero flag clear -> move is valid
|
||||||
; destroys : nothing
|
; destroys : nothing
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
%macro BOARDISVALIDMOVE 1
|
macro BOARDISVALIDMOVE p1 {
|
||||||
cmp dword [free+%1*4],0
|
cmp dword [free+p1*4],0
|
||||||
%endmacro
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -160,9 +145,9 @@ boardUndoMove:
|
|||||||
; output : current player is switched
|
; output : current player is switched
|
||||||
; destroys : flags
|
; destroys : flags
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
%macro BOARDSWITCHPLAYERS 0
|
macro BOARDSWITCHPLAYERS {
|
||||||
xor dword [currentplayer],(PLAYER1 ^ PLAYER2)
|
xor dword [currentplayer],(PLAYER1 xor PLAYER2)
|
||||||
%endmacro
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -174,9 +159,9 @@ boardUndoMove:
|
|||||||
; output : player changed
|
; output : player changed
|
||||||
; destroys : flags
|
; destroys : flags
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
%macro BOARDGETOTHERPLAYER 1
|
macro BOARDGETOTHERPLAYER r1 {
|
||||||
xor %1,(PLAYER1 ^ PLAYER2)
|
xor r1,(PLAYER1 xor PLAYER2)
|
||||||
%endmacro
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -188,9 +173,9 @@ boardUndoMove:
|
|||||||
; output : zero flag set -> board is full
|
; output : zero flag set -> board is full
|
||||||
; zero flag clear -> board isn't full
|
; zero flag clear -> board isn't full
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
%macro BOARDISFULL 0
|
macro BOARDISFULL {
|
||||||
cmp dword [totalfree],0
|
cmp dword [totalfree],0
|
||||||
%endmacro
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -313,6 +298,3 @@ boardIsWin:
|
|||||||
; no win for this player
|
; no win for this player
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
@@ -1,2 +0,0 @@
|
|||||||
@nasmw -f bin -o c4 c4.asm
|
|
||||||
@pause
|
|
4
programs/games/c4/build_en.bat
Normal file
4
programs/games/c4/build_en.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo lang fix en_EN >lang.inc
|
||||||
|
@fasm.exe -m 16384 c4.asm c4.kex
|
||||||
|
@kpack c4.kex
|
||||||
|
pause
|
4
programs/games/c4/build_ru.bat
Normal file
4
programs/games/c4/build_ru.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo lang fix ru_RU >lang.inc
|
||||||
|
@fasm.exe -m 16384 c4.asm c4.kex
|
||||||
|
@kpack c4.kex
|
||||||
|
pause
|
@@ -18,14 +18,15 @@
|
|||||||
; along with C4; if not, write to the Free Software
|
; along with C4; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
bits 32
|
use32
|
||||||
%include 'mos.inc'
|
org 0
|
||||||
section .text
|
db 'MENUET01'
|
||||||
%include 'lang_nasm.inc' ;fedesco
|
dd 1,start,i_end,mem,stacktop,0,0
|
||||||
|
|
||||||
|
|
||||||
MOS_HEADER01 start,end
|
|
||||||
|
|
||||||
|
include '../../macros.inc'
|
||||||
|
include '../../proc32.inc'
|
||||||
|
include '../../KOSfuncs.inc'
|
||||||
|
include 'lang.inc' ;fedesco
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
@@ -46,11 +47,20 @@ BUTTON_HEIGHT equ 12
|
|||||||
|
|
||||||
BUTTON_NEW_X equ 14
|
BUTTON_NEW_X equ 14
|
||||||
BUTTON_NEW_Y equ 30
|
BUTTON_NEW_Y equ 30
|
||||||
%ifidn lang, 'it_IT'
|
BUTTON_NEW_HEIGHT equ 32
|
||||||
BUTTON_NEW_WIDTH equ 56 + 28
|
if lang eq it_IT
|
||||||
%else
|
BUTTON_NEW_WIDTH = 56 + 28
|
||||||
BUTTON_NEW_WIDTH equ 56
|
LABEL_PL1_X = 90 + 10
|
||||||
%endif
|
LABEL_PL1TYPE_X = (LABEL_PL1_X + 10*6 - 4)
|
||||||
|
else if lang eq ru_RU
|
||||||
|
BUTTON_NEW_WIDTH = 56 + 12
|
||||||
|
LABEL_PL1_X = 90
|
||||||
|
LABEL_PL1TYPE_X = (LABEL_PL1_X + 10*6)
|
||||||
|
else
|
||||||
|
BUTTON_NEW_WIDTH = 56
|
||||||
|
LABEL_PL1_X = 90
|
||||||
|
LABEL_PL1TYPE_X = (LABEL_PL1_X + 10*6)
|
||||||
|
end if
|
||||||
|
|
||||||
BUTTON_SPIN_WIDTH equ 8
|
BUTTON_SPIN_WIDTH equ 8
|
||||||
BUTTON_PL1DN_X equ 228
|
BUTTON_PL1DN_X equ 228
|
||||||
@@ -64,19 +74,9 @@ BUTTON_PL2UP_X equ (BUTTON_PL2DN_X + BUTTON_SPIN_WIDTH + 1)
|
|||||||
BUTTON_PL2UP_Y equ BUTTON_PL2DN_Y
|
BUTTON_PL2UP_Y equ BUTTON_PL2DN_Y
|
||||||
|
|
||||||
; label dimensions
|
; label dimensions
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
LABEL_PL1_X equ 90 + 10
|
|
||||||
%else
|
|
||||||
LABEL_PL1_X equ 90
|
|
||||||
%endif
|
|
||||||
LABEL_PL1_Y equ (1 + BUTTON_PL1DN_Y + (BUTTON_HEIGHT-8)/2)
|
LABEL_PL1_Y equ (1 + BUTTON_PL1DN_Y + (BUTTON_HEIGHT-8)/2)
|
||||||
LABEL_PL2_X equ LABEL_PL1_X
|
LABEL_PL2_X equ LABEL_PL1_X
|
||||||
LABEL_PL2_Y equ (1 + BUTTON_PL2DN_Y + (BUTTON_HEIGHT-8)/2)
|
LABEL_PL2_Y equ (1 + BUTTON_PL2DN_Y + (BUTTON_HEIGHT-8)/2)
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
LABEL_PL1TYPE_X equ (LABEL_PL1_X + 10*6 - 4)
|
|
||||||
%else
|
|
||||||
LABEL_PL1TYPE_X equ (LABEL_PL1_X + 10*6)
|
|
||||||
%endif
|
|
||||||
LABEL_PL1TYPE_Y equ LABEL_PL1_Y
|
LABEL_PL1TYPE_Y equ LABEL_PL1_Y
|
||||||
LABEL_PL2TYPE_X equ LABEL_PL1TYPE_X
|
LABEL_PL2TYPE_X equ LABEL_PL1TYPE_X
|
||||||
LABEL_PL2TYPE_Y equ LABEL_PL2_Y
|
LABEL_PL2TYPE_Y equ LABEL_PL2_Y
|
||||||
@@ -94,9 +94,7 @@ GRIDY equ 70
|
|||||||
GRIDSPACING equ (STONESIZE + 1) ; space between lines
|
GRIDSPACING equ (STONESIZE + 1) ; space between lines
|
||||||
GRIDHEIGHT equ (6*GRIDSPACING+1) ; total grid width and height
|
GRIDHEIGHT equ (6*GRIDSPACING+1) ; total grid width and height
|
||||||
GRIDWIDTH equ (7*GRIDSPACING+1)
|
GRIDWIDTH equ (7*GRIDSPACING+1)
|
||||||
GRIDCOLOR equ MOS_RGB(128,128,128)
|
GRIDCOLOR equ 0x808080
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; button id's
|
; button id's
|
||||||
BT_QUIT equ 1
|
BT_QUIT equ 1
|
||||||
@@ -106,55 +104,170 @@ BT_PLAYER1UP equ 4
|
|||||||
BT_PLAYER2DN equ 5
|
BT_PLAYER2DN equ 5
|
||||||
BT_PLAYER2UP equ 6
|
BT_PLAYER2UP equ 6
|
||||||
|
|
||||||
|
include "pcx.inc"
|
||||||
|
include "windows.inc"
|
||||||
|
include "board.inc"
|
||||||
|
include "rng.inc"
|
||||||
|
;include "randomai.inc"
|
||||||
|
include "ai.inc"
|
||||||
|
|
||||||
|
;
|
||||||
|
; label table
|
||||||
|
;
|
||||||
|
|
||||||
|
if lang eq it_IT
|
||||||
|
newgame db "Nuova partita",0
|
||||||
|
down db "<",0
|
||||||
|
up db ">",0
|
||||||
|
pl1 db "Giocatore 1:",0
|
||||||
|
pl2 db "Giocatore 2:",0
|
||||||
|
|
||||||
|
playertypes:
|
||||||
|
db "Umano ",0
|
||||||
|
.e1:
|
||||||
|
db "CPU 1 ",0
|
||||||
|
db "CPU 2 ",0
|
||||||
|
db "CPU 3 ",0
|
||||||
|
db "CPU 4 ",0
|
||||||
|
db "CPU 5 ",0
|
||||||
|
db "CPU 6 ",0
|
||||||
|
db "CPU 7 ",0
|
||||||
|
db "CPU 8 ",0
|
||||||
|
else if lang eq ru_RU
|
||||||
|
newgame db "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",0
|
||||||
|
down db "<",0
|
||||||
|
up db ">",0
|
||||||
|
pl1 db "<22><>ப 1:",0
|
||||||
|
pl2 db "<22><>ப 2:",0
|
||||||
|
|
||||||
|
playertypes:
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ",0
|
||||||
|
.e1:
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7 ",0
|
||||||
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8 ",0
|
||||||
|
else
|
||||||
|
newgame db "New game",0
|
||||||
|
down db "<",0
|
||||||
|
up db ">",0
|
||||||
|
pl1 db "Player 1:",0
|
||||||
|
pl2 db "Player 2:",0
|
||||||
|
|
||||||
|
playertypes:
|
||||||
|
db "Human ",0
|
||||||
|
.e1:
|
||||||
|
db "CPU level 1 ",0
|
||||||
|
db "CPU level 2 ",0
|
||||||
|
db "CPU level 3 ",0
|
||||||
|
db "CPU level 4 ",0
|
||||||
|
db "CPU level 5 ",0
|
||||||
|
db "CPU level 6 ",0
|
||||||
|
db "CPU level 7 ",0
|
||||||
|
db "CPU level 8 ",0
|
||||||
|
end if
|
||||||
|
playertypes_end:
|
||||||
|
|
||||||
|
PLAYERTYPELEN equ (playertypes.e1 - playertypes)
|
||||||
|
NPLAYERTYPES equ ((playertypes_end-playertypes)/PLAYERTYPELEN)
|
||||||
|
|
||||||
|
;
|
||||||
|
; button table
|
||||||
|
;
|
||||||
|
align 4
|
||||||
|
buttons:
|
||||||
|
; new
|
||||||
|
BUTTON (BUTTON_NEW_X shl 16) + BUTTON_NEW_WIDTH, (BUTTON_NEW_Y shl 16) + BUTTON_NEW_HEIGHT, BT_NEW, BUTTON_COLOR_WORK
|
||||||
|
; player 1 down
|
||||||
|
BUTTON (BUTTON_PL1DN_X shl 16) + BUTTON_SPIN_WIDTH, (BUTTON_PL1DN_Y shl 16) + BUTTON_HEIGHT, BT_PLAYER1DN, BUTTON_COLOR_WORK
|
||||||
|
; player 1 up
|
||||||
|
BUTTON (BUTTON_PL1UP_X shl 16) + BUTTON_SPIN_WIDTH, (BUTTON_PL1UP_Y shl 16) + BUTTON_HEIGHT, BT_PLAYER1UP, BUTTON_COLOR_WORK
|
||||||
|
; player 2 down
|
||||||
|
BUTTON (BUTTON_PL2DN_X shl 16) + BUTTON_SPIN_WIDTH, (BUTTON_PL2DN_Y shl 16) + BUTTON_HEIGHT, BT_PLAYER2DN, BUTTON_COLOR_WORK
|
||||||
|
; player 2 up
|
||||||
|
BUTTON (BUTTON_PL2UP_X shl 16) + BUTTON_SPIN_WIDTH, (BUTTON_PL2UP_Y shl 16) + BUTTON_HEIGHT, BT_PLAYER2UP, BUTTON_COLOR_WORK
|
||||||
|
buttons_end:
|
||||||
|
|
||||||
|
NBUTTONS equ ((buttons_end-buttons)/sizeof.BUTTON)
|
||||||
|
|
||||||
|
align 4
|
||||||
|
labels:
|
||||||
|
; new
|
||||||
|
LABEL ((BUTTON_NEW_X+4) shl 16) + (1+BUTTON_NEW_Y+(BUTTON_NEW_HEIGHT-8)/2), newgame,LABEL_COLOR_WORKBUTTON,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; player 1 down
|
||||||
|
LABEL ((BUTTON_PL1DN_X+(BUTTON_SPIN_WIDTH-4)/2) shl 16) + (1+BUTTON_PL1DN_Y+(BUTTON_HEIGHT-8)/2), down,LABEL_COLOR_WORKBUTTON,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; player 1 up
|
||||||
|
LABEL ((1+BUTTON_PL1UP_X+(BUTTON_SPIN_WIDTH-4)/2) shl 16) + (1+BUTTON_PL1UP_Y+(BUTTON_HEIGHT-8)/2), up,LABEL_COLOR_WORKBUTTON,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; player 2 down
|
||||||
|
LABEL ((BUTTON_PL2DN_X+(BUTTON_SPIN_WIDTH-4)/2) shl 16) + (1+BUTTON_PL2DN_Y+(BUTTON_HEIGHT-8)/2), down,LABEL_COLOR_WORKBUTTON,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; player 2 up
|
||||||
|
LABEL ((1+BUTTON_PL2UP_X+(BUTTON_SPIN_WIDTH-4)/2) shl 16) + (1+BUTTON_PL2UP_Y+(BUTTON_HEIGHT-8)/2), up,LABEL_COLOR_WORKBUTTON,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; player 1
|
||||||
|
LABEL (LABEL_PL1_X shl 16) + LABEL_PL1_Y, pl1,0xffffff,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; player 2
|
||||||
|
LABEL (LABEL_PL2_X shl 16) + LABEL_PL2_Y, pl2,0xffffff,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
; status bar
|
||||||
|
statusbar LABEL (LABEL_STATUS_X shl 16) + LABEL_STATUS_Y, 0,0xffffff,LABEL_BGCOLOR_TRANSPARENT
|
||||||
|
|
||||||
|
if lang eq it_IT
|
||||||
|
label_pl1type LABEL ((LABEL_PL1TYPE_X + 18) shl 16) + LABEL_PL1TYPE_Y, playertypes+PL1TYPE_INIT*PLAYERTYPELEN,0xffffff,0
|
||||||
|
label_pl2type LABEL ((LABEL_PL2TYPE_X + 18) shl 16) + LABEL_PL2TYPE_Y, playertypes+PL2TYPE_INIT*PLAYERTYPELEN,0xffffff,0
|
||||||
|
else
|
||||||
|
label_pl1type LABEL (LABEL_PL1TYPE_X shl 16) + LABEL_PL1TYPE_Y, playertypes+PL1TYPE_INIT*PLAYERTYPELEN,0xffffff,0
|
||||||
|
label_pl2type LABEL (LABEL_PL2TYPE_X shl 16) + LABEL_PL2TYPE_Y, playertypes+PL2TYPE_INIT*PLAYERTYPELEN,0xffffff,0
|
||||||
|
end if
|
||||||
|
labels_end:
|
||||||
|
|
||||||
|
NLABELS equ ((labels_end-labels)/sizeof.LABEL)
|
||||||
|
|
||||||
|
|
||||||
|
; button images
|
||||||
|
redpcx:
|
||||||
|
file "red.pcx"
|
||||||
|
REDPCXSIZE equ (bluepcx - redpcx)
|
||||||
|
bluepcx:
|
||||||
|
file "blue.pcx"
|
||||||
|
pcx_end:
|
||||||
|
BLUEPCXSIZE equ (pcx_end - bluepcx)
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
start:
|
start:
|
||||||
jmp main
|
|
||||||
|
|
||||||
%include "pcx.inc"
|
|
||||||
%include "windows.inc"
|
|
||||||
%include "board.inc"
|
|
||||||
%include "rng.inc"
|
|
||||||
; %include "randomai.inc"
|
|
||||||
%include "ai.inc"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; main program
|
|
||||||
;**********************************************************
|
|
||||||
main:
|
|
||||||
call randomize
|
call randomize
|
||||||
call defineWindow
|
call defineWindow
|
||||||
call decrunchImages
|
call decrunchImages
|
||||||
call newGame
|
call newGame
|
||||||
|
|
||||||
|
align 16
|
||||||
.msgpump:
|
.msgpump:
|
||||||
; wait for event
|
; wait for event
|
||||||
mov ebx,1
|
mcall SF_WAIT_EVENT_TIMEOUT,1
|
||||||
mov eax,MOS_SC_WAITEVENTTIMEOUT
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; process events
|
; process events
|
||||||
cmp eax,MOS_EVT_REDRAW
|
cmp eax,EV_REDRAW
|
||||||
je short .redraw
|
je .redraw
|
||||||
cmp eax,MOS_EVT_KEY
|
cmp eax,EV_KEY
|
||||||
je short .key
|
je .key
|
||||||
cmp eax,MOS_EVT_BUTTON
|
cmp eax,EV_BUTTON
|
||||||
je short .button
|
je .button
|
||||||
|
|
||||||
call pollMouse
|
call pollMouse
|
||||||
call gameLoop
|
call gameLoop
|
||||||
jmp short .msgpump
|
jmp .msgpump
|
||||||
|
|
||||||
.redraw:
|
.redraw:
|
||||||
call defineWindow
|
call defineWindow
|
||||||
jmp short .msgpump
|
jmp .msgpump
|
||||||
.key:
|
.key:
|
||||||
call keyboardInput
|
call keyboardInput
|
||||||
jmp short .msgpump
|
jmp .msgpump
|
||||||
.button:
|
.button:
|
||||||
call handleButton
|
call handleButton
|
||||||
jmp short .msgpump
|
jmp .msgpump
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -162,28 +275,27 @@ main:
|
|||||||
; button handling function
|
; button handling function
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
handleButton:
|
handleButton:
|
||||||
mov eax,MOS_SC_GETPRESSEDBUTTON ; get button id
|
mcall SF_GET_BUTTON ; get button id
|
||||||
int 0x40
|
|
||||||
|
|
||||||
cmp al,1 ; button pressed ?
|
cmp al,1 ; button pressed ?
|
||||||
je short .bye ; nope -> nothing to do
|
je .bye ; nope -> nothing to do
|
||||||
|
|
||||||
cmp ah,BT_QUIT ; which button has been pressed ?
|
cmp ah,BT_QUIT ; which button has been pressed ?
|
||||||
je short .quit
|
je .quit
|
||||||
cmp ah,BT_NEW
|
cmp ah,BT_NEW
|
||||||
je short .new
|
je .new
|
||||||
cmp ah,BT_PLAYER1DN
|
cmp ah,BT_PLAYER1DN
|
||||||
je short .player1dn
|
je .player1dn
|
||||||
cmp ah,BT_PLAYER1UP
|
cmp ah,BT_PLAYER1UP
|
||||||
je short .player1up
|
je .player1up
|
||||||
cmp ah,BT_PLAYER2DN
|
cmp ah,BT_PLAYER2DN
|
||||||
je short .player2dn
|
je .player2dn
|
||||||
cmp ah,BT_PLAYER2UP
|
cmp ah,BT_PLAYER2UP
|
||||||
je short .player2up
|
je .player2up
|
||||||
.bye:
|
.bye:
|
||||||
ret
|
ret
|
||||||
.quit:
|
.quit:
|
||||||
MOS_EXIT
|
mcall SF_TERMINATE_PROCESS
|
||||||
.new:
|
.new:
|
||||||
call newGame
|
call newGame
|
||||||
ret
|
ret
|
||||||
@@ -234,7 +346,7 @@ handleButton:
|
|||||||
; window definition function
|
; window definition function
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
defineWindow:
|
defineWindow:
|
||||||
MOS_STARTREDRAW
|
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||||
|
|
||||||
mov edi,window
|
mov edi,window
|
||||||
call drawWindow
|
call drawWindow
|
||||||
@@ -250,7 +362,7 @@ defineWindow:
|
|||||||
xor eax,eax
|
xor eax,eax
|
||||||
call drawBoard
|
call drawBoard
|
||||||
|
|
||||||
MOS_ENDREDRAW
|
mcall SF_REDRAW,SSF_END_DRAW
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@@ -270,11 +382,10 @@ updateStatusText:
|
|||||||
mov dword [statusbar + LABEL.caption],esi ; yeah -> save & redraw
|
mov dword [statusbar + LABEL.caption],esi ; yeah -> save & redraw
|
||||||
|
|
||||||
; clear background
|
; clear background
|
||||||
mov ebx,MOS_DWORD(LABEL_STATUS_X,LABEL_STATUS_WIDTH)
|
mov ebx, LABEL_STATUS_X shl 16 + LABEL_STATUS_WIDTH
|
||||||
mov ecx,MOS_DWORD(LABEL_STATUS_Y,LABEL_STATUS_HEIGHT)
|
mov ecx, LABEL_STATUS_Y shl 16 + LABEL_STATUS_HEIGHT
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
mov eax,MOS_SC_DRAWBAR
|
mcall SF_DRAW_RECT
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; redraw label
|
; redraw label
|
||||||
mov edi,statusbar
|
mov edi,statusbar
|
||||||
@@ -310,50 +421,50 @@ updatePlayerType:
|
|||||||
; draw whole board
|
; draw whole board
|
||||||
;
|
;
|
||||||
; input : eax nonzero = clear board background
|
; input : eax nonzero = clear board background
|
||||||
|
align 4
|
||||||
drawBoard:
|
drawBoard:
|
||||||
|
|
||||||
; clear background ?
|
; clear background ?
|
||||||
or eax,eax
|
or eax,eax
|
||||||
jz .noclear
|
jz .noclear
|
||||||
mov ebx,MOS_DWORD(GRIDX,GRIDWIDTH)
|
mov ebx, GRIDX shl 16 + GRIDWIDTH
|
||||||
mov ecx,MOS_DWORD(GRIDY,GRIDHEIGHT)
|
mov ecx, GRIDY shl 16 + GRIDHEIGHT
|
||||||
mov edx,WND_WORKCOLOR
|
mov edx,WND_WORKCOLOR
|
||||||
mov eax,MOS_SC_DRAWBAR
|
mcall SF_DRAW_RECT
|
||||||
int 0x40
|
|
||||||
.noclear:
|
.noclear:
|
||||||
call drawGrid
|
call drawGrid
|
||||||
call drawStones
|
call drawStones
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
drawGrid:
|
drawGrid:
|
||||||
|
|
||||||
; vertical lines
|
; vertical lines
|
||||||
mov ebx,MOS_DWORD(GRIDX,GRIDX)
|
mov ebx, GRIDX shl 16 + GRIDX
|
||||||
mov ecx,MOS_DWORD(GRIDY,GRIDY+GRIDHEIGHT-1)
|
mov ecx, GRIDY shl 16 + GRIDY+GRIDHEIGHT-1
|
||||||
mov edx,GRIDCOLOR
|
mov edx,GRIDCOLOR
|
||||||
mov eax,MOS_SC_DRAWLINE
|
mcall SF_DRAW_LINE
|
||||||
mov esi,8
|
mov esi,8
|
||||||
.vlines:
|
.vlines:
|
||||||
int 0x40
|
int 0x40
|
||||||
add ebx,MOS_DWORD(GRIDSPACING,GRIDSPACING)
|
add ebx, GRIDSPACING shl 16 + GRIDSPACING
|
||||||
dec esi
|
dec esi
|
||||||
jnz .vlines
|
jnz .vlines
|
||||||
|
|
||||||
; horizontal lines
|
; horizontal lines
|
||||||
mov ebx,MOS_DWORD(GRIDX,GRIDX+GRIDWIDTH-1)
|
mov ebx, GRIDX shl 16 + GRIDX+GRIDWIDTH-1
|
||||||
mov ecx,MOS_DWORD(GRIDY,GRIDY)
|
mov ecx, GRIDY shl 16 + GRIDY
|
||||||
mov esi,7
|
mov esi,7
|
||||||
.hlines:
|
.hlines:
|
||||||
int 0x40
|
int 0x40
|
||||||
add ecx,MOS_DWORD(GRIDSPACING,GRIDSPACING)
|
add ecx, GRIDSPACING shl 16 + GRIDSPACING
|
||||||
dec esi
|
dec esi
|
||||||
jnz .hlines
|
jnz .hlines
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
drawStones:
|
drawStones:
|
||||||
mov ebx,6
|
mov ebx,6
|
||||||
.col:
|
.col:
|
||||||
@@ -369,6 +480,7 @@ drawStones:
|
|||||||
|
|
||||||
; ecx = column (1..7)
|
; ecx = column (1..7)
|
||||||
; ebx = row (1..6)
|
; ebx = row (1..6)
|
||||||
|
align 4
|
||||||
drawStone:
|
drawStone:
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
@@ -402,9 +514,8 @@ drawStone:
|
|||||||
|
|
||||||
; put image (position is already in edx)
|
; put image (position is already in edx)
|
||||||
mov ebx,ebp ; image address
|
mov ebx,ebp ; image address
|
||||||
mov ecx,MOS_DWORD(STONESIZE,STONESIZE) ; image dimensions
|
mov ecx, (STONESIZE shl 16) + STONESIZE ; image dimensions
|
||||||
mov eax,MOS_SC_PUTIMAGE
|
mcall SF_PUT_IMAGE
|
||||||
int 0x40
|
|
||||||
|
|
||||||
.bye:
|
.bye:
|
||||||
popad
|
popad
|
||||||
@@ -461,9 +572,8 @@ newGame:
|
|||||||
; destroys : everything
|
; destroys : everything
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
pollMouse:
|
pollMouse:
|
||||||
mov ebx,2
|
mcall SF_MOUSE_GET,SSF_BUTTON
|
||||||
mov eax,MOS_SC_GETMOUSEPOSITION
|
|
||||||
int 0x40
|
|
||||||
and eax,1
|
and eax,1
|
||||||
jz .mousenotpressed
|
jz .mousenotpressed
|
||||||
.mousepressed:
|
.mousepressed:
|
||||||
@@ -502,10 +612,8 @@ pollMouse:
|
|||||||
; destroys : everything
|
; destroys : everything
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
getMouseCol:
|
getMouseCol:
|
||||||
|
|
||||||
mov ebx,1 ; get mouse position, window relative
|
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ; get mouse position, window relative
|
||||||
mov eax,MOS_SC_GETMOUSEPOSITION
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
movzx ebx,ax ; y clipping
|
movzx ebx,ax ; y clipping
|
||||||
cmp ebx,GRIDY
|
cmp ebx,GRIDY
|
||||||
@@ -539,24 +647,15 @@ getMouseCol:
|
|||||||
; destroys : everything
|
; destroys : everything
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
isActiveApp:
|
isActiveApp:
|
||||||
|
|
||||||
%define PROCINFO (ebp-MOS_PROCESSINFO_size)
|
|
||||||
|
|
||||||
enter MOS_PROCESSINFO_size,0
|
|
||||||
|
|
||||||
; get process information
|
; get process information
|
||||||
mov eax,MOS_SC_GETPROCESSINFO
|
mcall SF_THREAD_INFO,procinfo,-1
|
||||||
lea ebx,[ebp-MOS_PROCESSINFO_size]
|
|
||||||
mov ecx,-1
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
; set al to 1 if we are the active application
|
; set al to 1 if we are the active application
|
||||||
cmp ax,[PROCINFO+MOS_PROCESSINFO.windowStackPos]
|
cmp ax,[procinfo+process_information.window_stack_position]
|
||||||
sete al
|
sete al
|
||||||
|
|
||||||
leave
|
;;;leave
|
||||||
ret
|
ret
|
||||||
%undef PROCINFO
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -569,8 +668,7 @@ isActiveApp:
|
|||||||
; destroys : everything
|
; destroys : everything
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
keyboardInput:
|
keyboardInput:
|
||||||
mov eax,MOS_SC_GETKEY ; get key
|
mcall SF_GET_KEY ; get key
|
||||||
int 0x40
|
|
||||||
or al,al ; key available ?
|
or al,al ; key available ?
|
||||||
jnz .bye ; no -> bye
|
jnz .bye ; no -> bye
|
||||||
cmp dword [playerinput],0 ; unprocessed input available ?
|
cmp dword [playerinput],0 ; unprocessed input available ?
|
||||||
@@ -698,7 +796,7 @@ updatePlayerStatusText:
|
|||||||
cmp dword [player1_type],0
|
cmp dword [player1_type],0
|
||||||
je .statustextok
|
je .statustextok
|
||||||
mov esi,player1cpuprmpt
|
mov esi,player1cpuprmpt
|
||||||
jmp short .statustextok
|
jmp .statustextok
|
||||||
.player2:
|
.player2:
|
||||||
mov esi,player2hmnprmpt
|
mov esi,player2hmnprmpt
|
||||||
cmp dword [player2_type],0
|
cmp dword [player2_type],0
|
||||||
@@ -714,196 +812,11 @@ updatePlayerStatusText:
|
|||||||
; initialized data
|
; initialized data
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
|
|
||||||
section .data
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; window definition
|
; window definition
|
||||||
;
|
;
|
||||||
windowtitle db "C4",0
|
windowtitle db "C4",0
|
||||||
window:
|
window WND WND_WIDTH, WND_HEIGHT, 0x14000000 or WND_WORKCOLOR, 0,0,windowtitle,0, WND_CENTER or WND_DEFAULT_GRABCOLOR or WND_DEFAULT_FRAMECOLOR or WND_DEFAULT_CAPTIONCOLOR
|
||||||
istruc WND
|
|
||||||
at WND.xposandsize, dd MOS_DWORD(0,WND_WIDTH)
|
|
||||||
at WND.yposandsize, dd MOS_DWORD(0,WND_HEIGHT)
|
|
||||||
at WND.workcolor, dd 0x14000000 | WND_WORKCOLOR
|
|
||||||
at WND.grabcolor, dd 0
|
|
||||||
at WND.framecolor, dd 0
|
|
||||||
at WND.caption, dd windowtitle
|
|
||||||
at WND.captioncolor, dd 0
|
|
||||||
at WND.flags, dd WND_CENTER | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR
|
|
||||||
iend
|
|
||||||
|
|
||||||
;
|
|
||||||
; button table
|
|
||||||
;
|
|
||||||
buttons:
|
|
||||||
istruc BUTTON ; new
|
|
||||||
at BUTTON.xposandsize
|
|
||||||
dd MOS_DWORD(BUTTON_NEW_X,BUTTON_NEW_WIDTH)
|
|
||||||
dd MOS_DWORD(BUTTON_NEW_Y,BUTTON_HEIGHT)
|
|
||||||
dd BT_NEW
|
|
||||||
dd BUTTON_COLOR_WORK
|
|
||||||
iend
|
|
||||||
istruc BUTTON ; player 1 down
|
|
||||||
at BUTTON.xposandsize
|
|
||||||
dd MOS_DWORD(BUTTON_PL1DN_X,BUTTON_SPIN_WIDTH)
|
|
||||||
dd MOS_DWORD(BUTTON_PL1DN_Y,BUTTON_HEIGHT)
|
|
||||||
dd BT_PLAYER1DN
|
|
||||||
dd BUTTON_COLOR_WORK
|
|
||||||
iend
|
|
||||||
istruc BUTTON ; player 1 up
|
|
||||||
at BUTTON.xposandsize
|
|
||||||
dd MOS_DWORD(BUTTON_PL1UP_X,BUTTON_SPIN_WIDTH)
|
|
||||||
dd MOS_DWORD(BUTTON_PL1UP_Y,BUTTON_HEIGHT)
|
|
||||||
dd BT_PLAYER1UP
|
|
||||||
dd BUTTON_COLOR_WORK
|
|
||||||
iend
|
|
||||||
istruc BUTTON ; player 2 down
|
|
||||||
at BUTTON.xposandsize
|
|
||||||
dd MOS_DWORD(BUTTON_PL2DN_X,BUTTON_SPIN_WIDTH)
|
|
||||||
dd MOS_DWORD(BUTTON_PL2DN_Y,BUTTON_HEIGHT)
|
|
||||||
dd BT_PLAYER2DN
|
|
||||||
dd BUTTON_COLOR_WORK
|
|
||||||
iend
|
|
||||||
istruc BUTTON ; player 2 up
|
|
||||||
at BUTTON.xposandsize
|
|
||||||
dd MOS_DWORD(BUTTON_PL2UP_X,BUTTON_SPIN_WIDTH)
|
|
||||||
dd MOS_DWORD(BUTTON_PL2UP_Y,BUTTON_HEIGHT)
|
|
||||||
dd BT_PLAYER2UP
|
|
||||||
dd BUTTON_COLOR_WORK
|
|
||||||
iend
|
|
||||||
NBUTTONS equ (($-buttons)/BUTTON_size)
|
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
; label table
|
|
||||||
;
|
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
newgame db "Nuova partita",0
|
|
||||||
%else
|
|
||||||
newgame db "New game",0
|
|
||||||
%endif
|
|
||||||
down db "<",0
|
|
||||||
up db ">",0
|
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
pl1 db "Giocatore 1:",0
|
|
||||||
pl2 db "Giocatore 2:",0
|
|
||||||
%else
|
|
||||||
pl1 db "Player 1:",0
|
|
||||||
pl2 db "Player 2:",0
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
playertypes:
|
|
||||||
db "Umano",0
|
|
||||||
PLAYERTYPELEN equ ($ - playertypes)
|
|
||||||
db "CPU 1 ",0
|
|
||||||
db "CPU 2 ",0
|
|
||||||
db "CPU 3 ",0
|
|
||||||
db "CPU 4 ",0
|
|
||||||
db "CPU 5 ",0
|
|
||||||
db "CPU 6 ",0
|
|
||||||
db "CPU 7 ",0
|
|
||||||
db "CPU 8 ",0
|
|
||||||
%else
|
|
||||||
playertypes:
|
|
||||||
db "Human ",0
|
|
||||||
PLAYERTYPELEN equ ($ - playertypes)
|
|
||||||
db "CPU level 1 ",0
|
|
||||||
db "CPU level 2 ",0
|
|
||||||
db "CPU level 3 ",0
|
|
||||||
db "CPU level 4 ",0
|
|
||||||
db "CPU level 5 ",0
|
|
||||||
db "CPU level 6 ",0
|
|
||||||
db "CPU level 7 ",0
|
|
||||||
db "CPU level 8 ",0
|
|
||||||
%endif
|
|
||||||
|
|
||||||
NPLAYERTYPES equ (($-playertypes)/PLAYERTYPELEN)
|
|
||||||
|
|
||||||
|
|
||||||
labels:
|
|
||||||
istruc LABEL ; new
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(BUTTON_NEW_X+4,1+BUTTON_NEW_Y+(BUTTON_HEIGHT-8)/2)
|
|
||||||
dd newgame
|
|
||||||
dd LABEL_COLOR_WORKBUTTON
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
istruc LABEL ; player 1 down
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(BUTTON_PL1DN_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL1DN_Y+(BUTTON_HEIGHT-8)/2)
|
|
||||||
dd down
|
|
||||||
dd LABEL_COLOR_WORKBUTTON
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
istruc LABEL ; player 1 up
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(1+BUTTON_PL1UP_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL1UP_Y+(BUTTON_HEIGHT-8)/2)
|
|
||||||
dd up
|
|
||||||
dd LABEL_COLOR_WORKBUTTON
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
istruc LABEL ; player 2 down
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(BUTTON_PL2DN_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL2DN_Y+(BUTTON_HEIGHT-8)/2)
|
|
||||||
dd down
|
|
||||||
dd LABEL_COLOR_WORKBUTTON
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
istruc LABEL ; player 2 up
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(1+BUTTON_PL2UP_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL2UP_Y+(BUTTON_HEIGHT-8)/2)
|
|
||||||
dd up
|
|
||||||
dd LABEL_COLOR_WORKBUTTON
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
istruc LABEL ; player 1
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(LABEL_PL1_X,LABEL_PL1_Y)
|
|
||||||
dd pl1
|
|
||||||
dd MOS_RGB(255,255,255)
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
istruc LABEL ; player 2
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(LABEL_PL2_X,LABEL_PL2_Y)
|
|
||||||
dd pl2
|
|
||||||
dd MOS_RGB(255,255,255)
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
statusbar: ; status bar
|
|
||||||
istruc LABEL
|
|
||||||
at LABEL.position
|
|
||||||
dd MOS_DWORD(LABEL_STATUS_X,LABEL_STATUS_Y)
|
|
||||||
dd 0
|
|
||||||
dd MOS_RGB(255,255,255)
|
|
||||||
dd LABEL_BGCOLOR_TRANSPARENT
|
|
||||||
iend
|
|
||||||
label_pl1type:
|
|
||||||
istruc LABEL
|
|
||||||
at LABEL.position
|
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
dd MOS_DWORD(LABEL_PL1TYPE_X + 18,LABEL_PL1TYPE_Y)
|
|
||||||
%else
|
|
||||||
dd MOS_DWORD(LABEL_PL1TYPE_X,LABEL_PL1TYPE_Y)
|
|
||||||
%endif
|
|
||||||
dd playertypes+PL1TYPE_INIT*PLAYERTYPELEN
|
|
||||||
dd MOS_RGB(255,255,255)
|
|
||||||
dd MOS_RGB(0,0,0)
|
|
||||||
iend
|
|
||||||
label_pl2type:
|
|
||||||
istruc LABEL
|
|
||||||
at LABEL.position
|
|
||||||
%ifidn lang, 'it_IT'
|
|
||||||
dd MOS_DWORD(LABEL_PL2TYPE_X + 18,LABEL_PL2TYPE_Y)
|
|
||||||
%else
|
|
||||||
dd MOS_DWORD(LABEL_PL2TYPE_X,LABEL_PL2TYPE_Y)
|
|
||||||
%endif
|
|
||||||
dd playertypes+PL2TYPE_INIT*PLAYERTYPELEN
|
|
||||||
dd MOS_RGB(255,255,255)
|
|
||||||
dd MOS_RGB(0,0,0)
|
|
||||||
iend
|
|
||||||
NLABELS equ (($-labels)/LABEL_size)
|
|
||||||
|
|
||||||
|
|
||||||
; player types
|
; player types
|
||||||
@@ -912,23 +825,31 @@ player2_type dd PL2TYPE_INIT
|
|||||||
|
|
||||||
|
|
||||||
; status messages
|
; status messages
|
||||||
%ifidn lang, 'it_IT'
|
if lang eq it_IT
|
||||||
player1hmnprmpt db "Turno del giocatore 1",0
|
player1hmnprmpt db "Turno del giocatore 1",0
|
||||||
player2hmnprmpt db "Turno del giocatore 2",0
|
player2hmnprmpt db "Turno del giocatore 2",0
|
||||||
player1cpuprmpt db "Attendi, giocatore 1 sta pensando...",0
|
player1cpuprmpt db "Attendi, giocatore 1 sta pensando...",0
|
||||||
player2cpuprmpt db "Attendi, giocatore 2 sta pensando...",0
|
player2cpuprmpt db "Attendi, giocatore 2 sta pensando...",0
|
||||||
itisadraw db "Pareggio",0
|
itisadraw db "Pareggio",0
|
||||||
player1wins db "Vince giocatore 1",0
|
player1wins db "Vince giocatore 1",0
|
||||||
player2wins db "Vince Giocatore 2",0
|
player2wins db "Vince giocatore 2",0
|
||||||
%else
|
else if lang eq ru_RU
|
||||||
player1hmnprmpt db "Make your move, player 1.",0
|
player1hmnprmpt db "<EFBFBD><EFBFBD>ப 1 ᤥ<><E1A4A5><EFBFBD><EFBFBD><EFBFBD> 室",0
|
||||||
player2hmnprmpt db "Make your move, player 2.",0
|
player2hmnprmpt db "<EFBFBD><EFBFBD>ப 2 ᤥ<><E1A4A5><EFBFBD><EFBFBD><EFBFBD> 室",0
|
||||||
|
player1cpuprmpt db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>ப 1 <20>㬠<EFBFBD><E3ACA0>......",0
|
||||||
|
player2cpuprmpt db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>ப 2 <20>㬠<EFBFBD><E3ACA0>......",0
|
||||||
|
itisadraw db "<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>",0
|
||||||
|
player1wins db "<22><>ப 1 <20>먣ࠫ",0
|
||||||
|
player2wins db "<22><>ப 2 <20>먣ࠫ",0
|
||||||
|
else
|
||||||
|
player1hmnprmpt db "Make your move, player 1",0
|
||||||
|
player2hmnprmpt db "Make your move, player 2",0
|
||||||
player1cpuprmpt db "Player 1 is thinking, please wait...",0
|
player1cpuprmpt db "Player 1 is thinking, please wait...",0
|
||||||
player2cpuprmpt db "Player 2 is thinking, please wait...",0
|
player2cpuprmpt db "Player 2 is thinking, please wait...",0
|
||||||
itisadraw db "It's a draw.",0
|
itisadraw db "It's a draw",0
|
||||||
player1wins db "Player 1 wins.",0
|
player1wins db "Player 1 wins",0
|
||||||
player2wins db "Player 2 wins.",0
|
player2wins db "Player 2 wins",0
|
||||||
%endif
|
end if
|
||||||
|
|
||||||
|
|
||||||
; pointer to ai player. future releases C4 might
|
; pointer to ai player. future releases C4 might
|
||||||
@@ -936,29 +857,22 @@ player2_type dd PL2TYPE_INIT
|
|||||||
aicode dd aiGetMove
|
aicode dd aiGetMove
|
||||||
|
|
||||||
|
|
||||||
; button images
|
align 16
|
||||||
redpcx: incbin "red.pcx"
|
i_end:
|
||||||
REDPCXSIZE equ ($ - redpcx)
|
sc system_colors
|
||||||
bluepcx: incbin "blue.pcx"
|
procinfo process_information
|
||||||
BLUEPCXSIZE equ ($ - bluepcx)
|
rb 1024
|
||||||
|
align 16
|
||||||
|
stacktop:
|
||||||
|
; player input
|
||||||
|
; 0 : no input available
|
||||||
|
; 1..7 : column to drop stone into
|
||||||
|
playerinput rd 1
|
||||||
|
|
||||||
|
mouseinput rd 1
|
||||||
|
gameover rd 1
|
||||||
|
|
||||||
|
redstone rb STONESIZE*STONESIZE*3
|
||||||
|
bluestone rb STONESIZE*STONESIZE*3
|
||||||
|
mem:
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; uninitialized data
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
section .bss
|
|
||||||
|
|
||||||
; player input
|
|
||||||
; 0 : no input available
|
|
||||||
; 1..7 : column to drop stone into
|
|
||||||
playerinput resd 1
|
|
||||||
|
|
||||||
mouseinput resd 1
|
|
||||||
gameover resd 1
|
|
||||||
|
|
||||||
redstone resb STONESIZE*STONESIZE*3
|
|
||||||
bluestone resb STONESIZE*STONESIZE*3
|
|
||||||
|
|
||||||
end:
|
|
||||||
|
@@ -1,305 +0,0 @@
|
|||||||
; mos.inc 0.0.2
|
|
||||||
; Copyright (c) 2002 Thomas Mathys
|
|
||||||
; killer@vantage.ch
|
|
||||||
;
|
|
||||||
; This program is free software; you can redistribute it and/or modify
|
|
||||||
; it under the terms of the GNU General Public License as published by
|
|
||||||
; the Free Software Foundation; either version 2 of the License, or
|
|
||||||
; (at your option) any later version.
|
|
||||||
;
|
|
||||||
; This program is distributed in the hope that it will be useful,
|
|
||||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
; GNU General Public License for more details.
|
|
||||||
;
|
|
||||||
; You should have received a copy of the GNU General Public License
|
|
||||||
; along with this program; if not, write to the Free Software
|
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
;
|
|
||||||
;
|
|
||||||
;
|
|
||||||
; revision history
|
|
||||||
; ----------------
|
|
||||||
;
|
|
||||||
; 10-04-2002 version 0.0.2
|
|
||||||
; - removed MOS_WNDCOLORS_SIZE and similar constants.
|
|
||||||
; while reading the docs i realized that NASM creates
|
|
||||||
; such symbols already itself...
|
|
||||||
; + macros: MOS_WAITEVENT, MOS_WAITEVENT_S, MOS_STARTREDRAW,
|
|
||||||
; MOS_STARTREDRAW_S, MOS_ENDREDRAW, MOS_ENDREDRAW_S,
|
|
||||||
; MOS_GETSCREENMAX, MOS_GETSCREENMAX_S, MOS_EXIT, MOS_EXIT_S
|
|
||||||
; + event bit masks
|
|
||||||
; + some syscall numbers
|
|
||||||
; + process info structure
|
|
||||||
;
|
|
||||||
; 08-??-2002 version 0.0.1
|
|
||||||
; first release
|
|
||||||
;
|
|
||||||
%ifndef _MOS_INC
|
|
||||||
%define _MOS_INC
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; generates a menuetos 01 header
|
|
||||||
; takes 2-6 parameters:
|
|
||||||
;
|
|
||||||
; MOS_HEADER01 start,end[,appmem,esp,i_param,i_icon]
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
%macro MOS_HEADER01 2-6 0x100000,0x7fff0,0,0
|
|
||||||
org 0x0
|
|
||||||
db 'MENUET01' ; 8 byte id
|
|
||||||
dd 0x01 ; header version
|
|
||||||
dd %1 ; start of code
|
|
||||||
dd %2 ; image size
|
|
||||||
dd %3 ; application memory
|
|
||||||
dd %4 ; esp
|
|
||||||
dd %5 ; i_param
|
|
||||||
dd %6 ; i_icon
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; MOS_DWORD
|
|
||||||
; packs 2 words into a double word
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
%define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff))
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; MOS_RGB
|
|
||||||
; creates a menuet os compatible color (0x00RRGGBB)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
%define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255))
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; window color structure
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
struc MOS_WNDCOLORS
|
|
||||||
.frame: resd 1
|
|
||||||
.grab: resd 1
|
|
||||||
.grabButton: resd 1
|
|
||||||
.grabButtonText: resd 1
|
|
||||||
.grabText: resd 1
|
|
||||||
.work: resd 1
|
|
||||||
.workButton: resd 1
|
|
||||||
.workButtonText: resd 1
|
|
||||||
.workText: resd 1
|
|
||||||
.workGraphics: resd 1
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; process info structure
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
struc MOS_PROCESSINFO
|
|
||||||
.CPUUsage: resd 1 ; cpu usage
|
|
||||||
.windowStackPos: resw 1 ; process' position in windowing stack
|
|
||||||
.windowStackVal: resw 1 ; window stack value at ecx
|
|
||||||
.reserved1: resw 1
|
|
||||||
.processName: resb 12 ; process name
|
|
||||||
.memStart: resd 1 ; start of process memory
|
|
||||||
.memUsed: resd 1 ; memory used by the process
|
|
||||||
.pid: resd 1 ; process id
|
|
||||||
.reserved2: resb (1024-34)
|
|
||||||
endstruc
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; system call numbers
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_SC_EXIT equ -1
|
|
||||||
MOS_SC_DEFINEWINDOW equ 0
|
|
||||||
MOS_SC_PUTPIXEL equ 1
|
|
||||||
MOS_SC_GETKEY equ 2
|
|
||||||
MOS_SC_GETSYSCLOCK equ 3
|
|
||||||
MOS_SC_WRITETEXT equ 4
|
|
||||||
MOS_SC_DELAY equ 5
|
|
||||||
MOS_SC_OPENFILEFLOPPY equ 6
|
|
||||||
MOS_SC_PUTIMAGE equ 7
|
|
||||||
MOS_SC_DEFINEBUTTON equ 8
|
|
||||||
MOS_SC_GETPROCESSINFO equ 9
|
|
||||||
MOS_SC_WAITEVENT equ 10
|
|
||||||
MOS_SC_CHECKEVENT equ 11
|
|
||||||
MOS_SC_REDRAWSTATUS equ 12
|
|
||||||
MOS_SC_DRAWBAR equ 13
|
|
||||||
MOS_SC_GETSCREENMAX equ 14
|
|
||||||
MOS_SC_SETBACKGROUND equ 15
|
|
||||||
MOS_SC_GETPRESSEDBUTTON equ 17
|
|
||||||
MOS_SC_SYSTEMSERVICE equ 18
|
|
||||||
MOS_SC_STARTPROGRAM equ 19
|
|
||||||
MOS_SC_MIDIINTERFACE equ 20
|
|
||||||
MOS_SC_DEVICESETUP equ 21
|
|
||||||
MOS_SC_WAITEVENTTIMEOUT equ 23
|
|
||||||
MOS_SC_CDAUDIO equ 24
|
|
||||||
MOS_SC_SB16MIXER1 equ 25
|
|
||||||
MOS_SC_GETDEVICESETUP equ 26
|
|
||||||
MOS_SC_WSS equ 27
|
|
||||||
MOS_SC_SB16MIXER2 equ 28
|
|
||||||
MOS_SC_GETDATE equ 29
|
|
||||||
MOS_SC_READHD equ 30
|
|
||||||
MOS_SC_STARTPROGRAMHD equ 31
|
|
||||||
MOS_SC_GETSCREENPIXEL equ 35
|
|
||||||
MOS_SC_GETMOUSEPOSITION equ 37
|
|
||||||
MOS_SC_DRAWLINE equ 38
|
|
||||||
MOS_SC_GETBACKGROUND equ 39
|
|
||||||
MOS_SC_SETEVENTMASK equ 40
|
|
||||||
MOS_SC_WRITENUMBER equ 47
|
|
||||||
MOS_SC_WINDOWPROPERTIES equ 48
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; event numbers
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_EVT_NONE equ 0
|
|
||||||
MOS_EVT_REDRAW equ 1
|
|
||||||
MOS_EVT_KEY equ 2
|
|
||||||
MOS_EVT_BUTTON equ 3
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; event bits
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_EVTBIT_REDRAW equ (1 << 0)
|
|
||||||
MOS_EVTBIT_KEY equ (1 << 1)
|
|
||||||
MOS_EVTBIT_BUTTON equ (1 << 2)
|
|
||||||
MOS_EVTBIT_ENDREQUEST equ (1 << 3)
|
|
||||||
MOS_EVTBIT_BGDRAW equ (1 << 4)
|
|
||||||
MOS_EVTBIT_MOUSECHANGE equ (1 << 5)
|
|
||||||
MOS_EVTBIT_IPCEVENT equ (1 << 6)
|
|
||||||
MOS_EVTBIT_IRQ0 equ (1 << 16)
|
|
||||||
MOS_EVTBIT_IRQ1 equ (1 << 17)
|
|
||||||
MOS_EVTBIT_IRQ2 equ (1 << 18)
|
|
||||||
MOS_EVTBIT_IRQ3 equ (1 << 19)
|
|
||||||
MOS_EVTBIT_IRQ4 equ (1 << 20)
|
|
||||||
MOS_EVTBIT_IRQ5 equ (1 << 21)
|
|
||||||
MOS_EVTBIT_IRQ6 equ (1 << 22)
|
|
||||||
MOS_EVTBIT_IRQ7 equ (1 << 23)
|
|
||||||
MOS_EVTBIT_IRQ8 equ (1 << 24)
|
|
||||||
MOS_EVTBIT_IRQ9 equ (1 << 25)
|
|
||||||
MOS_EVTBIT_IRQ10 equ (1 << 26)
|
|
||||||
MOS_EVTBIT_IRQ11 equ (1 << 27)
|
|
||||||
MOS_EVTBIT_IRQ12 equ (1 << 28)
|
|
||||||
MOS_EVTBIT_IRQ13 equ (1 << 29)
|
|
||||||
MOS_EVTBIT_IRQ14 equ (1 << 30)
|
|
||||||
MOS_EVTBIT_IRQ15 equ (1 << 31)
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; exit application (syscall -1)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; exit application
|
|
||||||
%macro MOS_EXIT 0
|
|
||||||
mov eax,MOS_SC_EXIT
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; exit application, smaller version
|
|
||||||
%macro MOS_EXIT_S 0
|
|
||||||
xor eax,eax
|
|
||||||
dec eax
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; wait event stuff
|
|
||||||
; (MOS_SC_WAITEVENT, syscall 10)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; wait for event
|
|
||||||
; destroys : nothing
|
|
||||||
; returns : eax = event type
|
|
||||||
%macro MOS_WAITEVENT 0
|
|
||||||
mov eax,MOS_SC_WAITEVENT
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; wait for event, smaller version
|
|
||||||
; destroys : flags
|
|
||||||
; returns : eax = event type
|
|
||||||
%macro MOS_WAITEVENT_S 0
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_WAITEVENT
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; window redraw status stuff
|
|
||||||
; (MOS_SC_REDRAWSTATUS, syscall 12)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
MOS_RS_STARTREDRAW equ 1
|
|
||||||
MOS_RS_ENDREDRAW equ 2
|
|
||||||
|
|
||||||
; start window redraw
|
|
||||||
; destroys: eax,ebx
|
|
||||||
%macro MOS_STARTREDRAW 0
|
|
||||||
mov ebx,MOS_RS_STARTREDRAW
|
|
||||||
mov eax,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; start window redraw, smaller version
|
|
||||||
; destroys: eax,ebx,flags
|
|
||||||
%macro MOS_STARTREDRAW_S 0
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; end window redraw
|
|
||||||
; destroys: eax,ebx
|
|
||||||
%macro MOS_ENDREDRAW 0
|
|
||||||
mov ebx,MOS_RS_ENDREDRAW
|
|
||||||
mov eax,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; end window redraw, smaller version
|
|
||||||
; destroys: eax,ebx,flags
|
|
||||||
%macro MOS_ENDREDRAW_S 0
|
|
||||||
xor ebx,ebx
|
|
||||||
mov bl,MOS_RS_ENDREDRAW
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_REDRAWSTATUS
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
|
||||||
; get screen max stuff (syscall 14)
|
|
||||||
;**********************************************************
|
|
||||||
|
|
||||||
; get screen dimensions in eax
|
|
||||||
; destroys: nothing
|
|
||||||
%macro MOS_GETSCREENMAX 0
|
|
||||||
mov eax,MOS_SC_GETSCREENMAX
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
; get screen dimensions in eax, smaller version
|
|
||||||
; destroys: flags
|
|
||||||
%macro MOS_GETSCREENMAX_S 0
|
|
||||||
xor eax,eax
|
|
||||||
mov al,MOS_SC_GETSCREENMAX
|
|
||||||
int 0x40
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
@@ -16,38 +16,32 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
%ifndef _PCX_INC
|
|
||||||
%define _PCX_INC
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
; pcx header
|
; pcx header
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
|
|
||||||
PCXHEADER_SIZE equ 128
|
PCXHEADER_SIZE equ 128
|
||||||
struc PCXHEADER
|
struct PCXHEADER
|
||||||
.id: resb 1 ; id, should be 10
|
id rb 1 ; id, should be 10
|
||||||
.version: resb 1 ; pcx version
|
version rb 1 ; pcx version
|
||||||
.encoding: resb 1 ; 1 = rle
|
encoding rb 1 ; 1 = rle
|
||||||
.bpp: resb 1 ; bits per pixel
|
bpp rb 1 ; bits per pixel
|
||||||
.xmin: resw 1 ; image dimensions
|
xmin rw 1 ; image dimensions
|
||||||
.ymin: resw 1
|
ymin rw 1
|
||||||
.xmax: resw 1
|
xmax rw 1
|
||||||
.ymax: resw 1
|
ymax rw 1
|
||||||
.hdpi: resw 1 ; horizontal resolution in dpi
|
hdpi rw 1 ; horizontal resolution in dpi
|
||||||
.vdpi: resw 1 ; verttical resolution in dpi
|
vdpi rw 1 ; verttical resolution in dpi
|
||||||
.colormap: resb 48 ; 16 color palette
|
colormap rb 48 ; 16 color palette
|
||||||
.reserved1: resb 1
|
reserved1 rb 1
|
||||||
.nplanes: resb 1 ; # of color planes
|
nplanes rb 1 ; # of color planes
|
||||||
.bytesperline: resw 1 ; # of bytes per scanline. always even
|
bytesperline rw 1 ; # of bytes per scanline. always even
|
||||||
.palinfo: resw 1 ; 1 = color/bw, 2 = grayscale
|
palinfo rw 1 ; 1 = color/bw, 2 = grayscale
|
||||||
.hscreensize: resw 1 ; horizontal screen size
|
hscreensize rw 1 ; horizontal screen size
|
||||||
.vscreensize: resw 1 ; vertical screen size
|
vscreensize rw 1 ; vertical screen size
|
||||||
.reserved2: resb 54
|
reserved2 rb 54
|
||||||
endstruc
|
ends
|
||||||
|
|
||||||
|
|
||||||
section .text
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +92,7 @@ loadPCX:
|
|||||||
.decode:
|
.decode:
|
||||||
lodsb ; read byte from input stream
|
lodsb ; read byte from input stream
|
||||||
cmp al,192 ; encoded/unencoded byte ?
|
cmp al,192 ; encoded/unencoded byte ?
|
||||||
jae short .encoded
|
jae .encoded
|
||||||
lea edx,[eax*2+eax] ; read color values from
|
lea edx,[eax*2+eax] ; read color values from
|
||||||
mov al,[ebx+edx+2] ; palette and store them
|
mov al,[ebx+edx+2] ; palette and store them
|
||||||
stosb ; in the destination image
|
stosb ; in the destination image
|
||||||
@@ -107,7 +101,7 @@ loadPCX:
|
|||||||
mov al,[ebx+edx+0]
|
mov al,[ebx+edx+0]
|
||||||
stosb
|
stosb
|
||||||
dec ebp ; one less to go...
|
dec ebp ; one less to go...
|
||||||
jmp short .continue
|
jmp .continue
|
||||||
.encoded:
|
.encoded:
|
||||||
and al,00111111b ; calc # of times to repeat
|
and al,00111111b ; calc # of times to repeat
|
||||||
mov cl,al
|
mov cl,al
|
||||||
@@ -127,11 +121,8 @@ loadPCX:
|
|||||||
xor ah,ah ; reset ah to 0 !
|
xor ah,ah ; reset ah to 0 !
|
||||||
.continue:
|
.continue:
|
||||||
or ebp,ebp ; all pixels decoded ?
|
or ebp,ebp ; all pixels decoded ?
|
||||||
jnz short .decode
|
jnz .decode
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
@@ -18,12 +18,6 @@
|
|||||||
; along with C4; if not, write to the Free Software
|
; along with C4; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
%infdef _RANDOMAI_INC
|
|
||||||
%define _RANDOMAI_INC
|
|
||||||
|
|
||||||
section .text
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
; randomaiGetMove
|
; randomaiGetMove
|
||||||
@@ -47,4 +41,3 @@ randomaiGetMove
|
|||||||
mov eax,edx ; return move
|
mov eax,edx ; return move
|
||||||
ret
|
ret
|
||||||
|
|
||||||
%endif
|
|
@@ -18,10 +18,6 @@
|
|||||||
; along with C4; if not, write to the Free Software
|
; along with C4; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
%ifndef _RNG_INC
|
|
||||||
%define _RNG_INC
|
|
||||||
|
|
||||||
section .data
|
|
||||||
|
|
||||||
|
|
||||||
; random seed
|
; random seed
|
||||||
@@ -29,9 +25,6 @@ seed dd 0
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
section .text
|
|
||||||
|
|
||||||
|
|
||||||
;**********************************************************
|
;**********************************************************
|
||||||
; randomize
|
; randomize
|
||||||
; initialize random number generator.
|
; initialize random number generator.
|
||||||
@@ -43,8 +36,7 @@ seed dd 0
|
|||||||
;**********************************************************
|
;**********************************************************
|
||||||
randomize:
|
randomize:
|
||||||
push eax
|
push eax
|
||||||
mov eax,MOS_SC_GETSYSCLOCK
|
mcall SF_GET_SYS_TIME
|
||||||
int 0x40
|
|
||||||
mov [seed],eax
|
mov [seed],eax
|
||||||
pop eax
|
pop eax
|
||||||
ret
|
ret
|
||||||
@@ -72,5 +64,3 @@ rand:
|
|||||||
pop edx
|
pop edx
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
|
|
||||||
%endif
|
|
@@ -16,63 +16,52 @@
|
|||||||
; along with this program; if not, write to the Free Software
|
; along with this program; if not, write to the Free Software
|
||||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
%ifndef _WINDOWS_INC
|
|
||||||
%define _WINDOWS_INC
|
|
||||||
|
|
||||||
|
WND_CENTER equ (1 shl 0)
|
||||||
WND_CENTER equ (1 << 0)
|
WND_DEFAULT_WORKCOLOR equ (1 shl 1)
|
||||||
WND_DEFAULT_WORKCOLOR equ (1 << 1)
|
WND_DEFAULT_GRABCOLOR equ (1 shl 2)
|
||||||
WND_DEFAULT_GRABCOLOR equ (1 << 2)
|
WND_DEFAULT_FRAMECOLOR equ (1 shl 3)
|
||||||
WND_DEFAULT_FRAMECOLOR equ (1 << 3)
|
WND_DEFAULT_CAPTIONCOLOR equ (1 shl 4)
|
||||||
WND_DEFAULT_CAPTIONCOLOR equ (1 << 4)
|
|
||||||
WND_DEFAULT_COLORS equ (WND_DEFAULT_WORKCOLOR | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR)
|
WND_DEFAULT_COLORS equ (WND_DEFAULT_WORKCOLOR | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR)
|
||||||
|
|
||||||
|
|
||||||
struc WND
|
struct WND
|
||||||
.xposandsize resd 1 ; x position and size (like syscall)
|
xposandsize rd 1 ; x position and size (like syscall)
|
||||||
.yposandsize resd 1 ; y position and size (like syscall)
|
yposandsize rd 1 ; y position and size (like syscall)
|
||||||
.workcolor resd 1 ; work area color (like syscall)
|
workcolor rd 1 ; work area color (like syscall)
|
||||||
.grabcolor resd 1 ; grab bar color (like syscall)
|
grabcolor rd 1 ; grab bar color (like syscall)
|
||||||
.framecolor resd 1 ; frame color (like syscall)
|
framecolor rd 1 ; frame color (like syscall)
|
||||||
.caption resd 1 ; pointer to caption (zero terminated)
|
caption rd 1 ; pointer to caption (zero terminated)
|
||||||
; can be zero, if no caption is desired.
|
; can be zero, if no caption is desired.
|
||||||
.captioncolor resd 1 ; caption color
|
captioncolor rd 1 ; caption color
|
||||||
.flags resd 1 ; combination of WND_xxx flags, or zero.
|
flags rd 1 ; combination of WND_xxx flags, or zero.
|
||||||
endstruc
|
ends
|
||||||
|
|
||||||
|
USE_SYSTEM_COLORS equ 0 ;0 or 1
|
||||||
|
BUTTON_COLOR_WORK equ 0x505050
|
||||||
|
|
||||||
|
|
||||||
BUTTON_COLOR_GRAB equ 0x01000000
|
struct BUTTON
|
||||||
BUTTON_COLOR_WORK equ 0x02000000
|
xposandsize rd 1 ; x position and size (like syscall)
|
||||||
|
yposandsize rd 1 ; y position and size (like syscall)
|
||||||
|
id rd 1 ; button id
|
||||||
struc BUTTON
|
color rd 1 ; button color. can be a real color
|
||||||
.xposandsize resd 1 ; x position and size (like syscall)
|
|
||||||
.yposandsize resd 1 ; y position and size (like syscall)
|
|
||||||
.id resd 1 ; button id
|
|
||||||
.color resd 1 ; button color. can be a real color
|
|
||||||
; or one of the BUTTON_COLOR_xxx constants
|
; or one of the BUTTON_COLOR_xxx constants
|
||||||
endstruc
|
ends
|
||||||
|
|
||||||
|
|
||||||
LABEL_COLOR_GRABBUTTON equ 0x01000000 ; use grab button text default color
|
LABEL_COLOR_WORKBUTTON equ 0xffffff ; use work button text default color
|
||||||
LABEL_COLOR_GRAB equ 0x02000000 ; use grab text default color
|
|
||||||
LABEL_COLOR_WORKBUTTON equ 0x03000000 ; use work button text default color
|
|
||||||
LABEL_COLOR_WORK equ 0x04000000 ; use work text default color
|
|
||||||
LABEL_BGCOLOR_TRANSPARENT equ 0x01000000 ; transparent
|
LABEL_BGCOLOR_TRANSPARENT equ 0x01000000 ; transparent
|
||||||
LABEL_BGCOLOR_WORK equ 0x02000000 ; use work area color
|
|
||||||
|
|
||||||
|
|
||||||
struc LABEL
|
struct LABEL
|
||||||
.position resd 1 ; position, x in upper word, y in lower word
|
position rd 1 ; position, x in upper word, y in lower word
|
||||||
.caption resd 1 ; pointer to caption (zero terminated)
|
caption rd 1 ; pointer to caption (zero terminated)
|
||||||
; if this is field is zero, the label will
|
; if this is field is zero, the label will
|
||||||
; not be drawn.
|
; not be drawn.
|
||||||
.color resd 1 ; text color, or a LABEL_COLOR_xxx constant
|
color rd 1 ; text color, or a LABEL_COLOR_xxx constant
|
||||||
.bgcolor resd 1 ; background color, or a LABEL_BGCOLOR_xxx constant
|
bgcolor rd 1 ; background color, or a LABEL_BGCOLOR_xxx constant
|
||||||
endstruc
|
ends
|
||||||
|
|
||||||
|
|
||||||
section .text
|
|
||||||
|
|
||||||
|
|
||||||
;***********************************************************
|
;***********************************************************
|
||||||
@@ -87,61 +76,47 @@ endstruc
|
|||||||
;***********************************************************
|
;***********************************************************
|
||||||
|
|
||||||
drawWindow:
|
drawWindow:
|
||||||
|
|
||||||
%define WNDCOLORS ebp-MOS_WNDCOLORS_size
|
|
||||||
|
|
||||||
enter MOS_WNDCOLORS_size,0
|
|
||||||
pushfd
|
pushfd
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
; get default window colors
|
; get default window colors
|
||||||
mov ebx,3
|
mcall SF_STYLE_SETTINGS,3,sc,sizeof.system_colors
|
||||||
lea ecx,[WNDCOLORS]
|
|
||||||
mov edx,MOS_WNDCOLORS_size
|
|
||||||
mov eax,MOS_SC_WINDOWPROPERTIES
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; window position
|
; window position
|
||||||
;
|
;
|
||||||
test dword [edi + WND.flags],WND_CENTER ; center window ?
|
test dword [edi + WND.flags],WND_CENTER ; center window ?
|
||||||
jnz short .center
|
jnz .center
|
||||||
mov ebx,[edi + WND.xposandsize] ; nope -> just load dimensions
|
mov ebx,[edi + WND.xposandsize] ; nope -> just load dimensions
|
||||||
mov ecx,[edi + WND.yposandsize]
|
mov ecx,[edi + WND.yposandsize]
|
||||||
jmp short .positionok
|
jmp .positionok
|
||||||
.center: ; so let's center this window...
|
.center: ; so let's center this window...
|
||||||
MOS_GETSCREENMAX ; get screen dimensions
|
mcall SF_GET_SCREEN_SIZE ; get screen dimensions
|
||||||
mov ebx,eax ; xpos = (screenx-width)/2
|
mov ebx,eax ; xpos = (screenx-width)/2
|
||||||
shr ebx,16
|
shr ebx,16
|
||||||
sub bx,[edi + WND.xposandsize]
|
sub bx,word[edi + WND.xposandsize]
|
||||||
jns short .xok
|
jns .xok
|
||||||
xor ebx,ebx
|
xor ebx,ebx
|
||||||
.xok:
|
.xok:
|
||||||
shl ebx,15 ; / 2, move result to hi-word
|
shl ebx,15 ; / 2, move result to hi-word
|
||||||
mov bx,[edi + WND.xposandsize]
|
mov bx,word[edi + WND.xposandsize]
|
||||||
movzx ecx,ax ; same for ypos
|
movzx ecx,ax ; same for ypos
|
||||||
sub cx,[edi + WND.yposandsize]
|
sub cx,word[edi + WND.yposandsize]
|
||||||
jns short .yok
|
jns .yok
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
.yok:
|
.yok:
|
||||||
shl ecx,15
|
shl ecx,15
|
||||||
mov cx,[edi + WND.yposandsize]
|
mov cx,word[edi + WND.yposandsize]
|
||||||
.positionok: ; ebx/ecx contain dimensions
|
.positionok: ; ebx/ecx contain dimensions
|
||||||
|
|
||||||
push edi
|
|
||||||
|
|
||||||
; define window
|
; define window
|
||||||
mov eax,MOS_SC_DEFINEWINDOW
|
|
||||||
mov edx,[edi + WND.workcolor]
|
mov edx,[edi + WND.workcolor]
|
||||||
mov edi,windowtitle
|
mov edi,windowtitle
|
||||||
int 0x40
|
mcall SF_CREATE_WINDOW
|
||||||
pop edi
|
|
||||||
|
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
leave
|
|
||||||
ret
|
ret
|
||||||
%undef WNDCOLORS
|
|
||||||
|
|
||||||
|
|
||||||
;***********************************************************
|
;***********************************************************
|
||||||
@@ -153,53 +128,40 @@ drawWindow:
|
|||||||
; destroys: nothing
|
; destroys: nothing
|
||||||
; notes: you must call begin redraw/end redraw yourself
|
; notes: you must call begin redraw/end redraw yourself
|
||||||
;***********************************************************
|
;***********************************************************
|
||||||
|
align 4
|
||||||
drawButtons:
|
drawButtons:
|
||||||
|
|
||||||
%define WNDCOLORS ebp-MOS_WNDCOLORS_size
|
|
||||||
|
|
||||||
or ecx,ecx
|
or ecx,ecx
|
||||||
jnz short .ok
|
jnz .ok
|
||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
enter MOS_WNDCOLORS_size,0
|
|
||||||
pushfd
|
pushfd
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
; get default window colors
|
; get default window colors
|
||||||
|
if USE_SYSTEM_COLORS eq 1
|
||||||
push ecx
|
push ecx
|
||||||
mov ebx,3
|
mcall SF_STYLE_SETTINGS,3,sc,sizeof.system_colors
|
||||||
lea ecx,[WNDCOLORS]
|
|
||||||
mov edx,MOS_WNDCOLORS_size
|
|
||||||
mov eax,MOS_SC_WINDOWPROPERTIES
|
|
||||||
int 0x40
|
|
||||||
pop ecx
|
pop ecx
|
||||||
|
end if
|
||||||
|
align 4
|
||||||
.drawall:
|
.drawall:
|
||||||
push ecx
|
push ecx
|
||||||
mov ebx,[edi + BUTTON.xposandsize]
|
mov ebx,[edi + BUTTON.xposandsize]
|
||||||
mov ecx,[edi + BUTTON.yposandsize]
|
mov ecx,[edi + BUTTON.yposandsize]
|
||||||
mov edx,[edi + BUTTON.id]
|
mov edx,[edi + BUTTON.id]
|
||||||
mov esi,[edi + BUTTON.color]
|
if USE_SYSTEM_COLORS eq 1
|
||||||
cmp esi,BUTTON_COLOR_GRAB ; use a default color ?
|
mov esi,[sc.work_button] ; use a system color
|
||||||
jne .ok1
|
else
|
||||||
mov esi,[WNDCOLORS + MOS_WNDCOLORS.grabButton]
|
mov esi,[edi + BUTTON.color] ; use a default color
|
||||||
.ok1:
|
end if
|
||||||
cmp esi,BUTTON_COLOR_WORK
|
mcall SF_DEFINE_BUTTON
|
||||||
jne .ok2
|
add edi,sizeof.BUTTON
|
||||||
mov esi,[WNDCOLORS + MOS_WNDCOLORS.workButton]
|
|
||||||
.ok2:
|
|
||||||
mov eax,MOS_SC_DEFINEBUTTON
|
|
||||||
int 0x40
|
|
||||||
add edi,BUTTON_size
|
|
||||||
pop ecx
|
pop ecx
|
||||||
loop .drawall
|
loop .drawall
|
||||||
|
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
leave
|
|
||||||
ret
|
ret
|
||||||
%undef WNDCOLORS
|
|
||||||
|
|
||||||
|
|
||||||
;***********************************************************
|
;***********************************************************
|
||||||
@@ -210,33 +172,27 @@ drawButtons:
|
|||||||
; output: nothing
|
; output: nothing
|
||||||
; destroys: nothing
|
; destroys: nothing
|
||||||
;***********************************************************
|
;***********************************************************
|
||||||
|
align 4
|
||||||
drawLabels:
|
drawLabels:
|
||||||
|
|
||||||
%define WNDCOLORS ebp-MOS_WNDCOLORS_size
|
|
||||||
|
|
||||||
or ecx,ecx
|
or ecx,ecx
|
||||||
jnz short .ok
|
jnz .ok
|
||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
enter MOS_WNDCOLORS_size,0
|
|
||||||
pushfd
|
pushfd
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
; get default window colors
|
; get default window colors
|
||||||
|
if USE_SYSTEM_COLORS eq 1
|
||||||
push ecx
|
push ecx
|
||||||
mov ebx,3
|
mcall SF_STYLE_SETTINGS,3,sc,sizeof.system_colors
|
||||||
lea ecx,[WNDCOLORS]
|
|
||||||
mov edx,MOS_WNDCOLORS_size
|
|
||||||
mov eax,MOS_SC_WINDOWPROPERTIES
|
|
||||||
int 0x40
|
|
||||||
pop ecx
|
pop ecx
|
||||||
|
end if
|
||||||
|
|
||||||
.drawall:
|
.drawall:
|
||||||
push ecx
|
push ecx
|
||||||
|
|
||||||
cmp dword [edi + LABEL.caption],0
|
cmp dword [edi + LABEL.caption],0
|
||||||
jne short .notnull
|
jne .notnull
|
||||||
jmp .next
|
jmp .next
|
||||||
.notnull:
|
.notnull:
|
||||||
|
|
||||||
@@ -261,41 +217,28 @@ drawLabels:
|
|||||||
mov bx,ax
|
mov bx,ax
|
||||||
mov ecx,[edi + LABEL.position] ; ecx = ystart/height
|
mov ecx,[edi + LABEL.position] ; ecx = ystart/height
|
||||||
shl ecx,16
|
shl ecx,16
|
||||||
mov cx,8
|
mov cx,8
|
||||||
|
if USE_SYSTEM_COLORS eq 1
|
||||||
|
mov edx,[sc.work]
|
||||||
|
else
|
||||||
mov edx,[edi + LABEL.bgcolor]
|
mov edx,[edi + LABEL.bgcolor]
|
||||||
cmp edx,LABEL_BGCOLOR_WORK
|
end if
|
||||||
jne short .bgcolorok
|
mcall SF_DRAW_RECT
|
||||||
mov edx,[WNDCOLORS + MOS_WNDCOLORS.work]
|
|
||||||
.bgcolorok:
|
|
||||||
mov eax,MOS_SC_DRAWBAR
|
|
||||||
int 0x40
|
|
||||||
.clearok:
|
.clearok:
|
||||||
|
|
||||||
; draw label
|
; draw label
|
||||||
mov ebx,[edi + LABEL.position] ; ebx = label position
|
mov ebx,[edi + LABEL.position] ; ebx = label position
|
||||||
mov edx,[edi + LABEL.caption] ; edx -> caption
|
mov edx,[edi + LABEL.caption] ; edx -> caption
|
||||||
|
|
||||||
|
if USE_SYSTEM_COLORS eq 1
|
||||||
|
mov ecx,[sc.work_button_text]
|
||||||
|
else
|
||||||
mov ecx,[edi + LABEL.color] ; ecx = color
|
mov ecx,[edi + LABEL.color] ; ecx = color
|
||||||
cmp ecx,LABEL_COLOR_GRABBUTTON
|
end if
|
||||||
jne short .ok1
|
mcall SF_DRAW_TEXT
|
||||||
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabButtonText]
|
|
||||||
.ok1:
|
|
||||||
cmp ecx,LABEL_COLOR_GRAB
|
|
||||||
jne short .ok2
|
|
||||||
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabText]
|
|
||||||
.ok2:
|
|
||||||
cmp ecx,LABEL_COLOR_WORKBUTTON
|
|
||||||
jne short .ok3
|
|
||||||
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.workButtonText]
|
|
||||||
.ok3:
|
|
||||||
cmp ecx,LABEL_COLOR_WORK
|
|
||||||
jne short .ok4
|
|
||||||
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.workText]
|
|
||||||
.ok4:
|
|
||||||
mov eax,MOS_SC_WRITETEXT
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
.next:
|
.next:
|
||||||
add edi,LABEL_size ; next label
|
add edi,sizeof.LABEL ; next label
|
||||||
pop ecx
|
pop ecx
|
||||||
dec ecx
|
dec ecx
|
||||||
jz .done
|
jz .done
|
||||||
@@ -304,9 +247,5 @@ drawLabels:
|
|||||||
|
|
||||||
popad
|
popad
|
||||||
popfd
|
popfd
|
||||||
leave
|
|
||||||
ret
|
ret
|
||||||
%undef WNDCOLORS
|
|
||||||
|
|
||||||
|
|
||||||
%endif
|
|
@@ -1,2 +1,2 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
tup.rule("fillscr.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "fillscr")
|
tup.rule("fillscr.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fillscr")
|
||||||
|
3
programs/media/FillScr/build.bat
Normal file
3
programs/media/FillScr/build.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@fasm.exe -m 16384 fillscr.asm fillscr.kex
|
||||||
|
@kpack fillscr.kex
|
||||||
|
pause
|
@@ -1,28 +1,29 @@
|
|||||||
; to compile: nasm -f bin fillscr.asm -o fillscr ;
|
|
||||||
; to generate random colors use "fillscr rnd" ;
|
; to generate random colors use "fillscr rnd" ;
|
||||||
; otherwise use "filscr r,g,b, r,g,b, r,g,b,..." ;
|
; otherwise use "filscr r,g,b, r,g,b, r,g,b,..." ;
|
||||||
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 program.params
|
||||||
|
dd 0
|
||||||
; ---------------------------- ;
|
; ---------------------------- ;
|
||||||
points equ END
|
|
||||||
POINTS_SIZE equ 108
|
include '../../macros.inc'
|
||||||
PARAMS_SIZE equ 256
|
include '../../KOSfuncs.inc'
|
||||||
; ---------------------------- ;
|
|
||||||
MENUET01 db 'MENUET01'
|
|
||||||
version dd 1
|
|
||||||
program.start dd START
|
|
||||||
program.end dd END
|
|
||||||
program.memory dd END + POINTS_SIZE + PARAMS_SIZE
|
|
||||||
program.stack dd 0
|
|
||||||
program.params dd END + POINTS_SIZE
|
|
||||||
program.path dd 0
|
|
||||||
; ---------------------------- ;
|
; ---------------------------- ;
|
||||||
|
POINTS_SIZE = 108
|
||||||
points_count dd 0
|
points_count dd 0
|
||||||
rnd dd 0
|
rnd dd 0
|
||||||
; ---------------------------- ;
|
; ---------------------------- ;
|
||||||
START:
|
align 4
|
||||||
|
program.start:
|
||||||
mov edi, points
|
mov edi, points
|
||||||
mov esi, [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
|
||||||
@@ -125,32 +126,29 @@ START:
|
|||||||
@@:
|
@@:
|
||||||
add edx, 2
|
add edx, 2
|
||||||
sub eax, edx
|
sub eax, edx
|
||||||
jnle @@
|
jnle @b
|
||||||
sbb edx, -1
|
sbb edx, -1
|
||||||
shr edx, 1
|
shr edx, 1
|
||||||
; set width, height
|
; set width, height
|
||||||
mov eax, 15
|
|
||||||
mov ebx, 1
|
|
||||||
mov ecx, edx
|
mov ecx, edx
|
||||||
int 64
|
mcall SF_BACKGROUND_SET,SSF_SIZE_BG
|
||||||
; set "stretch"
|
; set "stretch"
|
||||||
; mov eax, 15
|
mcall ,SSF_MODE_BG
|
||||||
mov ebx, 4
|
|
||||||
mov ecx, 2
|
|
||||||
int 64
|
|
||||||
; put pixels
|
; put pixels
|
||||||
; mov eax, 15
|
|
||||||
mov ebx, 5
|
|
||||||
mov ecx, points ; BBGGRRBBGGRR...
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov esi, [points_count] ; size of data = count * 3
|
mov esi, [points_count] ; size of data = count * 3
|
||||||
lea esi, [esi * 2 + esi]
|
lea esi, [esi * 2 + esi]
|
||||||
int 64
|
mcall ,SSF_IMAGE_BG, points ; BBGGRRBBGGRR...
|
||||||
; refresh screen
|
; refresh screen
|
||||||
; mov eax, 15
|
mcall ,SSF_REDRAW_BG
|
||||||
mov ebx, 3
|
|
||||||
int 64
|
|
||||||
; thread terminate
|
; thread terminate
|
||||||
mov eax, -1
|
mcall SF_TERMINATE_PROCESS
|
||||||
int 64
|
|
||||||
END:
|
align 4
|
||||||
|
program.end:
|
||||||
|
points rb POINTS_SIZE
|
||||||
|
program.params rb 256
|
||||||
|
rb 256
|
||||||
|
align 16
|
||||||
|
program.stack:
|
||||||
|
program.memory:
|
@@ -1,2 +0,0 @@
|
|||||||
nasm -f bin fillscr.asm -o fillscr
|
|
||||||
pause
|
|
@@ -1,11 +1,21 @@
|
|||||||
; Timer with three buttons ;
|
; Timer with three buttons ;
|
||||||
; %define lang "ru_RU"
|
; %define lang "ru_RU"
|
||||||
; %define lang "it_IT"
|
; %define lang "it_IT"
|
||||||
ORG 0
|
use32
|
||||||
BITS 32
|
org 0
|
||||||
; ---------------------------------------------------------------------------- ;
|
db 'MENUET01'
|
||||||
STACK_SIZE equ 256
|
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'
|
||||||
|
include 'lang.inc'
|
||||||
|
; ---------------------------------------------------------------------------- ;
|
||||||
BUTTON_START equ 2
|
BUTTON_START equ 2
|
||||||
BUTTON_PAUSE equ 3
|
BUTTON_PAUSE equ 3
|
||||||
BUTTON_RESET equ 4
|
BUTTON_RESET equ 4
|
||||||
@@ -19,33 +29,24 @@ CHAR_WIDTH equ 6
|
|||||||
CHAR2_WIDTH equ 8
|
CHAR2_WIDTH equ 8
|
||||||
CHAR_HEIGHT equ 9
|
CHAR_HEIGHT equ 9
|
||||||
|
|
||||||
BUTTON_START_WIDTH equ (BUTTON_PADDING * 2) + (sz_start.end - sz_start) * CHAR_WIDTH
|
BUTTON_START_WIDTH = (BUTTON_PADDING * 2) + (sz_start.end - sz_start) * CHAR_WIDTH
|
||||||
BUTTON_PAUSE_WIDTH equ (BUTTON_PADDING * 2) + (sz_pause.end - sz_pause) * CHAR_WIDTH
|
BUTTON_PAUSE_WIDTH = (BUTTON_PADDING * 2) + (sz_pause.end - sz_pause) * CHAR_WIDTH
|
||||||
BUTTON_RESET_WIDTH equ (BUTTON_PADDING * 2) + (sz_reset.end - sz_reset) * CHAR_WIDTH
|
BUTTON_RESET_WIDTH = (BUTTON_PADDING * 2) + (sz_reset.end - sz_reset) * CHAR_WIDTH
|
||||||
|
|
||||||
BUTTON_HEIGHT equ (BUTTON_PADDING * 2) + CHAR_HEIGHT + 1
|
BUTTON_HEIGHT = (BUTTON_PADDING * 2) + CHAR_HEIGHT + 1
|
||||||
|
|
||||||
WINDOW_WIDTH equ (BORDER_SIZE * 2) + (MARGIN * 2) + (BUTTON_MARGIN * 2) + (BUTTON_START_WIDTH + BUTTON_PAUSE_WIDTH + BUTTON_RESET_WIDTH)
|
WINDOW_WIDTH = (BORDER_SIZE * 2) + (MARGIN * 2) + (BUTTON_MARGIN * 2) + (BUTTON_START_WIDTH + BUTTON_PAUSE_WIDTH + BUTTON_RESET_WIDTH)
|
||||||
|
|
||||||
TIME_AREA_WIDTH equ (CHAR2_WIDTH * 8) ; HH MM SS
|
TIME_AREA_WIDTH = (CHAR2_WIDTH * 8) ; HH MM SS
|
||||||
TIME_AREA_LEFT equ (WINDOW_WIDTH - BORDER_SIZE * 2 - TIME_AREA_WIDTH) / 2
|
TIME_AREA_LEFT = (WINDOW_WIDTH - BORDER_SIZE * 2 - TIME_AREA_WIDTH) / 2
|
||||||
TIME_AREA_TOP equ MARGIN + 1
|
TIME_AREA_TOP = MARGIN + 1
|
||||||
|
|
||||||
TEXT_ON_BUTTONS_TOP equ (MARGIN + CHAR_HEIGHT + MARGIN + BUTTON_PADDING) + 1
|
TEXT_ON_BUTTONS_TOP = (MARGIN + CHAR_HEIGHT + MARGIN + BUTTON_PADDING) + 1
|
||||||
|
|
||||||
BUTTON_START_BACK_COLOR equ 0x880000
|
BUTTON_START_BACK_COLOR equ 0x880000
|
||||||
BUTTON_PAUSE_BACK_COLOR equ 0x008800
|
BUTTON_PAUSE_BACK_COLOR equ 0x008800
|
||||||
BUTTON_RESET_BACK_COLOR equ 0x000088
|
BUTTON_RESET_BACK_COLOR equ 0x000088
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
MENUET01 db 'MENUET01'
|
|
||||||
version dd 1
|
|
||||||
program.start dd START
|
|
||||||
program.end dd END
|
|
||||||
program.memory dd END + STACK_SIZE
|
|
||||||
program.stack dd END + STACK_SIZE
|
|
||||||
program.params dd 0
|
|
||||||
program.path dd 0
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
|
||||||
screen:
|
screen:
|
||||||
.height dw 0
|
.height dw 0
|
||||||
.width dw 0
|
.width dw 0
|
||||||
@@ -56,17 +57,7 @@ window:
|
|||||||
.width dd WINDOW_WIDTH
|
.width dd WINDOW_WIDTH
|
||||||
.height dd 0
|
.height dd 0
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
sc:
|
sc system_colors
|
||||||
.frames dd 0
|
|
||||||
.grab dd 0
|
|
||||||
.work_dark dd 0
|
|
||||||
.work_light dd 0
|
|
||||||
.grab_text dd 0
|
|
||||||
.work dd 0
|
|
||||||
.work_button dd 0
|
|
||||||
.work_button_text dd 0
|
|
||||||
.work_text dd 0
|
|
||||||
.work_graph dd 0
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
timer_ticks dd 0
|
timer_ticks dd 0
|
||||||
last_timer_ticks dd 0
|
last_timer_ticks dd 0
|
||||||
@@ -88,16 +79,16 @@ ButtonEvents:
|
|||||||
.pause dd EmptyProc ; at start Pause must not work
|
.pause dd EmptyProc ; at start Pause must not work
|
||||||
.reset dd On_ButtonReset
|
.reset dd On_ButtonReset
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
%ifidn lang, "ru_RU"
|
if lang eq ru_RU
|
||||||
sz_timer db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",0
|
sz_timer db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",0
|
||||||
|
|
||||||
sz_start: db "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
sz_start: db "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||||
.end: db 0
|
.end: db 0
|
||||||
sz_pause: db "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
sz_pause: db "<22><>㧠"
|
||||||
.end: db 0
|
.end: db 0
|
||||||
sz_reset: db "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
sz_reset: db "<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||||
.end: db 0
|
.end: db 0
|
||||||
%elifidn lang, "it_IT"
|
else if lang eq it_IT
|
||||||
sz_timer db "Timer",0
|
sz_timer db "Timer",0
|
||||||
|
|
||||||
sz_start: db "lancio"
|
sz_start: db "lancio"
|
||||||
@@ -106,7 +97,7 @@ ButtonEvents:
|
|||||||
.end: db 0
|
.end: db 0
|
||||||
sz_reset: db "reset"
|
sz_reset: db "reset"
|
||||||
.end: db 0
|
.end: db 0
|
||||||
%else
|
else
|
||||||
sz_timer db "Timer",0
|
sz_timer db "Timer",0
|
||||||
|
|
||||||
sz_start: db "start"
|
sz_start: db "start"
|
||||||
@@ -115,13 +106,12 @@ ButtonEvents:
|
|||||||
.end: db 0
|
.end: db 0
|
||||||
sz_reset: db "reset"
|
sz_reset: db "reset"
|
||||||
.end: db 0
|
.end: db 0
|
||||||
%endif
|
end if
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
START:
|
align 4
|
||||||
|
program.start:
|
||||||
; get.screen.size
|
; get.screen.size
|
||||||
mov eax, 61
|
mcall SF_GET_GRAPHICAL_PARAMS,SSF_SCREEN_SIZE
|
||||||
mov ebx, 1
|
|
||||||
int 64
|
|
||||||
mov [screen], eax
|
mov [screen], eax
|
||||||
|
|
||||||
movzx eax, word[screen.width]
|
movzx eax, word[screen.width]
|
||||||
@@ -130,9 +120,7 @@ START:
|
|||||||
mov [window.left], eax
|
mov [window.left], eax
|
||||||
|
|
||||||
; skin.height
|
; skin.height
|
||||||
mov eax, 48
|
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
|
||||||
mov ebx, 4
|
|
||||||
int 64
|
|
||||||
add eax, (MARGIN * 3) + BORDER_SIZE + BUTTON_HEIGHT + CHAR_HEIGHT
|
add eax, (MARGIN * 3) + BORDER_SIZE + BUTTON_HEIGHT + CHAR_HEIGHT
|
||||||
mov [window.height], eax
|
mov [window.height], eax
|
||||||
|
|
||||||
@@ -144,33 +132,26 @@ START:
|
|||||||
call On_Redraw
|
call On_Redraw
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
wait.event:
|
wait.event:
|
||||||
mov eax, 23
|
mcall SF_WAIT_EVENT_TIMEOUT, 50
|
||||||
mov ebx, 50
|
call dword[eax * 4 + Events]
|
||||||
int 64
|
|
||||||
call [eax * 4 + Events]
|
|
||||||
jmp wait.event
|
jmp wait.event
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_KeyPress:
|
On_KeyPress:
|
||||||
mov eax, 2
|
mcall SF_GET_KEY
|
||||||
int 64
|
|
||||||
ret
|
ret
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_ButtonPress:
|
On_ButtonPress:
|
||||||
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
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_ButtonClose:
|
On_ButtonClose:
|
||||||
or eax, -1
|
mcall SF_TERMINATE_PROCESS
|
||||||
int 64
|
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_ButtonStart:
|
On_ButtonStart:
|
||||||
; get system counter
|
; get system counter
|
||||||
mov eax, 26
|
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
|
||||||
mov ebx, 9
|
|
||||||
int 64
|
|
||||||
sub eax, [last_timer_ticks]
|
sub eax, [last_timer_ticks]
|
||||||
and [last_timer_ticks], dword 0
|
and [last_timer_ticks], dword 0
|
||||||
mov [timer_ticks], eax
|
mov [timer_ticks], eax
|
||||||
@@ -181,9 +162,7 @@ On_ButtonStart:
|
|||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_ButtonPause:
|
On_ButtonPause:
|
||||||
; get system counter
|
; get system counter
|
||||||
mov eax, 26
|
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
|
||||||
mov ebx, 9
|
|
||||||
int 64
|
|
||||||
sub eax, [timer_ticks]
|
sub eax, [timer_ticks]
|
||||||
mov [last_timer_ticks], eax
|
mov [last_timer_ticks], eax
|
||||||
mov [timer_proc], dword EmptyProc
|
mov [timer_proc], dword EmptyProc
|
||||||
@@ -204,23 +183,14 @@ On_ButtonReset:
|
|||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_Redraw:
|
On_Redraw:
|
||||||
; redraw.start
|
; redraw.start
|
||||||
mov eax, 12
|
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||||
mov ebx, 1
|
|
||||||
int 64
|
|
||||||
; get.standart.colors
|
; get.standart.colors
|
||||||
mov eax, 48
|
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||||
mov ebx, 3
|
|
||||||
mov ecx, sc
|
|
||||||
mov edx, 40
|
|
||||||
int 64
|
|
||||||
; skin.height
|
; skin.height
|
||||||
mov eax, 48
|
mcall ,SSF_GET_SKIN_HEIGHT
|
||||||
mov ebx, 4
|
|
||||||
int 64
|
|
||||||
add eax, (MARGIN * 3) + BORDER_SIZE + BUTTON_HEIGHT + CHAR_HEIGHT
|
add eax, (MARGIN * 3) + BORDER_SIZE + BUTTON_HEIGHT + CHAR_HEIGHT
|
||||||
mov [window.height], eax
|
mov [window.height], eax
|
||||||
; draw.window
|
; draw.window
|
||||||
xor eax, eax
|
|
||||||
mov ebx, [window.left]
|
mov ebx, [window.left]
|
||||||
shl ebx, 16
|
shl ebx, 16
|
||||||
add ebx, [window.width]
|
add ebx, [window.width]
|
||||||
@@ -230,51 +200,28 @@ On_Redraw:
|
|||||||
mov edx, [sc.work]
|
mov edx, [sc.work]
|
||||||
or edx, 0x34000000
|
or edx, 0x34000000
|
||||||
mov edi, sz_timer
|
mov edi, sz_timer
|
||||||
int 64
|
mcall SF_CREATE_WINDOW
|
||||||
; draw.buttons:
|
; draw.buttons:
|
||||||
mov eax, 8
|
mcall SF_DEFINE_BUTTON, (MARGIN shl 16) or BUTTON_START_WIDTH, ((MARGIN + CHAR_HEIGHT + MARGIN) shl 16) or BUTTON_HEIGHT, BUTTON_START, BUTTON_START_BACK_COLOR
|
||||||
mov ecx, ((MARGIN + CHAR_HEIGHT + MARGIN) << 16) | BUTTON_HEIGHT
|
|
||||||
|
|
||||||
mov ebx, (MARGIN << 16) | BUTTON_START_WIDTH
|
mcall , ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN) shl 16) or BUTTON_PAUSE_WIDTH,, BUTTON_PAUSE, BUTTON_PAUSE_BACK_COLOR
|
||||||
mov edx, BUTTON_START
|
|
||||||
mov esi, BUTTON_START_BACK_COLOR
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ebx, ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN) << 16) | BUTTON_PAUSE_WIDTH
|
mcall , ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN + BUTTON_PAUSE_WIDTH + BUTTON_MARGIN) shl 16) or BUTTON_RESET_WIDTH,, BUTTON_RESET, BUTTON_RESET_BACK_COLOR
|
||||||
mov edx, BUTTON_PAUSE
|
|
||||||
mov esi, BUTTON_PAUSE_BACK_COLOR
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ebx, ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN + BUTTON_PAUSE_WIDTH + BUTTON_MARGIN) << 16) | BUTTON_RESET_WIDTH
|
|
||||||
mov edx, BUTTON_RESET
|
|
||||||
mov esi, BUTTON_RESET_BACK_COLOR
|
|
||||||
int 64
|
|
||||||
;----------------------
|
;----------------------
|
||||||
; draw.texts:
|
; draw.texts:
|
||||||
mov eax, 4
|
mcall SF_DRAW_TEXT, ((MARGIN + BUTTON_PADDING + 1) shl 16) or TEXT_ON_BUTTONS_TOP, 0x80FFFFFF, sz_start
|
||||||
mov ecx, 0x80FFFFFF
|
|
||||||
|
|
||||||
mov ebx, ((MARGIN + BUTTON_PADDING + 1) << 16) | TEXT_ON_BUTTONS_TOP
|
mcall , ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN + BUTTON_PADDING + 1) shl 16) or TEXT_ON_BUTTONS_TOP,, sz_pause
|
||||||
mov edx, sz_start
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ebx, ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN + BUTTON_PADDING + 1) << 16) | TEXT_ON_BUTTONS_TOP
|
mcall , ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN + BUTTON_PAUSE_WIDTH + BUTTON_MARGIN + BUTTON_PADDING + 1) shl 16) or TEXT_ON_BUTTONS_TOP,, sz_reset
|
||||||
mov edx, sz_pause
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ebx, ((MARGIN + BUTTON_START_WIDTH + BUTTON_MARGIN + BUTTON_PAUSE_WIDTH + BUTTON_MARGIN + BUTTON_PADDING + 1) << 16) | TEXT_ON_BUTTONS_TOP
|
|
||||||
mov edx, sz_reset
|
|
||||||
int 64
|
|
||||||
;----------------------
|
;----------------------
|
||||||
call On_Idle
|
call On_Idle
|
||||||
; redraw.finish
|
; redraw.finish
|
||||||
mov eax, 12
|
mcall SF_REDRAW,SSF_END_DRAW
|
||||||
mov ebx, 2
|
|
||||||
int 64
|
|
||||||
ret
|
ret
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
DrawTime:
|
DrawTime:
|
||||||
mov ebx, (1 << 16)
|
mov ebx, (1 shl 16)
|
||||||
mov esi, [sc.work_text]
|
mov esi, [sc.work_text]
|
||||||
mov edi, [sc.work]
|
mov edi, [sc.work]
|
||||||
; HH
|
; HH
|
||||||
@@ -287,24 +234,16 @@ DrawTime:
|
|||||||
mov ecx, eax ; [hours] first digit
|
mov ecx, eax ; [hours] first digit
|
||||||
|
|
||||||
or esi, 0x70000000
|
or esi, 0x70000000
|
||||||
mov eax, 47
|
mcall SF_DRAW_NUMBER,,, (TIME_AREA_LEFT shl 16) or TIME_AREA_TOP
|
||||||
mov edx, (TIME_AREA_LEFT << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
and esi, 0x30FFFFFF
|
and esi, 0x30FFFFFF
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ecx, ebp ; [hours] second digit
|
mov ecx, ebp ; [hours] second digit
|
||||||
|
|
||||||
or esi, 0x70000000
|
or esi, 0x70000000
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
and esi, 0x30FFFFFF
|
and esi, 0x30FFFFFF
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH + 1) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH + 1) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
; MM
|
; MM
|
||||||
mov eax, [minutes]
|
mov eax, [minutes]
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
@@ -315,24 +254,16 @@ DrawTime:
|
|||||||
mov ecx, eax ; [minutes] first digit
|
mov ecx, eax ; [minutes] first digit
|
||||||
|
|
||||||
or esi, 0x70000000
|
or esi, 0x70000000
|
||||||
mov eax, 47
|
mcall SF_DRAW_NUMBER,,, ((TIME_AREA_LEFT + CHAR2_WIDTH * 3) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + CHAR2_WIDTH * 3) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
and esi, 0x30FFFFFF
|
and esi, 0x30FFFFFF
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + CHAR2_WIDTH * 3 + 1) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + CHAR2_WIDTH * 3 + 1) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ecx, ebp ; [minutes] second digit
|
mov ecx, ebp ; [minutes] second digit
|
||||||
|
|
||||||
or esi, 0x70000000
|
or esi, 0x70000000
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 3 + CHAR2_WIDTH) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 3 + CHAR2_WIDTH) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
and esi, 0x30FFFFFF
|
and esi, 0x30FFFFFF
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 3 + CHAR2_WIDTH + 1) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 3 + CHAR2_WIDTH + 1) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
; SS
|
; SS
|
||||||
mov eax, [seconds]
|
mov eax, [seconds]
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
@@ -343,24 +274,16 @@ DrawTime:
|
|||||||
mov ecx, eax ; [seconds] first digit
|
mov ecx, eax ; [seconds] first digit
|
||||||
|
|
||||||
or esi, 0x70000000
|
or esi, 0x70000000
|
||||||
mov eax, 47
|
mcall SF_DRAW_NUMBER,,, ((TIME_AREA_LEFT + CHAR2_WIDTH * 6) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + CHAR2_WIDTH * 6) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
and esi, 0x30FFFFFF
|
and esi, 0x30FFFFFF
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + CHAR2_WIDTH * 6 + 1) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + CHAR2_WIDTH * 6 + 1) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
|
|
||||||
mov ecx, ebp ; [seconds] second digit
|
mov ecx, ebp ; [seconds] second digit
|
||||||
|
|
||||||
or esi, 0x70000000
|
or esi, 0x70000000
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 6 + CHAR2_WIDTH) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 6 + CHAR2_WIDTH) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
and esi, 0x30FFFFFF
|
and esi, 0x30FFFFFF
|
||||||
mov eax, 47
|
mcall ,,, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 6 + CHAR2_WIDTH + 1) shl 16) or TIME_AREA_TOP
|
||||||
mov edx, ((TIME_AREA_LEFT + 1 + CHAR2_WIDTH * 6 + CHAR2_WIDTH + 1) << 16) | TIME_AREA_TOP
|
|
||||||
int 64
|
|
||||||
ret
|
ret
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
On_Idle:
|
On_Idle:
|
||||||
@@ -370,9 +293,7 @@ On_Idle:
|
|||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
TimerStarted:
|
TimerStarted:
|
||||||
; get system counter
|
; get system counter
|
||||||
mov eax, 26
|
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
|
||||||
mov ebx, 9
|
|
||||||
int 64
|
|
||||||
sub eax, [timer_ticks]
|
sub eax, [timer_ticks]
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov ecx, 100
|
mov ecx, 100
|
||||||
@@ -390,4 +311,9 @@ TimerStarted:
|
|||||||
EmptyProc:
|
EmptyProc:
|
||||||
ret
|
ret
|
||||||
; ---------------------------------------------------------------------------- ;
|
; ---------------------------------------------------------------------------- ;
|
||||||
END:
|
align 4
|
||||||
|
program.end:
|
||||||
|
rb 512
|
||||||
|
align 16
|
||||||
|
program.stack:
|
||||||
|
program.memory:
|
||||||
|
@@ -1,2 +1,7 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
tup.rule("Timer.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "timer")
|
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||||
|
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||||
|
add_include(tup.getvariantdir())
|
||||||
|
|
||||||
|
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
|
||||||
|
tup.rule({"Timer.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "Timer")
|
||||||
|
4
programs/other/Timer/build_en.bat
Normal file
4
programs/other/Timer/build_en.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo lang fix en_EN >lang.inc
|
||||||
|
@fasm.exe -m 16384 timer.asm timer.kex
|
||||||
|
@kpack timer.kex
|
||||||
|
pause
|
4
programs/other/Timer/build_ru.bat
Normal file
4
programs/other/Timer/build_ru.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo lang fix ru_RU >lang.inc
|
||||||
|
@fasm.exe -m 16384 timer.asm timer.kex
|
||||||
|
@kpack timer.kex
|
||||||
|
pause
|
@@ -1 +0,0 @@
|
|||||||
nasm -f bin Timer.asm -o Timer
|
|
@@ -1,2 +1,7 @@
|
|||||||
if tup.getconfig("NO_NASM") ~= "" then return end
|
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||||
tup.rule("tinfo.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "tinfo")
|
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||||
|
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||||
|
add_include(tup.getvariantdir())
|
||||||
|
|
||||||
|
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
|
||||||
|
tup.rule({"tinfo.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "tinfo")
|
||||||
|
4
programs/system/tinfo/build_en.bat
Normal file
4
programs/system/tinfo/build_en.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo lang fix en_EN >lang.inc
|
||||||
|
@fasm.exe -m 16384 tinfo.asm tinfo.kex
|
||||||
|
@kpack tinfo.kex
|
||||||
|
pause
|
4
programs/system/tinfo/build_ru.bat
Normal file
4
programs/system/tinfo/build_ru.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo lang fix ru_RU >lang.inc
|
||||||
|
@fasm.exe -m 16384 tinfo.asm tinfo.kex
|
||||||
|
@kpack tinfo.kex
|
||||||
|
pause
|
@@ -1 +0,0 @@
|
|||||||
nasm -f bin tinfo.asm -o tinfo
|
|
File diff suppressed because it is too large
Load Diff
@@ -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
|
|
Reference in New Issue
Block a user