1 ; Catacomb Armageddon 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
22 INCLUDE "ID_ASM.EQU"
\r
24 VIEWWIDTH = (40*8) ;33
\r
30 ;=================== Tables filled in by DrawVWall ==========================
\r
33 ; wallheight has the height (scale number) of that collumn of scaled wall
\r
34 ; it is pre bounded to 1-MAXSCALE (the actuial height on screen is 2*height)
\r
36 wallheight dw VIEWWIDTH dup (?)
\r
39 ; wallwidth has the pixel width (1-7) of that collumn
\r
41 wallwidth dw VIEWWIDTH dup (?)
\r
44 ; wallseg has the segment of the wall picture
\r
46 wallseg dw VIEWWIDTH dup (?)
\r
49 ; wallofs has the offset of the wall picture
\r
51 wallofs dw VIEWWIDTH dup (?)
\r
53 ;============================================================================
\r
56 ; screenbyte is just position/8
\r
58 LABEL screenbyte WORD
\r
66 ; screenbit is (position&7)*16
\r
68 LABEL screenbit WORD
\r
76 ; Use offset: screenbit[]+pixwidth*2
\r
77 ; acess from bitmasks-2+offset for one biased pixwidth
\r
78 ; the low byte of bitmasks is for the first screen byte, the high byte
\r
79 ; is the bitmask for the second screen byte (if non 0)
\r
82 bitmasks dw 0080h,00c0h,00e0h,00f0h,00f8h,00fch,00feh,00ffh
\r
83 dw 0040h,0060h,0070h,0078h,007ch,007eh,007fh,807fh
\r
84 dw 0020h,0030h,0038h,003ch,003eh,003fh,803fh,0c03fh
\r
85 dw 0010h,0018h,001ch,001eh,001fh,801fh,0c01fh,0e01fh
\r
86 dw 0008h,000ch,000eh,000fh,800fh,0c00fh,0e00fh,0f00fh
\r
87 dw 0004h,0006h,0007h,8007h,0c007h,0e007h,0f007h,0f807h
\r
88 dw 0002h,0003h,8003h,0c003h,0e003h,0f003h,0f803h,0fc03h
\r
89 dw 0001h,8001h,0c001h,0e001h,0f001h,0f801h,0fc01h,0fe01h
\r
93 ; wallscalecall is a far pointer to the start of a compiled scaler
\r
94 ; The low word will never change, while the high word is set to
\r
95 ; compscaledirectory[scale]
\r
97 wallscalecall dd (65*6) ; offset of t_compscale->code[0]
\r
100 PUBLIC wallheight,wallwidth,wallseg,wallofs,screenbyte,screenbit
\r
101 PUBLIC bitmasks,wallscalecall
\r
104 EXTRN scaledirectory:WORD ; array of MAXSCALE segment pointers to
\r
106 EXTRN screenseg:WORD ; basically just 0xa000
\r
107 EXTRN bufferofs:WORD ; offset of the current work screen
\r
109 EXTRN screenpage:WORD
\r
113 ;============================================================================
\r
117 ; AX AL is scratched in bit mask setting and scaling
\r
121 ; SI offset into wall data to scale from, allways 0,64,128,...4032
\r
122 ; DI byte at top of screen that the collumn is contained in
\r
123 ; BP x pixel * 2, index into VIEWWIDTH wide tables
\r
124 ; DS segment of the wall data to texture map
\r
126 ; SS addressing DGROUP variables
\r
128 ;============================================================================
\r
134 xor bp,bp ; start at location 0 in the tables
\r
139 ; scale one collumn of data, possibly across two bytes
\r
143 mov bx,[wallheight+bp] ; height of walls (1-MAXSCALE)
\r
145 mov ax,[ss:scaledirectory+bx] ; segment of the compiled scaler
\r
146 mov [WORD PTR ss:wallscalecall+2],ax
\r
148 mov cx,[wallwidth+bp]
\r
156 mov ds,[wallseg+bp]
\r
157 mov si,[wallofs+bp]
\r
159 mov di,[screenbyte+bp] ; byte at the top of the scaled collumn
\r
160 add di,[ss:bufferofs] ; offset of current page flip
\r
161 mov bx,[screenbit+bp] ; 0-7 << 4
\r
163 mov ax,[ss:bitmasks-2+bx]
\r
164 out dx,al ; set bit mask register
\r
165 call [DWORD PTR ss:wallscalecall] ; scale the line of pixels
\r
166 or ah,ah ; is there anything in the second byte?
\r
178 ; draw a second byte for vertical strips that cross two bytes
\r
182 inc di ; next byte over
\r
183 out dx,al ; set bit mask register
\r
184 call [DWORD PTR ss:wallscalecall] ; scale the line of pixels
\r
199 ;---------------------------------------------------------------------------
\r
203 ; Displays a 'blip' (1 pixel wide X 2 pixel high) on the radar at
\r
204 ; an (X,Y) relative to (RADAR_X,RADAR_Y) (defined below...)
\r
206 ;---------------------------------------------------------------------------
\r
208 PROC RadarBlip x:WORD, y:WORD, color:WORD
\r
240 mov ah,[es:di] ; read into latches
\r
241 mov [es:di],al ; write latches / color bit
\r