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