programs/demos: Post-SVN tidy (part 2) (#412)

- Move source code from `trunk` into root directory for each program.
- Update build files and ASM include paths. Add SPDX license header where appropriate.
- Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden.

(Work towards #75, point 3)

Reviewed-on: KolibriOS/kolibrios#412
Reviewed-by: Ivan B <dunkaist@gmail.com>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: Andrew <dent.ace@gmail.com>
Co-committed-by: Andrew <dent.ace@gmail.com>
This commit is contained in:
ace-dent authored and Burer committed 2026-04-10 07:12:30 +00:00
1 parent 9ca506ed15
commit 398dcbb13d
59 files changed
+2026 -1996

No files matched your search

+9 -9
View File
@@ -451,15 +451,15 @@ tup.append_table(img_files, {
{"UNZ", VAR_PROGS .. "/fs/unz/unz"},
{"ZKEY", VAR_PROGS .. "/system/zkey/trunk/ZKEY"},
{"3D/3DWAV", VAR_PROGS .. "/demos/3dwav/3dwav"},
{"3D/CROWNSCR", VAR_PROGS .. "/demos/crownscr/trunk/crownscr"},
{"3D/CROWNSCR", VAR_PROGS .. "/demos/crownscr/crownscr"},
{"3D/3DCUBE2", VAR_PROGS .. "/demos/3dcube2/3DCUBE2"},
{"3D/FREE3D04", VAR_PROGS .. "/demos/free3d04/trunk/free3d04"},
{"3D/FREE3D04", VAR_PROGS .. "/demos/free3d04/free3d04"},
{"3D/GEARS", VAR_PROGS .. "/develop/libraries/TinyGL/asm_fork/examples/gears"},
{"3D/RAY", VAR_PROGS .. "/demos/ray/ray"},
{"3D/VIEW3DS", VAR_PROGS .. "/demos/view3ds/view3ds"},
{"DEMOS/BCDCLK", VAR_PROGS .. "/demos/bcdclk/trunk/bcdclk"},
{"DEMOS/BUDHBROT", VAR_PROGS .. "/demos/buddhabrot/trunk/buddhabrot"},
{"DEMOS/EYES", VAR_PROGS .. "/demos/eyes/trunk/eyes"},
{"DEMOS/BCDCLK", VAR_PROGS .. "/demos/bcdclk/bcdclk"},
{"DEMOS/BUDHBROT", VAR_PROGS .. "/demos/buddhabrot/buddhabrot"},
{"DEMOS/EYES", VAR_PROGS .. "/demos/eyes/eyes"},
{"DEMOS/FIREWORK", VAR_PROGS .. "/demos/firework/firework"},
{"DEMOS/MOVBACK", VAR_PROGS .. "/demos/movback/movback"},
{"DEMOS/PLASMA", VAR_PROGS .. "/demos/plasma/plasma"},
@@ -484,9 +484,9 @@ tup.append_table(img_files, {
{"DEVELOP/MSTATE", VAR_PROGS .. "/develop/mstate/mstate"},
{"DEVELOP/SCANCODE", VAR_PROGS .. "/develop/scancode/trunk/scancode"},
{"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/colorref"},
{"DEVELOP/EXAMPLES/CONGET", VAR_PROGS .. "/develop/libraries/console_coff/examples/test_gets"},
{"DEVELOP/EXAMPLES/CSLIDE", VAR_PROGS .. "/demos/cslide/trunk/cslide"},
{"DEVELOP/EXAMPLES/CSLIDE", VAR_PROGS .. "/demos/cslide/cslide"},
{"DEVELOP/EXAMPLES/THREAD", VAR_PROGS .. "/develop/examples/thread/trunk/thread"},
{"File Managers/KFAR", VAR_PROGS .. "/fs/kfar/trunk/kfar"},
{"File Managers/OPENDIAL", VAR_PROGS .. "/fs/opendial/opendial"},
@@ -599,7 +599,7 @@ tup.append_table(extra_files, {
{"HD_Load/USB_boot_old/", VAR_PROGS .. "/hd_load/usb_boot_old/MeOSload.com"},
{"HD_Load/USB_boot_old/", VAR_PROGS .. "/hd_load/usb_boot_old/enable.exe"},
{"kolibrios/3D/3dsheart", VAR_PROGS .. "/demos/3dsheart/3dsheart"},
{"kolibrios/3D/flatwav", VAR_PROGS .. "/demos/flatwav/trunk/flatwav"},
{"kolibrios/3D/flatwav", VAR_PROGS .. "/demos/flatwav/flatwav"},
{"kolibrios/3D/mos3de", VAR_PROGS .. "/demos/mos3de/mos3de"},
{"kolibrios/3D/info3ds/INFO3DS", VAR_PROGS .. "/develop/info3ds/info3ds"},
{"kolibrios/3D/textures1", VAR_PROGS .. "/develop/libraries/TinyGL/asm_fork/examples/textures1"},
@@ -760,7 +760,7 @@ tup.append_table(img_files, {
{"LIB/ICONV.OBJ", VAR_PROGS .. "/develop/libraries/iconv/iconv.obj"},
})
tup.append_table(extra_files, {
-- {"kolibrios/3D/cubeline", VAR_PROGS .. "/demos/cubeline/trunk/cubeline"},
-- {"kolibrios/3D/cubeline", VAR_PROGS .. "/demos/cubeline/cubeline"},
{"kolibrios/3D/gears", VAR_PROGS .. "/demos/gears/gears"},
{"kolibrios/emul/e80/e80", VAR_PROGS .. "/emulator/e80/e80"},
{"kolibrios/emul/uarm/", VAR_CONTRIB .. "/other/uarm/uARM"},
+8 -8
View File
@@ -207,16 +207,16 @@ fasm demos\3dtcub10\3dtcub10.asm %BIN%\3d\3dtcub10
cd demos\aclock\trunk\
nasmw -t -f bin -o ..\..\..\%BIN%\demos\aclock aclock.asm
cd ..\..\..
fasm demos\bcdclk\trunk\bcdclk.asm %BIN%\demos\bcdclk
fasm demos\bcdclk\bcdclk.asm %BIN%\demos\bcdclk
fasm demos\bgitest\trunk\bgitest.asm %BIN%\fonts\bgitest
fasm demos\colorref\trunk\colorref.asm %BIN%\demos\colorref
fasm demos\crownscr\trunk\crownscr.asm %BIN%\3d\crownscr
fasm demos\cslide\trunk\cslide.asm %BIN%\demos\cslide
fasm demos\eyes\trunk\eyes.asm %BIN%\demos\eyes
fasm demos\fire\trunk\fire.asm %BIN%\demos\fire
fasm demos\fire2\trunk\fire2.asm %BIN%\demos\fire2
fasm demos\colorref\colorref.asm %BIN%\demos\colorref
fasm demos\crownscr\crownscr.asm %BIN%\3d\crownscr
fasm demos\cslide\cslide.asm %BIN%\demos\cslide
fasm demos\eyes\eyes.asm %BIN%\demos\eyes
fasm demos\fire\fire.asm %BIN%\demos\fire
fasm demos\fire2\fire2.asm %BIN%\demos\fire2
fasm demos\firework\trunk\firework.asm %BIN%\demos\firework
fasm demos\free3d04\trunk\free3d04.asm %BIN%\3d\free3d04
fasm demos\free3d04\free3d04.asm %BIN%\3d\free3d04
fasm demos\magnify\trunk\magnify.asm %BIN%\magnify
fasm demos\movback\trunk\movback.asm %BIN%\demos\movback
fasm demos\plasma\trunk\plasma.asm %BIN%\demos\plasma
@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
@@ -1,150 +1,153 @@
;
; BCD CLOCK
;
; Compile with FASM for Menuet
;
;
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x1000
dd 0x1000
dd 0x0 , 0x0
include 'lang.inc'
include '../../../macros.inc'
START:
red:
call drawwindow
still:
mov eax,23 ; wait for timeout
mov ebx,50
mcall
cmp eax,1 ; redraw ?
je red
cmp eax, 2 ; key
je key
cmp eax,3 ; button in buffer ?
je button
call drawclock
jmp still
key:
mov eax, 2
int 0x40
jmp still
button:
mov al,17 ; get id
mcall
cmp ah,1 ; button id=1 ?
jne noclose
or eax,-1 ; close this program
mcall
noclose:
jmp still
drawclock:
mov eax,3 ; get time
mcall
bswap eax
shr eax,8
mov edi,dg1
mov ecx,6
dgtomem:
push eax
and al,0x0f
mov [edi],al
inc edi
pop eax
shr eax,4
loop dgtomem
mov ebx,79*65536+11
mov edi,dg1
digitlp:
mov ecx,10*65536+11
xor esi,esi
plotlp:
xor edx,edx
test byte[edi],8
je nobit
mov edx,0x00ff0000
nobit:
mov eax,13 ; plot 8,4,2,1
mcall
add ecx,13*65536
shl byte[edi],1
inc esi
cmp esi,4
jne plotlp
shr byte[edi],4
mov edx,0x00880040
mov eax,13 ; draw digit box
mcall
pusha
mov edx,ebx
and edx,0xffff0000
shr ecx,16
or edx,ecx
add edx,3*65536+2
mov ebx,0x00010100
mov ecx,[edi]
mov esi,0x00ffffff
mov eax,47 ; display decimal
mcall
popa
sub ebx,13*65536
inc edi
cmp edi,dg1+6
jne digitlp
ret
drawwindow:
mov eax,12
mov ebx,1 ; start redraw
mcall
mov eax, 48
mov ebx, 4
mcall
mov ecx, eax
xor eax,eax ; window
mov ebx,100*65536+113
add ecx,100*65536+87
mov edx,0x34400088
mov edi,title
mcall
call drawclock
mov eax,12
mov ebx,2 ; end redraw
mcall
ret
title db 'BCD Clock',0
I_END:
dg1: db ?
; SPDX-License-Identifier: NOASSERTION
;
;
; BCD CLOCK
;
; Compile with FASM for Menuet
;
;
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x1000
dd 0x1000
dd 0x0 , 0x0
include 'lang.inc'
include '../../macros.inc'
START:
red:
call drawwindow
still:
mov eax,23 ; wait for timeout
mov ebx,50
mcall
cmp eax,1 ; redraw ?
je red
cmp eax, 2 ; key
je key
cmp eax,3 ; button in buffer ?
je button
call drawclock
jmp still
key:
mov eax, 2
int 0x40
jmp still
button:
mov al,17 ; get id
mcall
cmp ah,1 ; button id=1 ?
jne noclose
or eax,-1 ; close this program
mcall
noclose:
jmp still
drawclock:
mov eax,3 ; get time
mcall
bswap eax
shr eax,8
mov edi,dg1
mov ecx,6
dgtomem:
push eax
and al,0x0f
mov [edi],al
inc edi
pop eax
shr eax,4
loop dgtomem
mov ebx,79*65536+11
mov edi,dg1
digitlp:
mov ecx,10*65536+11
xor esi,esi
plotlp:
xor edx,edx
test byte[edi],8
je nobit
mov edx,0x00ff0000
nobit:
mov eax,13 ; plot 8,4,2,1
mcall
add ecx,13*65536
shl byte[edi],1
inc esi
cmp esi,4
jne plotlp
shr byte[edi],4
mov edx,0x00880040
mov eax,13 ; draw digit box
mcall
pusha
mov edx,ebx
and edx,0xffff0000
shr ecx,16
or edx,ecx
add edx,3*65536+2
mov ebx,0x00010100
mov ecx,[edi]
mov esi,0x00ffffff
mov eax,47 ; display decimal
mcall
popa
sub ebx,13*65536
inc edi
cmp edi,dg1+6
jne digitlp
ret
drawwindow:
mov eax,12
mov ebx,1 ; start redraw
mcall
mov eax, 48
mov ebx, 4
mcall
mov ecx, eax
xor eax,eax ; window
mov ebx,100*65536+113
add ecx,100*65536+87
mov edx,0x34400088
mov edi,title
mcall
call drawclock
mov eax,12
mov ebx,2 ; end redraw
mcall
ret
title db 'BCD Clock',0
I_END:
dg1: db ?
File renamed without changes.
File renamed without changes.
@@ -1,357 +1,360 @@
; App written by randall ported to Kolibri and MenuetOS64 by macgub (www.macgub.hekko.pl).
; Now it use static memory, it is mixed 32bit code and SSE instructions.
include '../../../macros.inc'
include '../../../KOSfuncs.inc'
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IMG_END ; size of image
dd I_END ;0x100000 ; memory for app
dd I_END ;0xbffff ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
; start of execution
START:
call draw_window
call draw_from_buffer
call Main
call draw_from_buffer
mcall SF_SET_CAPTION,1,wintitle2
still:
mcall SF_WAIT_EVENT
cmp eax,EV_REDRAW
je .redraw
cmp eax,EV_KEY
je .key
cmp eax,EV_BUTTON
je .button
jmp still
.redraw:
call draw_window
call draw_from_buffer
jmp still
.key:
mcall SF_GET_KEY
shr eax,16 ; get scancode in 'al'
cmp al,1
je .exit
cmp al,66
je set_as_wallpaper
jmp still
.button:
mcall SF_GET_BUTTON
cmp ah,1 ; button id=1 ?
jne still
.exit:
mcall SF_TERMINATE_PROCESS
set_as_wallpaper:
mcall SF_BACKGROUND_SET,SSF_MODE_BG,2
mcall SF_BACKGROUND_SET,SSF_SIZE_BG,IMG_SIZE,IMG_SIZE
mcall SF_BACKGROUND_SET,SSF_IMAGE_BG,screen,0,3*IMG_SIZE*IMG_SIZE
mcall SF_BACKGROUND_SET,SSF_REDRAW_BG
jmp still
draw_from_buffer:
pusha
mcall SF_PUT_IMAGE,screen,IMG_SIZE*65536+IMG_SIZE,0
popa
ret
;-------------------------------------------------------------------------------
; NAME: XORWOW
; DESC: Pseudo random number generator.
; OUT: eax [0;2^32-1]
;-------------------------------------------------------------------------------
macro XORWOW {
mov edx,[g_xorwow_x] ; edx = x
shr edx,2 ; edx = x >> 2
xor edx,[g_xorwow_x] ; t = x ^ (x >> 2)
mov eax,[g_xorwow_y] ; eax = y
mov [g_xorwow_x],eax ; x = y
mov eax,[g_xorwow_z] ; eax = z
mov [g_xorwow_y],eax ; y = z
mov eax,[g_xorwow_w] ; eax = w
mov [g_xorwow_z],eax ; z = w
mov eax,[g_xorwow_v] ; eax = v
mov [g_xorwow_w],eax ; w = v
mov edi,eax ; edi = v
shl edi,4 ; edi = v << 4
xor edi,eax ; edi = (v ^ (v << 4))
mov eax,edx ; eax = t
shl eax,1 ; eax = t << 1
xor eax,edx ; eax = (t ^ (t << 1))
xor eax,edi ; eax = (v ^ (v << 4)) ^ (t ^ (t << 1))
mov [g_xorwow_v],eax ; v = eax
add [g_xorwow_d],362437 ; d += 362437
mov eax,[g_xorwow_d] ; eax = d
add eax,[g_xorwow_v] ; eax = d + v
}
;-------------------------------------------------------------------------------
; NAME: RANDOM
; DESC: Returns pseudo random number in the range [-0.5;0.5).
; OUT: xmm0.x [-0.5;0.5)
;-------------------------------------------------------------------------------
macro RANDOM {
XORWOW
cvtsi2ss xmm0,eax
mulss xmm0,[g_rand_scale]
}
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; NAME: GenerateSequence
; IN: xmm0.x re (c0.x)
; IN: xmm1.x im (c0.y)
; IN: edi array size
; IN/OUT: esi pointer to the allocated array
; OUT: eax generated sequence size
;-------------------------------------------------------------------------------
align 16
GenerateSequence:
xor eax,eax ; eax is index loop
xorps xmm4,xmm4 ; xmm4 is c.x
xorps xmm5,xmm5 ; xmm5 is c.y
.Loop:
; cn.x = c.x * c.x - c.y * c.y + c0.x
movaps xmm2,xmm4
movaps xmm3,xmm5
mulss xmm2,xmm4
mulss xmm3,xmm5
subss xmm2,xmm3
addss xmm2,xmm0
movaps xmm6,xmm2 ; xmm6 is cn.x
; cn.y = 2.0 * c.x * c.y + c0.y
movaps xmm7,xmm4
mulss xmm7,xmm5
addss xmm7,xmm7
addss xmm7,xmm1 ; xmm7 is cn.y
; store cn
movd dword [esi+eax*8],xmm6
movd dword [esi+eax*8+4],xmm7
; if (cn.x * cn.x + cn.y * cn.y > 10.0) return eax;
movaps xmm2,xmm6
movaps xmm3,xmm7
mulss xmm2,xmm6
mulss xmm3,xmm7
addss xmm2,xmm3
ucomiss xmm2,[g_max_dist]
ja .EndLoop
movaps xmm4,xmm6 ; c.x = cn.x
movaps xmm5,xmm7 ; c.y = cn.y
; continue loop
inc eax
cmp eax,edi
jb .Loop
; return 0
xor eax,eax
.EndLoop:
ret
;-------------------------------------------------------------------------------
; NAME: main
; DESC: Program main function.
;-------------------------------------------------------------------------------
align 16
Main:
img_ptr equ ebp-8
seq_ptr equ ebp-16
pixel equ ebp-24
r13dd equ ebp-64
r12dd equ ebp-68
r15dd equ ebp-72
push ebp
mov ebp,esp
sub esp,128
; mem for the sequence
lea eax,[sequence]
mov [seq_ptr],eax
; mem for the image
lea eax,[screen]
mov [img_ptr],eax
; begin loops
mov dword[r13dd],0 ; .LoopIterations counter
.LoopIterations:
mov dword[r12dd],0 ; .LoopOneMillion counter
.LoopOneMillion:
RANDOM
mulss xmm0,[g_range]
movaps xmm1,xmm0
RANDOM
mulss xmm0,[g_range]
mov edi,SEQ_SIZE
mov esi,[seq_ptr]
call GenerateSequence ; eax = n sequence size
test eax,eax
jz .LoopSequenceEnd
xor ecx,ecx ; ecx = i = 0 loop counter
; mov r9dd,[seq_ptr] ; r9 = sequence base address
; mov r8dd,[img_ptr] ; r8 = image base address
movss xmm2,[g_img_size]
movaps xmm3,xmm2
mulss xmm3,[g_0_5] ; xmm3 = (g_img_size)/2
movss xmm4,[g_zoom]
mulss xmm4,xmm2 ; xmm4 = g_zoom * g_img_size
movss xmm5,[g_offsetx] ; xmm5 = g_offsetx
movss xmm6,[g_offsety] ; xmm6 = g_offsety
.LoopSequence:
cmp ecx,eax ; i < n
je .LoopSequenceEnd
movd xmm0,[sequence+ecx*8] ; load re
movd xmm1,[sequence+ecx*8+4] ; load im
addss xmm0,xmm5 ; xmm0 = re+g_offsetx
addss xmm1,xmm6 ; xmm1 = im+g_offsety
mulss xmm0,xmm4 ; xmm0 = (re+g_offsetx)*g_img_size*g_zoom
mulss xmm1,xmm4 ; xmm1 = (im+g_offsety)*g_img_size*g_zoom
addss xmm0,xmm3 ; xmm0 = (re+g_offsetx)*g_img_size*g_zoom+g_img_size/2
addss xmm1,xmm3 ; xmm1 = (im+g_offsety)*g_img_size*g_zoom+g_img_size/2
cvtss2si edi,xmm0 ; edi = x = int(xmm0.x)
cvtss2si esi,xmm1 ; esi = y = int(xmm1.x)
cmp edi,0
jl @f
cmp edi,IMG_SIZE
jge @f
cmp esi,0
jl @f
cmp esi,IMG_SIZE
jge @f
imul esi,esi,IMG_SIZE
add esi,edi
add dword [screen+esi*4],1
@@:
inc ecx
jmp .LoopSequence
.LoopSequenceEnd:
; continue .LoopOneMillion
add dword[r12dd],1
cmp dword[r12dd],1000000
jb .LoopOneMillion
; continue .LoopIterations
add dword[r13dd],1
cmp dword[r13dd],ITERATIONS
jb .LoopIterations
; find max value
mov dword[r12dd],0
xor eax,eax ; eax = i = loop counter
.LoopMax:
push ecx
mov ecx,[r12dd]
cmp dword [screen+eax*4],ecx
cmova ecx,dword [screen+eax*4]
mov [r12dd],ecx
pop ecx
inc eax
cmp eax,IMG_SIZE*IMG_SIZE
jb .LoopMax
; find min value
; mov r13d,r12d ; r13d = min_val = max_val
push dword[r12dd]
pop dword[r13dd]
xor eax,eax ; eax = i = loop counter
.LoopMin:
push ecx
mov ecx,[r13dd]
cmp dword [screen+eax*4],ecx
cmovb ecx,dword [screen+eax*4]
mov [r13dd],ecx
pop ecx
inc eax
cmp eax,IMG_SIZE*IMG_SIZE
jb .LoopMin
; write image pixels
mov byte [pixel+3],255
; mov r14,[img_ptr] ; r14 = image base address
; xor r15d,r15d ; r15d = i = loop counter
mov dword[r15dd],0
cvtsi2ss xmm0,[r12dd] ; load max_value
cvtsi2ss xmm1,[r13dd] ; load min_value
movaps xmm2,xmm0
subss xmm2,xmm1 ; xmm2 = r = max_value - min_value
xor ecx,ecx
.LoopWrite:
mov eax,[screen+ecx*4] ; eax = image_value
sub eax,[r13dd] ; eax = image_value - min_value
cvtsi2ss xmm0,eax ; xmm0 = float(image_value - min_value)
addss xmm0,xmm0 ; xmm0 = 2.0f * float(image_value - min_value)
divss xmm0,xmm2 ; xmm0 = 2.0f * float(image_value - min_value) / r
minss xmm0,[g_1_0] ; clamp to 1.0
maxss xmm0,[g_0_0] ; clamp to 0.0
mulss xmm0,[g_255_0] ; convert to 0 - 255
cvtss2si eax,xmm0
; write pixel data
mov [screen+ecx*3],eax
inc ecx
cmp ecx,IMG_SIZE*IMG_SIZE
jb .LoopWrite
mov esp,ebp
pop ebp
ret
; restore img_ptr,seq_ptr,pixel
;-------------------------------------------------------------------------------
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
lea ecx, [50*65536+IMG_SIZE+4+eax] ; [y start] *65536 + [y size] + [skin_height]
mcall SF_CREATE_WINDOW,<50,IMG_SIZE+9>,,0x74000000,,wintitle1
mcall SF_REDRAW, SSF_END_DRAW
ret
;-------------------------------------------------------------------------------
align 1
wintitle1 db 'Buddhabrot - Calculating, please wait...',0
wintitle2 db 'Buddhabrot - Press F8 to set image as wallpaper',0
align 4
g_xorwow_x dd 123456789
g_xorwow_y dd 362436069
g_xorwow_z dd 521288629
g_xorwow_w dd 88675123
g_xorwow_v dd 5783321
g_xorwow_d dd 6615241
g_rand_scale dd 2.3283064e-10 ; 1.0 / 2^32
IMG_SIZE = 600
SEQ_SIZE = 50
ITERATIONS = 100
g_img_size dd 600.0
g_offsetx dd 0.5
g_offsety dd 0.0
g_zoom dd 0.4
g_max_dist dd 10.0
g_range dd 4.2
g_0_5 dd 0.5
g_0_0 dd 0.0
g_1_0 dd 1.0
g_255_0 dd 255.0
IMG_END:
;--------------------
sequence: rb SEQ_SIZE*8
screen: rb IMG_SIZE*IMG_SIZE*4
memStack: rd 1024
I_END:
; SPDX-License-Identifier: NOASSERTION
;
; App written by randall ported to Kolibri and MenuetOS64 by macgub (www.macgub.hekko.pl).
; Now it use static memory, it is mixed 32bit code and SSE instructions.
include '../../macros.inc'
include '../../KOSfuncs.inc'
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IMG_END ; size of image
dd I_END ;0x100000 ; memory for app
dd I_END ;0xbffff ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
; start of execution
START:
call draw_window
call draw_from_buffer
call Main
call draw_from_buffer
mcall SF_SET_CAPTION,1,wintitle2
still:
mcall SF_WAIT_EVENT
cmp eax,EV_REDRAW
je .redraw
cmp eax,EV_KEY
je .key
cmp eax,EV_BUTTON
je .button
jmp still
.redraw:
call draw_window
call draw_from_buffer
jmp still
.key:
mcall SF_GET_KEY
shr eax,16 ; get scancode in 'al'
cmp al,1
je .exit
cmp al,66
je set_as_wallpaper
jmp still
.button:
mcall SF_GET_BUTTON
cmp ah,1 ; button id=1 ?
jne still
.exit:
mcall SF_TERMINATE_PROCESS
set_as_wallpaper:
mcall SF_BACKGROUND_SET,SSF_MODE_BG,2
mcall SF_BACKGROUND_SET,SSF_SIZE_BG,IMG_SIZE,IMG_SIZE
mcall SF_BACKGROUND_SET,SSF_IMAGE_BG,screen,0,3*IMG_SIZE*IMG_SIZE
mcall SF_BACKGROUND_SET,SSF_REDRAW_BG
jmp still
draw_from_buffer:
pusha
mcall SF_PUT_IMAGE,screen,IMG_SIZE*65536+IMG_SIZE,0
popa
ret
;-------------------------------------------------------------------------------
; NAME: XORWOW
; DESC: Pseudo random number generator.
; OUT: eax [0;2^32-1]
;-------------------------------------------------------------------------------
macro XORWOW {
mov edx,[g_xorwow_x] ; edx = x
shr edx,2 ; edx = x >> 2
xor edx,[g_xorwow_x] ; t = x ^ (x >> 2)
mov eax,[g_xorwow_y] ; eax = y
mov [g_xorwow_x],eax ; x = y
mov eax,[g_xorwow_z] ; eax = z
mov [g_xorwow_y],eax ; y = z
mov eax,[g_xorwow_w] ; eax = w
mov [g_xorwow_z],eax ; z = w
mov eax,[g_xorwow_v] ; eax = v
mov [g_xorwow_w],eax ; w = v
mov edi,eax ; edi = v
shl edi,4 ; edi = v << 4
xor edi,eax ; edi = (v ^ (v << 4))
mov eax,edx ; eax = t
shl eax,1 ; eax = t << 1
xor eax,edx ; eax = (t ^ (t << 1))
xor eax,edi ; eax = (v ^ (v << 4)) ^ (t ^ (t << 1))
mov [g_xorwow_v],eax ; v = eax
add [g_xorwow_d],362437 ; d += 362437
mov eax,[g_xorwow_d] ; eax = d
add eax,[g_xorwow_v] ; eax = d + v
}
;-------------------------------------------------------------------------------
; NAME: RANDOM
; DESC: Returns pseudo random number in the range [-0.5;0.5).
; OUT: xmm0.x [-0.5;0.5)
;-------------------------------------------------------------------------------
macro RANDOM {
XORWOW
cvtsi2ss xmm0,eax
mulss xmm0,[g_rand_scale]
}
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; NAME: GenerateSequence
; IN: xmm0.x re (c0.x)
; IN: xmm1.x im (c0.y)
; IN: edi array size
; IN/OUT: esi pointer to the allocated array
; OUT: eax generated sequence size
;-------------------------------------------------------------------------------
align 16
GenerateSequence:
xor eax,eax ; eax is index loop
xorps xmm4,xmm4 ; xmm4 is c.x
xorps xmm5,xmm5 ; xmm5 is c.y
.Loop:
; cn.x = c.x * c.x - c.y * c.y + c0.x
movaps xmm2,xmm4
movaps xmm3,xmm5
mulss xmm2,xmm4
mulss xmm3,xmm5
subss xmm2,xmm3
addss xmm2,xmm0
movaps xmm6,xmm2 ; xmm6 is cn.x
; cn.y = 2.0 * c.x * c.y + c0.y
movaps xmm7,xmm4
mulss xmm7,xmm5
addss xmm7,xmm7
addss xmm7,xmm1 ; xmm7 is cn.y
; store cn
movd dword [esi+eax*8],xmm6
movd dword [esi+eax*8+4],xmm7
; if (cn.x * cn.x + cn.y * cn.y > 10.0) return eax;
movaps xmm2,xmm6
movaps xmm3,xmm7
mulss xmm2,xmm6
mulss xmm3,xmm7
addss xmm2,xmm3
ucomiss xmm2,[g_max_dist]
ja .EndLoop
movaps xmm4,xmm6 ; c.x = cn.x
movaps xmm5,xmm7 ; c.y = cn.y
; continue loop
inc eax
cmp eax,edi
jb .Loop
; return 0
xor eax,eax
.EndLoop:
ret
;-------------------------------------------------------------------------------
; NAME: main
; DESC: Program main function.
;-------------------------------------------------------------------------------
align 16
Main:
img_ptr equ ebp-8
seq_ptr equ ebp-16
pixel equ ebp-24
r13dd equ ebp-64
r12dd equ ebp-68
r15dd equ ebp-72
push ebp
mov ebp,esp
sub esp,128
; mem for the sequence
lea eax,[sequence]
mov [seq_ptr],eax
; mem for the image
lea eax,[screen]
mov [img_ptr],eax
; begin loops
mov dword[r13dd],0 ; .LoopIterations counter
.LoopIterations:
mov dword[r12dd],0 ; .LoopOneMillion counter
.LoopOneMillion:
RANDOM
mulss xmm0,[g_range]
movaps xmm1,xmm0
RANDOM
mulss xmm0,[g_range]
mov edi,SEQ_SIZE
mov esi,[seq_ptr]
call GenerateSequence ; eax = n sequence size
test eax,eax
jz .LoopSequenceEnd
xor ecx,ecx ; ecx = i = 0 loop counter
; mov r9dd,[seq_ptr] ; r9 = sequence base address
; mov r8dd,[img_ptr] ; r8 = image base address
movss xmm2,[g_img_size]
movaps xmm3,xmm2
mulss xmm3,[g_0_5] ; xmm3 = (g_img_size)/2
movss xmm4,[g_zoom]
mulss xmm4,xmm2 ; xmm4 = g_zoom * g_img_size
movss xmm5,[g_offsetx] ; xmm5 = g_offsetx
movss xmm6,[g_offsety] ; xmm6 = g_offsety
.LoopSequence:
cmp ecx,eax ; i < n
je .LoopSequenceEnd
movd xmm0,[sequence+ecx*8] ; load re
movd xmm1,[sequence+ecx*8+4] ; load im
addss xmm0,xmm5 ; xmm0 = re+g_offsetx
addss xmm1,xmm6 ; xmm1 = im+g_offsety
mulss xmm0,xmm4 ; xmm0 = (re+g_offsetx)*g_img_size*g_zoom
mulss xmm1,xmm4 ; xmm1 = (im+g_offsety)*g_img_size*g_zoom
addss xmm0,xmm3 ; xmm0 = (re+g_offsetx)*g_img_size*g_zoom+g_img_size/2
addss xmm1,xmm3 ; xmm1 = (im+g_offsety)*g_img_size*g_zoom+g_img_size/2
cvtss2si edi,xmm0 ; edi = x = int(xmm0.x)
cvtss2si esi,xmm1 ; esi = y = int(xmm1.x)
cmp edi,0
jl @f
cmp edi,IMG_SIZE
jge @f
cmp esi,0
jl @f
cmp esi,IMG_SIZE
jge @f
imul esi,esi,IMG_SIZE
add esi,edi
add dword [screen+esi*4],1
@@:
inc ecx
jmp .LoopSequence
.LoopSequenceEnd:
; continue .LoopOneMillion
add dword[r12dd],1
cmp dword[r12dd],1000000
jb .LoopOneMillion
; continue .LoopIterations
add dword[r13dd],1
cmp dword[r13dd],ITERATIONS
jb .LoopIterations
; find max value
mov dword[r12dd],0
xor eax,eax ; eax = i = loop counter
.LoopMax:
push ecx
mov ecx,[r12dd]
cmp dword [screen+eax*4],ecx
cmova ecx,dword [screen+eax*4]
mov [r12dd],ecx
pop ecx
inc eax
cmp eax,IMG_SIZE*IMG_SIZE
jb .LoopMax
; find min value
; mov r13d,r12d ; r13d = min_val = max_val
push dword[r12dd]
pop dword[r13dd]
xor eax,eax ; eax = i = loop counter
.LoopMin:
push ecx
mov ecx,[r13dd]
cmp dword [screen+eax*4],ecx
cmovb ecx,dword [screen+eax*4]
mov [r13dd],ecx
pop ecx
inc eax
cmp eax,IMG_SIZE*IMG_SIZE
jb .LoopMin
; write image pixels
mov byte [pixel+3],255
; mov r14,[img_ptr] ; r14 = image base address
; xor r15d,r15d ; r15d = i = loop counter
mov dword[r15dd],0
cvtsi2ss xmm0,[r12dd] ; load max_value
cvtsi2ss xmm1,[r13dd] ; load min_value
movaps xmm2,xmm0
subss xmm2,xmm1 ; xmm2 = r = max_value - min_value
xor ecx,ecx
.LoopWrite:
mov eax,[screen+ecx*4] ; eax = image_value
sub eax,[r13dd] ; eax = image_value - min_value
cvtsi2ss xmm0,eax ; xmm0 = float(image_value - min_value)
addss xmm0,xmm0 ; xmm0 = 2.0f * float(image_value - min_value)
divss xmm0,xmm2 ; xmm0 = 2.0f * float(image_value - min_value) / r
minss xmm0,[g_1_0] ; clamp to 1.0
maxss xmm0,[g_0_0] ; clamp to 0.0
mulss xmm0,[g_255_0] ; convert to 0 - 255
cvtss2si eax,xmm0
; write pixel data
mov [screen+ecx*3],eax
inc ecx
cmp ecx,IMG_SIZE*IMG_SIZE
jb .LoopWrite
mov esp,ebp
pop ebp
ret
; restore img_ptr,seq_ptr,pixel
;-------------------------------------------------------------------------------
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
lea ecx, [50*65536+IMG_SIZE+4+eax] ; [y start] *65536 + [y size] + [skin_height]
mcall SF_CREATE_WINDOW,<50,IMG_SIZE+9>,,0x74000000,,wintitle1
mcall SF_REDRAW, SSF_END_DRAW
ret
;-------------------------------------------------------------------------------
align 1
wintitle1 db 'Buddhabrot - Calculating, please wait...',0
wintitle2 db 'Buddhabrot - Press F8 to set image as wallpaper',0
align 4
g_xorwow_x dd 123456789
g_xorwow_y dd 362436069
g_xorwow_z dd 521288629
g_xorwow_w dd 88675123
g_xorwow_v dd 5783321
g_xorwow_d dd 6615241
g_rand_scale dd 2.3283064e-10 ; 1.0 / 2^32
IMG_SIZE = 600
SEQ_SIZE = 50
ITERATIONS = 100
g_img_size dd 600.0
g_offsetx dd 0.5
g_offsety dd 0.0
g_zoom dd 0.4
g_max_dist dd 10.0
g_range dd 4.2
g_0_5 dd 0.5
g_0_0 dd 0.0
g_1_0 dd 1.0
g_255_0 dd 255.0
IMG_END:
;--------------------
sequence: rb SEQ_SIZE*8
screen: rb IMG_SIZE*IMG_SIZE*4
memStack: rd 1024
I_END:
@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
@@ -1,3 +1,6 @@
; SPDX-License-Identifier: NOASSERTION
;
; COLORREF.ASM - COLOR REFERENCE
;
; Compile with FASM for Menuet
@@ -15,7 +18,7 @@ use32
dd 0x0,0x0 ; I_Param , I_Icon
include 'lang.inc'
include '..\..\..\macros.inc'
include '..\..\macros.inc'
wide: dd 0 ; screen pixels width
mouse: dd 0 ; 1=right,2=left [mouse click]
@@ -148,7 +151,7 @@ draw_window:
mov edx,0x14000000 ; work area color (type II)
mov edi,title ; frame color
mcall
call palette ; display color palette
mcall 12, 2
@@ -267,7 +270,7 @@ help:
add ecx, 236
sub ecx, eax
mov ebx,5*65536+190 ; x and width
mov edx,0x465e8f ; dark denim color
mov eax,13 ; write text funx
@@ -294,7 +297,7 @@ h1: push ecx
jne h2 ; nope
mov eax,2 ; yep, burn it
mcall
h2:
h2:
call draw_window
ret
@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
@@ -1,3 +1,6 @@
; SPDX-License-Identifier: NOASSERTION
;
;
; Crown_s Soft Screensaver v1.13m
; WWW: http://www.crown-s-soft.com
@@ -34,8 +37,8 @@ copyrightlen:
include "lang.inc"
include "figuresi.inc"
include "..\..\..\macros.inc"
include "..\..\..\KOSfuncs.inc"
include "..\..\macros.inc"
include "..\..\KOSfuncs.inc"
start:
cmp dword[params], '@ss'
setz [screensaver]
@@ -96,7 +99,7 @@ red:
still:
mcall SF_WAIT_EVENT_TIMEOUT, delay ; wait here for event
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
@@ -117,7 +120,7 @@ jmp still
key:
cmp [screensaver], 0
jnz close
mcall SF_GET_KEY
cmp al,1 ; is key in buffer ?
@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,6 @@
; SPDX-License-Identifier: NOASSERTION
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Color Slider Control Demonstration ;
@@ -20,8 +23,8 @@ use32
dd 0x0 , 0x0 ; I_Param , I_Icon
include 'lang.inc'
include '..\..\..\macros.inc'
include '..\..\..\KOSfuncs.inc'
include '..\..\macros.inc'
include '..\..\KOSfuncs.inc'
START: ; start of execution
call draw_window ; at first, draw the window
@@ -50,7 +53,7 @@ still:
button: ; button
mcall SF_GET_BUTTON ; get id
shr eax,8
cmp eax,1 ; button id=1 ?
@@ -72,7 +75,7 @@ draw_window:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_CREATE_WINDOW, <100,200>, <100,200>, 0x14ffffff, , title
mcall SF_REDRAW, SSF_END_DRAW
call draw_slider_info
xor ecx,ecx
@@ -151,7 +154,7 @@ ret
draw_slider_info:
;Repaint value background
mcall SF_DRAW_RECT, 144*65536+36, 72*65536+9, 0x00ffffff
mcall SF_DRAW_RECT, 144*65536+36, 72*65536+9, 0x00ffffff
;Draw Color Box
xor edx, edx
movzx ecx,word [slider_1+12]
@@ -164,7 +167,7 @@ draw_slider_info:
mov ebx, 0x00860035
mov ecx, 0x00590040
mov eax, SF_DRAW_RECT
mcall
mcall
;draw current value of slider
mov ecx, edx
mov eax, SF_DRAW_NUMBER
@@ -340,4 +343,4 @@ ret
; DATA AREA
title db 'Color Slider',0
I_END:
I_END:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,6 @@
; SPDX-License-Identifier: NOASSERTION
;
;
; EYES FOR MENUET
;
@@ -22,7 +25,7 @@ use32
dd 0x0
dd 0x0
include '..\..\..\macros.inc'
include '..\..\macros.inc'
ENTRANCE: ; start of code
; ==== main ====
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,10 @@
include '..\..\..\macros.inc'
; SPDX-License-Identifier: NOASSERTION
;
; Text encoded with Code Page 866 - Cyrillic
include '..\..\macros.inc'
use32
org 0x0
@@ -199,7 +205,7 @@ put_big_point:
;DATA
align 4
count1 dd my_img
count2 dd 0
curtime dd 0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File diff suppressed because it is too large. Load diff
@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
@@ -1,3 +1,6 @@
; SPDX-License-Identifier: NOASSERTION
;
;
; Fisheye Raycasting Engine Etc. FREE3D for MENUETOS by Dieter Marfurt
; Version 0.4 (requires some texture-files to compile (see Data Section))
@@ -36,7 +39,7 @@ use32
dd APP_MEM;0x100000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
include 'lang.inc'
include '..\..\..\macros.inc'
include '..\..\macros.inc'
COLOR_ORDER equ OTHER
include 'gif_lite.inc'
@@ -296,7 +299,7 @@ m_right: ; turn right
draw_window:
mcall 12,1
mcall 48, 4 ;get skin width
lea ecx, [50*65536+484+eax] ;[y start] *65536 + [y size] + [skin_height]
mcall 0,<50,649>,,0x74ffffff,,title ;draw window
File renamed without changes.