Subversion Repositories Kolibri OS

Rev

Rev 1547 | Rev 2027 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1547 Rev 1728
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
; A unvwater demo
2
; A unvwater demo
3
; Programmed by Octavio Vega Fernandez
3
; Programmed by Octavio Vega Fernandez
4
; http://octavio.vega.fernandez.googlepages.com/CV4.HTM
4
; http://octavio.vega.fernandez.googlepages.com/CV4.HTM
5
; Converted to KolibriOS, By Asper
5
; Converted to KolibriOS, By Asper
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
use32
8
use32
9
	org	0x0
9
	org	0x0
10
 
10
 
11
	db	'MENUET00'	; 8 byte id
11
	db	'MENUET00'	; 8 byte id
12
	dd	38		; required os
12
	dd	38		; required os
13
	dd	STARTAPP	; program start
13
	dd	STARTAPP	; program start
14
	dd	I_END		; program image size
14
	dd	I_END		; program image size
15
	dd	0x100000	; required amount of memory
15
	dd	0x100000	; required amount of memory
16
	dd	0x00000000	; reserved=no extended header
16
	dd	0x00000000	; reserved=no extended header
17
 
17
 
18
include "aspAPI.inc"
18
include "aspapi.inc"
19
SCREEN_WIDTH   equ    100h
19
SCREEN_WIDTH   equ    100h
20
SCREEN_HEIGHT  equ    100h
20
SCREEN_HEIGHT  equ    100h
21
 
21
 
22
 
22
 
23
STARTAPP:
23
STARTAPP:
24
 
24
 
25
  mov  eax, 18	  ;Get CPU speed
25
  mov  eax, 18	  ;Get CPU speed
26
  mov  ebx, 5
26
  mov  ebx, 5
27
  int  0x40
27
  int  0x40
28
  shr  eax, 28
28
  shr  eax, 28
29
  mov  dword [delay], eax
29
  mov  dword [delay], eax
30
 
30
 
31
init_palette:
31
init_palette:
32
  mov  edi, Paleta
32
  mov  edi, Paleta
33
  ;xor  eax, eax
33
  ;xor  eax, eax
34
  mov  eax, 0x40
34
  mov  eax, 0x40
35
@@:
35
@@:
36
  stosd
36
  stosd
37
  inc  al
37
  inc  al
38
  jnz  @b
38
  jnz  @b
39
 
39
 
40
MAIN:
40
MAIN:
41
l1:
41
l1:
42
  xor  esi, esi
42
  xor  esi, esi
43
l11:
43
l11:
44
  xor  ebx, ebx
44
  xor  ebx, ebx
45
  mov  edx, 303h
45
  mov  edx, 303h
46
  sub  esi, 101h
46
  sub  esi, 101h
47
l2:
47
l2:
48
  and  esi, 0xFFFF ;esi=si
48
  and  esi, 0xFFFF ;esi=si
49
  add  bl,  [esi+img]
49
  add  bl,  [esi+img]
50
  adc  bh,  ah
50
  adc  bh,  ah
51
  inc  esi
51
  inc  esi
52
  dec  dh
52
  dec  dh
53
  jnz  l2
53
  jnz  l2
54
 
54
 
55
  mov  dh, 3
55
  mov  dh, 3
56
  add  esi, 100h-3
56
  add  esi, 100h-3
57
  dec  dl
57
  dec  dl
58
  jnz  l2
58
  jnz  l2
59
  sub  esi, 1ffh
59
  sub  esi, 1ffh
60
  and  esi, 0xFFFF ;esi=si
60
  and  esi, 0xFFFF ;esi=si
61
 
61
 
62
  mov  al, [img+esi]
62
  mov  al, [img+esi]
63
  sub  bx, ax
63
  sub  bx, ax
64
  shl  ax, 2
64
  shl  ax, 2
65
  sub  bx, ax
65
  sub  bx, ax
66
  shr  bx, 2
66
  shr  bx, 2
67
 
67
 
68
  mov  ax, bx
68
  mov  ax, bx
69
  shr  ax, 7
69
  shr  ax, 7
70
  sub  bx, ax
70
  sub  bx, ax
71
  mov  [img+esi], bl
71
  mov  [img+esi], bl
72
  inc  si
72
  inc  si
73
  jnz  l11
73
  jnz  l11
74
 
74
 
75
  call	copy_buffer_to_video
75
  call	copy_buffer_to_video
76
 
76
 
77
 
77
 
78
still:
78
still:
79
	mov	eax, 11 	    ; Test if there is an event in the queue.
79
	mov	eax, 11 	    ; Test if there is an event in the queue.
80
	int	0x40
80
	int	0x40
81
 
81
 
82
	cmp	al,1		      ; redraw request ?
82
	cmp	al,1		      ; redraw request ?
83
	jz	red
83
	jz	red
84
	cmp	al,2		      ; key in buffer ?
84
	cmp	al,2		      ; key in buffer ?
85
	jz	key
85
	jz	key
86
	cmp	al,3		      ; button in buffer ?
86
	cmp	al,3		      ; button in buffer ?
87
	jz	button
87
	jz	button
88
 
88
 
89
	jmp	MAIN
89
	jmp	MAIN
90
 
90
 
91
red:
91
red:
92
	call	draw_window
92
	call	draw_window
93
	jmp	MAIN
93
	jmp	MAIN
94
 
94
 
95
 
95
 
96
key:
96
key:
97
	mov	eax, 2
97
	mov	eax, 2
98
	int	0x40
98
	int	0x40
99
	cmp	ah, 27		    ; Test Esc in ASCII
99
	cmp	ah, 27		    ; Test Esc in ASCII
100
	je	close_app
100
	je	close_app
101
	jmp	MAIN
101
	jmp	MAIN
102
 
102
 
103
button:
103
button:
104
	mov	eax, 17 	    ; Get pressed button code
104
	mov	eax, 17 	    ; Get pressed button code
105
	int	0x40
105
	int	0x40
106
	cmp	ah, 1		    ; Test x button
106
	cmp	ah, 1		    ; Test x button
107
	je	close_app
107
	je	close_app
108
	jmp	MAIN
108
	jmp	MAIN
109
 
109
 
110
draw_window:
110
draw_window:
111
	start_draw_window 100,70,SCREEN_WIDTH+10,SCREEN_HEIGHT+5,0x14224466,labelt;, 14;labellen-labelt
111
	start_draw_window 100,70,SCREEN_WIDTH+10,SCREEN_HEIGHT+5,0x14224466,labelt;, 14;labellen-labelt
112
	mov	dword [skin_h], eax
112
	mov	dword [skin_h], eax
113
	end_draw_window
113
	end_draw_window
114
ret
114
ret
115
 
115
 
116
 
116
 
117
fail:
117
fail:
118
	; Type something here.
118
	; Type something here.
119
close_app:
119
close_app:
120
	mov	eax, -1  ; close this program
120
	mov	eax, -1  ; close this program
121
	int	0x40
121
	int	0x40
122
 
122
 
123
 
123
 
124
 
124
 
125
copy_buffer_to_video:
125
copy_buffer_to_video:
126
	pusha
126
	pusha
127
    ;    mov     eax, 18 ;@WAITVSYNC();
127
    ;    mov     eax, 18 ;@WAITVSYNC();
128
    ;    mov     ebx, 14
128
    ;    mov     ebx, 14
129
    ;    int     0x40
129
    ;    int     0x40
130
	mov	eax, 5	;delay
130
	mov	eax, 5	;delay
131
	mov	ebx, dword [delay]
131
	mov	ebx, dword [delay]
132
	int	0x40
132
	int	0x40
133
 
133
 
134
	mov	eax, dword [skin_h]
134
	mov	eax, dword [skin_h]
135
	lea	edx, [5*65536+eax]
135
	lea	edx, [5*65536+eax]
136
 
136
 
137
	mov	eax, 65
137
	mov	eax, 65
138
	mov	ebx, img
138
	mov	ebx, img
139
	mov	ecx, SCREEN_WIDTH*65536+SCREEN_HEIGHT ;ecx = w*65536+h
139
	mov	ecx, SCREEN_WIDTH*65536+SCREEN_HEIGHT ;ecx = w*65536+h
140
       ; mov     edx, 5*65536+25 ;edx = x*65536+y
140
       ; mov     edx, 5*65536+25 ;edx = x*65536+y
141
	mov	esi, 8
141
	mov	esi, 8
142
	mov	edi, Paleta
142
	mov	edi, Paleta
143
	xor	ebp, ebp
143
	xor	ebp, ebp
144
	int	0x40
144
	int	0x40
145
	popa
145
	popa
146
ret
146
ret
147
 
147
 
148
; DATA AREA
148
; DATA AREA
149
 
149
 
150
; Application Title
150
; Application Title
151
labelt	 db   'UnvWater demo',0
151
labelt	 db   'UnvWater demo',0
152
delay	 dd   0
152
delay	 dd   0
153
skin_h	 dd   25 ; Skin height.
153
skin_h	 dd   25 ; Skin height.
154
 
154
 
155
I_END:
155
I_END:
156
Paleta	 rb 1024
156
Paleta	 rb 1024
157
img	 db 1
157
img	 db 1
158
	 rb 10000h
158
	 rb 10000h