1 ;--------------------------------------------------------------------
\r
2 ; StarPort Intro II V1.0
\r
3 ;--------------------------------------------------------------------
\r
4 ; Copyright (C) 1993 Future Crew
\r
5 ;--------------------------------------------------------------------
\r
8 ;--------------------------------------------------------------------
\r
9 ; This code is released to the public domain. You can do
\r
10 ; whatever you like with this code, but remember, that if
\r
11 ; you are just planning on making another small intro by
\r
12 ; changing a few lines of code, be prepared to enter the
\r
13 ; worldwide lamers' club. However, if you are looking at
\r
14 ; this code in hope of learning something new, go right
\r
15 ; ahead. That's exactly why this source was released.
\r
16 ; (BTW: I don't claim there's anything new to find here,
\r
17 ; but it's always worth looking, right?)
\r
18 ;--------------------------------------------------------------------
\r
19 ; The code is optimized mainly for size but also a little
\r
20 ; for speed. The goal was to get this little bbs intro to
\r
21 ; under 2K, and 1993 bytes sounded like a good size. Well,
\r
22 ; it wasn't easy, and there are surely places left one could
\r
23 ; squeeze a few extra bytes off...
\r
24 ; Making a small intro is not hard. Making a small intro
\r
25 ; with a nice feel is very hard, and you have to sacrifice
\r
26 ; ideas to fit the intro to the limits you have set. I had
\r
27 ; a lot of plans (a background piccy for example), but well,
\r
28 ; the size limit came first.
\r
29 ; I hope you enjoy my choice of size/feature ratio in this
\r
30 ; intro! In case you are interested, this was a three evening
\r
31 ; project (the last one spent testing).
\r
32 ;--------------------------------------------------------------------
\r
33 ; You can compile this with TASM, but the resulting COM-file
\r
34 ; will be a lot larger than the released version. This is
\r
35 ; because all the zero data is included to the result. The
\r
36 ; released version was first compiled to a COM file, and then
\r
37 ; a separate postprocessing program was ran which removed all
\r
38 ; the zero data from the end of the file. If you are just
\r
39 ; experimenting, recompiling is as easy as MAKE.BAT. If you
\r
40 ; want to make this small again, you have to do some work as
\r
41 ; well, and make your own postprocessor.
\r
42 ;--------------------------------------------------------------------
\r
44 BORDERS=0 ;set to 1 for visible border-timings
\r
46 code SEGMENT para public 'CODE'
\r
52 start: cld ;filler to make the filesize exactly 1993 bytes
\r
53 cld ;filler to make the filesize exactly 1993 bytes
\r
56 ;±±±±±±±±±±±±±±±± setborder ±±±±±±±±±±±±±±±±
\r
57 ;descr: debug/change border color
\r
74 ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Simplex Adlib Player ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
\r
75 ;this doesn't just read raw data to output to adlib like the one
\r
76 ;used in the last starport intro. This player really does have
\r
77 ;note & instrument data it reads and processes!
\r
79 ;±±±±±±±±±±±±±±±± output data to adlib ±±±±±±±±±±±±±±
\r
80 a_lodsboutaw03: ;size optimization related entry (instrument loading)
\r
83 a_lodsboutaw: ;size optimization related entry (instrument loading)
\r
85 a_outaw PROC NEAR ;ah=reg,al=data
\r
106 ;±±±±±±±±±±±±±±±± load instrument to adlib ±±±±±±±±±±±±±±
\r
107 a_loadinstrument PROC NEAR
\r
108 ;bx=channel, ds:si=offset to instrument data
\r
109 mov ah,ds:a_inst_table[bx]
\r
111 @@1: call a_lodsboutaw03
\r
115 call a_lodsboutaw03
\r
119 a_loadinstrument ENDP
\r
121 ;±±±±±±±±±±±±±±±± set note on/off ±±±±±±±±±±±±±±
\r
122 a_playnote PROC NEAR
\r
123 ;bx=channel, ax=data
\r
134 ;±±±±±±±±±±±±±±±± initialize/clear/shutup adlib ±±±±±±±±±±±±±±
\r
144 mov di,OFFSET music_instruments
\r
145 @@1_: mov si,ds:[di]
\r
147 call a_loadinstrument
\r
156 ;±±±±±±±±±±±±±±±± advance music one row ±±±±±±±±±±±±±±
\r
158 sub byte ptr ds:a_musiccnt,1;;;;
\r
160 mov byte ptr ds:a_musiccnt,8;;;;music_speed
\r
161 mov cx,music_channels
\r
162 mov di,OFFSET music_patterns
\r
164 @@1__: sub byte ptr ds:a_chdelaycnt[bx],1;;;;
\r
174 mov ds:a_chdelay[bx],al
\r
180 mov ax,ds:a_note_table[bp]
\r
186 mov al,ds:a_chdelay[bx]
\r
187 mov ds:a_chdelaycnt[bx],al
\r
193 @@7: mov si,ds:[di+2]
\r
197 ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Intro Routines ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
\r
199 ;±±±±±±±±±±±±±±±± sin/cos ±±±±±±±±±±±±±±±±
\r
200 ;entry: ax=angle (0..65535)
\r
201 ; exit: ax=muller (-127..127)
\r
202 addwcos:add ax,ds:[bx] ;optimized entry for wavesets
\r
220 mov ah,ds:sintable[bx]
\r
225 mov ah,ds:sintable[bx+1]
\r
234 ; shrd ax,dx,11;;;;;;;;
\r
237 ;±±±±±±±±±±±±±±±± rand ±±±±±±±±±±±±±±±±
\r
238 ;returns a random value in range -4096..4095
\r
240 mov ax,1107;;;;;;;;;030247
\r
242 add ax,9717;;;;;;;;7
\r
261 ;size optimizatin, some code moved from after all rand calls
\r
267 ;±±±±±±±±±±±±±±±± timer ±±±±±±±±±±±±±±±±
\r
268 inittimer PROC NEAR
\r
288 mov ax,OFFSET intti8
\r
306 intti8 PROC FAR ;timer interrupt
\r
310 inc [word ptr cs:framecounter];;;;
\r
315 ;±±±±±±±±±±±±±±±± load indexed palette ±±±±±±±±±±±±±±
\r
317 ;ds:si=pointer to colorindices
\r
335 setpl2: and bx,15*2
\r
336 mov ax,word ptr ds:col0[bx]
\r
340 mov al,ds:col0[bx+2]
\r
345 ;±±±±±±±±±±±±±± clear & copy videobuffer to screen ±±±±±±±±±±±±±±
\r
346 clearcopy PROC NEAR
\r
369 ;±±±±±±±±±±±±±± draw a small pixel ±±±±±±±±±±±±±±
\r
370 pset1 PROC NEAR ;ds:di=destination center, si=xmask offset
\r
376 ;±±±±±±±±±±±±±± draw a big pixel (depending on Z) ±±±±±±±±±±±±±
\r
377 pset2 PROC NEAR ;ds:di=destination center, si=xmask offset
\r
378 mov ax,ds:colbww[si]
\r
381 cmp bp,8300 ;zcompare for size
\r
384 mov ax,ds:colbw[si]
\r
387 mov ax,ds:colbv[si]
\r
394 mov ax,ds:colbw[si]
\r
400 ;±±±±±±±±±±±±±± add a letter composed of big dots to dotlist ±±±±±±±±±±±±±
\r
412 @@1_______: push cx
\r
415 @@2__: cmp byte ptr ds:font[bx],0;;;;
\r
418 mov ds:dots[di+2],bp
\r
429 mov al,ds:sintable[si]
\r
434 mov ds:dots[di+4],ax
\r
436 mov word ptr ds:dots[di+6],OFFSET pset2
\r
438 and di,2047;;;;DOTNUM1*8-1
\r
440 add si,LETTERDOTSPACING
\r
444 add bp,LETTERDOTSPACING
\r
451 ;±±±±±±±±±±±±±± calc 2x2 rotation matrix ±±±±±±±±±±±±±
\r
453 ;ax=angle,ds:di=pointer to matrix
\r
456 mov ds:[di+r01-r00],ax
\r
458 mov ds:[di+r10-r00],ax
\r
461 mov ds:[di+r00-r00],ax
\r
462 mov ds:[di+r11-r00],ax
\r
466 ;±±±±±±±±±±±± rotate point with 2x2 rotation matrix (innerpart) ±±±±±±±±±±±±±
\r
467 rotate2x2i PROC NEAR
\r
468 ;(di,bp)->(cx) with matrix half at ds:si
\r
469 ;this is the inner part, called twice
\r
472 imul word ptr ds:[si]
\r
476 imul word ptr ds:[si+2]
\r
479 ; shrd cx,bx,14;;;;;;;;
\r
485 ;±±±±±±±±±±±±±± advance demo one frame (raw work) ±±±±±±±±±±±±±
\r
487 ;======wait for border
\r
503 cmp si,OFFSET index4
\r
505 mov si,OFFSET index1
\r
506 @@i2: mov ds:index,si
\r
512 ;======do timer simulation stuff
\r
515 mov byte ptr ds:scrollsubber,0;;;;
\r
516 xchg cx,ds:framecounter
\r
519 add byte ptr ds:scrollsubber,90;;;;;SCROLLSPEED
\r
528 @@1________: push cx
\r
532 cmp word ptr ds:[bx+6],OFFSET pset2
\r
546 mov al,ds:sintable[si]
\r
552 sub cx,ds:scrollsubber
\r
558 @@5: ;--rotate coordinates
\r
593 ;calc dest address & xmask offset
\r
608 ;±±±±±±±±±±±±±± advance demo counters 1/70 sec ±±±±±±±±±±±±±
\r
609 ;a separate routine is used to get frame syncronization for
\r
610 ;slower machines (and slow vga cards)
\r
612 ;---add sinuses & udforce
\r
613 add byte ptr ds:sinus1,70;;;;
\r
614 add byte ptr ds:sinus2,177;;;;
\r
615 add word ptr ds:udforced,3000;;;;
\r
617 mov bx,OFFSET wwave
\r
627 mov bx,OFFSET zwave
\r
635 ;---set 3d rotate YZ
\r
636 mov bx,OFFSET udwave
\r
639 imul word ptr ds:udforce;;;;
\r
640 ; shrd ax,dx,8;;;;;;;;
\r
643 ;---set 3d rotate XZ
\r
644 mov bx,OFFSET lrwave
\r
650 ;---add more text to 3d scroller
\r
651 sub byte ptr ds:textcnt,90;;;;SCROLLSPEED
\r
653 mov word ptr ds:textcnt,1023;;;;LETTERDOTSPACING*8-1
\r
665 shl bx,1;;;;SCROLLDELAYSHL
\r
680 @@t3: mov si,OFFSET text0
\r
687 ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Main routine ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
\r
691 ;ÍÍÍÍÍÍÍÍÍ Zero Zerodata & Init Segs ÍÍÍÍÍÍÍ
\r
697 mov cx,(zeroend-zerobeg)/2
\r
698 mov di,OFFSET zerobeg
\r
699 xor ax,ax ;zero used later
\r
703 ;segments now set: DS=code/data ES=vram
\r
704 ;ÍÍÍÍÍÍÍÍÍ Check for 386 ÍÍÍÍÍÍÍÍÍ
\r
709 @@o2: jmp endansi ;80(1)86
\r
711 @@o1: mov bx,OFFSET rows
\r
713 cmp byte ptr ds:[bx+5],0
\r
715 ;ÍÍÍÍÍÍÍÍÍ Check for VGA ÍÍÍÍÍÍÍÍÍ
\r
717 mov fs,ax ;ax was zero
\r
718 ;segments now set: DS=code/data ES=vram FS=zeropage
\r
722 jne endansi ;no vga
\r
725 ;ÍÍÍÍÍÍÍÍÍ Initialize - doinit 0 ÍÍÍÍÍÍÍÍÍ
\r
726 ;copy vga font to font buffer
\r
738 @@a2: mov ax,es:[di]
\r
742 ;ÍÍÍÍÍÍÍÍÍ Initialize - vga ÍÍÍÍÍÍÍÍÍ
\r
743 ;init videomode 320x200x16
\r
746 ;set up rows/cols/etc
\r
748 mov di,OFFSET vbuf-44
\r
752 @@b1: mov ds:rows[si],di
\r
754 mov ds:colbww[si],cx
\r
757 mov ds:colbw[si],dx
\r
760 mov ds:colbv[si],ax
\r
767 @@b5: mov cx,0000000011111110b
\r
768 mov dx,0000000001111100b
\r
769 mov ax,0000000000111000b
\r
774 ;set simplex palette order (16 color mode)
\r
786 ;ÍÍÍÍÍÍÍÍÍ Initialize - doinit ÍÍÍÍÍÍÍÍÍ
\r
788 mov bx,OFFSET dots-2
\r
796 mov word ptr ds:[bx],OFFSET pset1
\r
799 ;ÍÍÍÍÍÍÍÍÍ Initialize - others ÍÍÍÍÍÍÍÍÍ
\r
802 ;ÍÍÍÍÍÍÍÍÍ Do the intro stuff ÍÍÍÍÍÍÍÍÍ
\r
809 ;ÍÍÍÍÍÍÍÍÍ DeInitialize ÍÍÍÍÍÍÍÍÍ
\r
811 call a_init ;reinitializing adlib shuts it up
\r
812 ;ÍÍÍÍÍÍÍÍÍ Display end ansi (only thing done if no 386 or vga) ÍÍÍÍÍÍÍÍÍ
\r
815 mov si,OFFSET endtext
\r
816 push 0b800h ;if the user has an MGA or HGC
\r
817 pop es ;it's not my problem :-)
\r
820 @@1__________: lodsb
\r
831 @@3__: mov ax,4c00h
\r
835 ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Initialized (nonzero) data ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
\r
837 ;pointer & delay counter for scrolltext
\r
838 text dw OFFSET text0
\r
841 ;3d rotation values (more in zerodata)
\r
842 udforced LABEL DWORD
\r
848 sintable LABEL BYTE ;sine table (circle is 64 units)
\r
849 db 0,12,24,36,48,59,70,80,89,98,105,112,117,121,124,126,127,126
\r
850 db 124,121,117,112,105,98,89,80,70,59,48,36,24,12,0,-12,-24,-36
\r
851 db -48,-59,-70,-80,-89,-98,-105,-112,-117,-121,-124,-126,-127
\r
852 db -126,-124,-121,-117,-112,-105,-98,-89,-80,-70,-59,-48,-36
\r
853 db -24,-12,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54
\r
854 db 57,59,62,65,67,70
\r
857 a_inst_table LABEL BYTE
\r
858 db 20h+0,20h+1,20h+2,20h+8,20h+9,20h+10,20h+16,20h+17,20h+18
\r
859 NTB equ 8192 ;+1024*1
\r
860 a_note_table LABEL WORD
\r
861 dw NTB+363,NTB+385,NTB+408,NTB+432,NTB+458,NTB+485
\r
862 dw NTB+514,NTB+544,NTB+577,NTB+611,NTB+647,NTB+868
\r
863 ;note: a zero word is expected after this table (found in col0)
\r
865 col0 db 0, 0, 0 ,0 ;background color
\r
866 col1 db 0,15,35 ,0 ;delay color 3
\r
867 col2 db 16,30,48 ,0 ;delay color 2
\r
868 col3 db 32,45,55 ,0 ;delay color 1
\r
869 col4 db 60,61,62 ;brightest color
\r
870 ;1 . x . x . x . x . x . x . x . x
\r
871 ;2 . . x x . . x x . . x x . . x x
\r
872 ;4 . . . . x x x x . . . . x x x x
\r
873 ;8 . . . . . . . . x x x x x x x x
\r
874 ;palette indices for 4 palettes. Last number is bitplane to write
\r
875 ;during the frame having this palette
\r
876 index1 db 04h,34h,24h,34h,14h,34h,24h,34h ,1 ;1248
\r
877 index2 db 03h,23h,13h,23h,44h,44h,44h,44h ,8 ;8124
\r
878 index3 db 02h,12h,44h,44h,33h,33h,44h,44h ,4 ;4812
\r
879 index4 db 01h,44h,33h,44h,22h,44h,33h,44h ,2 ;2481
\r
880 index dw OFFSET index1 ;offset to current index
\r
882 ;################## Music - (tune by skaven/fc) ###################
\r
883 ;generated with ST3->SIMPLEXADLIB, handoptimized by psi (283 bytes)
\r
884 music_channels equ 8
\r
886 music_instruments LABEL BYTE
\r
896 db 65,194,6,0,35,242,240,240,1,0,4
\r
898 db 145,64,135,128,243,111,35,3,1,1,2
\r
900 db 225,33,17,128,17,19,34,34,0,0,12
\r
902 db 97,33,27,0,98,132,86,85,0,0,14
\r
904 db 145,64,135,136,243,111,35,3,1,1,2
\r
905 music_patterns LABEL BYTE
\r
906 ach0 dw OFFSET ach0d,OFFSET ach0dr
\r
907 ach1 dw OFFSET ach1d,OFFSET ach1dr
\r
908 ach2 dw OFFSET ach2d,OFFSET ach2dr
\r
909 ach3 dw OFFSET ach3d,OFFSET ach3d
\r
910 ach4 dw OFFSET ach4d,OFFSET ach4d
\r
911 ach5 dw OFFSET ach5d,OFFSET ach5d
\r
912 ach6 dw OFFSET ach6d,OFFSET ach6d
\r
913 ach7 dw OFFSET ach7d,OFFSET ach7d
\r
917 db 057h,050h,050h,055h,057h,050h,055h,057h
\r
918 db 050h,055h,057h,050h,055h,057h,050h,055h
\r
923 db 050h,055h,057h,050h,055h,057h,050h,055h
\r
924 db 057h,050h,055h,057h,050h,055h,057h,050h
\r
928 db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
\r
929 db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
\r
931 db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
\r
932 db 025h,015h,025h,015h,028h,018h,02Ah,01Ah
\r
935 db 0A0h,050h,040h,0C0h,040h,088h,040h,040h
\r
936 db 03Ah,042h,090h,045h,088h,040h,042h,040h
\r
937 db 047h,090h,04Ah,088h,045h,098h,040h
\r
940 db 0A0h,050h,030h,0C0h,047h,088h,047h,043h
\r
941 db 042h,045h,047h,045h,048h,047h,047h,050h
\r
942 db 052h,084h,050h,04Ah,088h,050h,098h,045h
\r
945 db 0C0h,020h,0A0h,010h,010h,090h,010h,02Ah
\r
946 db 025h,088h,028h,02Ah,090h,010h,02Ah,025h
\r
950 db 0C0h,020h,0A0h,020h,020h,090h,020h,01Ah
\r
951 db 015h,088h,018h,01Ah,090h,020h,01Ah,015h
\r
955 db 0C0h,00Ch,0FEh,050h,090h,00Ch,081h,04Ah
\r
956 db 050h,084h,052h,055h,086h,04Ah,081h,050h
\r
957 db 04Ah,086h,050h,082h,055h,098h,045h
\r
959 ;#########################################################
\r
962 SCROLLDELAYSHL equ 9
\r
963 LETTERDOTSPACING equ 128
\r
967 text0 LABEL BYTE ;scrolltext (numbers are delays)
\r
968 db 31,25,'CALL STARPORT',9,'FUTURE CREW WORLD HQ',9,'CDN',9,'GRAVIS EURO',9,'AND MORE',0
\r
970 endtext LABEL BYTE ;endansi... well... endansiline (numbers are colors)
\r
974 db 'V32bis +358-0-8044626'
\r
975 db ' +358-0-8041133'
\r
979 endtext1 LABEL BYTE
\r
983 ;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Uninitialized (zero) data ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
\r
985 zerobeg LABEL WORD ;start zero clear from here
\r
987 rows dw 320 dup(0) ;offsets to screen rows
\r
988 cols dw 320 dup(0) ;offsets to screen cols
\r
989 colb db 320 dup(0,0) ;bitmasks for screen cols
\r
990 colbv dw 320 dup(0) ;wide -"-
\r
991 colbw dw 320 dup(0) ;wider -"-
\r
992 colbww dw 320 dup(0) ;very wide -"-
\r
995 db 44*8 dup(0) ;negative overflow for videobuffer
\r
997 db 44*200 dup(0) ;video buffer
\r
998 db 44*8 dup(0) ;positive overflow for videobuffer
\r
1002 db 8 dup(320 dup(0)) ;font buffer
\r
1005 DOTNUM1 equ 256 ;number of dots used for text
\r
1006 DOTNUM equ 444 ;total number of dots
\r
1009 dw DOTNUM dup(0,0,0,0) ;x,y,z,routine data for each dot
\r
1011 ;2x2 rotation matrices
\r
1021 ;zero initialized 3d rotation stuff
\r
1031 a_chdelaycnt db 9 dup(0)
\r
1032 a_chdelay db 9 dup(0)
\r
1039 oldint8 dw 0;;;;;;;;
\r
1042 padder db 16 dup(0)
\r
1043 zeroend LABEL WORD ;end zero clear here
\r