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