2010-08-01 23:38:13 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; A unvwater demo
|
|
|
|
; Programmed by Octavio Vega Fernandez
|
|
|
|
; http://octavio.vega.fernandez.googlepages.com/CV4.HTM
|
|
|
|
; Converted to KolibriOS, By Asper
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
use32
|
2021-11-28 16:31:56 +01:00
|
|
|
org 0x0
|
|
|
|
|
|
|
|
;db 'MENUET00' ; 8 byte id
|
|
|
|
;dd 38 ; required os
|
|
|
|
;dd STARTAPP ; program start
|
|
|
|
;dd I_END ; program image size
|
|
|
|
;dd 0x100000 ; required amount of memory
|
|
|
|
;dd 0x00000000 ; reserved=no extended header
|
|
|
|
|
|
|
|
db 'MENUET01'
|
|
|
|
dd 1
|
|
|
|
dd STARTAPP
|
|
|
|
dd I_END
|
|
|
|
dd MEM
|
|
|
|
dd STACKTOP
|
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
|
|
|
|
;macro start_draw_window x,y,xsize,ysize,areacolor,caption;,capsize
|
|
|
|
;{
|
|
|
|
; mov eax, 12 ; function 12:tell os about windowdraw
|
|
|
|
; mov ebx, 1 ; 1, start of draw
|
|
|
|
; int 0x40
|
|
|
|
; ; DRAW WINDOW
|
|
|
|
; mov eax, 48 ; function 48.4 : get skin height
|
|
|
|
; mov ebx, 4
|
|
|
|
; int 0x40
|
|
|
|
; push eax
|
|
|
|
; lea ecx, [y*65536+ysize+eax]; [y start] *65536 + [y size] + [skin_height]
|
|
|
|
; xor eax, eax ; function 0 : define and draw window
|
|
|
|
; mov ebx, x*65536+xsize ; [x start] *65536 + [x size]
|
|
|
|
; mov edx, areacolor ; color of work area RRGGBB
|
|
|
|
; ;mov esi, 0x00334455 ; color of grab bar RRGGBB
|
|
|
|
; mov edi, caption;0x00ddeeff ; color of frames RRGGBB
|
|
|
|
; int 0x40
|
|
|
|
; pop eax
|
|
|
|
;}
|
|
|
|
;
|
|
|
|
;macro end_draw_window
|
|
|
|
;{
|
|
|
|
; mov eax, 12 ; end of redraw
|
|
|
|
; mov ebx, 2
|
|
|
|
; int 0x40
|
|
|
|
;}
|
2010-08-01 23:38:13 +02:00
|
|
|
|
2010-12-27 13:29:39 +01:00
|
|
|
include "aspapi.inc"
|
2010-08-01 23:38:13 +02:00
|
|
|
SCREEN_WIDTH equ 100h
|
|
|
|
SCREEN_HEIGHT equ 100h
|
|
|
|
|
|
|
|
|
|
|
|
STARTAPP:
|
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, 18 ;Get CPU speed
|
2010-08-01 23:38:13 +02:00
|
|
|
mov ebx, 5
|
|
|
|
int 0x40
|
|
|
|
shr eax, 28
|
|
|
|
mov dword [delay], eax
|
|
|
|
|
|
|
|
init_palette:
|
|
|
|
mov edi, Paleta
|
|
|
|
;xor eax, eax
|
|
|
|
mov eax, 0x40
|
|
|
|
@@:
|
|
|
|
stosd
|
|
|
|
inc al
|
|
|
|
jnz @b
|
|
|
|
|
|
|
|
MAIN:
|
|
|
|
l1:
|
|
|
|
xor esi, esi
|
|
|
|
l11:
|
|
|
|
xor ebx, ebx
|
|
|
|
mov edx, 303h
|
|
|
|
sub esi, 101h
|
|
|
|
l2:
|
|
|
|
and esi, 0xFFFF ;esi=si
|
|
|
|
add bl, [esi+img]
|
|
|
|
adc bh, ah
|
|
|
|
inc esi
|
|
|
|
dec dh
|
|
|
|
jnz l2
|
|
|
|
|
|
|
|
mov dh, 3
|
|
|
|
add esi, 100h-3
|
|
|
|
dec dl
|
|
|
|
jnz l2
|
|
|
|
sub esi, 1ffh
|
|
|
|
and esi, 0xFFFF ;esi=si
|
|
|
|
|
|
|
|
mov al, [img+esi]
|
|
|
|
sub bx, ax
|
|
|
|
shl ax, 2
|
|
|
|
sub bx, ax
|
|
|
|
shr bx, 2
|
|
|
|
|
|
|
|
mov ax, bx
|
|
|
|
shr ax, 7
|
|
|
|
sub bx, ax
|
|
|
|
mov [img+esi], bl
|
|
|
|
inc si
|
|
|
|
jnz l11
|
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
call copy_buffer_to_video
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
still:
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, 11 ; Test if there is an event in the queue.
|
|
|
|
int 0x40
|
2010-08-01 23:38:13 +02:00
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
cmp al,1 ; redraw request ?
|
|
|
|
jz red
|
|
|
|
cmp al,2 ; key in buffer ?
|
|
|
|
jz key
|
|
|
|
cmp al,3 ; button in buffer ?
|
|
|
|
jz button
|
2010-08-01 23:38:13 +02:00
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
jmp MAIN
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
red:
|
2021-11-28 16:31:56 +01:00
|
|
|
call draw_window
|
|
|
|
jmp MAIN
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
key:
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, 2
|
|
|
|
int 0x40
|
|
|
|
cmp ah, 27 ; Test Esc in ASCII
|
|
|
|
je close_app
|
|
|
|
jmp MAIN
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
button:
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, 17 ; Get pressed button code
|
|
|
|
int 0x40
|
|
|
|
cmp ah, 1 ; Test x button
|
|
|
|
je close_app
|
|
|
|
jmp MAIN
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
draw_window:
|
2021-11-28 16:31:56 +01:00
|
|
|
start_draw_window 100,70,SCREEN_WIDTH+9,SCREEN_HEIGHT+4,0x54224466,labelt;, 14;labellen-labelt
|
|
|
|
mov dword [skin_h], eax
|
|
|
|
end_draw_window
|
2010-08-01 23:38:13 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
fail:
|
2021-11-28 16:31:56 +01:00
|
|
|
; Type something here.
|
2010-08-01 23:38:13 +02:00
|
|
|
close_app:
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, -1 ; close this program
|
|
|
|
int 0x40
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
copy_buffer_to_video:
|
2021-11-28 16:31:56 +01:00
|
|
|
pusha
|
2010-08-01 23:38:13 +02:00
|
|
|
; mov eax, 18 ;@WAITVSYNC();
|
|
|
|
; mov ebx, 14
|
|
|
|
; int 0x40
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, 5 ;delay
|
|
|
|
mov ebx, dword [delay]
|
|
|
|
int 0x40
|
2010-08-01 23:38:13 +02:00
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, dword [skin_h]
|
|
|
|
lea edx, [5*65536+eax]
|
2010-08-01 23:38:13 +02:00
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
mov eax, 65
|
|
|
|
mov ebx, img
|
|
|
|
mov ecx, SCREEN_WIDTH*65536+SCREEN_HEIGHT ;ecx = w*65536+h
|
2010-08-01 23:38:13 +02:00
|
|
|
; mov edx, 5*65536+25 ;edx = x*65536+y
|
2021-11-28 16:31:56 +01:00
|
|
|
mov esi, 8
|
|
|
|
mov edi, Paleta
|
|
|
|
xor ebp, ebp
|
|
|
|
int 0x40
|
|
|
|
popa
|
2010-08-01 23:38:13 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
; Application Title
|
2021-11-28 16:31:56 +01:00
|
|
|
labelt db 'UnvWater demo',0
|
|
|
|
delay dd 0
|
|
|
|
skin_h dd 25 ; Skin height.
|
2010-08-01 23:38:13 +02:00
|
|
|
|
|
|
|
I_END:
|
2021-11-28 16:31:56 +01:00
|
|
|
Paleta rb 1024
|
|
|
|
img db 1
|
|
|
|
rb 10000h
|
2010-08-01 23:38:13 +02:00
|
|
|
|
2021-11-28 16:31:56 +01:00
|
|
|
rb 256
|
|
|
|
STACKTOP:
|
|
|
|
MEM:
|