Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- ;File: Afl.asm
- ;Description: aFL Loader Main Procedure
- ;Code: VoXel
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- .386p
- locals
- include w.inc
- @DSEG ; Code Segment
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- ;DATA
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- include afl_pic.inc ; Afl Picture (AFL_PIC)
- include afl_pal.inc ; Afl Palette (ALF_PAL)
- include font.inc ; Font
- include stack.inc
- VGA_PAGE1 db 64000 dup (0) ; Vga Page
- VERTICAL dw 0
- VERTICAL_TOTAL dw 0
- HORIZONTAL dw 0
- HORIZONTAL_TOTAL dw 0
- HDONE db 0
- VDONE db 0
- ECX2 dd 0
- X1 dd 80
- X2 dd 240
- Y1 dd 50
- Y2 dd 140
- ;-Format for Motion follows as-
- ;-Horizontal Movement,Vertical Movement ,H,V ,H,V ,H,V... ECT..
- AmountM dd 16 ;Amount in Motion (x,y) - 1
- Motion dw -30,23, 0,0, 10,-21, 10,31
- dw 12,21, 0,0 -10,-23, -1,2
- dw 23,12 ,-20,20, 0,0, 1,1
- dw 0,0 ,2,2 ,-10,-20 ,20,-20
- dw 0,0
- Credits db '/+/ aLpHa FLiGhT \+\',13,10
- db 'Code: VoXel',13,10
- db 'Art: The Unknown',13,10
- db 'Music: None Yet',13,10,'$'
- Note db 'Beta 0.01a',13,10
- db '13h 60hz',13,10
- db 'Greetz and thanx to the #coders team!$'
- ends
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- ;CODE
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- @CSEG
- public Main_Afl
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Main_Afl proc
- mov ax,0003h
- int 10h
- mov ah, 09h ; Show Note
- mov edx, offset Note ; Load Note
- int 21h ; Display Note
- xor ah,ah
- int 16h
- cld ; Clear Direction Flag
- mov ax, 0013h ; Set 320x200x256
- int 10h
- ;include 60hrz.inc ; Set 320x200x256 50hrz
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Start:
- call Set_Pal ; Setup Palette
- call Intro ; Show Main Intro
- call Fade_Pal ; Fade Palette
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Shutdown:
- mov ax, 0003h ; Set Text Mode
- int 10h
- mov ah, 09h ; Show Credits
- mov edx, offset Credits ; Load Credits
- int 21h ; Display Credits
- ret
- Main_Afl endp
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Set_Pal proc near ; Setup the palette
- call Wait_Vsync
- mov esi, offset AFL_PAL
- mov dx, 03c8h ; Setup palette write
- xor al, al
- out dx, al
- mov ecx, 192 ; Read in dwords
- inc dx ; Set component port
- Color:
- lodsd ; Read 4 bytes at a time
- out dx, al ; COL:COL:COL:COL.
- mov al, ah
- out dx, al
- shr eax, 16 ; Move hi word to lo word
- out dx, al
- mov al, ah
- out dx, al
- dec ecx
- jnz Color
- ret
- Set_Pal endp
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Fade_Pal proc
- mov ecx, 64 ; 64 Values for each comp.
- Fade0:
- mov esi, offset AFL_PAL ; Reset Source to AFL_PAL
- mov edi, offset AFL_PAL ; Reset Dest to AFL_PAL
- mov ecx_,ecx ; Push Ecx
- mov ecx, 192 ; 768/4 = 384
- Fade1:
- lodsd ; Load 4 Bytes
- cmp al,0 ; Is Byte 1 black?
- jz Fade1_Done ; If so Its done
- dec al ; Otherwise dec it
- Fade1_Done:
- cmp ah,0 ; Check Byte 2
- jz Fade2_Done
- dec ah
- Fade2_Done:
- rol eax,16 ; Rotate Bits around to work HIGH
- cmp al,0 ; Check byte 3
- jz Fade3_Done
- dec al
- Fade3_Done:
- cmp ah,0 ; Check Byte 4
- jz Fade4_Done
- dec ah
- Fade4_Done:
- ror eax,16 ; Rotate Bits Back to Original
- stosd ; Save 4 Bytes
- dec ecx
- cmp ecx,0
- jnz Fade1
- call Set_Pal ; Show Fade
- mov ecx,ecx_
- dec ecx
- jnz Fade0
- ret
- Fade_Pal endp
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Intro proc
- mov HORIZONTAL,0 ; Initial Settings
- mov VERTICAL,0 ; For Velocity's
- xor ebp,ebp
- ResetMotion:
- mov HDONE,0
- mov VDONE,0
- xor esi,esi
- mov ecx,AmountM
- SetMotion:
- mov ax,Motion[esi]
- cmp HORIZONTAL,ax ; Are we set for Horizontal?
- jg HGreater
- cmp HORIZONTAL,ax ; Are we set for Horizontal?
- jl HLess
- mov HDONE,1 ; Horizontal Is Done
- ;------
- SetVert:
- mov ax,Motion[esi+2]
- cmp VERTICAL,ax
- jg VGreater
- cmp VERTICAL,ax
- jl VLess
- mov VDONE,1
- ;------
- VGreater:
- dec VERTICAL
- jmp done1
- VLess:
- inc VERTICAL
- jmp done1
- HGreater:
- dec HORIZONTAL
- jmp SetVert
- HLess:
- inc HORIZONTAL
- jmp SetVert
- done1:
- mov ecx2,ecx
- push esi
- call Scroller
- pop esi
- mov ecx,ecx2
- cmp HDONE,1
- je TestV
- jmp SetMotion
- TestV:
- cmp VDONE,1
- jne SetMotion
- dec ecx
- cmp ecx,0
- jne NotFinished
- jmp DonePlay
- NotFinished:
- add esi,4
- mov HDONE,0
- mov VDONE,0
- jmp SetMotion
- DonePlay:
- mov ah,01h
- int 16h
- jz ResetMotion
- xor ah,ah
- int 16h
- ret
- endp Intro
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Delay proc near
- Delay_Loop:
- call Scroller
- dec ecx
- cmp ecx,0
- jne Delay_Loop
- ret
- endp Delay
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Font_Screen proc near
- ; Uses (X1,Y1)
- mov esi,offset FONT ; Source = Font
- mov edi,offset VGA_PAGE1 ; Dest = Vga Page
- add esi,256
- add edi,3200
- mov ecx,3
- Font_Total:
- push ecx
- mov ecx,320
- Font_Out:
- push ecx
- mov ecx,16
- Font_In:
- mov al,[esi] ; Load 1 bytes
- cmp al,0 ; Is it Black?
- je A_Black ; If so then dont save
- mov al,[edi]
- add al,128
- mov [edi],al ; Save 1 Bytes
- A_Black:
- add edi,320
- add esi,1
- dec ecx
- jnz Font_In
- sub edi,5119
- pop ecx
- dec ecx
- jnz Font_Out
- add edi,5120
- pop ecx
- dec ecx
- jnz Font_Total
- ret
- Font_Screen endp
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Scroller proc near
- ;Do Somthing with Virtual Screen
- ;Lets Scroll it!
- ; (E)BP = Offset in the Picture
- ; EAX = 4 Byte Storage for 32 Bit Blit
- ; ESI = Offset of the AFL_PIC
- ; EDI = Offset of the VGA_PAGE1
- ; AFL_PIC will be Set by BP (E)BP,
- ; ECX Will have to be Incremented in 4's
- ; Setup
- mov ecx_,ecx
- mov esi,offset AFL_PIC
- mov edi,offset VGA_PAGE1; RE-Set EDI
- mov ecx,100
- Scrolloop:
- push ecx
- mov ecx,80
- LoadPix:
- mov eax,[esi+ebp] ; Load 4 Pixels
- mov [edi],eax ; Save 4 Pixels
- add bp,4 ; Get ready for the next 4 Pixels
- add edi,4 ; Increment the Desitation Pointer
- dec ecx ; Decrement Counter
- jnz LoadPix ; If not then Load more Pixels
- add bp,320
- add edi,320
- pop ecx
- dec ecx
- jnz Scrolloop
- ;call Font_Screen
- call Blit_Screen ; Show what we just did
- ;------------
- ; Horizontal_Total=Horizontal_Total+Horizontal
- mov ax,HORIZONTAL_TOTAL ; |
- add ax,HORIZONTAL ; |
- cmp ax,320
- jge FixItHigh
- cmp ax,-320
- jle FixItLow
- jmp Continue
- FixItHigh:
- sub ax,320
- jmp Continue
- FixItLow:
- add ax,320
- Continue:
- mov HORIZONTAL_TOTAL,ax
- mov bx,HORIZONTAL_TOTAL
- mov ax,VERTICAL
- imul ax,320
- add VERTICAL_TOTAL,ax
- mov ax,VERTICAL_TOTAL
- add ax,bx
- mov bp,ax
- ;------------
- mov ecx,ecx_
- ret
- endp Scroller
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Blit_Screen proc near ; Copy VGA_PAGE1 to Screen (32bit Blit)
- ; Funky Blit
- mov esi,offset VGA_PAGE1
- mov edi,0a0000h
- mov ecx,16000
- call Wait_Vsync
- ; mov esi,offset VGA_PAGE1; ESI -> EDI
- ; mov edi,0a0000h ; Destination to Screen
- ; add edi,3200
- ;
- ; mov ecx, 90
- ; call Wait_Vsync ; Wait for Retrace
- ;Blitter:
- ; push ecx
- ; mov ecx,80
- ; rep movsd ; Blit 1 line
- ; add esi,320
- ; add edi,320
- ;
- ; pop ecx
- ; dec ecx
- ; jne Blitter
- ret ; Return
- endp Blit_Screen
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- Wait_Vsync proc
- mov dx,3dah
- l1:
- in al,dx
- test al,8
- jz l1
- rep movsd
- l2: in al,dx
- test al,8
- jnz l2
- ret ; Return
- Wait_Vsync endp
- ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
- ends
- end
Add Comment
Please, Sign In to add comment