home *** CD-ROM | disk | FTP | other *** search
- .MODEL SMALL
- .386
- .CODE
- public fractalpart
- ;▓▓▓▓▓▓▓▓▓▓▓▓▓Main▓▓▓▓▓▓▓▓▓▓▓▓▓
- fractalpart: push CS
- pop ds
- mov ax,13h ;Switch 320*200*256 mode.
- int 10h
- call Iqron ;Do the Mario!
- mov ax,0A000h ;Calculate extra segments.
- mov es,ax
- xor di,di
- Delete: mov gs:[di],word ptr 0 ;Delete GS segment area
- add di,2 ;(here will be the wall-paper).
- jnz Delete
- mov si,offset Cmap ;Set colors.
- call Setpal
- mov si,offset Tomb
- Controller: lodsw ;What to do ? controller.
- mov bp,ax ;Loads the data and the
- lodsw ;the offset to call.
- push si ;Store SI.
- call ax
- pop si
- jmp Controller
-
- ;▓▓▓▓▓▓▓▓▓Subroutines▓▓▓▓▓▓▓▓▓▓
- ;▒▒▒▒▒▒Put 'Phanto...' up▒▒▒▒▒▒
- Putup: cmp Counter,0
- je Putup
- dec Counter
- mov cx,64 ;Put 64 pixel to the screen
- cmp di,6000h ;Reached 'presents'?
- jb pu1
- mov bp,offset present-14
- pu1: mov si,bp
- call Fractal ;Calculate next fractal pixel.
- shrd fs:[di],ebx,25 ;Store the coordinates.
- call Plot ;Show it.
- add di,4
- loop pu1
- or di,di
- jns Putup
- ret
-
- ;▒▒▒▒▒▒Calculate fractals▒▒▒▒▒▒
- Newfrac: cmp Counter,0
- je Newfrac
- dec Counter
- mov cx,64 ;Put 64 pixel to the screen.
- nf1: mov si,bp
- call Fractal ;Calculate next fractal pixel.
- add bx,160
- shl ebx,7
- sub ebx,fs:[di-8000h] ;This will increase the
- sar ebx,7 ;previous coordinates
- mov fs:[di],ebx ;when morphing.
- add di,4
- loop nf1
- or di,di
- js Newfrac
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒Morph▒▒▒▒▒▒▒▒▒▒▒▒▒
- Morph: xor ax,ax
- xchg Counter,ax
- cmp ax,bp ;Disable overadding
- jbe mo1 ;the deltas.
- mov ax,bp
- mo1: xor di,di
- mo2: call Plot ;Delete the old pixel.
- sub byte ptr es:[bx],2
- mov ebx,fs:[di+8000h] ;Calculate the next pixel...
- mov cx,ax
- jcxz mo4 ;Do nothing if the machine
- mo3: add fs:[di],ebx ;is too fast.
- loop mo3
- mo4: call Plot ;...and show it.
- add di,4
- jns mo2
- sub bp,ax
- jg Morph
- ret
-
- ;▒▒▒▒▒Copy fractal to wall▒▒▒▒▒
- Wallcopy: mov eax,fs:[di-8000h] ;Get the coordinates.
- mul number ;Multiple the coordinates
- mov bx,dx ;to fit into the 256*256
- sar eax,16 ;sized wall-paper.
- mul number
- mov bh,dl
- inc byte ptr gs:[bx+0CAh] ;Put it to the wall-paper.
- add di,4
- js Wallcopy
- ret
-
- ;▒▒▒▒▒▒Wallpaper rotation▒▒▒▒▒▒
- Dowall: mov bx,217 ;Set the rotation angle.
- sub bx,bp
- shl bx,7
- add bx,5119
- lea ax,[bx-5119] ;Calculate some variables.
- call Sin ; (incX ; incY)
- imul bx
- sar dx,6
- mov incX,dx
- mov ax,bx
- call Sin
- imul bx
- sar dx,2
- mov incY,dx
- call PutTexture ;Show the wall-paper.
- dec bp
- jnz Dowall
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒Waiting▒▒▒▒▒▒▒▒▒▒▒▒
- Waiting: cmp Counter,bp ;Waiting bp/70 seconds.
- jne Waiting
- sub Counter,bp
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒The end▒▒▒▒▒▒▒▒▒▒▒▒
- Theend: call Iqroff ;Out the Mario.
- POP EAX
- RETF
-
- ;▓▓▓▓▓▓▓Smaller routines▓▓▓▓▓▓▓
- ;▒▒▒▒▒▒▒▒▒▒▒▒timer▒▒▒▒▒▒▒▒▒▒▒▒▒
- Timer: inc cs:shit
- cmp cs:shit,7
- jb notmost
- mov cs:shit,0
- inc cs:Counter
- notmost: db 0EAh ;...means 'JMP far Oldtimer'.
- Oldtimer dd 0
- Shit dw 0
- ;▒▒▒▒▒▒▒▒▒I Q R ki/be▒▒▒▒▒▒▒▒▒▒
- Iqroff: xor dx,dx
- mov es,dx
- push dword ptr Oldtimer
- jmp iq1
- Iqron: xor dx,dx
- mov es,dx
- mov eax,dword ptr es:[08h*4];Connecting to IRQ 8.
- mov Oldtimer,eax
- mov dh,43h ;69.565hz
- push cs
- push offset Timer
- iq1: ;cli
- pop dword ptr es:[08h*4]
- ;mov al,036h
- ;out 43h,al
- ;mov al,dl
- ;out 40h,al
- ;mov al,dh
- ;out 40h,al
- ;sti
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒paletta▒▒▒▒▒▒▒▒▒▒▒
- Setpal: mov dx,3C8h ;Set the colors from 0.
- mov al,0
- out dx,al
- inc dx
- mov cx,20*3 ;Set 20 colors.
- rep outsb ;Set.
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒plot▒▒▒▒▒▒▒▒▒▒▒▒▒
- Plot: mov dx,fs:[di+2] ;Get the coordinates from
- shr dx,1 ;the table.
- and dl,0C0h ;Set the pixel at dx*320+bx.
- lea dx,[edx*4+edx]
- mov bx,fs:[di]
- shr bx,7
- add bx,dx
- inc byte ptr es:[bx]
- ret
-
- ;▒▒▒▒▒▒▒random ( 0-255 )▒▒▒▒▒▒▒
- Random: mov ax,4568h ;No comment...
- mul randseed
- add ax,dx
- mov randseed,ax
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒fractal▒▒▒▒▒▒▒▒▒▒▒
- Fractal: push cx ;The table offset-14 is in SI.
- call Random
- fr1: add si,14 ;Choose the line.
- sub ah,[si+12]
- ja fr1
-
- mov cx,2 ;Calculate the next
- fr2: lodsw ;point with the choosen line.
- imul fx
- shrd ax,dx,8 ;Here I want to say thanks
- mov bx,ax ;to Michael Barnsley
- lodsw ;for inventing this
- imul fy ;fantastic fractal type
- shrd ax,dx,8 ;called IFS.
- add bx,ax ;If you have got Fractint
- lodsw ;it may known to you.
- add bx,ax
- add bx,ax
- rol ebx,16
- loop fr2
-
- mov dword ptr fx,ebx ;Store the coordinates.
- pop cx
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒ sin/cos ▒▒▒▒▒▒▒▒▒▒
- Cos: add ax,16384 ;Nothing new...
- Sin: push bx cx dx
- mov bx,ax ;Well right here I want
- mov cx,bx ;to say thanks to Future
- shr bx,10 ;Crew for it.
- and cx,1023 ;It was the shortest sinus
- mov ah,[sintable+bx+1] ;computing around.
- xor al,al ;(Although it is shorter
- imul cx ;than the original FC's)
- push ax dx
- neg cx
- add cx,1023
- mov ah,[sintable+bx+0]
- xor al,al
- imul cx
- pop cx bx
- add ax,bx
- adc dx,cx
- shrd ax,dx,11
- pop dx cx bx
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒ texture ▒▒▒▒▒▒▒▒▒▒▒
- PutTexture: pusha ;Yeah, this is the wall-paper,
- imul ax,incX,-320/2 ;my favourite.
- mov px,ax ;This is the first texturing
- imul ax,incY,-200/2 ;routine which uses such a
- mov py,ax ;lot of pixel as 320*200.
- xor di,di ;So take care!
- ausser: mov cx,320/2
- mov si,incX ;This is the same difficult
- shl esi,16 ;as the former one, so
- mov si,incY ;there is no space to tell
- mov dx,pX ;it's logic.
- shl edx,16 ;You can see the result...
- mov dx,pY
- inner: add edx,esi
- shld ebx,edx,16
- mov bl,dh ;Certainly there is a
- mov al,gs:[bx] ;greeting here too.
- add edx,esi ;Thanks to the gentleman
- shld ebx,edx,16 ;known as The Faker whoever
- mov bl,dh ;is he.
- mov ah,gs:[bx] ;It was very interesting
- stosw ;to see how he used 32 bit
- dec cx ;registers in Pascal code.
- jnz inner ;There were 'db 66h'-s
- mov ax,incY ;before each line.
- add pX,ax ;Very cool.
- mov ax,incX
- sub pY,ax
- cmp di,0FA00h
- jb ausser
- popa
- ret
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ a ▒▒▒ b ▒▒▒ e ▒▒▒ c ▒▒▒ d ▒▒▒ f ▒▒▒ p ▒▒▒
- phantom dw 0 ,- 50 , 28 , 40 , 0 , 24 , 16
- dw 14 , 0 , 23 , 0 , 10 , 26 , 4
- dw 0 ,- 50 , 40 , 20 , 0 , 25 , 8
- dw 14 , 0 , 23 , 0 , 10 , 34 , 4
- dw 0 ,- 50 , 46 , 40 , 0 , 24 , 16
- dw 14 , 0 , 41 , 0 , 10 , 34 , 4
- dw 0 ,- 50 , 57 , 40 , 0 , 24 , 16
- dw 0 ,- 50 , 63 , 40 , 0 , 24 , 16
- dw 0 ,- 50 , 75 , 40 , 0 , 24 , 16
- dw 14 , 0 , 58 , 0 , 10 , 26 , 4
- dw 14 , 0 , 58 , 0 , 10 , 34 , 4
- dw 0 ,- 50 , 81 , 40 , 0 , 24 , 16
- dw 15 , 0 , 76 , 30 , 60 , 19 , 11
- dw 0 ,- 50 , 93 , 40 , 0 , 24 , 16
- dw 0 ,- 50 , 110 , 40 , 0 , 24 , 16
- dw 20 , 0 , 90 , 0 , 10 , 26 , 4
- dw 0 ,- 50 , 116 , 40 , 0 , 24 , 16
- dw 0 ,- 50 , 128 , 40 , 0 , 24 , 16
- dw 14 , 0 , 111 , 0 , 10 , 26 , 4
- dw 14 , 0 , 111 , 0 , 10 , 44 , 4
- dw 0 ,- 50 , 134 , 40 , 0 , 24 , 16
- dw 0 ,- 50 , 145 , 40 , 0 , 24 , 16
- dw 7 , 0 , 129 , 10 , 60 , 21 , 6
- dw 7 , 0 , 133 , -10 , 60 , 26 , 6
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ a ▒▒▒ b ▒▒▒ e ▒▒▒ c ▒▒▒ d ▒▒▒ f ▒▒▒ p ▒▒▒
- present dw 0 ,- 60 , 43 , 24 , 0 , 52 , 18
- dw 17 , 0 , 29 , 0 , 25 , 49 , 9
- dw 0 ,- 60 , 52 , 13 , 0 , 53 , 9
- dw 17 , 0 , 29 , 0 , 25 , 54 , 9
- dw 0 ,- 60 , 56 , 13 , 0 , 53 , 8
- dw 21 , 0 , 42 , 0 , 25 , 49 , 9
- dw 17 , 0 , 56 , 0 , 25 , 49 , 9
- dw 17 , 0 , 56 , 0 , 25 , 51 , 9
- dw 21 , 0 , 56 , 0 , 25 , 54 , 9
- dw 0 ,- 60 , 70 , 13 , 0 , 53 , 8
- dw 0 ,- 60 , 79 , 5 , 0 , 54 , 4
- dw 21 , 0 , 69 , 0 , 25 , 49 , 9
- dw 17 , 0 , 69 , 0 , 25 , 51 , 9
- dw 21 , 0 , 68 , 0 , 25 , 54 , 9
- dw 0 ,- 60 , 83 , 5 , 0 , 54 , 4
- dw 0 ,- 60 , 92 , 7 , 0 , 56 , 4
- dw 17 , 0 , 82 , 0 , 25 , 49 , 9
- dw 17 , 0 , 82 , 0 , 25 , 51 , 9
- dw 21 , 0 , 82 , 0 , 25 , 54 , 9
- dw 0 ,- 60 , 96 , 13 , 0 , 53 , 8
- dw 0 ,- 60 , 105 , 5 , 0 , 54 , 4
- dw 0 ,- 60 , 110 , 13 , 0 , 53 , 8
- dw 17 , 0 , 96 , 0 , 25 , 49 , 9
- dw 0 ,- 60 , 119 , 11 , 0 , 54 , 8
- dw 0 ,- 60 , 125 , 19 , 0 , 50 , 13
- dw 15 , 0 , 108 , 0 , 25 , 49 , 7
- dw 21 , 0 , 118 , 0 , 25 , 49 , 9
- dw 17 , 0 , 118 , 0 , 25 , 51 , 9
- dw 21 , 0 , 117 , 0 , 25 , 54 , 9
- dw 0 ,- 60 , 132 , 5 , 0 , 54 , 4
- dw 0 ,- 60 , 141 , 7 , 0 , 56 , 4
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ a ▒▒▒ b ▒▒▒ e ▒▒▒ c ▒▒▒ d ▒▒▒ f ▒▒▒ p ▒▒▒
- trance dw 0 ,- 50 ,- 55 , 25 , 0 , 48 , 14
- dw 0 ,- 50 ,- 48 , 25 , 0 , 48 , 13
- dw 8 , 0 ,- 52 , 15 , 30 , 43 , 8
- dw 0 ,- 50 ,- 38 , 25 , 0 , 48 , 13
- dw 0 ,- 50 ,- 25 , 25 , 0 , 48 , 13
- dw 30 , 0 ,- 34 , 0 , 10 , 41 , 11
- dw 0 ,- 50 ,- 13 , 25 , 0 , 48 , 13
- dw 0 ,- 50 ,- 3 , 12 , 0 , 45 , 8
- dw 14 , 0 ,- 18 , 0 , 10 , 41 , 5
- dw 14 , 0 ,- 18 , 0 , 10 , 46 , 5
- dw 14 , 0 ,- 15 , 10 , 30 , 46 , 5
- dw - 10 ,- 50 , 7 , 25 , 0 , 48 , 14
- dw 10 ,- 50 , 15 , 25 , 0 , 48 , 14
- dw 10 , 0 , 2 , 0 , 10 , 48 , 5
- dw 0 ,- 50 , 25 , 25 , 0 , 48 , 13
- dw 8 , 0 , 21 , 15 , 30 , 43 , 8
- dw 0 ,- 50 , 35 , 25 , 0 , 48 , 13
- dw 0 ,- 50 , 42 , 25 , 0 , 48 , 13
- dw 20 , 0 , 40 , 0 , 10 , 41 , 11
- dw 20 , 0 , 40 , 0 , 10 , 51 , 11
- dw 0 ,- 50 , 58 , 25 , 0 , 48 , 13
- dw 20 ,- 50 , 64 , 0 , 10 , 41 , 11
- dw 20 ,- 50 , 64 , 0 , 10 , 45 , 11
- dw 20 ,- 50 , 64 , 0 , 10 , 51 , 11
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ a ▒▒▒ b ▒▒▒ e ▒▒▒ c ▒▒▒ d ▒▒▒ f ▒▒▒ p ▒▒▒
- floor dw 0 ,-128 ,- 17 , 128 , 0 , 33 , 85
- dw 128 , 0 , 0 , 0 , 128 , 50 , 86
- dw 0 , 128 , 16 ,-128 , 0 , 33 , 85
- spiral dw 202 ,-108 , 15 , 61 , 220 , 13 , 230
- dw - 31 , 67 ,- 60 , 38 , 13 , 13 , 13
- dw 26 ,- 36 , 55 , 23 , 46 , 14 , 13
- dragon dw 210 , 72 ,- 22 ,- 54 , 220 , 2 , 202
- dw 23 , 133 , 8 ,-118 ,- 97 , 75 , 54
- cristal dw 179 ,-123 , 24 ,-100 ,-169 , 100 , 192
- dw 23 ,-113 , 46 , 133 ,- 23 , 22 , 64
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ a ▒▒▒ b ▒▒▒ e ▒▒▒ c ▒▒▒ d ▒▒▒ f ▒▒▒ p ▒▒▒
- Cmap db 05ch/4,045h/4,063h/4,020h/4,060h/4,0a0h/4,025h/4,06ah/4,0a5h/4,025h/4
- db 075h/4,0afh/4,02bh/4,083h/4,0b7h/4,02fh/4,08fh/4,0bbh/4,033h/4,09bh/4
- db 0c3h/4,037h/4,0abh/4,0cbh/4,03fh/4,0bbh/4,0d7h/4,043h/4,0cbh/4,0dfh/4
- db 04bh/4,0dbh/4,0ebh/4,04fh/4,0ebh/4,0f3h/4,057h/4,0ffh/4,0ffh/4,08fh/4
- db 0ffh/4,0ffh/4,0c3h/4,0ffh/4,0ffh/4,0c3h/4,0ffh/4,0ffh/4,0c3h/4,0ffh/4
- db 0ffh/4,0c3h/4,0ffh/4,0ffh/4,0c3h/4,0ffh/4,0ffh/4,0c3h/4,0ffh/4,0ffh/4
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- sintable LABEL BYTE ;sine table (circle is 64 units)
- db 0,12,24,36,48,59,70,80,89,98,105,112,117,121,124,126,127,126
- db 124,121,117,112,105,98,89,80,70,59,48,36,24,12,0,-12,-24,-36
- db -48,-59,-70,-80,-89,-98,-105,-112,-117,-121,-124,-126,-127
- db -126,-124,-121,-117,-112,-105,-98,-89,-80,-70,-59,-48,-36
- db -24,-12,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54
- db 57,59,62,65,67,70
-
- ;▓▓▓▓▓▓▓▓▓▓variables▓▓▓▓▓▓▓▓▓▓▓
- Tomb dw 140 ,offset Waiting
- dw offset phantom-14,offset Putup
- dw offset trance-14 ,offset Newfrac
- dw 128 ,offset Morph
- dw 35 ,offset Waiting
- dw offset floor-14 ,offset Newfrac
- dw 128 ,offset Morph
- dw offset spiral-14 ,offset Newfrac
- dw 128 ,offset Morph
- dw offset dragon-14 ,offset Newfrac
- dw 128 ,offset Morph
- dw offset cristal-14,offset Newfrac
- dw 128 ,offset Morph
- dw 0 ,offset Wallcopy
- dw 217 ,offset Dowall
- dw 0 ,offset Theend
- randseed dw 91Ch
- number dw 285 ;512*0.6
- fx dw 0
- fy dw 0
- Counter dw 0
- Dataseg1 dw 0
- Dataseg2 dw 0
- incX dw 0
- incY dw 0
- pX dw 0
- pY dw 0
- END
-