1
;Copyright (C) 1997-2005 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
4
;http://sourceforge.net/projects/zsnes
6
;This program is free software; you can redistribute it and/or
7
;modify it under the terms of the GNU General Public License
8
;as published by the Free Software Foundation; either
9
;version 2 of the License, or (at your option) any later
12
;This program is distributed in the hope that it will be useful,
13
;but WITHOUT ANY WARRANTY; without even the implied warranty of
14
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
;GNU General Public License for more details.
17
;You should have received a copy of the GNU General Public License
18
;along with this program; if not, write to the Free Software
19
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30
; Start line by line drawing/check
38
test dword[BGMS1+ebx*2],%4
40
test dword[BGMS1+ebx*2],%5
42
; Check if at a tile alignment
43
mov ecx,[BG1SYl+ebx*2+%1*512]
49
; process line by line
58
mov eax,[BG1SXl+ebx*2+%1*512]
59
cmp ax,[BG1SXl+ebx*2+2+%1*512]
61
cmp eax,[BG1SXl+ebx*2+4+%1*512]
63
cmp eax,[BG1SXl+ebx*2+8+%1*512]
65
cmp eax,[BG1SXl+ebx*2+12+%1*512]
67
mov eax,[BG1SYl+ebx*2+%1*512]
68
cmp ax,[BG1SYl+ebx*2+2+%1*512]
70
cmp eax,[BG1SYl+ebx*2+4+%1*512]
72
cmp eax,[BG1SYl+ebx*2+8+%1*512]
74
cmp eax,[BG1SYl+ebx*2+12+%1*512]
76
test dword[BGMS1+ebx*2+14],%4
77
jz near %%proclinebyline
78
test dword[BGMS1+ebx*2+14],%5
79
jnz near %%proclinebyline
81
jae near %%proclinebyline
84
jne near %%proclinebyline
85
mov eax,[BGOPT1+ebx*2+%1*512]
86
cmp ax,[BGOPT1+ebx*2+2+%1*512]
87
jne near %%proclinebyline
88
cmp eax,[BGOPT1+ebx*2+4+%1*512]
89
jne near %%proclinebyline
90
cmp eax,[BGOPT1+ebx*2+8+%1*512]
91
jne near %%proclinebyline
92
cmp eax,[BGOPT1+ebx*2+12+%1*512]
93
jne near %%proclinebyline
94
mov eax,[BGPT1+ebx*2+%1*512]
95
cmp ax,[BGPT1+ebx*2+2+%1*512]
96
jne near %%proclinebyline
97
cmp eax,[BGPT1+ebx*2+4+%1*512]
98
jne near %%proclinebyline
99
cmp eax,[BGPT1+ebx*2+8+%1*512]
100
jne near %%proclinebyline
101
cmp eax,[BGPT1+ebx*2+12+%1*512]
102
jne near %%proclinebyline
103
mov eax,[BGPT1X+ebx*2+%1*512]
104
cmp ax,[BGPT1X+ebx*2+2+%1*512]
105
jne near %%proclinebyline
106
cmp eax,[BGPT1X+ebx*2+4+%1*512]
107
jne near %%proclinebyline
108
cmp eax,[BGPT1X+ebx*2+8+%1*512]
109
jne near %%proclinebyline
110
cmp eax,[BGPT1X+ebx*2+12+%1*512]
111
jne near %%proclinebyline
112
mov eax,[BGPT1Y+ebx*2+%1*512]
113
cmp ax,[BGPT1Y+ebx*2+2+%1*512]
114
jne near %%proclinebyline
115
cmp eax,[BGPT1Y+ebx*2+4+%1*512]
116
jne near %%proclinebyline
117
cmp eax,[BGPT1Y+ebx*2+8+%1*512]
118
jne near %%proclinebyline
119
cmp eax,[BGPT1Y+ebx*2+12+%1*512]
120
jne near %%proclinebyline
122
cmp eax,[BGMS1+ebx+4]
123
jne near %%proclinebyline
124
cmp eax,[BGMS1+ebx+8]
125
jne near %%proclinebyline
126
cmp eax,[BGMS1+ebx+12]
127
jne near %%proclinebyline
130
jne near %%proclinebyline
131
mov eax,[t16x161+ebx+%1*256]
132
cmp eax,[t16x161+ebx+4+%1*256]
133
jne near %%proclinebyline
135
jae near %%proclinebyline
137
je near %%proclinebyline
138
test dword[intrlng+ebx],01010101h
139
jnz near %%proclinebyline
140
test dword[intrlng+ebx+4],01010101h
141
jnz near %%proclinebyline
142
test byte[mosenng+ebx],1 << %1
152
cmp byte[mosszng+ebx],0
160
; Start line by line drawing/check
168
test dword[BGMS1+ebx*2],%4
170
test dword[BGMS1+ebx*2],%5
172
; Check if at a tile alignment
173
mov ecx,[BG1SYl+ebx*2+%1*512]
179
; process line by line
188
mov eax,[BG1SXl+ebx*2+%1*512]
189
cmp ax,[BG1SXl+ebx*2+2+%1*512]
191
cmp eax,[BG1SXl+ebx*2+4+%1*512]
193
cmp eax,[BG1SXl+ebx*2+8+%1*512]
195
cmp eax,[BG1SXl+ebx*2+12+%1*512]
197
mov eax,[BG1SYl+ebx*2+%1*512]
198
cmp ax,[BG1SYl+ebx*2+2+%1*512]
200
cmp eax,[BG1SYl+ebx*2+4+%1*512]
202
cmp eax,[BG1SYl+ebx*2+8+%1*512]
204
cmp eax,[BG1SYl+ebx*2+12+%1*512]
206
test dword[BGMS1+ebx*2+14],%4
207
jz near %%proclinebyline
208
test dword[BGMS1+ebx*2+14],%5
209
jnz near %%proclinebyline
211
jae near %%proclinebyline
214
jne near %%proclinebyline
215
mov eax,[BGOPT1+ebx*2+%1*512]
216
cmp ax,[BGOPT1+ebx*2+2+%1*512]
217
jne near %%proclinebyline
218
cmp eax,[BGOPT1+ebx*2+4+%1*512]
219
jne near %%proclinebyline
220
cmp eax,[BGOPT1+ebx*2+8+%1*512]
221
jne near %%proclinebyline
222
cmp eax,[BGOPT1+ebx*2+12+%1*512]
223
jne near %%proclinebyline
224
mov eax,[BGPT1+ebx*2+%1*512]
225
cmp ax,[BGPT1+ebx*2+2+%1*512]
226
jne near %%proclinebyline
227
cmp eax,[BGPT1+ebx*2+4+%1*512]
228
jne near %%proclinebyline
229
cmp eax,[BGPT1+ebx*2+8+%1*512]
230
jne near %%proclinebyline
231
cmp eax,[BGPT1+ebx*2+12+%1*512]
232
jne near %%proclinebyline
233
mov eax,[BGPT1X+ebx*2+%1*512]
234
cmp ax,[BGPT1X+ebx*2+2+%1*512]
235
jne near %%proclinebyline
236
cmp eax,[BGPT1X+ebx*2+4+%1*512]
237
jne near %%proclinebyline
238
cmp eax,[BGPT1X+ebx*2+8+%1*512]
239
jne near %%proclinebyline
240
cmp eax,[BGPT1X+ebx*2+12+%1*512]
241
jne near %%proclinebyline
242
mov eax,[BGPT1Y+ebx*2+%1*512]
243
cmp ax,[BGPT1Y+ebx*2+2+%1*512]
244
jne near %%proclinebyline
245
cmp eax,[BGPT1Y+ebx*2+4+%1*512]
246
jne near %%proclinebyline
247
cmp eax,[BGPT1Y+ebx*2+8+%1*512]
248
jne near %%proclinebyline
249
cmp eax,[BGPT1Y+ebx*2+12+%1*512]
250
jne near %%proclinebyline
252
cmp eax,[BGMS1+ebx+4]
253
jne near %%proclinebyline
254
cmp eax,[BGMS1+ebx+8]
255
jne near %%proclinebyline
256
cmp eax,[BGMS1+ebx+12]
257
jne near %%proclinebyline
259
cmp eax,[BG3PRI+ebx+4]
260
jne near %%proclinebyline
263
jne near %%proclinebyline
264
mov eax,[t16x161+ebx+%1*256]
265
cmp eax,[t16x161+ebx+4+%1*256]
266
jne near %%proclinebyline
267
test dword[intrlng+ebx],01010101h
268
jnz near %%proclinebyline
269
test dword[intrlng+ebx+4],01010101h
270
jnz near %%proclinebyline
271
test byte[mosenng+ebx],1 << %1
280
cmp byte[mosszng+ebx],0
288
; Start line by line drawing/check
296
test dword[BGMS1+ebx*2],%5
298
test dword[BGMS1+ebx*2],%6
300
; Check if at a tile alignment
304
; process line by line
323
; Start line by line drawing/check
330
test dword[BGMS1+ebx*2],%5
332
test dword[BGMS1+ebx*2],%6
336
cmp byte[BG3PRI+ebx],0
339
; Check if at a tile alignment
343
; process line by line
362
; Start line by line drawing/check
369
test dword[BGMS1+ebx*2],%5
371
test dword[BGMS1+ebx*2],%6
375
cmp byte[BG3PRI+ebx],0
377
; Check if at a tile alignment
381
; process line by line
400
; Start line by line drawing/check
407
test dword[BGMS1+ebx*2],%1
409
test dword[BGMS1+ebx*2],%2
413
mov cl,byte[sprlefttot+ebx]
415
inc byte[sprtlng+ebx]
416
test byte[sprleftpr+ebx*4+eax],1
426
mov cl,byte[sprlefttot+ebx]
438
; Start line by line drawing/check
445
test dword[BGMS1+ebx*2],%1
447
test dword[BGMS1+ebx*2],%2
453
mov cl,byte[sprlefttot+ebx]
455
inc byte[sprtlng+ebx]
456
test byte[sprleftpr+ebx*4+eax],1
466
mov cl,byte[sprlefttot+ebx]
476
%macro Procsprng234567 2
478
; Start line by line drawing/check
485
test dword[BGMS1+ebx*2],%1
487
test dword[BGMS1+ebx*2],%2
493
mov cl,byte[sprlefttot+ebx]
495
inc byte[sprtlng+ebx]
496
test byte[sprleftpr+ebx*4+eax],1
506
mov cl,byte[sprlefttot+ebx]
519
; Start line by line drawing/check
528
test dword[BGMS1+ebx*2],%1
530
test dword[BGMS1+ebx*2],%2
534
mov byte[curmosaicsz],1
536
test byte[mosenng+ebx],1
542
mov byte[curmosaicsz],cl
550
; process line by line
551
mov edx,[mode7ab+ebx*4]
553
mov edx,[mode7cd+ebx*4]
555
mov edx,[mode7xy+ebx*4]
557
mov edx,[mode7st+ebx]
561
test byte[mode7set],02h
566
mov dx,[BG1SXl+ebx*2]
567
add ax,[BG1SYl+ebx*2]
568
mov [curvidoffset],esi
600
test dword[vidmemch4+ecx*2],0FFFFh
605
add edx,dword[mode0add]
606
test dword[vidmemch2+ecx],0FFh
611
test dword[vidmemch8+ecx*4],0FFFFFFFFh
615
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
616
; bit 10-12 = palette, 0-9=tile#
619
inc dword[bg1drwng+ebx*4]
632
; start drawing from ecx
633
test dword[vrama+eax],8000h
635
test dword[vrama+eax],4000h
654
mov [edi+288*2+4],ebx
660
mov [edi+288*3+4],ebx
666
mov [edi+288*4+4],ebx
672
mov [edi+288*5+4],ebx
678
mov [edi+288*6+4],ebx
684
mov [edi+288*7+4],ebx
710
mov [edi+288*2+4],ebx
718
mov [edi+288*3+4],ebx
726
mov [edi+288*4+4],ebx
734
mov [edi+288*5+4],ebx
742
mov [edi+288*6+4],ebx
750
mov [edi+288*7+4],ebx
753
test word[vrama+eax],4000h
754
jnz near %%flipxyfull
760
mov [edi+288*7+4],ebx
766
mov [edi+288*6+4],ebx
772
mov [edi+288*5+4],ebx
778
mov [edi+288*4+4],ebx
784
mov [edi+288*3+4],ebx
790
mov [edi+288*2+4],ebx
812
mov [edi+288*7+4],ebx
820
mov [edi+288*6+4],ebx
828
mov [edi+288*5+4],ebx
836
mov [edi+288*4+4],ebx
844
mov [edi+288*3+4],ebx
852
mov [edi+288*2+4],ebx
872
; start drawing from ecx to edi
873
test word[vrama+eax],8000h
875
test word[vrama+eax],4000h
980
test word[vrama+eax],4000h
981
jnz near %%flipxypart
1033
mov dword[tleftnb],8
1083
mov ebx,[ng16bbgval]
1085
inc dword[bg1totng+ebx*4]
1096
jmp %%returnfromcache
1102
%macro drawtileng16x16 8
1103
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
1104
; bit 10-12 = palette, 0-9=tile#
1105
mov ebx,[ng16bbgval]
1107
inc dword[bg1drwng+ebx*4]
1111
add cx,[taddnfy16x16]
1112
test dword[vrama+eax],8000h
1114
add cx,[taddfy16x16]
1116
test dword[vrama+eax],4000h
1132
; start drawing from ecx
1133
test dword[vrama+eax],8000h
1134
jnz near %%flipyfull
1135
test dword[vrama+eax],4000h
1136
jnz near %%flipxfull
1155
mov [edi+288*2+4],eax
1161
mov [edi+288*3+4],eax
1167
mov [edi+288*4+4],eax
1173
mov [edi+288*5+4],eax
1179
mov [edi+288*6+4],eax
1185
mov [edi+288*7+4],eax
1213
mov [edi+288*2+4],eax
1221
mov [edi+288*3+4],eax
1229
mov [edi+288*4+4],eax
1237
mov [edi+288*5+4],eax
1245
mov [edi+288*6+4],eax
1253
mov [edi+288*7+4],eax
1257
test word[vrama+eax],4000h
1258
jnz near %%flipxyfull
1265
mov [edi+288*7+4],eax
1271
mov [edi+288*6+4],eax
1277
mov [edi+288*5+4],eax
1283
mov [edi+288*4+4],eax
1289
mov [edi+288*3+4],eax
1295
mov [edi+288*2+4],eax
1319
mov [edi+288*7+4],eax
1327
mov [edi+288*6+4],eax
1335
mov [edi+288*5+4],eax
1343
mov [edi+288*4+4],eax
1351
mov [edi+288*3+4],eax
1359
mov [edi+288*2+4],eax
1380
; start drawing from ecx to edi
1381
test word[vrama+eax],8000h
1382
jnz near %%flipypart
1383
test word[vrama+eax],4000h
1384
jnz near %%flipxpart
1385
mov dword[tleftnb],8
1436
mov dword[tleftnb],8
1488
test word[vrama+eax],4000h
1489
jnz near %%flipxypart
1490
mov dword[tleftnb],8
1541
mov dword[tleftnb],8
1594
test dword[vrama+eax],4000h
1599
xor dword[switch16x16],1
1602
mov ebx,[ng16bbgval]
1604
inc dword[bg1totng+ebx*4]
1617
jmp %%returnfromcache
1623
%macro drawbgtileng 2
1624
mov dword[ng16bprval],0
1625
mov dword[ng16bbgval],%1
1626
cmp byte[t16x161+ebx+%1*256],1
1629
mov eax,[BGPT1+ebx*2+%1*512]
1632
add eax,[BGPT1Y+ebx*2+%1*512]
1635
and ecx,07C0h ; 1Fh*40h
1637
mov ecx,[BG1SXl+ebx*2+%1*512]
1638
mov edx,[BGPT1X+ebx*2+%1*512]
1650
mov [bgtxad+ebx*2+%2*512],dx
1652
mov ecx,[BGOPT1+ebx*2+%1*512]
1657
mov edx,[colormodedef+edx*4+%1]
1663
mov [ngptrdat+%2*1024+ebx*4],ecx
1665
mov [ngceax+%2*1024+ebx*4],eax
1666
mov [ngcedi+%2*1024+ebx*4],edi
1667
; eax = pointer to beginning of tile area
1674
mov [ngptrdat+%2*1024+ebx*4],ecx
1676
mov [ngceax+%2*1024+ebx*4],eax
1677
mov [ngcedi+%2*1024+ebx*4],edi
1678
; eax = pointer to beginning of tile area
1679
mov dword[mode0add],0
1680
cmp byte[BGMA+ebx],0
1691
mov [ngptrdat+%2*1024+ebx*4],ecx
1693
mov [ngceax+%2*1024+ebx*4],eax
1694
mov [ngcedi+%2*1024+ebx*4],edi
1695
; eax = pointer to beginning of tile area
1702
mov dword[taddnfy16x16],0
1703
mov dword[taddfy16x16],16
1706
mov dword[taddnfy16x16],16
1707
mov dword[taddfy16x16],-16
1710
mov eax,[BGPT1+ebx*2+%1*512]
1713
add eax,[BGPT1Y+ebx*2+%1*512]
1716
and ecx,07C0h ; 1Fh*40h
1718
mov ecx,[BG1SXl+ebx*2+%1*512]
1719
mov edx,[BGPT1X+ebx*2+%1*512]
1731
mov [bgtxad+ebx*2+%2*512],dx
1733
mov ecx,[BGOPT1+ebx*2+%1*512]
1738
mov edx,[colormodedef+edx*4+%1]
1744
mov [ngptrdat+%2*1024+ebx*4],ecx
1746
mov [ngceax+%2*1024+ebx*4],eax
1747
mov [ngcedi+%2*1024+ebx*4],edi
1748
; eax = pointer to beginning of tile area
1749
jmp drawtileng16x164b
1755
mov [ngptrdat+%2*1024+ebx*4],ecx
1757
mov [ngceax+%2*1024+ebx*4],eax
1758
mov [ngcedi+%2*1024+ebx*4],edi
1759
; eax = pointer to beginning of tile area
1760
mov dword[mode0add],0
1761
cmp byte[BGMA+ebx],0
1766
jmp drawtileng16x162b
1772
mov [ngptrdat+%2*1024+ebx*4],ecx
1774
mov [ngceax+%2*1024+ebx*4],eax
1775
mov [ngcedi+%2*1024+ebx*4],edi
1776
; eax = pointer to beginning of tile area
1777
jmp drawtileng16x168b
1783
%macro drawbgtilengpr1 2
1784
mov dword[ng16bprval],2000h
1785
mov dword[ng16bbgval],%1
1786
cmp byte[t16x161+ebx+%1*256],1
1790
mov ecx,[bgtxad+ebx*2+%2*512]
1793
mov ecx,[ngptrdat+%2*1024+ebx*4]
1794
mov edx,[colormodedef+edx*4+%1]
1796
mov eax,[ngceax+%2*1024+ebx*4]
1797
mov edi,[ngcedi+%2*1024+ebx*4]
1800
; eax = pointer to beginning of tile area
1805
; eax = pointer to beginning of tile area
1806
mov dword[mode0add],0
1807
cmp byte[BGMA+ebx],0
1816
; eax = pointer to beginning of tile area
1822
mov ecx,[BG1SYl+ebx*2+%1*512]
1824
mov dword[taddnfy16x16],0
1826
mov dword[taddfy16x16],16
1829
mov dword[taddnfy16x16],16
1830
mov dword[taddfy16x16],-16
1834
mov ecx,[bgtxad+ebx*2+%2*512]
1837
mov ecx,[ngptrdat+%2*1024+ebx*4]
1838
mov edx,[colormodedef+edx*4+%1]
1840
mov eax,[ngceax+%2*1024+ebx*4]
1841
mov edi,[ngcedi+%2*1024+ebx*4]
1844
; eax = pointer to beginning of tile area
1845
jmp drawtileng16x164b
1849
; eax = pointer to beginning of tile area
1850
mov dword[mode0add],0
1851
cmp byte[BGMA+ebx],0
1856
jmp drawtileng16x162b
1860
; eax = pointer to beginning of tile area
1861
jmp drawtileng16x168b
1868
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
1869
; bit 10-12 = palette, 0-9=tile#
1870
mov ebx,[ng16bbgval]
1872
inc dword[bg1drwng+ebx*4]
1885
; start drawing from ecx
1886
test dword[vrama+eax],8000h
1887
jnz near %%flipyfull
1889
test dword[vrama+eax],4000h
1890
jnz near %%flipxfull
1909
add ecx,[flipyposng]
1910
test word[vrama+eax],4000h
1911
jnz near %%flipxyfull
1931
; start drawing from ecx to edi
1932
test word[vrama+eax],8000h
1933
jnz near %%flipypart
1935
test word[vrama+eax],4000h
1936
jnz near %%flipxpart
2027
add ecx,[flipyposng]
2028
test word[vrama+eax],4000h
2029
jnz near %%flipxypart
2118
mov ebx,[ng16bbgval]
2120
inc dword[bg1totng+ebx*4]
2128
cmp byte[curmosaicsz],1
2133
jmp %%returnfromcache
2139
%macro drawlineng16x16 8
2140
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
2141
; bit 10-12 = palette, 0-9=tile#
2142
mov ebx,[ng16bbgval]
2144
inc dword[bg1drwng+ebx*4]
2148
add cx,[taddnfy16x16]
2149
test dword[vrama+eax],8000h
2151
add cx,[taddfy16x16]
2153
test dword[vrama+eax],4000h
2169
; start drawing from ecx
2170
test dword[vrama+eax],8000h
2171
jnz near %%flipyfull
2173
test dword[vrama+eax],4000h
2174
jnz near %%flipxfull
2193
add ecx,[flipyposng]
2194
test word[vrama+eax],4000h
2195
jnz near %%flipxyfull
2215
; start drawing from ecx to edi
2216
test word[vrama+eax],8000h
2217
jnz near %%flipypart
2219
test word[vrama+eax],4000h
2220
jnz near %%flipxpart
2311
add ecx,[flipyposng]
2312
test word[vrama+eax],4000h
2313
jnz near %%flipxypart
2405
test dword[vrama+eax],4000h
2410
xor dword[switch16x16],1
2413
mov ebx,[ng16bbgval]
2415
inc dword[bg1totng+ebx*4]
2422
cmp byte[curmosaicsz],1
2430
jmp %%returnfromcache
2436
%macro drawbglineng 2
2437
mov dword[ng16bprval],0
2438
mov dword[ng16bbgval],%1
2441
test byte[intrlng+ebx],01h
2447
mov byte[curmosaicsz],1
2449
test byte[mosenng+ebx],1 << %1
2451
mov al,[mosszng+ebx]
2455
mov byte[curmosaicsz],al
2471
mov ecx,[BG1SYl+ebx*2+%1*512]
2476
cmp byte[BGMA+ebx],5
2479
cmp byte[t16x161+ebx+%1*256],1
2481
cmp byte[BGMA+ebx],2
2483
; cmp byte[BGMA+ebx],4
2485
mov eax,[BGPT1+ebx*2+%1*512]
2488
add eax,[BGPT1Y+ebx*2+%1*512]
2492
and ecx,07C0h ; 1Fh*40h
2497
mov ecx,[BG1SXl+ebx*2+%1*512]
2498
mov [flipyposng],edx
2499
mov edx,[BGPT1X+ebx*2+%1*512]
2511
mov [bgtxad+ebx*2+%2*512],dx
2513
mov ecx,[BGOPT1+ebx*2+%1*512]
2518
mov edx,[colormodedef+edx*4+%1]
2524
mov [ngptrdat+%2*1024+ebx*4],ecx
2526
mov [ngceax+%2*1024+ebx*4],eax
2527
mov [ngcedi+%2*1024+ebx*4],edi
2528
; eax = pointer to beginning of tile area
2535
mov [ngptrdat+%2*1024+ebx*4],ecx
2537
mov [ngceax+%2*1024+ebx*4],eax
2538
mov [ngcedi+%2*1024+ebx*4],edi
2539
; eax = pointer to beginning of tile area
2540
mov dword[mode0add],0
2541
cmp byte[BGMA+ebx],0
2552
mov [ngptrdat+%2*1024+ebx*4],ecx
2554
mov [ngceax+%2*1024+ebx*4],eax
2555
mov [ngcedi+%2*1024+ebx*4],edi
2556
; eax = pointer to beginning of tile area
2563
mov dword[taddnfy16x16],0
2564
mov dword[taddfy16x16],16
2567
mov dword[taddnfy16x16],16
2568
mov dword[taddfy16x16],-16
2570
mov eax,[BGPT1+ebx*2+%1*512]
2573
add eax,[BGPT1Y+ebx*2+%1*512]
2578
and ecx,07C0h ; 1Fh*40h
2582
mov [flipyposng],edx
2583
mov ecx,[BG1SXl+ebx*2+%1*512]
2584
mov edx,[BGPT1X+ebx*2+%1*512]
2596
mov [bgtxad+ebx*2+%2*512],dx
2598
mov ecx,[BGOPT1+ebx*2+%1*512]
2603
mov edx,[colormodedef+edx*4+%1]
2609
mov [ngptrdat+%2*1024+ebx*4],ecx
2611
mov [ngceax+%2*1024+ebx*4],eax
2612
mov [ngcedi+%2*1024+ebx*4],edi
2613
; eax = pointer to beginning of tile area
2614
jmp drawlineng16x164b
2620
mov [ngptrdat+%2*1024+ebx*4],ecx
2622
mov [ngceax+%2*1024+ebx*4],eax
2623
mov [ngcedi+%2*1024+ebx*4],edi
2624
; eax = pointer to beginning of tile area
2625
mov dword[mode0add],0
2626
cmp byte[BGMA+ebx],0
2631
jmp drawlineng16x162b
2637
mov [ngptrdat+%2*1024+ebx*4],ecx
2639
mov [ngceax+%2*1024+ebx*4],eax
2640
mov [ngcedi+%2*1024+ebx*4],edi
2641
; eax = pointer to beginning of tile area
2642
jmp drawlineng16x168b
2648
cmp byte[t16x161+ebx+%1*256],1
2650
mov dword[taddnfy16x16],0
2651
mov dword[taddfy16x16],0
2652
mov eax,[BGPT1+ebx*2+%1*512]
2655
add eax,[BGPT1Y+ebx*2+%1*512]
2659
and ecx,07C0h ; 1Fh*40h
2663
mov dword[taddnfy16x16],0
2664
mov dword[taddfy16x16],16
2667
mov dword[taddnfy16x16],16
2668
mov dword[taddfy16x16],-16
2670
mov eax,[BGPT1+ebx*2+%1*512]
2673
add eax,[BGPT1Y+ebx*2+%1*512]
2678
and ecx,07C0h ; 1Fh*40h
2683
mov [flipyposng],edx
2684
mov ecx,[BG1SXl+ebx*2+%1*512]
2686
mov edx,[BGPT1X+ebx*2+%1*512]
2698
mov [bgtxad+ebx*2+%2*512],dx
2700
mov ecx,[BGOPT1+ebx*2+%1*512]
2706
mov edx,[colormodedef+edx*4+%1]
2712
mov [ngptrdat+%2*1024+ebx*4],ecx
2714
mov [ngceax+%2*1024+ebx*4],eax
2715
mov [ngcedi+%2*1024+ebx*4],edi
2716
; eax = pointer to beginning of tile area
2722
drawlineng16x8 tltype4b, preparet4ba, cachesingle4bng,.loop2b,.fintile2b,ngpalcon4b,test4ba,0Fh,%1
2728
mov [ngptrdat+%2*1024+ebx*4],ecx
2730
mov [ngceax+%2*1024+ebx*4],eax
2731
mov [ngcedi+%2*1024+ebx*4],edi
2732
; eax = pointer to beginning of tile area
2733
mov dword[mode0add],0
2738
jnz near .fintileb2b
2739
drawlineng16x8 tltype2b, preparet2ba, cachesingle2bng,.loopb2b,.fintileb2b,ngpalcon2b,test2ba,03h,%1
2744
; Offsetmode calculation : <b2-7,2109>*1024+<b3-7,2112>*32+<b3-7,2111>
2747
mov dx,[BG3SYl+ebx*2]
2752
mov ax,[BGPT3+ebx*2]
2755
mov dx,[BG3SXl+ebx*2]
2768
mov eax,[BGPT1Y+ebx*2+%1*512]
2770
mov eax,[BGPT1X+ebx*2+%1*512]
2772
mov eax,[BGPT1+ebx*2+%1*512]
2777
add eax,[BGPT1Y+ebx*2+%1*512]
2781
and ecx,07C0h ; 1Fh*40h
2787
mov ecx,[BG1SXl+ebx*2+%1*512]
2788
mov [flipyposng],edx
2789
mov [flipyposngom],edx
2790
mov edx,[BGPT1X+ebx*2+%1*512]
2803
mov [bgtxad+ebx*2+%2*512],dx
2807
mov dword[ofshvaladd],0
2808
mov ecx,[BGOPT1+ebx*2+%1*512]
2813
mov edx,[colormodedef+edx*4+%1]
2819
mov [ngptrdat+%2*1024+ebx*4],ecx
2821
mov [ngceax+%2*1024+ebx*4],eax
2822
mov [ngcedi+%2*1024+ebx*4],edi
2823
; eax = pointer to beginning of tile area
2829
drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loopd,.fintiled,ngpalcon4b,test4ba,0Fh,%1
2836
mov dx,[BG3SYl+ebx*2]
2841
mov ax,[BGPT3+ebx*2]
2844
mov dx,[BG3SXl+ebx*2]
2857
mov eax,[BGPT1Y+ebx*2+%1*512]
2859
mov eax,[BGPT1X+ebx*2+%1*512]
2861
mov eax,[BGPT1+ebx*2+%1*512]
2866
add eax,[BGPT1Y+ebx*2+%1*512]
2870
and ecx,07C0h ; 1Fh*40h
2876
mov ecx,[BG1SXl+ebx*2+%1*512]
2877
mov [flipyposng],edx
2878
mov [flipyposngom],edx
2879
mov edx,[BGPT1X+ebx*2+%1*512]
2892
mov [bgtxad+ebx*2+%2*512],dx
2896
mov dword[ofshvaladd],0
2897
mov ecx,[BGOPT1+ebx*2+%1*512]
2902
mov edx,[colormodedef+edx*4+%1]
2906
; eax = pointer to beginning of tile area
2909
mov [ngptrdat+%2*1024+ebx*4],ecx
2911
mov [ngceax+%2*1024+ebx*4],eax
2912
mov [ngcedi+%2*1024+ebx*4],edi
2913
; eax = pointer to beginning of tile area
2914
mov dword[mode0add],0
2920
drawlinengom2 tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1
2924
; eax = pointer to beginning of tile area
2927
mov [ngptrdat+%2*1024+ebx*4],ecx
2929
mov [ngceax+%2*1024+ebx*4],eax
2930
mov [ngcedi+%2*1024+ebx*4],edi
2931
; eax = pointer to beginning of tile area
2936
jnz near .fintiledn2
2937
drawlinengom2 tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1
2950
mov dword[ignor512],0
2954
%macro drawbglinengpr1 2
2955
mov dword[ng16bprval],2000h
2956
mov dword[ng16bbgval],%1
2958
mov byte[curmosaicsz],1
2960
test byte[mosenng+ebx],1 << %1
2962
mov al,[mosszng+ebx]
2966
mov byte[curmosaicsz],al
2983
cmp byte[BGMA+ebx],5
2986
cmp byte[t16x161+ebx+%1*256],1
2988
cmp byte[BGMA+ebx],2
2990
; cmp byte[BGMA+ebx],4
2992
mov eax,[BG1SYl+ebx*2+%1*512]
2999
mov [flipyposng],eax
3002
mov ecx,[bgtxad+ebx*2+%2*512]
3005
mov ecx,[ngptrdat+%2*1024+ebx*4]
3006
mov edx,[colormodedef+edx*4+%1]
3008
mov eax,[ngceax+%2*1024+ebx*4]
3009
mov edi,[ngcedi+%2*1024+ebx*4]
3012
; eax = pointer to beginning of tile area
3017
; eax = pointer to beginning of tile area
3018
mov dword[mode0add],0
3019
cmp byte[BGMA+ebx],0
3028
; eax = pointer to beginning of tile area
3035
mov ecx,[BG1SYl+ebx*2+%1*512]
3037
mov dword[taddnfy16x16],0
3039
mov dword[taddfy16x16],16
3042
mov dword[taddnfy16x16],16
3043
mov dword[taddfy16x16],-16
3050
mov [flipyposng],eax
3053
mov ecx,[bgtxad+ebx*2+%2*512]
3056
mov ecx,[ngptrdat+%2*1024+ebx*4]
3057
mov edx,[colormodedef+edx*4+%1]
3059
mov eax,[ngceax+%2*1024+ebx*4]
3060
mov edi,[ngcedi+%2*1024+ebx*4]
3063
; eax = pointer to beginning of tile area
3064
jmp drawlineng16x164b
3068
; eax = pointer to beginning of tile area
3069
mov dword[mode0add],0
3070
cmp byte[BGMA+ebx],0
3075
jmp drawlineng16x162b
3079
; eax = pointer to beginning of tile area
3080
jmp drawlineng16x168b
3086
mov ecx,[BG1SYl+ebx*2+%1*512]
3089
mov dword[taddnfy16x16],0
3090
mov dword[taddfy16x16],16
3093
mov dword[taddnfy16x16],16
3094
mov dword[taddfy16x16],-16
3096
cmp byte[t16x161+ebx+%1*256],1
3097
je near .tiles16x16hr
3098
mov dword[taddnfy16x16],0
3099
mov dword[taddfy16x16],0
3106
mov [flipyposng],eax
3109
mov ecx,[bgtxad+ebx*2+%2*512]
3112
mov ecx,[ngptrdat+%2*1024+ebx*4]
3113
mov edx,[colormodedef+edx*4+%1]
3115
mov eax,[ngceax+%2*1024+ebx*4]
3116
mov edi,[ngcedi+%2*1024+ebx*4]
3119
; eax = pointer to beginning of tile area
3125
drawlineng16x8 tltype4b, preparet4ba, cachesingle4bng,.loop2b,.fintile2b,ngpalcon4b,test4ba,0Fh,%1
3131
; eax = pointer to beginning of tile area
3132
mov dword[mode0add],0
3138
drawlineng16x8 tltype2b, preparet2ba, cachesingle2bng,.loopb2b,.fintileb2b,ngpalcon2b,test2ba,03h,%1
3147
mov dx,[BG3SYl+ebx*2]
3152
mov ax,[BGPT3+ebx*2]
3155
mov dx,[BG3SXl+ebx*2]
3168
mov eax,[BGPT1Y+ebx*2+%1*512]
3170
mov eax,[BGPT1X+ebx*2+%1*512]
3172
mov eax,[BGPT1+ebx*2+%1*512]
3175
mov ecx,[BG1SXl+ebx*2+%1*512]
3176
mov edx,[BGPT1X+ebx*2+%1*512]
3184
mov eax,[BG1SYl+ebx*2+%1*512]
3192
mov [flipyposng],eax
3193
mov [flipyposngom],eax
3195
mov ecx,[bgtxad+ebx*2+%2*512]
3198
mov ecx,[ngptrdat+%2*1024+ebx*4]
3199
mov edx,[colormodedef+edx*4+%1]
3201
mov eax,[ngceax+%2*1024+ebx*4]
3202
mov edi,[ngcedi+%2*1024+ebx*4]
3204
mov dword[ofshvaladd],0
3207
; eax = pointer to beginning of tile area
3213
drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loopd,.fintiled,ngpalcon4b,test4ba,0Fh,%1
3220
mov dx,[BG3SYl+ebx*2]
3225
mov ax,[BGPT3+ebx*2]
3228
mov dx,[BG3SXl+ebx*2]
3241
mov eax,[BGPT1Y+ebx*2+%1*512]
3243
mov eax,[BGPT1X+ebx*2+%1*512]
3245
mov eax,[BGPT1+ebx*2+%1*512]
3248
mov ecx,[BG1SXl+ebx*2+%1*512]
3249
mov edx,[BGPT1X+ebx*2+%1*512]
3257
mov eax,[BG1SYl+ebx*2+%1*512]
3265
mov [flipyposng],eax
3266
mov [flipyposngom],eax
3268
mov ecx,[bgtxad+ebx*2+%2*512]
3271
mov ecx,[ngptrdat+%2*1024+ebx*4]
3272
mov edx,[colormodedef+edx*4+%1]
3274
mov eax,[ngceax+%2*1024+ebx*4]
3275
mov edi,[ngcedi+%2*1024+ebx*4]
3277
mov dword[ofshvaladd],0
3280
; eax = pointer to beginning of tile area
3286
drawlinengom2 tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1
3290
; eax = pointer to beginning of tile area
3296
drawlinengom2 tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1