1 ; Catacomb 3-D Source Code
\r
2 ; Copyright (C) 1993-2014 Flat Rock Software
\r
4 ; This program is free software; you can redistribute it and/or modify
\r
5 ; it under the terms of the GNU General Public License as published by
\r
6 ; the Free Software Foundation; either version 2 of the License, or
\r
7 ; (at your option) any later version.
\r
9 ; This program is distributed in the hope that it will be useful,
\r
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 ; GNU General Public License for more details.
\r
14 ; You should have received a copy of the GNU General Public License along
\r
15 ; with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 ; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
28 ;=================== Tables filled in by DrawVWall ==========================
\r
31 ; wallheight has the height (scale number) of that collumn of scaled wall
\r
32 ; it is pre bounded to 1-MAXSCALE (the actuial height on screen is 2*height)
\r
34 wallheight dw VIEWWIDTH dup (?)
\r
37 ; wallwidth has the pixel width (1-7) of that collumn
\r
39 wallwidth dw VIEWWIDTH dup (?)
\r
42 ; wallseg has the segment of the wall picture
\r
44 wallseg dw VIEWWIDTH dup (?)
\r
47 ; wallofs has the offset of the wall picture
\r
49 wallofs dw VIEWWIDTH dup (?)
\r
51 ;============================================================================
\r
54 ; screenbyte is just position/8
\r
56 LABEL screenbyte WORD
\r
64 ; screenbit is (position&7)*16
\r
66 LABEL screenbit WORD
\r
74 ; Use offset: screenbit[]+pixwidth*2
\r
75 ; acess from bitmasks-2+offset for one biased pixwidth
\r
76 ; the low byte of bitmasks is for the first screen byte, the high byte
\r
77 ; is the bitmask for the second screen byte (if non 0)
\r
80 bitmasks dw 0080h,00c0h,00e0h,00f0h,00f8h,00fch,00feh,00ffh
\r
81 dw 0040h,0060h,0070h,0078h,007ch,007eh,007fh,807fh
\r
82 dw 0020h,0030h,0038h,003ch,003eh,003fh,803fh,0c03fh
\r
83 dw 0010h,0018h,001ch,001eh,001fh,801fh,0c01fh,0e01fh
\r
84 dw 0008h,000ch,000eh,000fh,800fh,0c00fh,0e00fh,0f00fh
\r
85 dw 0004h,0006h,0007h,8007h,0c007h,0e007h,0f007h,0f807h
\r
86 dw 0002h,0003h,8003h,0c003h,0e003h,0f003h,0f803h,0fc03h
\r
87 dw 0001h,8001h,0c001h,0e001h,0f001h,0f801h,0fc01h,0fe01h
\r
91 ; wallscalecall is a far pointer to the start of a compiled scaler
\r
92 ; The low word will never change, while the high word is set to
\r
93 ; compscaledirectory[scale]
\r
95 wallscalecall dd (65*6) ; offset of t_compscale->code[0]
\r
98 PUBLIC wallheight,wallwidth,wallseg,wallofs,screenbyte,screenbit
\r
99 PUBLIC bitmasks,wallscalecall
\r
102 EXTRN scaledirectory:WORD ; array of MAXSCALE segment pointers to
\r
104 EXTRN screenseg:WORD ; basically just 0xa000
\r
105 EXTRN bufferofs:WORD ; offset of the current work screen
\r
109 ;============================================================================
\r
113 ; AX AL is scratched in bit mask setting and scaling
\r
117 ; SI offset into wall data to scale from, allways 0,64,128,...4032
\r
118 ; DI byte at top of screen that the collumn is contained in
\r
119 ; BP x pixel * 2, index into VIEWWIDTH wide tables
\r
120 ; DS segment of the wall data to texture map
\r
122 ; SS addressing DGROUP variables
\r
124 ;============================================================================
\r
130 xor bp,bp ; start at location 0 in the tables
\r
135 ; scale one collumn of data, possibly across two bytes
\r
139 mov bx,[wallheight+bp] ; height of walls (1-MAXSCALE)
\r
141 mov ax,[ss:scaledirectory+bx] ; segment of the compiled scaler
\r
142 mov [WORD PTR ss:wallscalecall+2],ax
\r
144 mov cx,[wallwidth+bp]
\r
152 mov ds,[wallseg+bp]
\r
153 mov si,[wallofs+bp]
\r
155 mov di,[screenbyte+bp] ; byte at the top of the scaled collumn
\r
156 add di,[ss:bufferofs] ; offset of current page flip
\r
157 mov bx,[screenbit+bp] ; 0-7 << 4
\r
159 mov ax,[ss:bitmasks-2+bx]
\r
160 out dx,al ; set bit mask register
\r
161 call [DWORD PTR ss:wallscalecall] ; scale the line of pixels
\r
162 or ah,ah ; is there anything in the second byte?
\r
174 ; draw a second byte for vertical strips that cross two bytes
\r
178 inc di ; next byte over
\r
179 out dx,al ; set bit mask register
\r
180 call [DWORD PTR ss:wallscalecall] ; scale the line of pixels
\r