Subversion Repositories Kolibri OS

Rev

Rev 2322 | Rev 2470 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2322 Rev 2461
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 2322 $
8
$Revision: 2461 $
9
 
9
 
10
; // Alver 22.06.2008 // {
10
; // Alver 22.06.2008 // {
11
align 4
11
align 4
Line 139... Line 139...
139
;
139
;
Line 140... Line 140...
140
 
140
 
141
align 8
141
align 8
Line -... Line 142...
-
 
142
sdsh_data:
-
 
143
 
142
sdsh_data:
144
diff16 "sdsh_data      : ",0,$
Line 143... Line 145...
143
 
145
 
Line 144... Line 146...
144
include 'fonts/sd_data.asm'
146
include 'fonts/sd_data.asm'
Line 152... Line 154...
152
; ecx	=	0x00RRGGBB
154
; ecx   =       0x00RRGGBB
153
; edx	=	if (bits[31:8] == 0)
155
; edx   =       if (bits[31:8] == 0)
154
;				then dl = single char to write 
156
;                               then dl = single char to write
155
;				else edx= pointer to asciiz-string
157
;                               else edx= pointer to asciiz-string
Line -... Line 158...
-
 
158
 
-
 
159
diff16 "draw_char      : ",0,$
156
 
160
 
157
draw_char:
161
draw_char:
158
; font test
162
; font test
159
; bl=y; bh=x
163
; bl=y; bh=x
160
; dl=ascii
164
; dl=ascii
161
        movzx   eax, bh
165
	movzx	eax, bh
162
        movzx   ebx, bl
166
	movzx	ebx, bl
163
        movzx   ecx, dl
167
	movzx	ecx, dl
164
        xor     edi, edi
168
	xor	edi, edi
Line -... Line 169...
-
 
169
	mov	ebp, edi
165
        mov     ebp, edi
170
 
166
         
171
 
167
sdsh_draw_char:
172
sdsh_draw_char:
168
; eax = left side X
173
; eax = left side X
169
; ebx = bottom Y
174
; ebx = bottom Y
Line 173... Line 178...
173
        push    ecx
178
	push	ecx
174
        push    edx 
179
	push	edx
175
        push    ebp
180
	push	ebp
176
        shl     ebp, 4
181
	shl	ebp, 4
177
        add     ebp, sdsh_data.info
182
	add	ebp, sdsh_data.info
178
        call	ch_checkscreen
183
;        call   ch_checkscreen
179
        jb		.exit
184
;        jb             .exit
180
        call	ch_checkwin
185
;        call   ch_checkwin
181
        jc		.exit
186
;        jc             .exit
182
        xor		ch, ch
-
 
183
        mov     edx, [ebp + 4]              ; chartable addr
187
	mov	edx, [ebp + 4]		    ; chartable addr
184
        mov		cx, word[edx + ecx*2]       ; tick info
188
	mov	cx, word[edx + ecx*2]	    ; tick info
185
        mov		edx, ecx
189
	mov	edx, ecx
186
        and     ecx, 7                      ; cl = number of ticks
190
	and	ecx, 7			    ; cl = number of ticks
187
        jz      .blank
191
	jz	.blank
188
        shr     edx, 4                      ; offset in the chartable
192
	shr	edx, 4			    ; offset in the chartable
189
        add     edx, [sdsh_data.chars]      ; edx -> the char's ticklist 
193
	add	edx, sdsh_data.chars	    ; edx -> the char's ticklist
190
.next_tick:
194
.next_tick:
191
        call    parse_tick
195
	call	parse_tick
192
        add     edx, 4
196
	add	edx, 2
193
        dec     cl
197
	dec	cl
194
        jnz     .next_tick
198
	jnz	.next_tick
195
.blank:
199
.blank:
196
.exit:
200
.exit:
197
        pop     ebp 
201
	pop	ebp
Line 199... Line 203...
199
        pop     ecx
203
	pop	ecx
200
        ret
204
	ret
Line 201... Line 205...
201
 
205
 
-
 
206
 
202
 
207
parse_tick:
203
parse_tick:
208
diff16 "parse_tick     : ",0,$
204
; eax = left side X
209
; eax = left side X
205
; ebx = bottom Y
210
; ebx = bottom Y
206
; edx ->tickinfo
211
; edx ->tickinfo
Line 328... Line 333...
328
.lntick.long:
333
.lntick.long:
329
        and     dl, 0x07
334
	and	dl, 0x07
330
        add     dl, 8
335
	add	dl, 8
331
.lntick.both:
336
.lntick.both:
332
        sub     dl, 2               ; num_vertice = num_points - 2
337
	sub	dl, 2		    ; num_vertice = num_points - 2
333
        and     cl, 0x18            ; two rotation bits
338
	and	cl, 0x18	    ; two (lower) rotation bits
334
        shr     cl, 3
339
	shr	cl, 3
335
        mov     esi, sdsh_data.blank 
340
	mov	esi, sdsh_data.blank
336
.draw:
341
.draw:
337
; cl = rot; dl = numvert; dh = orig.xy 
342
; cl = rot; dl = numvert; dh = orig.xy
338
        push    ecx
343
	push	ecx
Line 348... Line 353...
348
.exit:
353
.exit:
349
        popad
354
	popad
350
        ret
355
	ret
Line -... Line 356...
-
 
356
 
Line 351... Line 357...
351
 
357
 
352
                
358
diff16 "draw_tick      : ",0,$
353
	
359
 
354
draw_tick:
360
draw_tick:
355
; eax = x-origin
361
; eax = x-origin
356
; ebx = y-origin
362
; ebx = y-origin
357
; edi = 0x0RRGGBB 
363
; edi = 0x0RRGGBB
Line 358... Line 364...
358
;  cl = direction (0..7)  
364
;  cl = direction (0..7)
359
;  dl = number of vertices  (dl)
-
 
360
; esi -> tick bitfield  
365
;  dl = number of vertice  (dl)
361
 
366
; esi -> tick bitfield
-
 
367
 
362
	pushad
368
	pushad
363
    inc     dl                      ; -- that's to count down to 0 
369
	call	ch_putpixel			; the point of origin
364
	call	ch_putpixel		        ; the point of origin
370
	and	ecx, 7
365
	and		ecx, 7
371
	lea	ebp, [.move000+ ecx*4]
366
	call	[.moves + ecx*4]        ; basic vector
372
	call	ebp		      ; basic vector
367
	call	ch_putpixel		
373
	call	ch_putpixel
368
    dec     dl
374
        and     edx, 15
369
    jz      .done                   ; 2pix lines only
375
        jz	.done		       ; no vertex (2pix line)
370
    mov     esi, dword [esi]        ; max 16 vertice bitfield limit
376
        mov     esi, dword [esi]       ; 15 vertice will easily fit to 1dw
371
    xchg    esi, edx 
377
        xchg    esi, edx
-
 
378
.move_and_draw:
-
 
379
        mov     ch, dl
372
.move_and_draw:
380
        and     ch, 3
373
    mov     ch, dl
381
        jz	.moved
-
 
382
        dec     ch
-
 
383
        jz      .1
374
    and     ch, 3
384
        dec     ch
375
    jz      .moved
-
 
376
    btc     ecx, 8
-
 
377
    jz      .2
-
 
378
.1:
385
        jz      .2
379
    dec     cl                      ; right turns (1 and 3)
386
.3: 
380
    and     cl, 7
387
        dec     cl
381
@@: btc     ecx, 9                  ; straight angle (3) ?
388
.1:
-
 
389
        dec     cl
382
    jc      .1
390
        jmp     .wipe_it
383
    jmp     .moved
-
 
384
.2:
391
.2:
-
 
392
        inc     cl
-
 
393
.wipe_it:
385
    inc     cl                      ; left turn (2)
394
        and     ecx, 7
386
    and     cl, 7
395
.moved:
387
    btc     ecx, 9                  ; just to zero ah
396
diff16 "moved          : ",0,$
388
.moved:
397
	lea	ebp, [.move000+ ecx*4]
389
	call	[.moves + ecx*4]        ; go new way
398
	call	ebp		    ; go new way
-
 
399
	call	ch_putpixel
390
	call	ch_putpixel	
400
        shr     edx, 2
391
    shr     edx, 2	
401
        dec     esi
392
    dec     esi
402
        jnz     .move_and_draw
Line -... Line 403...
-
 
403
diff16 "done           : ",0,$
-
 
404
.done:
-
 
405
	popad
393
    jnz     .move_and_draw	         
406
	ret
394
.done:
407
 
395
	popad
408
; WARNING! The order matters! ------
-
 
409
align 4
396
	ret
410
diff16 "move000        : ",0,$
397
 
411
.move000:
398
.move000:
412
	inc		eax
399
	inc		eax
413
	ret
-
 
414
align 4
400
	ret
415
.move001:
401
.move001:
416
	inc		eax
402
	inc		eax
417
	dec		ebx
-
 
418
	ret
403
	dec		ebx
419
align 4
404
	ret
420
.move010:
405
.move010:
421
	dec		ebx
406
	dec		ebx
422
	ret
-
 
423
align 4
407
	ret
424
.move011:
408
.move011:
425
	dec		eax
409
	dec		eax
426
	dec		ebx
-
 
427
	ret
410
	dec		ebx
428
align 4
411
	ret
429
.move100:
412
.move100:
430
	dec		eax
413
	dec		eax
431
	ret
-
 
432
align 4
414
	ret
433
.move101:
415
.move101:
434
	dec		eax
416
	dec		eax
435
	inc		ebx
-
 
436
	ret
-
 
437
align 4
-
 
438
.move110:
417
	inc		ebx
439
	inc		ebx
418
	ret
440
	ret
419
.move110:
441
 
420
	inc		ebx
442
align 4
Line 421... Line 443...
421
	ret
443
diff10 "move111-move000 (must be 28!)  : ",.move000,$
422
.move111:
-
 
423
	inc		eax
-
 
424
	inc		ebx
-
 
Line 425... Line 444...
425
	ret
444
.move111:
-
 
445
	inc		eax
426
 
446
	inc		ebx
427
align 4
447
	ret
428
.moves dd .move000, .move001, .move010, .move011, .move100, .move101, .move110, .move111
448
 
429
 
449
;) ---------------
430
;)
450
 
431
 
451
align 4
Line 432... Line 452...
432
align 4
452
diff16 "checkscreen    : ",0,$
-
 
453
ch_checkscreen:
433
ch_checkscreen:
454
     cmp	[Screen_Max_X], eax
434
     cmp	[Screen_Max_X], eax
455
     jb 	.getout
435
     jb		.getout
456
     cmp	[Screen_Max_Y], ebx
436
     cmp	[Screen_Max_Y], ebx
457
.getout:
437
.getout:
458
     ret
Line 470... Line 491...
470
        pop     ebx
491
	pop	ebx
471
        pop     eax
492
	pop	eax
472
        ret
493
	ret
Line 473... Line 494...
473
 
494
 
-
 
495
align 4
474
align 4
496
diff16 "ch_putpix      : ",0,$
475
ch_putpixel:
497
ch_putpixel:
476
; eax = x coordinate
498
; eax = x coordinate
477
; ebx = y coordinate
499
; ebx = y coordinate
478
; edi = 0x0RRGGBB    
500
; edi = 0x0RRGGBB