Guest User

Untitled

a guest
May 23rd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.76 KB | None | 0 0
  1. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  2. ;File: Afl.asm
  3. ;Description: aFL Loader Main Procedure
  4. ;Code: VoXel
  5. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  6.  
  7. .386p
  8. locals
  9. include w.inc
  10.  
  11. @DSEG ; Code Segment
  12. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  13. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  14. ;DATA
  15. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  16. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  17. include afl_pic.inc ; Afl Picture (AFL_PIC)
  18. include afl_pal.inc ; Afl Palette (ALF_PAL)
  19. include font.inc ; Font
  20. include stack.inc
  21.  
  22. VGA_PAGE1 db 64000 dup (0) ; Vga Page
  23. VERTICAL dw 0
  24. VERTICAL_TOTAL dw 0
  25.  
  26. HORIZONTAL dw 0
  27. HORIZONTAL_TOTAL dw 0
  28. HDONE db 0
  29. VDONE db 0
  30.  
  31. ECX2 dd 0
  32.  
  33. X1 dd 80
  34. X2 dd 240
  35. Y1 dd 50
  36. Y2 dd 140
  37.  
  38. ;-Format for Motion follows as-
  39. ;-Horizontal Movement,Vertical Movement ,H,V ,H,V ,H,V... ECT..
  40. AmountM dd 16 ;Amount in Motion (x,y) - 1
  41. Motion dw -30,23, 0,0, 10,-21, 10,31
  42. dw 12,21, 0,0 -10,-23, -1,2
  43. dw 23,12 ,-20,20, 0,0, 1,1
  44. dw 0,0 ,2,2 ,-10,-20 ,20,-20
  45. dw 0,0
  46.  
  47. Credits db '/+/ aLpHa FLiGhT \+\',13,10
  48. db 'Code: VoXel',13,10
  49. db 'Art: The Unknown',13,10
  50. db 'Music: None Yet',13,10,'$'
  51. Note db 'Beta 0.01a',13,10
  52. db '13h 60hz',13,10
  53. db 'Greetz and thanx to the #coders team!$'
  54. ends
  55. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  56.  
  57. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  58. ;CODE
  59. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  60. @CSEG
  61.  
  62. public Main_Afl
  63.  
  64.  
  65. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  66. Main_Afl proc
  67.  
  68. mov ax,0003h
  69. int 10h
  70.  
  71. mov ah, 09h ; Show Note
  72. mov edx, offset Note ; Load Note
  73. int 21h ; Display Note
  74. xor ah,ah
  75. int 16h
  76.  
  77. cld ; Clear Direction Flag
  78. mov ax, 0013h ; Set 320x200x256
  79. int 10h
  80. ;include 60hrz.inc ; Set 320x200x256 50hrz
  81.  
  82. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  83. Start:
  84. call Set_Pal ; Setup Palette
  85. call Intro ; Show Main Intro
  86. call Fade_Pal ; Fade Palette
  87. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  88. Shutdown:
  89.  
  90. mov ax, 0003h ; Set Text Mode
  91. int 10h
  92.  
  93. mov ah, 09h ; Show Credits
  94. mov edx, offset Credits ; Load Credits
  95. int 21h ; Display Credits
  96.  
  97. ret
  98. Main_Afl endp
  99.  
  100. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  101. Set_Pal proc near ; Setup the palette
  102. call Wait_Vsync
  103. mov esi, offset AFL_PAL
  104. mov dx, 03c8h ; Setup palette write
  105. xor al, al
  106. out dx, al
  107. mov ecx, 192 ; Read in dwords
  108.  
  109. inc dx ; Set component port
  110. Color:
  111. lodsd ; Read 4 bytes at a time
  112. out dx, al ; COL:COL:COL:COL.
  113. mov al, ah
  114. out dx, al
  115. shr eax, 16 ; Move hi word to lo word
  116. out dx, al
  117. mov al, ah
  118. out dx, al
  119. dec ecx
  120. jnz Color
  121.  
  122. ret
  123. Set_Pal endp
  124.  
  125. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  126. Fade_Pal proc
  127. mov ecx, 64 ; 64 Values for each comp.
  128. Fade0:
  129. mov esi, offset AFL_PAL ; Reset Source to AFL_PAL
  130. mov edi, offset AFL_PAL ; Reset Dest to AFL_PAL
  131.  
  132. mov ecx_,ecx ; Push Ecx
  133. mov ecx, 192 ; 768/4 = 384
  134. Fade1:
  135. lodsd ; Load 4 Bytes
  136. cmp al,0 ; Is Byte 1 black?
  137. jz Fade1_Done ; If so Its done
  138. dec al ; Otherwise dec it
  139. Fade1_Done:
  140. cmp ah,0 ; Check Byte 2
  141. jz Fade2_Done
  142. dec ah
  143. Fade2_Done:
  144. rol eax,16 ; Rotate Bits around to work HIGH
  145. cmp al,0 ; Check byte 3
  146. jz Fade3_Done
  147. dec al
  148. Fade3_Done:
  149. cmp ah,0 ; Check Byte 4
  150. jz Fade4_Done
  151. dec ah
  152. Fade4_Done:
  153. ror eax,16 ; Rotate Bits Back to Original
  154.  
  155. stosd ; Save 4 Bytes
  156. dec ecx
  157. cmp ecx,0
  158. jnz Fade1
  159.  
  160. call Set_Pal ; Show Fade
  161.  
  162. mov ecx,ecx_
  163. dec ecx
  164. jnz Fade0
  165.  
  166. ret
  167. Fade_Pal endp
  168.  
  169. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  170. Intro proc
  171.  
  172. mov HORIZONTAL,0 ; Initial Settings
  173. mov VERTICAL,0 ; For Velocity's
  174. xor ebp,ebp
  175.  
  176.  
  177. ResetMotion:
  178. mov HDONE,0
  179. mov VDONE,0
  180. xor esi,esi
  181. mov ecx,AmountM
  182.  
  183. SetMotion:
  184. mov ax,Motion[esi]
  185. cmp HORIZONTAL,ax ; Are we set for Horizontal?
  186. jg HGreater
  187.  
  188. cmp HORIZONTAL,ax ; Are we set for Horizontal?
  189. jl HLess
  190. mov HDONE,1 ; Horizontal Is Done
  191. ;------
  192. SetVert:
  193. mov ax,Motion[esi+2]
  194. cmp VERTICAL,ax
  195. jg VGreater
  196.  
  197. cmp VERTICAL,ax
  198. jl VLess
  199. mov VDONE,1
  200. ;------
  201.  
  202. VGreater:
  203. dec VERTICAL
  204. jmp done1
  205.  
  206. VLess:
  207. inc VERTICAL
  208. jmp done1
  209.  
  210. HGreater:
  211. dec HORIZONTAL
  212. jmp SetVert
  213.  
  214. HLess:
  215. inc HORIZONTAL
  216. jmp SetVert
  217.  
  218. done1:
  219.  
  220. mov ecx2,ecx
  221. push esi
  222. call Scroller
  223. pop esi
  224. mov ecx,ecx2
  225.  
  226. cmp HDONE,1
  227. je TestV
  228. jmp SetMotion
  229.  
  230. TestV:
  231. cmp VDONE,1
  232. jne SetMotion
  233.  
  234. dec ecx
  235. cmp ecx,0
  236. jne NotFinished
  237. jmp DonePlay
  238.  
  239. NotFinished:
  240. add esi,4
  241. mov HDONE,0
  242. mov VDONE,0
  243. jmp SetMotion
  244.  
  245. DonePlay:
  246. mov ah,01h
  247. int 16h
  248. jz ResetMotion
  249.  
  250. xor ah,ah
  251. int 16h
  252.  
  253. ret
  254. endp Intro
  255.  
  256. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  257. Delay proc near
  258. Delay_Loop:
  259. call Scroller
  260. dec ecx
  261. cmp ecx,0
  262. jne Delay_Loop
  263. ret
  264. endp Delay
  265.  
  266. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  267. Font_Screen proc near
  268. ; Uses (X1,Y1)
  269.  
  270.  
  271. mov esi,offset FONT ; Source = Font
  272. mov edi,offset VGA_PAGE1 ; Dest = Vga Page
  273. add esi,256
  274. add edi,3200
  275.  
  276. mov ecx,3
  277. Font_Total:
  278. push ecx
  279. mov ecx,320
  280. Font_Out:
  281. push ecx
  282. mov ecx,16
  283. Font_In:
  284. mov al,[esi] ; Load 1 bytes
  285. cmp al,0 ; Is it Black?
  286. je A_Black ; If so then dont save
  287. mov al,[edi]
  288. add al,128
  289. mov [edi],al ; Save 1 Bytes
  290. A_Black:
  291. add edi,320
  292. add esi,1
  293. dec ecx
  294. jnz Font_In
  295. sub edi,5119
  296.  
  297. pop ecx
  298. dec ecx
  299. jnz Font_Out
  300.  
  301. add edi,5120
  302.  
  303. pop ecx
  304. dec ecx
  305. jnz Font_Total
  306.  
  307. ret
  308.  
  309. Font_Screen endp
  310.  
  311.  
  312. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  313. Scroller proc near
  314. ;Do Somthing with Virtual Screen
  315. ;Lets Scroll it!
  316.  
  317.  
  318. ; (E)BP = Offset in the Picture
  319. ; EAX = 4 Byte Storage for 32 Bit Blit
  320. ; ESI = Offset of the AFL_PIC
  321. ; EDI = Offset of the VGA_PAGE1
  322. ; AFL_PIC will be Set by BP (E)BP,
  323. ; ECX Will have to be Incremented in 4's
  324.  
  325. ; Setup
  326. mov ecx_,ecx
  327. mov esi,offset AFL_PIC
  328. mov edi,offset VGA_PAGE1; RE-Set EDI
  329. mov ecx,100
  330. Scrolloop:
  331. push ecx
  332. mov ecx,80
  333.  
  334. LoadPix:
  335. mov eax,[esi+ebp] ; Load 4 Pixels
  336.  
  337. mov [edi],eax ; Save 4 Pixels
  338. add bp,4 ; Get ready for the next 4 Pixels
  339. add edi,4 ; Increment the Desitation Pointer
  340. dec ecx ; Decrement Counter
  341. jnz LoadPix ; If not then Load more Pixels
  342.  
  343. add bp,320
  344. add edi,320
  345. pop ecx
  346. dec ecx
  347. jnz Scrolloop
  348.  
  349. ;call Font_Screen
  350. call Blit_Screen ; Show what we just did
  351.  
  352. ;------------
  353. ; Horizontal_Total=Horizontal_Total+Horizontal
  354. mov ax,HORIZONTAL_TOTAL ; |
  355. add ax,HORIZONTAL ; |
  356.  
  357. cmp ax,320
  358. jge FixItHigh
  359. cmp ax,-320
  360. jle FixItLow
  361. jmp Continue
  362.  
  363. FixItHigh:
  364. sub ax,320
  365. jmp Continue
  366.  
  367. FixItLow:
  368. add ax,320
  369.  
  370. Continue:
  371. mov HORIZONTAL_TOTAL,ax
  372. mov bx,HORIZONTAL_TOTAL
  373.  
  374. mov ax,VERTICAL
  375. imul ax,320
  376. add VERTICAL_TOTAL,ax
  377. mov ax,VERTICAL_TOTAL
  378.  
  379. add ax,bx
  380. mov bp,ax
  381.  
  382. ;------------
  383. mov ecx,ecx_
  384.  
  385. ret
  386. endp Scroller
  387.  
  388.  
  389. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  390. Blit_Screen proc near ; Copy VGA_PAGE1 to Screen (32bit Blit)
  391. ; Funky Blit
  392.  
  393. mov esi,offset VGA_PAGE1
  394. mov edi,0a0000h
  395. mov ecx,16000
  396. call Wait_Vsync
  397.  
  398.  
  399. ; mov esi,offset VGA_PAGE1; ESI -> EDI
  400. ; mov edi,0a0000h ; Destination to Screen
  401. ; add edi,3200
  402. ;
  403. ; mov ecx, 90
  404. ; call Wait_Vsync ; Wait for Retrace
  405. ;Blitter:
  406. ; push ecx
  407. ; mov ecx,80
  408. ; rep movsd ; Blit 1 line
  409. ; add esi,320
  410. ; add edi,320
  411. ;
  412. ; pop ecx
  413. ; dec ecx
  414. ; jne Blitter
  415.  
  416. ret ; Return
  417. endp Blit_Screen
  418.  
  419. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  420. Wait_Vsync proc
  421.  
  422. mov dx,3dah
  423. l1:
  424. in al,dx
  425. test al,8
  426. jz l1
  427. rep movsd
  428.  
  429. l2: in al,dx
  430. test al,8
  431. jnz l2
  432.  
  433. ret ; Return
  434. Wait_Vsync endp
  435.  
  436. ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  437.  
  438. ends
  439. end
Add Comment
Please, Sign In to add comment