~ubuntu-branches/ubuntu/intrepid/zsnes/intrepid-proposed

« back to all changes in this revision

Viewing changes to src/vcache.asm

  • Committer: Bazaar Package Importer
  • Author(s): Joshua Kwan
  • Date: 2007-06-04 21:46:47 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070604214647-j5zowa8vplkug0yj
Tags: 1.510-1
* New upstream release - all patches merged. closes: #380734, #419270
* Add a .desktop file, thanks Nicholas Wheeler. closes: #367942
* Include a ton of documentation that ships with the tarball.
  closes: #392143 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
;Copyright (C) 1997-2005 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
 
1
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
2
2
;
3
3
;http://www.zsnes.com
4
4
;http://sourceforge.net/projects/zsnes
 
5
;https://zsnes.bountysource.com
5
6
;
6
7
;This program is free software; you can redistribute it and/or
7
8
;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
10
 
;version.
 
9
;version 2 as published by the Free Software Foundation.
11
10
;
12
11
;This program is distributed in the hope that it will be useful,
13
12
;but WITHOUT ANY WARRANTY; without even the implied warranty of
18
17
;along with this program; if not, write to the Free Software
19
18
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
19
 
 
20
 
 
21
 
21
22
%include "macros.mac"
22
23
 
23
24
EXTSYM MessageOn,MsgCount,Msgptr,Voice0Disable,Voice0Status,Voice1Disable
24
25
EXTSYM Voice1Status,Voice2Disable,Voice2Status,Voice3Disable,Voice3Status
25
26
EXTSYM Voice4Disable,Voice4Status,Voice5Disable,Voice5Status,Voice6Disable
26
 
EXTSYM Voice6Status,Voice7Disable,Voice7Status,bgcmsung,bgmode,cbackofsaddr
27
 
EXTSYM cbitmode,cgmod,debuggeron,disableeffects,frameskip,frskipper,newgfxerror2
28
 
EXTSYM maxbr,modeused,mousexloc,mouseyloc,newengen,newgfx16b,newgfxerror
29
 
EXTSYM nextdrawallng,oamaddr,pal16b,pal16bxcl,pressed,prevbright,prevpal
30
 
EXTSYM scaddsngb,scaddtngb,scaddtngbx,scfbl,scrndis,snesmouse,sprprdrn
31
 
EXTSYM t1cc,vidbright,vidbuffer,vidbufferm,vidbufferofsa,vidbufferofsb
32
 
EXTSYM vidmemch2,statefileloc,fnamest,GUIClick,MousePRClick,ngmsdraw,cvidmode
 
27
EXTSYM Voice6Status,Voice7Disable,Voice7Status,bgcmsung,bgmode
 
28
EXTSYM cgmod,disableeffects,frameskip,frskipper,current_zst
 
29
EXTSYM maxbr,modeused,mousexloc,mouseyloc,newengen,KeyRTRCycle
 
30
EXTSYM nextdrawallng,pal16b,pal16bxcl,pressed,prevbright,prevpal
 
31
EXTSYM scaddsngb,scaddtngb,scaddtngbx,scfbl,scrndis,sprprdrn,t1cc
 
32
EXTSYM vidbright,vidbuffer,vidbufferofsa,vidmemch2,MZTForceRTR
 
33
EXTSYM GUIRClick,MousePRClick,ngmsdraw,cvidmode,fulladdtab
33
34
EXTSYM KeyDisableSC0,KeyDisableSC1,KeyDisableSC2,KeyDisableSC3,KeyDisableSC4
34
35
EXTSYM KeyDisableSC5,KeyDisableSC6,KeyDisableSC7,KeyFastFrwrd,SRAMSave5Sec
35
36
EXTSYM KeyBGDisble0,KeyBGDisble1,KeyBGDisble2,KeyBGDisble3,KeySprDisble
36
 
EXTSYM KeyResetAll,KeyExtraEnab,KeyWinDisble,KeyNewGfxSwt,KeyOffsetMSw
 
37
EXTSYM KeyResetAll,KeyWinDisble,KeyNewGfxSwt,KeyOffsetMSw
37
38
EXTSYM KeyStateSlc0,KeyStateSlc1,KeyStateSlc2,KeyStateSlc3,KeyStateSlc4
38
39
EXTSYM KeyStateSlc5,KeyStateSlc6,KeyStateSlc7,KeyStateSlc8,KeyStateSlc9
39
 
EXTSYM KeyIncStateSlot,KeyDecStateSlot,KeyUsePlayer1234
40
 
EXTSYM maxskip,DSPMem,SprValAdd,dsp1ptr,dsp1array,FastFwdToggle,SaveSramData
41
 
EXTSYM ngextbg,Mode7HiRes,Check60hz,Get_MouseData,Get_MousePositionDisplacement
42
 
EXTSYM WindowDisables,scanlines,romispal
43
 
EXTSYM MusicRelVol,MusicVol,WDSPReg0C,WDSPReg1C
44
 
EXTSYM DSPOp02,Op02AAS,Op02AZS,Op02CX,Op02CY,Op02FX,Op02FY
45
 
EXTSYM Op02FZ,Op02LES,Op02LFE,Op02VOF,Op02VVA
46
 
EXTSYM CurRecv
47
 
EXTSYM CNetType
48
 
EXTSYM KeySlowDown
49
 
EXTSYM chaton
50
 
EXTSYM genfulladdtab
51
 
EXTSYM KeyFRateDown,KeyFRateUp,KeyVolUp,KeyVolDown,KeyDisplayFPS,FPSOn,pl12s34
52
 
EXTSYM bg1ptr,bg2ptr,bg3ptr,bg4ptr,cachebg1,resolutn
53
 
EXTSYM curypos,oamram,objhipr,objptr,objptrn,objsize1,objsize2
54
 
EXTSYM spritetablea,sprleftpr,sprlefttot,vcache4b
55
 
EXTSYM objadds1,objadds2,objmovs1,objmovs2,tltype4b,vidmemch4,vram
56
 
EXTSYM bgptr,bgptrc,bgptrd,curtileptr,vcache2b
57
 
EXTSYM vcache8b,vidmemch8
58
 
EXTSYM offsetmshl,NextLineCache
59
 
EXTSYM tltype2b
60
 
EXTSYM tltype8b,objwlrpos
61
 
EXTSYM snesinputdefault,cycleinputdevice
 
40
EXTSYM KeyIncStateSlot,KeyDecStateSlot,KeyUsePlayer1234,maxskip,DSPMem
 
41
EXTSYM FastFwdToggle,SaveSramData,ngextbg,Mode7HiRes,Check60hz
 
42
EXTSYM Get_MouseData,Get_MousePositionDisplacement,scanlines
 
43
EXTSYM romispal,MusicRelVol,MusicVol,WDSPReg0C,WDSPReg1C,KeySlowDown
 
44
EXTSYM KeyFRateDown,KeyFRateUp,KeyVolUp,KeyVolDown,KeyDisplayFPS
 
45
EXTSYM FPSOn,pl12s34,bg1ptr,bg2ptr,bg3ptr,bg4ptr,cachebg1,resolutn,curypos
 
46
EXTSYM oamram,objhipr,objptr,objptrn,objsize1,objsize2,spritetablea,sprleftpr
 
47
EXTSYM sprlefttot,vcache4b,objadds1,objadds2,objmovs1,objmovs2,tltype4b
 
48
EXTSYM vidmemch4,vram,bgptr,bgptrc,bgptrd,curtileptr,vcache2b,vcache8b,vidmemch8
 
49
EXTSYM offsetmshl,NextLineCache,tltype2b,tltype8b,objwlrpos
 
50
EXTSYM EmuSpeed,SDRatio,FFRatio,DisplayBatteryStatus,lhguimouse,SwapMouseButtons
 
51
EXTSYM KeyResetSpeed,KeyEmuSpeedUp,KeyEmuSpeedDown,KeyDisplayBatt,EMUPause
 
52
EXTSYM device1,device2,snesinputdefault1,snesinputdefault2
 
53
EXTSYM KeyExtraEnab1,KeyExtraEnab2,cycleinputdevice1,cycleinputdevice2,MouseDis
 
54
EXTSYM KeyIncreaseGamma,KeyDecreaseGamma,gammalevel,gammalevel16b
 
55
EXTSYM RawDumpInProgress
 
56
 
 
57
%ifndef NO_DEBUGGER
 
58
EXTSYM debuggeron
 
59
%else
 
60
EXTSYM SPCSave
 
61
%endif
62
62
 
63
63
; Process stuff & Cache sprites
64
64
 
65
 
SECTION .bss
66
 
NEWSYM fskipped,     resb 1
67
 
NEWSYM objvramadder, resd 1
68
 
NEWSYM pobjvram,     resw 1
69
 
 
70
65
SECTION .data
 
66
ALIGN32
 
67
 
 
68
NEWSYM fskipped,     db 0
71
69
NEWSYM sprprifix,    db 1
72
 
 
73
 
SECTION .bss
74
 
NEWSYM OMBGTestVal, resd 1
75
 
NEWSYM ngptrdat2, resd 1
76
 
NEWSYM ofshvaladd, resd 1
77
 
NEWSYM ofsmtptrs, resd 1
78
 
NEWSYM ofsmcptr2, resd 1
79
 
NEWSYM sramb4save, resd 1
80
 
 
81
 
SECTION .data
82
 
NEWSYM mode7hiresen, dd 1
83
 
 
84
 
SECTION .bss
85
 
NEWSYM hiresstuff, resd 1
86
 
NEWSYM cmovietimeint, resd 1
87
 
NEWSYM overalltimer, resd 1
88
 
 
89
 
mousecheck resb 1
90
 
 
91
 
section .text
92
 
 
93
 
 
94
 
 
95
 
%macro stateselcomp 3
 
70
NEWSYM OMBGTestVal, dd 0
 
71
NEWSYM ngptrdat2, dd 0
 
72
NEWSYM ofshvaladd, dd 0
 
73
NEWSYM ofsmtptrs, dd 0
 
74
NEWSYM ofsmcptr2, dd 0
 
75
NEWSYM sramb4save, dd 0
 
76
NEWSYM hiresstuff, dd 0
 
77
NEWSYM overalltimer, dd 0
 
78
 
 
79
SECTION .text
 
80
 
 
81
%macro stateselcomp 2
96
82
    mov eax,[%1]
97
83
    test byte[pressed+eax],1
98
84
    je %%nostsl
99
85
    mov byte[pressed+eax],2
100
 
    mov byte[sselm+11],%2
101
 
    mov eax,[statefileloc]
102
 
    mov byte[fnamest+eax],%3
 
86
    mov eax,[current_zst]
 
87
    mov cl,10
 
88
    div cl
 
89
    mov ah,%2
 
90
    add al,'0'
 
91
    add ah,'0'
 
92
    mov [sselm+11],ax
 
93
    sub al,'0'
 
94
    mul cl
 
95
    add al,%2
 
96
    mov [current_zst],eax
103
97
    mov dword[Msgptr],sselm
104
98
    mov eax,[MsgCount]
105
99
    mov [MessageOn],eax
125
119
%%nosdis
126
120
%endmacro
127
121
 
128
 
 
129
122
UpdateVolume:
130
123
    pushad
131
124
    xor eax,eax
178
171
    jne .dopal
179
172
    cmp dword[overalltimer],60
180
173
    jne .notimer
181
 
    inc dword[cmovietimeint]
182
174
    sub dword[overalltimer],60
183
175
    jmp .notimer
184
176
.dopal
185
177
    cmp dword[overalltimer],50
186
178
    jne .notimer
187
 
    inc dword[cmovietimeint]
188
179
    sub dword[overalltimer],50
189
180
.notimer
190
181
    test byte[pressed+2Eh],1
191
182
    jz .noclear
192
 
    mov dword[cmovietimeint],0
193
183
    mov dword[overalltimer],0
194
184
.noclear
195
185
    ret
196
186
 
197
 
 
198
 
NEWSYM dsp1teststuff
199
 
    ; /////////////////////////////
200
 
    mov dword[dsp1ptr],0
201
 
    push eax
202
 
    push ecx
203
 
    mov ecx,4096
204
 
    mov eax,dsp1array
205
 
.cvloop
206
 
    mov byte[eax],0
207
 
    inc eax
208
 
    dec ecx
209
 
    jnz .cvloop
210
 
    pop ecx
211
 
    pop eax
212
 
    ret
213
 
    mov eax,dsp1array
214
 
    add eax,[dsp1ptr]
215
 
    push ebx
216
 
    mov byte[eax],02h
217
 
    mov bx,[Op02FX]
218
 
    mov [eax+1],bx
219
 
    mov bx,[Op02FY]
220
 
    mov [eax+3],bx
221
 
    mov bx,[Op02FZ]
222
 
    mov [eax+5],bx
223
 
    mov bx,[Op02LFE]
224
 
    mov [eax+7],bx
225
 
    mov bx,[Op02LES]
226
 
    mov [eax+9],bx
227
 
    mov bx,[Op02AAS]
228
 
    mov [eax+11],bx
229
 
    mov bx,[Op02AZS]
230
 
    mov [eax+13],bx
231
 
    mov bx,[Op02VOF]
232
 
    mov [eax+15],bx
233
 
    mov bx,[Op02VVA]
234
 
    mov [eax+17],bx
235
 
    mov bx,[Op02CX]
236
 
    mov [eax+19],bx
237
 
    mov bx,[Op02CY]
238
 
    mov [eax+21],bx
239
 
    pop ebx
240
 
    add dword[dsp1ptr],23
241
 
    pop ecx
242
 
    pop eax
243
 
    ; /////////////////////////////
244
 
    ret
245
 
 
246
 
SECTION .data
247
 
SaveRamSaved db 'SAVED SRAM DATA',0
248
 
 
249
187
SECTION .bss
250
 
FastForwardLock resb 1
251
 
SlowDownLock resb 1
252
 
FastForwardLockp resb 1
 
188
NEWSYM FastForwardLock, resb 1
 
189
NEWSYM SlowDownLock, resb 1
253
190
NEWSYM CSprWinPtr, resd 1
 
191
NEWSYM SloMo, resb 1  ; number of extra times to draw a frame
254
192
section .text
255
193
 
256
194
NEWSYM cachevideo
258
196
    mov dword[objwlrpos],0FFFFFFFFh
259
197
    mov dword[CSprWinPtr],0
260
198
    mov byte[pressed],0
261
 
    mov dword[objvramadder],0
262
199
    mov dword[bgcmsung],0
263
200
    mov dword[modeused],0
264
201
    mov dword[modeused+4],0
270
207
    mov dword[scaddtngbx],0FFFFFFFFh
271
208
    mov byte[hiresstuff],0
272
209
    mov byte[Mode7HiRes],0
273
 
    cmp dword[WindowDisables],0
274
 
    je .nowindis
275
 
    dec dword[WindowDisables]
276
 
.nowindis
277
 
 
278
 
    cmp byte[CurRecv],1
279
 
    je near .fskipall
280
210
 
281
211
    call ClockCounter
282
212
 
283
 
    cmp byte[mode7hiresen],0
284
 
    je .nohires
285
213
    cmp byte[scanlines],1
286
214
    je .nohires
287
215
    cmp byte[cvidmode],9
297
225
    mov byte[cgmod],1
298
226
    xor al,al
299
227
    mov [curblank],al
 
228
%ifndef NO_DEBUGGER
300
229
    cmp byte[debuggeron],0
301
230
    je .nodebugger
302
231
    mov byte[curblank],40h
303
232
    mov al,40h
304
233
    jmp .nofrskip
305
234
.nodebugger
 
235
%else
 
236
    cmp byte[SPCSave],1
 
237
    jne .nospcsave
 
238
    mov byte[curblank],40h
 
239
    mov al,40h
 
240
    jmp .nofrskip
 
241
.nospcsave
 
242
%endif
306
243
 
307
244
    cmp dword[sramb4save],0
308
245
    je .nofocussave
309
246
    cmp byte[SRAMSave5Sec],0
310
247
    je .nofocussaveb
311
248
    dec dword[sramb4save]
312
 
    cmp dword[sramb4save],0
 
249
    cmp dword[sramb4save],1
313
250
    jne .nofocussave
314
251
    pushad
315
252
    call SaveSramData
316
253
    popad
317
 
;    mov dword[Msgptr],SaveRamSaved
318
 
;    mov eax,[MsgCount]
319
 
;    mov [MessageOn],eax
320
254
    jmp .nofocussave
321
255
.nofocussaveb
322
256
    mov dword[sramb4save],0
323
257
.nofocussave
324
258
 
325
 
    cmp byte[CNetType],20
326
 
    je near .sdskip
327
 
 
 
259
    ; if emulation paused, don't alter timing
 
260
    mov ax,1
 
261
    cmp byte[EMUPause],1
 
262
    je near .ttldone
 
263
    ; fast forward goes over all other throttles
 
264
    ; don't fast forward while dumping a movie
 
265
    cmp byte[RawDumpInProgress],1
 
266
    je .ffskip
328
267
    cmp byte[FastFwdToggle],0
329
268
    jne .ffmode2
330
269
    mov eax,[KeyFastFrwrd]
334
273
.ffmode2
335
274
    mov eax,[KeyFastFrwrd]
336
275
    test byte[pressed+eax],1
337
 
    je .nofastfor
 
276
    jz .nofastfor
338
277
    mov byte[pressed+eax],2
339
278
    xor byte[FastForwardLock],1
340
 
    jmp .ff
341
279
.nofastfor
342
 
.ff
343
280
    cmp byte[FastForwardLock],1
344
281
    je near .fastfor
345
282
.ffskip
346
 
 
 
283
    ; next up, check for slowdown
347
284
    cmp byte[FastFwdToggle],0
348
285
    jne .sdmode2
349
286
    mov eax,[KeySlowDown]
353
290
.sdmode2
354
291
    mov eax,[KeySlowDown]
355
292
    test byte[pressed+eax],1
356
 
    je .noslowdwn
 
293
    jz .noslowdwn
357
294
    mov byte[pressed+eax],2
358
295
    xor byte[SlowDownLock],1
359
296
.noslowdwn
361
298
    je near .slowdwn
362
299
    jmp .sdskip
363
300
.slowdwn
364
 
    mov ax,2
365
 
    jmp .skipnoslowdown
 
301
    mov al,[SDRatio]          ; 0-28
 
302
    inc al                    ; 1-29
 
303
    mov [SloMo],al            ; /2-/30 slowmotion
 
304
    jmp .throttleskip
366
305
.sdskip
367
 
    mov ax,1
368
 
.skipnoslowdown
 
306
    ; now we can look at emuspeed
 
307
    cmp byte[EmuSpeed],30     ; 0-28 slow, 29 normal, 30-58 skip
 
308
    jb .noskipping
 
309
    inc byte[frskipper]
 
310
    push ebx
 
311
    mov bl,[EmuSpeed]
 
312
    sub bl,29                 ; 30-58 -> 1-29 frames to skip, 2x-30x speed
 
313
    jmp .fastforb
 
314
.noskipping
 
315
    mov byte[SloMo],29
 
316
    mov al,[EmuSpeed]
 
317
    sub byte[SloMo],al        ; 0-29 -> repeat 29-0 times, /30-1x speed
 
318
.throttleskip
 
319
    mov ax,[SloMo]
 
320
    inc ax                    ; total times frame is drawn
 
321
.ttldone
369
322
 
370
323
    cmp byte[frameskip],0
371
324
    jne near .frameskip
383
336
    jb .noskip2
384
337
    mov byte[curblank],40h
385
338
    inc byte[fskipped]
386
 
    mov al,40h
387
339
    mov cl,[maxskip]
388
340
    cmp byte[fskipped],cl
389
341
    jbe near .nofrskip
390
342
    mov word[t1cc],0
391
343
    mov byte[curblank],0
392
 
    mov byte[fskipped],0
393
 
    jmp .nofrskip
394
344
.noskip2
395
345
    mov byte[fskipped],0
396
346
    jmp .nofrskip
397
347
.fastfor
398
348
    inc byte[frskipper]
399
349
    push ebx
400
 
    mov bl,10
 
350
    mov bl,[FFRatio]      ; 0-28
 
351
    inc bl                    ; 1-29, 2x-30x fastmotion
401
352
    jmp .fastforb
402
353
.frameskip
403
354
    inc byte[frskipper]
404
355
    push ebx
405
 
    mov bl,byte[frameskip]
 
356
    mov bl,[frameskip]
406
357
.fastforb
407
358
    cmp byte[frskipper],bl
408
359
    pop ebx
409
360
    jae .nofrskip
410
 
.fskipall
411
361
    mov byte[curblank],40h
412
 
    mov al,40h
413
362
    jmp .frskip
414
363
.nofrskip
415
364
    mov byte[frskipper],0
418
367
    push esi
419
368
    push edi
420
369
    push edx
421
 
    inc byte[mousecheck]
422
 
    and byte[mousecheck],07h
423
 
    cmp byte[mousecheck],0
 
370
    cmp byte[MouseDis],1
 
371
    je .noclick
 
372
    cmp byte[GUIRClick],0
 
373
    je .noclick
 
374
    cmp byte[device1],0
424
375
    jne .noclick
425
 
    cmp byte[GUIClick],0
426
 
    je .noclick
427
 
    cmp byte[snesmouse],0
 
376
    cmp byte[device2],0
428
377
    jne .noclick
429
378
    call Get_MouseData
 
379
    cmp byte[lhguimouse],1
 
380
    jne .notlefthanded
 
381
    call SwapMouseButtons
 
382
.notlefthanded
430
383
    test bx,02h
431
384
    jz .norclick
432
385
    cmp byte[MousePRClick],0
435
388
.norclick
436
389
    mov byte[MousePRClick],0
437
390
.noclick
438
 
    mov ax,[oamaddr]
439
 
    mov cl,[bgmode]
440
 
    mov al,01h
441
 
    shl al,cl
442
 
    mov [cachedmode],al
443
391
    ; disable all necessary backgrounds
444
 
    cmp byte[chaton],1
445
 
    je near .finishchatskip
446
392
    mov eax,[KeyBGDisble0]
447
393
    test byte[pressed+eax],1
448
394
    je .nodis1
508
454
    mov eax,[MsgCount]
509
455
    mov [MessageOn],eax
510
456
.nodis5
 
457
    mov eax,[KeyEmuSpeedDown]
 
458
    test byte[pressed+eax],1
 
459
    jz .nospeeddown
 
460
    mov byte[pressed+eax],2
 
461
    cmp byte[EmuSpeed],0
 
462
    je .nospeeddown
 
463
    dec byte[EmuSpeed]
 
464
.nospeeddown
 
465
    mov eax,[KeyEmuSpeedUp]
 
466
    test byte[pressed+eax],1
 
467
    jz .nospeedup
 
468
    mov byte[pressed+eax],2
 
469
    cmp byte[EmuSpeed],58
 
470
    je .nospeedup
 
471
    inc byte[EmuSpeed]
 
472
.nospeedup
 
473
    mov eax,[KeyResetSpeed]
 
474
    test byte[pressed+eax],1
 
475
    jz .nospeedreset
 
476
    mov byte[pressed+eax],2
 
477
    mov byte[EmuSpeed],29
 
478
.nospeedreset
511
479
    mov eax,[KeyResetAll]
512
480
    test byte[pressed+eax],1
513
 
    je .nodis6
 
481
    je near .nodis6
514
482
    mov byte[pressed+eax],2
515
 
    mov byte[Voice0Disable],01h
516
 
    mov byte[Voice1Disable],01h
517
 
    mov byte[Voice2Disable],01h
518
 
    mov byte[Voice3Disable],01h
519
 
    mov byte[Voice4Disable],01h
520
 
    mov byte[Voice5Disable],01h
521
 
    mov byte[Voice6Disable],01h
522
 
    mov byte[Voice7Disable],01h
523
 
    mov byte[scrndis],00h
524
 
    push eax
525
 
    mov al,byte[snesinputdefault]
526
 
    mov byte[snesmouse],al
527
 
    pop eax
 
483
    mov byte[Voice0Disable],1
 
484
    mov byte[Voice1Disable],1
 
485
    mov byte[Voice2Disable],1
 
486
    mov byte[Voice3Disable],1
 
487
    mov byte[Voice4Disable],1
 
488
    mov byte[Voice5Disable],1
 
489
    mov byte[Voice6Disable],1
 
490
    mov byte[Voice7Disable],1
 
491
    mov byte[scrndis],0
 
492
    mov byte[disableeffects],0
 
493
    mov byte[osm2dis],0
 
494
    mov byte[EmuSpeed],29
 
495
    mov al,[snesinputdefault1]
 
496
    mov [device1],al
 
497
    mov al,[snesinputdefault2]
 
498
    mov [device2],al
528
499
    mov dword[Msgptr],panickeyp
529
500
    mov eax,[MsgCount]
530
501
    mov [MessageOn],eax
531
502
.nodis6
532
 
    mov eax,[KeyExtraEnab]
533
 
    test byte[pressed+eax],1
534
 
    je near .nodis7
 
503
    mov eax,[KeyRTRCycle]
 
504
    test byte[pressed+eax],1
 
505
    je near .nortrcycle
 
506
    mov byte[pressed+eax],2
 
507
    inc byte[MZTForceRTR]
 
508
    cmp byte[MZTForceRTR],3
 
509
    jne .notrtrwrap
 
510
    mov byte[MZTForceRTR],0
 
511
    mov dword[Msgptr],mztrtr0
 
512
    jmp .mztrtrmesg
 
513
.notrtrwrap
 
514
    cmp byte[MZTForceRTR],1
 
515
    jne .nomztrtr1
 
516
    mov dword[Msgptr],mztrtr1
 
517
    jmp .mztrtrmesg
 
518
.nomztrtr1
 
519
    mov dword[Msgptr],mztrtr2
 
520
.mztrtrmesg
 
521
    mov eax,[MsgCount]
 
522
    mov [MessageOn],eax
 
523
.nortrcycle
 
524
    mov eax,[KeyExtraEnab1]
 
525
    test byte[pressed+eax],1
 
526
    je near .nodisd1
535
527
    mov byte[pressed+eax],2
536
528
    pushad
537
 
    call cycleinputdevice
 
529
    call cycleinputdevice1
538
530
    popad
539
 
    mov dword[Msgptr],snesle
540
 
    cmp byte[snesmouse],0
541
 
    jne .nom0
542
531
    mov dword[Msgptr],snesmousep0
543
 
.nom0
544
 
    cmp byte[snesmouse],1
545
 
    jne .nom1
 
532
    cmp byte[device1],1
 
533
    jne .nom11
546
534
    mov dword[Msgptr],snesmousep1
547
 
.nom1
548
 
    cmp byte[snesmouse],2
549
 
    jne .nom2
 
535
.nom11
 
536
    mov eax,[MsgCount]
 
537
    mov [MessageOn],eax
 
538
    call Get_MousePositionDisplacement
 
539
.nodisd1
 
540
    mov eax,[KeyExtraEnab2]
 
541
    test byte[pressed+eax],1
 
542
    je near .nodisd2
 
543
    mov byte[pressed+eax],2
 
544
    pushad
 
545
    call cycleinputdevice2
 
546
    popad
 
547
    mov dword[Msgptr],snesmousep0
 
548
    cmp byte[device2],1
 
549
    jne .nom21
550
550
    mov dword[Msgptr],snesmousep2
551
 
.nom2
552
 
    cmp byte[snesmouse],3
553
 
    jne .nom3
 
551
.nom21
 
552
    cmp byte[device2],2
 
553
    jne .nom22
554
554
    mov dword[Msgptr],snesss
555
555
    mov word[mousexloc],128
556
556
    mov word[mouseyloc],112
557
 
.nom3
 
557
.nom22
 
558
    cmp byte[device2],3
 
559
    jne .nom23
 
560
    mov dword[Msgptr],snesle1
 
561
.nom23
 
562
    cmp byte[device2],4
 
563
    jne .nom24
 
564
    mov dword[Msgptr],snesle2
 
565
.nom24
558
566
    mov eax,[MsgCount]
559
567
    mov [MessageOn],eax
560
568
    call Get_MousePositionDisplacement
561
 
.nodis7
562
 
    cmp byte[CNetType],20
563
 
    jne .nonet
564
 
    cmp byte[snesmouse],0
565
 
    je .nonet
566
 
    mov byte[snesmouse],0
567
 
    mov dword[MessageOn],0
568
 
.nonet
 
569
.nodisd2
569
570
    mov eax,[KeyNewGfxSwt]
570
571
    test byte[pressed+eax],1
571
572
    je near .nodis8
572
573
    mov byte[pressed+eax],2
573
 
    cmp byte[cbitmode],1
574
 
    jne .no16bng
575
 
    cmp byte[newgfx16b],1
576
 
    je .no16bng
577
 
    jmp .no16bng
578
 
    mov dword[Msgptr],newgfxerror
579
 
.msgstuff
580
 
    mov eax,[MsgCount]
581
 
    mov [MessageOn],eax
582
 
    cmp byte[newengen],0
583
 
    je near .nodis8
584
 
    mov byte[newengen],0
585
 
    jmp .disng
586
 
.nores
587
 
    mov dword[Msgptr],newgfxerror2
588
 
    jmp .msgstuff
589
 
.no16bng
590
574
    mov byte[prevbright],16
591
575
    xor byte[newengen],1
592
576
    mov dword[Msgptr],ngena
700
684
    mov eax,[MsgCount]
701
685
    mov [MessageOn],eax
702
686
.nofrdown
 
687
    mov eax,[KeyDisplayBatt]
 
688
    test byte[pressed+eax],1
 
689
    je .nodisplaybatt
 
690
    mov byte[pressed+eax],2
 
691
    pushad
 
692
    call DisplayBatteryStatus
 
693
    popad
 
694
.nodisplaybatt
 
695
    mov eax,[KeyIncreaseGamma]
 
696
    test byte[pressed+eax],1
 
697
    je .noincgamma
 
698
    mov byte[pressed+eax],2
 
699
    cmp byte[gammalevel],15
 
700
    jge .noincgamma
 
701
    inc byte[gammalevel]
 
702
    mov al,[gammalevel]
 
703
    mov [gammalevel16b],al
 
704
    shr byte[gammalevel16b],1
 
705
    cmp byte[gammalevel],10
 
706
    jl .gammanot10
 
707
    mov byte[gammamsg+13],'1'
 
708
    sub al,10
 
709
    jmp .postgamma
 
710
.gammanot10
 
711
    mov byte[gammamsg+13],' '
 
712
.postgamma
 
713
    add al,'0'
 
714
    mov [gammamsg+14],al
 
715
    mov dword[Msgptr],gammamsg
 
716
    mov eax,[MsgCount]
 
717
    mov [MessageOn],eax
 
718
.noincgamma
 
719
    mov eax,[KeyDecreaseGamma]
 
720
    test byte[pressed+eax],1
 
721
    je .nodecgamma
 
722
    mov byte[pressed+eax],2
 
723
    cmp byte [gammalevel],0
 
724
    je .nodecgamma
 
725
    dec byte[gammalevel]
 
726
    mov eax,[gammalevel]
 
727
    mov [gammalevel16b],eax
 
728
    shr byte[gammalevel16b],1
 
729
    cmp byte[gammalevel],10
 
730
    jl .gamma2not10
 
731
    mov byte[gammamsg+13],'1'
 
732
    sub al,10
 
733
    jmp .postgamma2
 
734
.gamma2not10
 
735
    mov byte[gammamsg+13],' '
 
736
.postgamma2
 
737
    add al,'0'
 
738
    mov [gammamsg+14],al
 
739
    mov dword[Msgptr],gammamsg
 
740
    mov eax,[MsgCount]
 
741
    mov [MessageOn],eax
 
742
.nodecgamma
703
743
    mov eax,[KeyDisplayFPS]
704
744
    test byte[pressed+eax],1
705
745
    je .nodisplayfps
710
750
.nodisplayfps
711
751
 
712
752
    ; do state selects
713
 
    stateselcomp KeyStateSlc0,'0','t'
714
 
    stateselcomp KeyStateSlc1,'1','1'
715
 
    stateselcomp KeyStateSlc2,'2','2'
716
 
    stateselcomp KeyStateSlc3,'3','3'
717
 
    stateselcomp KeyStateSlc4,'4','4'
718
 
    stateselcomp KeyStateSlc5,'5','5'
719
 
    stateselcomp KeyStateSlc6,'6','6'
720
 
    stateselcomp KeyStateSlc7,'7','7'
721
 
    stateselcomp KeyStateSlc8,'8','8'
722
 
    stateselcomp KeyStateSlc9,'9','9'
 
753
    stateselcomp KeyStateSlc0,0
 
754
    stateselcomp KeyStateSlc1,1
 
755
    stateselcomp KeyStateSlc2,2
 
756
    stateselcomp KeyStateSlc3,3
 
757
    stateselcomp KeyStateSlc4,4
 
758
    stateselcomp KeyStateSlc5,5
 
759
    stateselcomp KeyStateSlc6,6
 
760
    stateselcomp KeyStateSlc7,7
 
761
    stateselcomp KeyStateSlc8,8
 
762
    stateselcomp KeyStateSlc9,9
723
763
    mov eax,[KeyStateSlc0]
724
764
    test byte[pressed+eax],1
725
765
    je .nostsl0
732
772
 
733
773
    mov eax,[KeyIncStateSlot]
734
774
    test byte[pressed+eax],1
735
 
    je .noincstateslot
 
775
    je near .noincstateslot
736
776
    mov byte[pressed+eax],2
737
 
    mov eax,[statefileloc]
738
 
    mov dh,[fnamest+eax]
739
 
    cmp dh,'t'
740
 
    je .secondstate
741
 
    cmp dh,'9'
742
 
    je .jumptofirststate
743
 
    inc dh
744
 
    jmp .donextstate
745
 
.secondstate
746
 
    mov dh,'1'
747
 
    jmp .donextstate
748
 
.jumptofirststate
749
 
    mov dh,'t'
750
 
.donextstate
751
 
    mov byte[fnamest+eax],dh
752
 
    cmp dh,'t'
753
 
    je .firststatemsg
754
 
    mov byte[sselm+11],dh
755
 
    jmp .incstatemsg
756
 
.firststatemsg
757
 
    mov byte[sselm+11],'0'
758
 
.incstatemsg
 
777
    mov eax,[current_zst]
 
778
    inc eax
 
779
    cmp eax,100
 
780
    jne .notend
 
781
    xor eax,eax
 
782
.notend
 
783
    mov [current_zst],eax
 
784
    mov dl,10
 
785
    div dl
 
786
    add ah,'0'
 
787
    add al,'0'
 
788
    mov [sselm+11],ax
759
789
    mov dword[Msgptr],sselm
760
790
    mov eax,[MsgCount]
761
791
    mov [MessageOn],eax
762
 
    xor dh,dh
 
792
    xor dx,dx
763
793
.noincstateslot
764
794
 
765
795
    mov eax,[KeyDecStateSlot]
766
796
    test byte[pressed+eax],1
767
 
    je .nodecstateslot
 
797
    je near .nodecstateslot
768
798
    mov byte[pressed+eax],2
769
 
    mov eax,[statefileloc]
770
 
    mov dh,[fnamest+eax]
771
 
    cmp dh,'t'
772
 
    je .jumptolaststate
773
 
    dec dh
774
 
    cmp dh,'0'
775
 
    jne .doprevstate
776
 
.firststate
777
 
    mov dh,'t'
778
 
    jmp .doprevstate
779
 
.jumptolaststate
780
 
    mov dh,'9'
781
 
.doprevstate
782
 
    mov byte[fnamest+eax],dh
783
 
    cmp dh,'t'
784
 
    je .firststatemsg2
785
 
    mov byte[sselm+11],dh
786
 
    jmp .decstatemsg
787
 
.firststatemsg2
788
 
    mov byte[sselm+11],'0'
789
 
.decstatemsg
 
799
    mov eax,[current_zst]
 
800
    cmp eax,0
 
801
    jne .notstart
 
802
    mov eax,100
 
803
.notstart
 
804
    dec eax
 
805
    mov [current_zst],eax
 
806
    mov dl,10
 
807
    div dl
 
808
    add ah,'0'
 
809
    add al,'0'
 
810
    mov [sselm+11],ax
790
811
    mov dword[Msgptr],sselm
791
812
    mov eax,[MsgCount]
792
813
    mov [MessageOn],eax
793
 
    xor dh,dh
 
814
    xor dx,dx
794
815
.nodecstateslot
 
816
 
795
817
    mov eax,[KeyUsePlayer1234]
796
818
    test byte[pressed+eax],1
797
819
    je .nousepl1234
816
838
    soundselcomp KeyDisableSC6,Voice6Disable,Voice6Status,'7'
817
839
    soundselcomp KeyDisableSC7,Voice7Disable,Voice7Status,'8'
818
840
 
819
 
.finishchatskip
820
841
    cmp byte[curblank],0h
821
842
    jne near yesblank
822
843
    ; Swap video addresses
825
846
;    je .useb
826
847
    mov ebx,[vidbufferofsa]
827
848
    mov [vidbuffer],ebx
828
 
    add ebx,75036+16
829
 
    mov [cbackofsaddr],ebx
830
 
    mov ebx,[vidbufferofsb]
831
 
    mov [vidbufferm],ebx
832
 
;    jmp .nouseb
833
 
;.useb
834
 
;    mov ebx,[vidbufferofsb]
835
 
;    mov [vidbuffer],ebx
836
 
;    add ebx,75036+16
837
 
;    mov [cbackofsaddr],ebx
838
 
;    mov ebx,[vidbufferofsa]
839
 
;    mov [vidbufferm],ebx
840
 
;.nouseb
841
849
 
842
850
NEWSYM docache
843
851
    xor ebx,ebx
892
900
 
893
901
.nosprites
894
902
    ; fill background with 0's unless 16-bit/new graphics engine mode is on
895
 
    jmp .skipbgclear
896
 
    cmp byte[cbitmode],1
897
 
    je .skipbgclear
898
 
    cmp byte[newengen],1
899
 
    jne .skipbgclear
900
 
    mov edi,[vidbuffer]
901
 
    xor eax,eax
902
 
    add edi,16
903
 
    mov dl,[resolutn]
904
 
.loopa
905
 
    mov ecx,64
906
 
    rep stosd
907
 
    add edi,32
908
 
    dec dl
909
 
    jnz .loopa
910
 
.skipbgclear
911
903
    xor ecx,ecx
912
904
    pop es
913
905
NEWSYM yesblank
917
909
    pop ebx
918
910
    ret
919
911
 
920
 
NEWSYM ClearBGFPUCopy
921
 
    mov edi,[vidbuffer]
922
 
    xor eax,eax
923
 
    add edi,16
924
 
    mov dl,[resolutn]
925
 
.loopa
926
 
    mov ecx,16
927
 
.TopOfLoop
928
 
    FLDZ
929
 
    FLDZ
930
 
    FISTP QWORD [EDI]
931
 
    FISTP QWORD [EDI+8]
932
 
    ADD EDI,16
933
 
    DEC ECX
934
 
    JNZ .TopOfLoop
935
 
    add edi,32
936
 
    dec dl
937
 
    jnz .loopa
938
 
.skipbgclear
939
 
    xor ecx,ecx
940
 
    pop es
941
 
    pop edx
942
 
    pop edi
943
 
    pop esi
944
 
    pop ebx
945
 
    ret
946
 
 
947
 
SECTION .bss
948
 
.Zero resd 2
949
 
.Zero2 resd 2
950
 
 
951
912
SECTION .data
952
913
NEWSYM osm2dis,      db 0
953
 
NEWSYM cachedmode,   db 0
954
 
NEWSYM tempfname,    db 'vram.bin',0
955
 
NEWSYM scrnsizebyte, dw 1024,2048,2048,4096
956
914
NEWSYM colormodedef, db 1,1,1,1, 2,2,1,0, 2,2,0,0, 3,2,0,0,
957
915
               db 3,1,0,0, 2,1,0,0, 2,0,0,0, 0,0,0,0
958
 
NEWSYM colormoded2,  db 4,4,4,4, 5,5,4,0, 5,5,0,0, 6,5,0,0,
959
 
               db 6,4,0,0, 5,4,0,0, 5,0,0,0, 0,0,0,0
960
916
NEWSYM colormodeofs, dd 0
961
917
NEWSYM curblank,     db 80h             ; current blank state (40h = skip fill)
962
918
NEWSYM addr2add,     dd 0
979
935
NEWSYM curcolbg3,   db 0
980
936
NEWSYM curcolbg4,   db 0
981
937
NEWSYM panickeyp,   db 'ALL SWITCHES NORMAL',0
982
 
NEWSYM snesmousep0, db 'MOUSE/SUPER SCOPE DISABLED',0
 
938
NEWSYM mztrtr0, db 'LOAD MZT MODE - OFF',0
 
939
NEWSYM mztrtr1, db 'LOAD MZT MODE - RECORD',0
 
940
NEWSYM mztrtr2, db 'LOAD MZT MODE - REPLAY',0
 
941
NEWSYM snesmousep0, db 'EXTRA DEVICES DISABLED',0
983
942
NEWSYM snesmousep1, db 'MOUSE ENABLED IN PORT 1',0
984
943
NEWSYM snesmousep2, db 'MOUSE ENABLED IN PORT 2',0
985
944
NEWSYM snesss,      db 'SUPER SCOPE ENABLED',0
986
 
NEWSYM snesle,      db 'LETHAL ENFORCER GUN ENABLED',0
 
945
NEWSYM snesle1,      db '1 JUSTIFIER ENABLED',0
 
946
NEWSYM snesle2,      db '2 JUSTIFIERS ENABLED',0
987
947
NEWSYM windissw,    db 'WINDOWING DISABLED',0
988
948
NEWSYM winenasw,    db 'WINDOWING ENABLED',0
989
949
NEWSYM ofsdissw,    db 'OFFSET MODE DISABLED',0
990
950
NEWSYM ofsenasw,    db 'OFFSET MODE ENABLED',0
991
951
NEWSYM ngena, db 'NEW GFX ENGINE ENABLED',0
992
952
NEWSYM ngdis, db 'NEW GFX ENGINE DISABLED',0
993
 
NEWSYM sselm, db 'STATE SLOT 0 SELECTED',0
 
953
NEWSYM sselm, db 'STATE SLOT  0 SELECTED',0
994
954
NEWSYM vollv, db 'VOLUME LEVEL :    ',0
995
955
NEWSYM frlev, db 'FRAME SKIP SET TO  ',0
996
956
NEWSYM frlv0, db 'AUTO FRAMERATE ENABLED',0
1008
968
bg3laydis db 'BG3 LAYER DISABLED',0
1009
969
bg4laydis db 'BG4 LAYER DISABLED',0
1010
970
sprlaydis db 'SPRITE LAYER DISABLED',0
 
971
gammamsg db 'GAMMA LEVEL:   ',0
1011
972
section .text
1012
973
 
1013
974
;*******************************************************
1060
1021
    jne .64dot2
1061
1022
    mov ebx,.process32x32sprite
1062
1023
    mov [.size2ptr],ebx
1063
 
    jmp .fin2 
1064
 
.64dot2 
 
1024
    jmp .fin2
 
1025
.64dot2
1065
1026
    mov ebx,.process64x64sprite
1066
1027
    mov [.size2ptr],ebx
1067
1028
.fin2
1182
1143
    xor eax,eax
1183
1144
    cmp bx,[curypos]
1184
1145
    jb .overflow
1185
 
    mov al,byte[sprlefttot+ebx]
1186
 
    cmp al,37
 
1146
    mov al,[sprlefttot+ebx]
 
1147
    cmp al,45
1187
1148
    ja near .overflow
1188
1149
    inc byte[sprlefttot+ebx]
1189
1150
    add ebx,[addr2add]
1195
1156
    mov [ebp+ebx],cx
1196
1157
    mov [ebp+ebx+2],esi
1197
1158
    mov al,[.statusbit]
1198
 
    mov byte[ebp+ebx+6],dh
1199
 
    mov byte[ebp+ebx+7],al
 
1159
    mov [ebp+ebx+6],dh
 
1160
    mov [ebp+ebx+7],al
1200
1161
.overflow
1201
1162
    inc dl
1202
1163
    add esi,8
1223
1184
    mov bl,dl
1224
1185
    cmp bx,[curypos]
1225
1186
    jb .overflow2
1226
 
    mov al,byte[sprlefttot+ebx]
1227
 
    cmp al,37
 
1187
    mov al,[sprlefttot+ebx]
 
1188
    cmp al,45
1228
1189
    ja near .overflow2
1229
1190
    inc byte[sprlefttot+ebx]
1230
1191
    add ebx,[addr2add]
1236
1197
    mov [ebp+ebx],cx
1237
1198
    mov [ebp+ebx+2],esi
1238
1199
    mov al,[.statusbit]
1239
 
    mov byte[ebp+ebx+6],dh
1240
 
    mov byte[ebp+ebx+7],al
 
1200
    mov [ebp+ebx+6],dh
 
1201
    mov [ebp+ebx+7],al
1241
1202
.overflow2
1242
1203
    inc dl
1243
1204
    sub esi,8
1733
1694
    jne .64dot2
1734
1695
    mov ebx,.process32x32sprite
1735
1696
    mov [.size2ptr],ebx
1736
 
    jmp .fin2 
1737
 
.64dot2 
 
1697
    jmp .fin2
 
1698
.64dot2
1738
1699
    mov ebx,.process64x64sprite
1739
1700
    mov [.size2ptr],ebx
1740
1701
.fin2
1848
1809
    mov bl,dl
1849
1810
    cmp bx,[curypos]
1850
1811
    jb .overflow
1851
 
    mov al,byte[sprlefttot+ebx]
1852
 
    cmp al,37
 
1812
    mov al,[sprlefttot+ebx]
 
1813
    cmp al,45
1853
1814
    ja near .overflow
1854
1815
    inc byte[sprlefttot+ebx]
1855
1816
    mov edi,[.cpri]
1862
1823
    mov al,[.statusbit]
1863
1824
    and al,0F8h
1864
1825
    or al,[.cpri]
1865
 
    mov byte[ebp+ebx+6],dh
1866
 
    mov byte[ebp+ebx+7],al
 
1826
    mov [ebp+ebx+6],dh
 
1827
    mov [ebp+ebx+7],al
1867
1828
.overflow
1868
1829
    inc dl
1869
1830
    add esi,8
1890
1851
    mov bl,dl
1891
1852
    cmp bx,[curypos]
1892
1853
    jb .overflow
1893
 
    mov al,byte[sprlefttot+ebx]
1894
 
    cmp al,37
 
1854
    mov al,[sprlefttot+ebx]
 
1855
    cmp al,45
1895
1856
    ja near .overflow2
1896
1857
    inc byte[sprlefttot+ebx]
1897
1858
    mov edi,[.cpri]
1904
1865
    mov al,[.statusbit]
1905
1866
    and al,0F8h
1906
1867
    or al,[.cpri]
1907
 
    mov byte[ebp+ebx+6],dh
1908
 
    mov byte[ebp+ebx+7],al
 
1868
    mov [ebp+ebx+6],dh
 
1869
    mov [ebp+ebx+7],al
1909
1870
.overflow2
1910
1871
    inc dl
1911
1872
    sub esi,8
2279
2240
    ; initialize obj size cache
2280
2241
    mov dword[.objptr],oamram
2281
2242
    add dword[.objptr],512
2282
 
    mov esi,dword[.objptr]
 
2243
    mov esi,[.objptr]
2283
2244
    mov al,[esi]
2284
2245
    mov [.curobjtype],al
2285
2246
    mov byte[.objleftinbyte],4
2422
2383
    mov al,[tiletypec]
2423
2384
    shr ebx,1
2424
2385
    pop esi
2425
 
    mov byte[tltype4b+ebx],al
 
2386
    mov [tltype4b+ebx],al
2426
2387
.nocache
2427
2388
    inc word[.curobj]
2428
2389
    dec byte[.byteb4add]
2430
2391
    mov ax,[.byte2add]
2431
2392
    add word[.curobj],ax
2432
2393
    mov al,[.byte2move]
2433
 
    mov byte[.byteb4add],al
 
2394
    mov [.byteb4add],al
2434
2395
.skipbyteadd
2435
2396
    dec byte[.num2do]
2436
2397
    jnz near .nextobject
3917
3878
    pop esi
3918
3879
    ret
3919
3880
 
3920
 
 
 
3881
SECTION .bss
 
3882
NEWSYM dcolortab, resd 256
 
3883
 
 
3884
SECTION .data
 
3885
NEWSYM ExitFromGUI,     db 0
 
3886
NEWSYM videotroub,      dd 0
 
3887
NEWSYM TripBufAvail,    db 0
 
3888
NEWSYM vesa2_clbit,     dd 0            ; clear all bit 0's if AND is used
 
3889
NEWSYM vesa2_rpos,      dd 0            ; Red bit position
 
3890
NEWSYM vesa2_gpos,      dd 0            ; Green bit position
 
3891
NEWSYM vesa2_bpos,      dd 0            ; Blue bit position
 
3892
NEWSYM vesa2_clbitng,   dd 0            ; clear all bit 0's if AND is used
 
3893
NEWSYM vesa2_clbitng2,  dd 0,0          ; clear all bit 0's if AND is used
 
3894
NEWSYM vesa2_clbitng3,  dd 0            ; clear all bit 0's if AND is used
 
3895
NEWSYM vesa2red10,      dd 0            ; red position at bit 10
 
3896
NEWSYM vesa2_rtrcl,     dd 0            ; red transparency clear     (bit+4)
 
3897
NEWSYM vesa2_rtrcla,    dd 0            ; red transparency (AND) clear (not(bit+4))
 
3898
NEWSYM vesa2_rfull,     dd 0            ; red max (or bit*1Fh)
 
3899
NEWSYM vesa2_gtrcl,     dd 0            ; red transparency clear     (bit+4)
 
3900
NEWSYM vesa2_gtrcla,    dd 0            ; red transparency (AND) clear (not(bit+4))
 
3901
NEWSYM vesa2_gfull,     dd 0            ; red max (or bit*1Fh)
 
3902
NEWSYM vesa2_btrcl,     dd 0            ; red transparency clear     (bit+4)
 
3903
NEWSYM vesa2_btrcla,    dd 0            ; red transparency (AND) clear (not(bit+4))
 
3904
NEWSYM vesa2_bfull,     dd 0            ; red max (or bit*1Fh)
 
3905
NEWSYM vesa2_x,         dd 320          ; Desired screen width
 
3906
NEWSYM vesa2_y,         dd 240          ; Height
 
3907
NEWSYM vesa2_bits,      dd 8            ; Bits per pixel
 
3908
NEWSYM vesa2_rposng,    dd 0            ; Red bit position
 
3909
NEWSYM vesa2_gposng,    dd 0            ; Green bit position
 
3910
NEWSYM vesa2_bposng,    dd 0            ; Blue bit position
 
3911
NEWSYM vesa2_usbit,     dd 0            ; Unused bit in proper bit location
 
3912
NEWSYM ErrorPointer,    dd 0
 
3913
 
 
3914
SECTION .text
 
3915
NEWSYM genfulladdtab
 
3916
    ; Write to buffer
 
3917
    cmp byte[newengen],1
 
3918
    jne .notneweng
 
3919
    cmp byte[vesa2red10],0
 
3920
    jne near genfulladdtabred
 
3921
.notneweng
 
3922
    xor ecx,ecx
 
3923
.loopers
 
3924
    mov ax,cx
 
3925
    test [vesa2_rtrcl],cx
 
3926
    jz .nor
 
3927
    and ax,[vesa2_rtrcla]
 
3928
    or ax,[vesa2_rfull]
 
3929
.nor
 
3930
    test [vesa2_gtrcl],cx
 
3931
    jz .nog
 
3932
    and ax,[vesa2_gtrcla]
 
3933
    or ax,[vesa2_gfull]
 
3934
.nog
 
3935
    test [vesa2_btrcl],cx
 
3936
    jz .nob
 
3937
    and ax,[vesa2_btrcla]
 
3938
    or ax,[vesa2_bfull]
 
3939
.nob
 
3940
    shl ax,1
 
3941
    mov [fulladdtab+ecx*2],ax
 
3942
    dec cx
 
3943
    jnz .loopers
 
3944
    ret
 
3945
 
 
3946
NEWSYM genfulladdtabred
 
3947
NEWSYM genfulladdtabng
 
3948
    ; Write to buffer
 
3949
    xor ecx,ecx
 
3950
.loopers
 
3951
    mov ax,cx
 
3952
    test cx,0100000000000000b
 
3953
    jz .nor
 
3954
    and ax,1011111111111111b
 
3955
    or ax, 0011110000000000b
 
3956
.nor
 
3957
    test cx,0000001000000000b
 
3958
    jz .nog
 
3959
    and ax,1111110111111111b
 
3960
    or ax, 0000000111100000b
 
3961
.nog
 
3962
    test cx,0000000000010000b
 
3963
    jz .nob
 
3964
    and ax,1111111111101111b
 
3965
    or ax, 0000000000001111b
 
3966
.nob
 
3967
    shl ax,1
 
3968
    mov [fulladdtab+ecx*2],ax
 
3969
    dec cx
 
3970
    jnz .loopers
 
3971
    ret