| 1 | ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
|
|---|
| 2 | ;
|
|---|
| 3 | ; This file is part of AiR-BOOT
|
|---|
| 4 | ;
|
|---|
| 5 | ; AiR-BOOT is free software: you can redistribute it and/or modify it under
|
|---|
| 6 | ; the terms of the GNU General Public License as published by the Free
|
|---|
| 7 | ; Software Foundation, either version 3 of the License, or (at your option)
|
|---|
| 8 | ; any later version.
|
|---|
| 9 | ;
|
|---|
| 10 | ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
|
|---|
| 11 | ; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
|
|---|
| 12 | ; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|---|
| 13 | ; details.
|
|---|
| 14 | ;
|
|---|
| 15 | ; You should have received a copy of the GNU General Public License along with
|
|---|
| 16 | ; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 17 | ;
|
|---|
| 18 | ;---------------------------------------------------------------------------
|
|---|
| 19 | ; AiR-BOOT / F/X
|
|---|
| 20 | ;---------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 | IFDEF MODULE_NAMES
|
|---|
| 23 | DB 'FX',0
|
|---|
| 24 | ENDIF
|
|---|
| 25 |
|
|---|
| 26 | ; There you go. Some nice old-school demo coder effects :)
|
|---|
| 27 | ; If you rip this code, I will ./ your ass. =]
|
|---|
| 28 |
|
|---|
| 29 | include special/fxtables.asm
|
|---|
| 30 |
|
|---|
| 31 | FX_MaxScanLine equ 384
|
|---|
| 32 | FX_TotalCooperBars equ 7
|
|---|
| 33 |
|
|---|
| 34 | FX_CalculateTables Proc Near
|
|---|
| 35 | ; Calculate the Cooper-Bar Color-Table -> FX_CooperColors
|
|---|
| 36 | mov di, offset FX_CooperColors
|
|---|
| 37 | mov ax, 000Fh ; Red
|
|---|
| 38 | call FX_MakeCooperBarColors
|
|---|
| 39 | mov ax, 0FF0h ; Pink
|
|---|
| 40 | call FX_MakeCooperBarColors
|
|---|
| 41 | mov ax, 0F0Fh ; Bright Blue
|
|---|
| 42 | call FX_MakeCooperBarColors
|
|---|
| 43 | mov ax, 0F00h ; Blue
|
|---|
| 44 | call FX_MakeCooperBarColors
|
|---|
| 45 | mov ax, 00FFh ; Yellow
|
|---|
| 46 | call FX_MakeCooperBarColors
|
|---|
| 47 | mov ax, 00F0h ; Green
|
|---|
| 48 | call FX_MakeCooperBarColors
|
|---|
| 49 | mov ax, 0FFFh ; White
|
|---|
| 50 | call FX_MakeCooperBarColors
|
|---|
| 51 | ret
|
|---|
| 52 | FX_CalculateTables EndP
|
|---|
| 53 |
|
|---|
| 54 | ; This routine will dump a color-table to ES:es:[DI]. Total of 96 bytes.
|
|---|
| 55 | ; In: AX - Color-Separator (RGB, per value 4 bit)
|
|---|
| 56 | ; DI - Pointer to Buffer for Color-Table
|
|---|
| 57 | ; Out: *none*
|
|---|
| 58 | ; Destroyed: DI - updated, +96
|
|---|
| 59 | FX_MakeCooperBarColors Proc Near
|
|---|
| 60 | mov bh, ah
|
|---|
| 61 | shl bh, 4
|
|---|
| 62 | or bh, ah ; BH - Blue-Value, now 00h or FFh
|
|---|
| 63 | mov dh, al
|
|---|
| 64 | mov bl, al
|
|---|
| 65 | shr dh, 4
|
|---|
| 66 | and bl, 0F0h
|
|---|
| 67 | or dh, bl ; DH - Green-Value, now 00h or FFh
|
|---|
| 68 | mov dl, al
|
|---|
| 69 | and al, 00Fh
|
|---|
| 70 | shl dl, 4
|
|---|
| 71 | or dl, al ; DL - Red-Value, now 00h or FFh
|
|---|
| 72 | mov ax, 1111h
|
|---|
| 73 | mov bl, 11h ; Start-Values
|
|---|
| 74 | mov cx, 15
|
|---|
| 75 | FX_MCBC_BuildColorLoop1:
|
|---|
| 76 | add ax, 0303h
|
|---|
| 77 | add bl, 03h
|
|---|
| 78 | and ax, dx
|
|---|
| 79 | and bl, bh
|
|---|
| 80 | mov es:[di], ax
|
|---|
| 81 | mov es:[di+2], bl
|
|---|
| 82 | add di, 3
|
|---|
| 83 | loop FX_MCBC_BuildColorLoop1
|
|---|
| 84 | push ax
|
|---|
| 85 | push bx
|
|---|
| 86 | add ax, 0101h
|
|---|
| 87 | add bl, 01h
|
|---|
| 88 | and ax, dx
|
|---|
| 89 | and bl, bh
|
|---|
| 90 | mov es:[di], ax
|
|---|
| 91 | mov es:[di+2], bl
|
|---|
| 92 | mov es:[di+3], ax
|
|---|
| 93 | mov es:[di+5], bl
|
|---|
| 94 | add di, 6
|
|---|
| 95 | pop bx
|
|---|
| 96 | pop ax
|
|---|
| 97 | mov cx, 15
|
|---|
| 98 | FX_MCBC_BuildColorLoop2:
|
|---|
| 99 | and ax, dx
|
|---|
| 100 | and bl, bh
|
|---|
| 101 | mov es:[di], ax
|
|---|
| 102 | mov es:[di+2], bl
|
|---|
| 103 | add di, 3
|
|---|
| 104 | sub ax, 0303h
|
|---|
| 105 | sub bl, 03h
|
|---|
| 106 | loop FX_MCBC_BuildColorLoop2
|
|---|
| 107 | ret
|
|---|
| 108 | FX_MakeCooperBarColors EndP
|
|---|
| 109 |
|
|---|
| 110 | ; This is called just before a new screen is generated
|
|---|
| 111 | ; If FX is active, we will modify the base segment for videoio to page 2,
|
|---|
| 112 | ; so the screen will be generated there instead of the current page.
|
|---|
| 113 | FX_StartScreen Proc Near
|
|---|
| 114 | test byte ptr [CFG_CooperBars], 1
|
|---|
| 115 | jz FXSS_NoFX
|
|---|
| 116 | mov word ptr [VideoIO_Segment], VideoIO_Page2
|
|---|
| 117 | FXSS_NoFX:
|
|---|
| 118 | ret
|
|---|
| 119 | FX_StartScreen EndP
|
|---|
| 120 |
|
|---|
| 121 | ; This is called, when a new screen was done
|
|---|
| 122 | ; If FX is active, we will copy the new screen to scroll area, do the FX,
|
|---|
| 123 | ; copy the new screen to Page 0 and activate it.
|
|---|
| 124 | FX_EndScreenLeft Proc Near
|
|---|
| 125 | test byte ptr [CFG_CooperBars], 1
|
|---|
| 126 | jnz FXESL_Go
|
|---|
| 127 | ret
|
|---|
| 128 | FXESL_Go:
|
|---|
| 129 | pusha
|
|---|
| 130 | mov ax, VideoIO_Page2
|
|---|
| 131 | mov bx, VideoIO_Page0
|
|---|
| 132 | mov dx, 160
|
|---|
| 133 | xor di, di
|
|---|
| 134 | call FX_InterleaveCopy
|
|---|
| 135 | call FX_ScrollScreenLeft
|
|---|
| 136 |
|
|---|
| 137 | mov ax, VideoIO_Page2
|
|---|
| 138 | call VideoIO_RestoreFrom
|
|---|
| 139 | mov word ptr [VideoIO_Segment], VideoIO_Page0
|
|---|
| 140 | call FX_EndScreenInternalCleanUp
|
|---|
| 141 | popa
|
|---|
| 142 | ret
|
|---|
| 143 | FX_EndScreenLeft EndP
|
|---|
| 144 |
|
|---|
| 145 | FX_ScrollScreenLeft Proc Near
|
|---|
| 146 | mov word ptr [FX_WideScrollerCurPos], 640
|
|---|
| 147 | mov byte ptr [FX_WideScrollerDirection], 0
|
|---|
| 148 | mov byte ptr [FX_WideScrollerAbsDirection], 0
|
|---|
| 149 | call FX_EndScreenInternalGo
|
|---|
| 150 | ret
|
|---|
| 151 | FX_ScrollScreenLeft EndP
|
|---|
| 152 |
|
|---|
| 153 | FX_EndScreenRight Proc Near
|
|---|
| 154 | test byte ptr [CFG_CooperBars], 1
|
|---|
| 155 | jnz FXESR_Go
|
|---|
| 156 | ret
|
|---|
| 157 | FXESR_Go:
|
|---|
| 158 | pusha
|
|---|
| 159 | mov ax, VideoIO_Page0
|
|---|
| 160 | mov bx, VideoIO_Page2
|
|---|
| 161 | mov dx, 160
|
|---|
| 162 | xor di, di
|
|---|
| 163 | call FX_InterleaveCopy
|
|---|
| 164 | call FX_ScrollScreenRight
|
|---|
| 165 |
|
|---|
| 166 | mov ax, VideoIO_Page2
|
|---|
| 167 | call VideoIO_RestoreFrom
|
|---|
| 168 | mov word ptr [VideoIO_Segment], VideoIO_Page0
|
|---|
| 169 | call FX_EndScreenInternalCleanUp
|
|---|
| 170 | popa
|
|---|
| 171 | ret
|
|---|
| 172 | FX_EndScreenRight EndP
|
|---|
| 173 |
|
|---|
| 174 | FX_ScrollScreenRight Proc Near
|
|---|
| 175 | mov word ptr [FX_WideScrollerCurPos], 0
|
|---|
| 176 | mov byte ptr [FX_WideScrollerDirection], 1
|
|---|
| 177 | mov byte ptr [FX_WideScrollerAbsDirection], 1
|
|---|
| 178 | call FX_EndScreenInternalGo
|
|---|
| 179 | ret
|
|---|
| 180 | FX_ScrollScreenRight EndP
|
|---|
| 181 |
|
|---|
| 182 | FX_EndScreenInternalGo Proc Near
|
|---|
| 183 | mov byte ptr [FX_WideScrollerSpeed], 1
|
|---|
| 184 | mov byte ptr [FX_WideScrollerSpeedState], 1
|
|---|
| 185 | mov byte ptr [FX_WideScrollerBounceSpeed], 25
|
|---|
| 186 | ; Check, if this is 1st time call...
|
|---|
| 187 | inc word ptr [FX_UseCount]
|
|---|
| 188 | cmp word ptr [FX_UseCount], 1
|
|---|
| 189 | jne FX_ES_NotFirstTime
|
|---|
| 190 | mov word ptr [FX_OverallTimer], 220
|
|---|
| 191 | mov word ptr [FX_WideScrollerTimer], 93
|
|---|
| 192 | mov word ptr [FX_CooperBarsTimer], 1
|
|---|
| 193 | jmp FX_ES_NowGoMagic
|
|---|
| 194 | FX_ES_NotFirstTime:
|
|---|
| 195 | mov word ptr [FX_OverallTimer], 127
|
|---|
| 196 | mov word ptr [FX_WideScrollerTimer], 1
|
|---|
| 197 | mov word ptr [FX_CooperBarsTimer], -1 ; Disable coopers on further goes
|
|---|
| 198 | FX_ES_NowGoMagic:
|
|---|
| 199 | call FX_MakeMagicalStuff
|
|---|
| 200 | ret
|
|---|
| 201 | FX_EndScreenInternalGo EndP
|
|---|
| 202 |
|
|---|
| 203 | FX_EndScreenInternalCleanUp Proc Near
|
|---|
| 204 | mov ax, -1
|
|---|
| 205 | call FX_SetVideoStart
|
|---|
| 206 | call FX_WaitRetrace
|
|---|
| 207 | mov ax, 80
|
|---|
| 208 | call FX_SetWideLength
|
|---|
| 209 | ret
|
|---|
| 210 | FX_EndScreenInternalCleanUp EndP
|
|---|
| 211 |
|
|---|
| 212 | ; In: AX - 1st Page Segment
|
|---|
| 213 | ; BX - 2nd Page Segment
|
|---|
| 214 | ; DX - Space to interleave
|
|---|
| 215 | ; DI - Destination offset for Page 4
|
|---|
| 216 | ; Out: Both pages interleaved to Page 4
|
|---|
| 217 | ; Destroyed: AX, CX, SI, DI
|
|---|
| 218 | FX_InterleaveCopy Proc Near
|
|---|
| 219 | push di
|
|---|
| 220 | call FX_InterleaveCopyPage
|
|---|
| 221 | pop di
|
|---|
| 222 | add di, dx
|
|---|
| 223 | mov ax, bx
|
|---|
| 224 | call FX_InterleaveCopyPage
|
|---|
| 225 | ret
|
|---|
| 226 | FX_InterleaveCopy EndP
|
|---|
| 227 |
|
|---|
| 228 | FX_InterleaveCopyPage Proc Near Uses ds es
|
|---|
| 229 | mov ds, ax
|
|---|
| 230 | mov ax, VideoIO_Page4
|
|---|
| 231 | mov es, ax
|
|---|
| 232 | xor si, si
|
|---|
| 233 | FXIC_CopyLoop:
|
|---|
| 234 | mov cx, 80
|
|---|
| 235 | rep movsw
|
|---|
| 236 | add di, dx
|
|---|
| 237 | cmp si, 1000h
|
|---|
| 238 | jb FXIC_CopyLoop
|
|---|
| 239 | ret
|
|---|
| 240 | FX_InterleaveCopyPage EndP
|
|---|
| 241 |
|
|---|
| 242 | FX_MakeMagicalStuff Proc Near Uses es
|
|---|
| 243 | ; Initiate Cooper-Variables...
|
|---|
| 244 | push ds
|
|---|
| 245 | pop es
|
|---|
| 246 | mov di, offset FX_CooperState
|
|---|
| 247 | mov cx, 7
|
|---|
| 248 | xor al, al
|
|---|
| 249 | rep stosb ; Initiates FX_CooperState
|
|---|
| 250 | mov cx, 7
|
|---|
| 251 | dec al ; AX = 255
|
|---|
| 252 | rep stosb ; Initiates FX_SinusPos
|
|---|
| 253 | mov si, offset FX_StartCooperPos
|
|---|
| 254 | mov cx, 7
|
|---|
| 255 | rep movsw ; Initiates FX_CooperPos
|
|---|
| 256 |
|
|---|
| 257 | call FX_WaitRetrace
|
|---|
| 258 | FX_MMS_RetraceLoop:
|
|---|
| 259 | mov dx, 3C8h
|
|---|
| 260 | xor al, al
|
|---|
| 261 | out dx, al
|
|---|
| 262 | inc dx
|
|---|
| 263 | out dx, al
|
|---|
| 264 | out dx, al
|
|---|
| 265 | call FX_WaitRetrace
|
|---|
| 266 | mov dx, 3C9h
|
|---|
| 267 | xor al, al
|
|---|
| 268 | out dx, al ; Really set background color now
|
|---|
| 269 |
|
|---|
| 270 | xor di, di ; DI - Cur Scan-Line Counter
|
|---|
| 271 | FX_MCS_VerticalLoop:
|
|---|
| 272 | call FX_ColorUpVLine
|
|---|
| 273 | inc di
|
|---|
| 274 | cmp di, FX_MaxScanLine
|
|---|
| 275 | jb FX_MCS_VerticalLoop
|
|---|
| 276 |
|
|---|
| 277 | mov ax, [FX_CooperBarsTimer]
|
|---|
| 278 | dec ax
|
|---|
| 279 | jnz FX_MMS_CooperBarsPending
|
|---|
| 280 | ; Here we need to calculate the movements of the Coopers...at last
|
|---|
| 281 | call FX_CalculateCoopers
|
|---|
| 282 | mov ax, 1
|
|---|
| 283 | FX_MMS_CooperBarsPending:
|
|---|
| 284 | mov [FX_CooperBarsTimer], ax
|
|---|
| 285 |
|
|---|
| 286 | mov ax, [FX_WideScrollerTimer]
|
|---|
| 287 | dec ax
|
|---|
| 288 | jnz FX_MMS_WideScrollerPending
|
|---|
| 289 | call FX_CalculateWideScroller
|
|---|
| 290 | mov ax, 1
|
|---|
| 291 | FX_MMS_WideScrollerPending:
|
|---|
| 292 | mov [FX_WideScrollerTimer], ax
|
|---|
| 293 |
|
|---|
| 294 | dec word ptr [FX_OverallTimer]
|
|---|
| 295 | jnz FX_MMS_RetraceLoop
|
|---|
| 296 | ret
|
|---|
| 297 | FX_MakeMagicalStuff EndP
|
|---|
| 298 |
|
|---|
| 299 | ; This routine is called per VRetrace, it will look for a CooperBar to display
|
|---|
| 300 | ; and color the Vertical Screen Line in the specified color
|
|---|
| 301 | ; In: DI - Vertical Line Counter
|
|---|
| 302 | ; Out: *none*
|
|---|
| 303 | ; Destroyed: all, but DI
|
|---|
| 304 | FX_ColorUpVLine Proc Near Uses di
|
|---|
| 305 | add di, 256 ; Real-Scanlines begin at 256 here
|
|---|
| 306 | mov si, offset FX_CooperPos
|
|---|
| 307 | xor cx, cx
|
|---|
| 308 | FX_CUVL_SearchCooperLoop:
|
|---|
| 309 | lodsw
|
|---|
| 310 | mov dx, ax ; AX - First VRLine used by Cooper
|
|---|
| 311 | add dx, 32 ; DX - Last VRLine used by Cooper
|
|---|
| 312 | cmp di, ax
|
|---|
| 313 | jb FX_CUVL_CooperNoHit
|
|---|
| 314 | cmp di, dx
|
|---|
| 315 | jb FX_CUVL_CooperGotHit
|
|---|
| 316 | FX_CUVL_CooperNoHit:
|
|---|
| 317 | inc cx
|
|---|
| 318 | cmp cx, FX_TotalCooperBars
|
|---|
| 319 | jb FX_CUVL_SearchCooperLoop
|
|---|
| 320 | FX_CUVL_CooperNotVisible:
|
|---|
| 321 | xor bx, bx
|
|---|
| 322 | xor cl, cl ; No Cooper -> So use Color [0/0/0]
|
|---|
| 323 | jmp FX_CUVL_ColorLine
|
|---|
| 324 |
|
|---|
| 325 | ; Okay, we got a cooper...now calculate color and done...
|
|---|
| 326 | FX_CUVL_CooperGotHit:
|
|---|
| 327 | mov dx, di
|
|---|
| 328 | sub dx, ax ; DX - Relative Pos within cooper
|
|---|
| 329 | mov bx, cx
|
|---|
| 330 | shl bx, 5 ; * 32
|
|---|
| 331 | mov ax, bx
|
|---|
| 332 | add bx, bx
|
|---|
| 333 | add bx, ax ; BX = CurCooper*96
|
|---|
| 334 | add bx, dx
|
|---|
| 335 | add bx, dx
|
|---|
| 336 | add bx, dx ; Plus RelativePos * 3
|
|---|
| 337 | mov cl, bptr ds:[FX_CooperColors+bx+2]
|
|---|
| 338 | mov bx, wptr ds:[FX_CooperColors+bx]
|
|---|
| 339 |
|
|---|
| 340 | FX_CUVL_ColorLine:
|
|---|
| 341 | mov dx, 3C8h
|
|---|
| 342 | xor al, al
|
|---|
| 343 | out dx, al
|
|---|
| 344 | inc dx
|
|---|
| 345 | mov al, bl
|
|---|
| 346 | out dx, al
|
|---|
| 347 | mov al, bh
|
|---|
| 348 | out dx, al
|
|---|
| 349 | call FX_WaitVRetrace
|
|---|
| 350 | mov dx, 3C9h
|
|---|
| 351 | mov al, cl
|
|---|
| 352 | out dx, al ; Colord on VRetrace...
|
|---|
| 353 | ret
|
|---|
| 354 | FX_ColorUpVLine EndP
|
|---|
| 355 |
|
|---|
| 356 | ; This routine is called to move the cooper bars on screen... It's called on
|
|---|
| 357 | ; every Retrace.
|
|---|
| 358 | ; In: *none*
|
|---|
| 359 | ; Out: *none*
|
|---|
| 360 | ; Destroyed: all
|
|---|
| 361 | FX_CalculateCoopers Proc Near
|
|---|
| 362 | ; Logic: When Intro-State: Increase CooperPos by 1 till 256 -> then active
|
|---|
| 363 | ; Active-State: Use SinusTable, till SinusPos=7Fh -> then Extro
|
|---|
| 364 | ; Extro-State: Decrease CooperPos by 1 till 0
|
|---|
| 365 |
|
|---|
| 366 | xor si, si
|
|---|
| 367 | FX_CC_CalcLoop:
|
|---|
| 368 | cmp bptr ds:[FX_CooperState+si], 1
|
|---|
| 369 | jb FX_CC_IntroState
|
|---|
| 370 | je FX_CC_ActiveState
|
|---|
| 371 | ja FX_CC_ExtroState
|
|---|
| 372 | jmp FX_CC_CalcLoopEnd
|
|---|
| 373 | FX_CC_IntroState:
|
|---|
| 374 | mov bx, si
|
|---|
| 375 | shl bx, 1
|
|---|
| 376 | mov ax, wptr ds:[FX_CooperPos+bx]
|
|---|
| 377 | inc ax
|
|---|
| 378 | mov wptr ds:[FX_CooperPos+bx], ax
|
|---|
| 379 | cmp ax, 256 ; Got into Active-State ?
|
|---|
| 380 | jb FX_CC_CalcLoopEnd
|
|---|
| 381 | inc bptr ds:[FX_CooperState+si]
|
|---|
| 382 | jmp FX_CC_CalcLoopEnd
|
|---|
| 383 | FX_CC_ExtroState:
|
|---|
| 384 | mov bx, si
|
|---|
| 385 | shl bx, 1
|
|---|
| 386 | mov ax, wptr ds:[FX_CooperPos+bx]
|
|---|
| 387 | dec ax
|
|---|
| 388 | jz FX_CC_CalcLoopEnd
|
|---|
| 389 | mov wptr ds:[FX_CooperPos+bx], ax
|
|---|
| 390 | jmp FX_CC_CalcLoopEnd
|
|---|
| 391 |
|
|---|
| 392 | FX_CC_ActiveState:
|
|---|
| 393 | ; increment SinusPos by 1
|
|---|
| 394 | ;movzx bx, bptr ds:[FX_SinusPos+si]
|
|---|
| 395 | mov bl,bptr ds:[FX_SinusPos+si]
|
|---|
| 396 | mov bh,0
|
|---|
| 397 |
|
|---|
| 398 | inc bx
|
|---|
| 399 | mov bptr ds:[FX_SinusPos+si], bl
|
|---|
| 400 | cmp bl, 7Fh
|
|---|
| 401 | jne FX_CC_ActiveNoStateChange
|
|---|
| 402 | inc bptr ds:[FX_CooperState+si]
|
|---|
| 403 | FX_CC_ActiveNoStateChange:
|
|---|
| 404 | ; Get SinusTab-Value for [BX] and put it to CooperPos-Table for easy xs
|
|---|
| 405 | and bx, 7Fh
|
|---|
| 406 | shl bx, 1
|
|---|
| 407 | mov ax, wptr es:[FX_SinusTab+bx]
|
|---|
| 408 | mov bx, si
|
|---|
| 409 | shl bx, 1
|
|---|
| 410 | mov wptr ds:[FX_CooperPos+bx], ax
|
|---|
| 411 | FX_CC_CalcLoopEnd:
|
|---|
| 412 | inc si
|
|---|
| 413 | cmp si, FX_TotalCooperBars
|
|---|
| 414 | jb FX_CC_CalcLoop
|
|---|
| 415 | ret
|
|---|
| 416 | FX_CalculateCoopers EndP
|
|---|
| 417 |
|
|---|
| 418 | FX_CalculateWideScroller Proc Near
|
|---|
| 419 | mov bx, [FX_WideScrollerCurPos]
|
|---|
| 420 | ;movzx cx, FX_WideScrollerSpeed
|
|---|
| 421 | mov cl, [FX_WideScrollerSpeed]
|
|---|
| 422 | mov ch,0
|
|---|
| 423 |
|
|---|
| 424 | test byte ptr [FX_WideScrollerAbsDirection], 1
|
|---|
| 425 | jnz FXCWS_RIGHT
|
|---|
| 426 | jmp FXCWS_LEFT
|
|---|
| 427 |
|
|---|
| 428 | ; ================================================== WideScroll: LEFT CALC
|
|---|
| 429 | FXCWS_LEFT:
|
|---|
| 430 | test byte ptr [FX_WideScrollerSpeedState], 1
|
|---|
| 431 | jz FXCWS_LEFT_Bouncing
|
|---|
| 432 | or bx, bx
|
|---|
| 433 | jz FXCWS_LEFT_BounceNOW
|
|---|
| 434 | jmp FXCWS_DoSpeedThing
|
|---|
| 435 |
|
|---|
| 436 | FXCWS_LEFT_Bouncing:
|
|---|
| 437 | or cx, cx
|
|---|
| 438 | jnz FXCWS_DoSpeedThing
|
|---|
| 439 | mov byte ptr [FX_WideScrollerSpeedState], 1
|
|---|
| 440 | mov byte ptr [FX_WideScrollerDirection], 0
|
|---|
| 441 | mov dl, [FX_WideScrollerBounceSpeed]
|
|---|
| 442 | shr dl,1
|
|---|
| 443 | mov [FX_WideScrollerBounceSpeed], dl
|
|---|
| 444 | jmp FXCWS_DoSpeedThing
|
|---|
| 445 |
|
|---|
| 446 | FXCWS_LEFT_BounceNOW:
|
|---|
| 447 | mov cl, [FX_WideScrollerBounceSpeed]
|
|---|
| 448 | mov byte ptr [FX_WideScrollerSpeedState], 0
|
|---|
| 449 | mov byte ptr [FX_WideScrollerDirection], 1
|
|---|
| 450 | jmp FXCWS_DoSpeedThing
|
|---|
| 451 |
|
|---|
| 452 | ; ================================================= WideScroll: RIGHT CALC
|
|---|
| 453 | FXCWS_RIGHT:
|
|---|
| 454 | test byte ptr [FX_WideScrollerSpeedState], 1
|
|---|
| 455 | jz FXCWS_RIGHT_Bouncing
|
|---|
| 456 | cmp bx, 640 ; 1280
|
|---|
| 457 | jae FXCWS_RIGHT_BounceNOW
|
|---|
| 458 | jmp FXCWS_DoSpeedThing
|
|---|
| 459 |
|
|---|
| 460 | FXCWS_RIGHT_Bouncing:
|
|---|
| 461 | or cl, cl
|
|---|
| 462 | jnz FXCWS_DoSpeedThing
|
|---|
| 463 | mov byte ptr [FX_WideScrollerSpeedState], 1
|
|---|
| 464 | mov byte ptr [FX_WideScrollerDirection], 1
|
|---|
| 465 | mov dl, [FX_WideScrollerBounceSpeed]
|
|---|
| 466 | shr dl, 1
|
|---|
| 467 | mov [FX_WideScrollerBounceSpeed], dl
|
|---|
| 468 | jmp FXCWS_DoSpeedThing
|
|---|
| 469 |
|
|---|
| 470 | FXCWS_RIGHT_BounceNOW:
|
|---|
| 471 | mov cl, [FX_WideScrollerBounceSpeed]
|
|---|
| 472 | mov byte ptr [FX_WideScrollerSpeedState], 0
|
|---|
| 473 | mov byte ptr [FX_WideScrollerDirection], 0
|
|---|
| 474 | jmp FXCWS_DoSpeedThing
|
|---|
| 475 |
|
|---|
| 476 | ; ================================================= WideScroll: SPEED CALC
|
|---|
| 477 | FXCWS_DoSpeedThing:
|
|---|
| 478 | test byte ptr [FX_WideScrollerSpeedState], 1
|
|---|
| 479 | jnz FXCWS_SpeedUp
|
|---|
| 480 | FXCWS_SpeedDown:
|
|---|
| 481 | or cl, cl
|
|---|
| 482 | jz FXCWS_WideScrollNOW
|
|---|
| 483 | dec cl
|
|---|
| 484 | jmp FXCWS_WideScrollNOW
|
|---|
| 485 |
|
|---|
| 486 | FXCWS_SpeedUp:
|
|---|
| 487 | cmp cl, 25
|
|---|
| 488 | jge FXCWS_WideScrollNOW
|
|---|
| 489 | inc cl
|
|---|
| 490 | jmp FXCWS_WideScrollNOW
|
|---|
| 491 |
|
|---|
| 492 | ; ================================================== WideScroll: DO SCROLL
|
|---|
| 493 | FXCWS_WideScrollNOW:
|
|---|
| 494 | xor ch, ch
|
|---|
| 495 | test byte ptr [FX_WideScrollerDirection], 1
|
|---|
| 496 | jnz FXCWS_ScrollRIGHT
|
|---|
| 497 | sub bx, cx
|
|---|
| 498 | jmp FXCWS_Continue
|
|---|
| 499 | FXCWS_ScrollRIGHT:
|
|---|
| 500 | add bx, cx
|
|---|
| 501 | FXCWS_Continue:
|
|---|
| 502 | cmp bx, 5555h ; Zu gross <g>
|
|---|
| 503 | jb FXCWS_NotToSmall
|
|---|
| 504 | mov bx, 0
|
|---|
| 505 | FXCWS_NotToSmall:
|
|---|
| 506 | cmp bx, 640 ; 1280
|
|---|
| 507 | jb FXCWS_NotToBig
|
|---|
| 508 | mov bx, 640 ; 1280
|
|---|
| 509 | FXCWS_NotToBig:
|
|---|
| 510 | mov [FX_WideScrollerCurPos], bx
|
|---|
| 511 | mov [FX_WideScrollerSpeed], cl
|
|---|
| 512 | mov ax, 160
|
|---|
| 513 | call FX_SetWideLength
|
|---|
| 514 | mov ax, bx
|
|---|
| 515 | call FX_SetVideoStart
|
|---|
| 516 | ret
|
|---|
| 517 | FX_CalculateWideScroller EndP
|
|---|
| 518 |
|
|---|
| 519 | FX_WaitRetrace Proc Near
|
|---|
| 520 | mov dx, 3DAh
|
|---|
| 521 | FX_WR1:
|
|---|
| 522 | in al,dx
|
|---|
| 523 | test al,8
|
|---|
| 524 | jnz FX_WR1
|
|---|
| 525 | FX_WR2:
|
|---|
| 526 | in al,dx
|
|---|
| 527 | test al,8
|
|---|
| 528 | jz FX_WR2
|
|---|
| 529 | ret
|
|---|
| 530 | FX_WaitRetrace EndP
|
|---|
| 531 |
|
|---|
| 532 | FX_WaitVRetrace Proc Near
|
|---|
| 533 | mov dx, 3DAh
|
|---|
| 534 | FX_WVR1:
|
|---|
| 535 | in al,dx
|
|---|
| 536 | test al,1
|
|---|
| 537 | jnz FX_WVR1
|
|---|
| 538 | FX_WVR2:
|
|---|
| 539 | in al,dx
|
|---|
| 540 | test al,1
|
|---|
| 541 | jz FX_WVR2
|
|---|
| 542 | ret
|
|---|
| 543 | FX_WaitVRetrace EndP
|
|---|
| 544 |
|
|---|
| 545 | FX_SetVideoStart Proc Near Uses bx cx dx
|
|---|
| 546 | cmp ax, -1
|
|---|
| 547 | je FXSVS_Reset
|
|---|
| 548 | mov bx, ax
|
|---|
| 549 | mov cl, al
|
|---|
| 550 | shr bx, 3
|
|---|
| 551 | and cl, 7
|
|---|
| 552 | add bx, 2000h ; Start at BC00h (Offset 4000h)
|
|---|
| 553 | or cl, cl
|
|---|
| 554 | jnz FXSVS_SetValues
|
|---|
| 555 | mov cl, 31 ; BX - StartAddr, CL - ShiftReg
|
|---|
| 556 | jmp FXSVS_SetValues
|
|---|
| 557 | FXSVS_Reset:
|
|---|
| 558 | xor bx, bx ; StartAddr==0, ShiftReg==31
|
|---|
| 559 | mov cl, 31
|
|---|
| 560 | FXSVS_SetValues:
|
|---|
| 561 | mov dx, 3D4h
|
|---|
| 562 | mov al, 0Ch
|
|---|
| 563 | mov ah, bh
|
|---|
| 564 | out dx, ax ; Set Start-Address
|
|---|
| 565 | inc al
|
|---|
| 566 | mov ah, bl
|
|---|
| 567 | out dx, ax
|
|---|
| 568 |
|
|---|
| 569 | mov dx, 3C0h
|
|---|
| 570 | mov al, 33h
|
|---|
| 571 | out dx, al
|
|---|
| 572 | mov al, cl
|
|---|
| 573 | out dx, al ; Set Shift-Register
|
|---|
| 574 | ret
|
|---|
| 575 | FX_SetVideoStart EndP
|
|---|
| 576 |
|
|---|
| 577 | FX_SetWideLength Proc Near Uses dx
|
|---|
| 578 | shr ax, 1 ; Divide by 2
|
|---|
| 579 | mov ah, al
|
|---|
| 580 | mov dx, 3D4h
|
|---|
| 581 | mov al, 13h
|
|---|
| 582 | out dx, ax
|
|---|
| 583 | ret
|
|---|
| 584 | FX_SetWideLength EndP
|
|---|