wolf3d

The original open source release of Wolfenstein 3D
Log | Files | Refs

WHACK_A.ASM (1610B)


      1 ; WOLFHACK.ASM
      2 
      3 .386C
      4 IDEAL
      5 MODEL	MEDIUM,C
      6 
      7 
      8 ;============================================================================
      9 
     10 DATASEG
     11 
     12 EXTRN	mr_rowofs:WORD
     13 EXTRN	mr_count:WORD
     14 EXTRN	mr_xstep:WORD
     15 EXTRN	mr_ystep:WORD
     16 EXTRN	mr_xfrac:WORD
     17 EXTRN	mr_yfrac:WORD
     18 EXTRN	mr_dest:WORD
     19 
     20 FARDATA
     21 
     22 planepics	db	8192 dup(?)	;	// 4k of ceiling, 4k of floor
     23 PUBLIC	planepics
     24 
     25 
     26 ;============================================================================
     27 
     28 CODESEG
     29 
     30 ;============================
     31 ;
     32 ; MapRow
     33 ;
     34 ;
     35 ;============================
     36 
     37 PROC	MapRow
     38 PUBLIC	MapRow
     39 	push	esi
     40 	push	edi
     41 	push	ebp
     42 	push 	ds
     43 
     44 	mov     bp,[mr_rowofs]
     45 	mov		cx,[mr_count]
     46 	mov		dx,[mr_ystep]
     47 	shl		edx,16
     48 	mov		dx,[mr_xstep]
     49 	mov		si,[mr_yfrac]
     50 	shl		esi,16
     51 	mov		si,[mr_xfrac]
     52 	mov		di,[mr_dest]
     53 	mov		ax,SEG planepics
     54 	mov		ds,ax
     55 	mov		ax,0a000h
     56 	mov		es,ax
     57 	mov		ax,1111111111110b
     58 
     59 ; eax		color lookup
     60 ; ebx		scratch offset and pixel values
     61 ; ecx     	loop counter
     62 ; edx		packed x / y step values
     63 ; esi		packed x / y fractional values
     64 ; edi		write pointer
     65 ; ebp		toprow to bottomrow delta
     66 ; es:		screenseg
     67 ; ds:		pictures
     68 
     69 ; mov	al,[esi]
     70 ; mov	al,[eax]
     71 ; mov	[edi],al
     72 
     73 ; mov   ax,[_variable+ebx+2]
     74 
     75 
     76 pixelloop:
     77 	shld	ebx,esi,22				; shift y units in
     78 	shld	ebx,esi,7				; shift x units in and one extra bit
     79 	and		bx,63*65*2				; mask off extra top bits and 0 low bit
     80 	add		esi,edx					; position += step
     81 	mov		al,[bx]
     82 	mov		al,[eax]
     83 	mov     [es:di],al     			; write ceiling pixel
     84 	mov		al,[bx+1]
     85 	mov		al,[eax]
     86 	mov     [es:di+bp],al     		; write floor pixel
     87 	inc		di
     88 	loop	pixelloop
     89 
     90 	pop		ds
     91 	pop		ebp
     92 	pop		edi
     93 	pop		esi
     94 
     95 	retf
     96 
     97 ENDP
     98 
     99 END
    100