Category : Recently Uploaded Files
Archive   : PCGPE.ZIP
Filename : DIGITAL.ASM

 
Output of file : DIGITAL.ASM contained in archive : PCGPE.ZIP

DOSSEG
.MODEL SMALL
.STACK 200h
.CODE
.386
ASSUME CS:@CODE, DS:@CODE
LOCALS

INCLUDE starrnd.dw ;file that has label StarRnd numbers
democount dw ?
;=== DATA Structures
a_musiccnt dw 1
a_chdelaycnt db 9 dup(0)
a_chdelay db 9 dup(0)
ALIGN 2
a_inst_table LABEL BYTE
db 20h+0,20h+1,20h+2,20h+8,20h+9,20h+10,20h+16,20h+17,20h+18
NTB equ 8192 ;+1024*1

a_note_table LABEL WORD
dw NTB+363,NTB+385,NTB+408,NTB+432,NTB+458,NTB+485
dw NTB+514,NTB+544,NTB+577,NTB+611,NTB+647,NTB+868

;################## Music - (tune by skaven/fc) ###################
;generated with ST3->SIMPLEXADLIB, handoptimized by psi (283 bytes)
music_channels equ 8
music_speed equ 8
music_instruments LABEL BYTE
dw OFFSET ains6
dw OFFSET ains2
dw OFFSET ains4
dw OFFSET ains3
dw OFFSET ains3
dw OFFSET ains1
dw OFFSET ains1
dw OFFSET ains4
ains1 LABEL BYTE
db 65,194,6,0,35,242,240,240,1,0,4
ains2 LABEL BYTE
db 145,64,135,128,243,111,35,3,1,1,2
ains3 LABEL BYTE
db 225,33,17,128,17,19,34,34,0,0,12
ains4 LABEL BYTE
db 97,33,27,0,98,132,86,85,0,0,14
ains6 LABEL BYTE
db 145,64,135,136,243,111,35,3,1,1,2
music_patterns LABEL BYTE
ach0 dw OFFSET ach0d,OFFSET ach0dr
ach1 dw OFFSET ach1d,OFFSET ach1dr
ach2 dw OFFSET ach2d,OFFSET ach2dr
ach3 dw OFFSET ach3d,OFFSET ach3d
ach4 dw OFFSET ach4d,OFFSET ach4d
ach5 dw OFFSET ach5d,OFFSET ach5d
ach6 dw OFFSET ach6d,OFFSET ach6d
ach7 dw OFFSET ach7d,OFFSET ach7d
ach0d LABEL BYTE
db 081h
ach0dr LABEL BYTE
db 057h,050h,050h,055h,057h,050h,055h,057h
db 050h,055h,057h,050h,055h,057h,050h,055h
db 0
ach1d LABEL BYTE
db 081h
ach1dr LABEL BYTE
db 050h,055h,057h,050h,055h,057h,050h,055h
db 057h,050h,055h,057h,050h,055h,057h,050h
db 0
ach2d LABEL BYTE
db 0C0h,050h,084h
db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
ach2dr LABEL BYTE
db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
db 025h,015h,025h,015h,028h,018h,02Ah,01Ah
db 0
ach3d LABEL BYTE
db 0A0h,050h,040h,0C0h,040h,088h,040h,040h
db 03Ah,042h,090h,045h,088h,040h,042h,040h
db 047h,090h,04Ah,088h,045h,098h,040h
db 0
ach4d LABEL BYTE
db 0A0h,050h,030h,0C0h,047h,088h,047h,043h
db 042h,045h,047h,045h,048h,047h,047h,050h
db 052h,084h,050h,04Ah,088h,050h,098h,045h
db 0
ach5d LABEL BYTE
db 0C0h,020h,0A0h,010h,010h,090h,010h,02Ah
db 025h,088h,028h,02Ah,090h,010h,02Ah,025h
db 088h,028h,02Ah
db 0
ach6d LABEL BYTE
db 0C0h,020h,0A0h,020h,020h,090h,020h,01Ah
db 015h,088h,018h,01Ah,090h,020h,01Ah,015h
db 088h,018h,01Ah
db 0
ach7d LABEL BYTE
db 0C0h,00Ch,0FEh,050h,090h,00Ch,081h,04Ah
db 050h,084h,052h,055h,086h,04Ah,081h,050h
db 04Ah,086h,050h,082h,055h,098h,045h
db 0
;#########################################################

digi db 'Digital Illusions BBS$'
PHONE DB '41o-284-0970$'
WAITCOUNT DW 1500
EXIT DB "Coded by D„rk Kn‹ght - AvA - My Second Intro! Digital Illusions 285-1158",0DH,0ah,' Music By Skavan /FC $'
digiloc dw 1601h
INFO db 'Code By Dark Knight$'
digidir dw 2


ava db ' Home Of DigiNet $'
avacount db ?
Star_Struc STRUC
X dw 0
Y dw 0
Z dw 0
OldDi dw 0 ;where to erase last dot
Color db 0 ;BASE color. a number 0-16 is added to it
Star_Struc ENDS

StarStrucSize = 9 ;number of bytes per entry

;=== DATA



ScreenWidth EQU 320
ScreenHeight EQU 200

NumRnds EQU 400 ;number of random numbers defined

MaxZpos EQU 4096
MinZpos EQU 2
MaxStars EQU 190
NumColors EQU 3 ;number of Base colors in the Color Chart

WarpSpeed dw 30 ;how quickly the stars move toward ya
MaxWarp EQU 90

Xindex dw 30 ;index into the StarRnd chart for X & Y
Yindex dw 230 ; -note they must be different; set em the same to
;see why
Cindex dw 0 ;index into ColorChart

ColorChart db 0,16,32,48 ;a list of base colors (-1) 0 16 32 48 64 80

Stars Star_Struc MaxStars DUP (<>) ;where all the data is held

NumActive dw 0 ;number of stars active

Palette db 3 dup (0) ;the palette.. first entrie is BG color (black)
i = 15
REPT 16
db 2*i,3*i,4*i
i=i-1
ENDM

i = 15
REPT 16
db 2*i,2*i,4*i
i=i-1
ENDM
i = 15
REPT 16
db 3*i,2*i,4*i
i=i-1
ENDM
i = 15
REPT 16
db 3*i,2*i,4*i
i=i-1
ENDM
i = 15
REPT 16
db 3*i,2*i,3*i
i=i-1
ENDM
i = 15
REPT 16
db 2*i,4*i,3*i
i=i-1
ENDM


MakeStar PROC NEAR
pusha
mov ax,cs
mov es,ax
mov ds,ax

cmp [NumActive],MaxStars ;is there room for another star?
jae NoEmptySpace

;search for 1st available slot

mov si,0
TryAgain:
cmp word ptr [Stars.Z+si],0 ;is this slot empty?
je GotOne ;yes, go fill it

add si,StarStrucSize
cmp si,MaxStars*StarStrucSize
jb TryAgain
jmp NoEmptySpace

GotOne: ;si points to the record for the star to fill
mov di,[Yindex] ;grab index for Ypos
add di,di ;multiply by 2 to make it a WORD index
mov ax,[StarRnd+di] ;get the number
shl ax,3 ;multiply by 8- could been done in BAS file
mov [Stars.Y+si],ax ;and save off the number

mov di,[Xindex] ;grab index for Xpos
add di,di ;... same as above, but for Xpos
mov ax,[StarRnd+di]
shl ax,3
mov [Stars.X+si],ax

mov [Stars.Z+si],MaxZpos ;reset Zpos to the max
inc [NumActive] ;we added a star so increase the counter

mov di,[Cindex] ;grab the color index
mov al,[ColorChart+di] ;grab the BaseColor for the star
mov [Stars.Color+si],al ;save it in the record

;increase all the index pointers

inc [Cindex] ;increases the color counter
cmp [Cindex],NumColors
jb OkColor
mov [Cindex],0
OkColor:
inc [Yindex] ;increases Yindex
cmp [Yindex],NumRnds ;note that for this one we
jb YindNotZero ; subtract NumRnds from Yindex if we
sub [Yindex],NumRnds ; go off the end of the chart
YindNotZero:
inc [Xindex] ;increase Xindex
cmp [Xindex],NumRnds ;have we gone through the entire chart?
jb XindNotZero ;nope...

;This clever bit of code makes more use out of the chart by increasing Yindex
; one additional unit each time Xindex goes through the entire chart... the
; result is nearly NumRND^2 random non-repeating points

inc [Yindex] ;yes, so change Yindex so that we get a
mov ax,[Yindex] ;new set of random (x,y)
cmp ax,[Xindex] ;does Xindex = Yindex?
jne NotTheSame ;if the index were the same, you'd see
;a graph of the line Y = X, not good...
inc [Yindex] ;if they are the same, inc Yindex again
NotTheSame:
mov [Xindex],0 ;reset Xindex to 0
XindNotZero: ;all done making the star...

NoEmptySpace:
popa
ret
MakeStar ENDP

DisplayStars PROC NEAR
pusha
mov ax,cs
mov ds,ax
mov ax,0a000h
mov es,ax

mov si,0
DispLoop:
mov cx,[Stars.Z+si]
or cx,cx ;if Zpos = 0 then this star is dead...
je Cont ;continue to the next one- skip this one

mov di,[Stars.OldDi+si] ;grab old Di
mov byte ptr es:[di],0 ;erase the star

cmp cx,MinZpos
jl TermStar ;if Zpos < MinZpos then kill the star

mov ax,[Stars.Y+si]
movsx dx,ah ;'multiply' Ypos by 256
shl ax,8

idiv cx ;and divide by Zpos
add ax,ScreenHeight/2 ;center it on the screen
mov di,ax
cmp di,ScreenHeight ;see if the star is in range.
jae PreTermStar ; If not, kill it
imul di,ScreenWidth ; DI = Y*ScreenWidth

mov ax,[Stars.X+si]
movsx dx,ah ;multiply Xpos by 256
shl ax,8

idiv cx ;and divide by Zpos
add ax,ScreenWidth/2 ;center it on the screen
cmp ax,ScreenWidth ;are we inside the screen boundries?
jae PreTermStar
add di,ax ; DI = Y * ScreenWidth + X

mov [Stars.OldDi+si],di ;save old di

;calculate the color below

add ch,cs:[Stars.Color+si] ;i'm dividing cx (the zpos) by 256 and
; putting the result in ch and adding
; the base color to it in one instruction
mov es:[di],ch ;put the dot on the screen

mov ax,cs:[WarpSpeed]
sub cs:[Stars.Z+si],ax ;move the stars inward at WarpSpeed

Cont:
add si,StarStrucSize ;point to next record
cmp si,MaxStars*StarStrucSize ;are we done yet?
jb DispLoop
popa
ret

PreTermStar:
mov [Stars.Z+si],1 ;this is here so that the star will get erased
jmp short Cont ;next time through if I just went off and killed
;the star, it would leave a dot on the screen
TermStar:
mov [Stars.Z+si],0 ;this actually kills the star, after it has
dec [NumActive] ;been erased
jmp short Cont

DisplayStars ENDP

a_lodsboutaw03: ;size optimization related entry (instrument loading)
call a_lodsboutaw
add ah,3
a_lodsboutaw: ;size optimization related entry (instrument loading)
lodsb
a_outaw PROC NEAR ;ah=reg,al=data
push ax
push cx
xchg al,ah
mov dx,388h
out dx,al
mov cx,7
call a_wait
mov dx,389h
mov al,ah
out dx,al


mov cx,30
call a_wait
pop cx
pop ax
skipit: ret
a_wait: in al,dx
loop a_wait
ret
a_outaw ENDP

a_loadinstrument PROC NEAR
mov ah,ds:a_inst_table[bx]
mov cx,4
@@1: call a_lodsboutaw03
add ah,20h-3
loop @@1
add ah,40h
call a_lodsboutaw03
mov ah,bl
add ah,0c0h
jmp a_lodsboutaw
a_loadinstrument ENDP

a_playnote PROC NEAR
push bx
xchg ah,bl
add ah,0a0h
call a_outaw
mov al,bl
add ah,010h
pop bx
jmp a_outaw
a_playnote ENDP

a_init PROC NEAR
mov ax,00120h
call a_outaw
mov ax,00800h
call a_outaw
mov ah,0bdh
call a_outaw
mov bp,9
xor bx,bx
mov di,OFFSET music_instruments
@@1: mov si,ds:[di]
add di,2
call a_loadinstrument
xor ax,ax
call a_playnote
inc bx
dec bp
jnz @@1
ret
a_init ENDP

a_dorow PROC NEAR
sub ds:a_musiccnt,1
jnc @@0
mov ds:a_musiccnt,music_speed
mov cx,music_channels
mov di,OFFSET music_patterns
xor bx,bx
@@1: sub ds:a_chdelaycnt[bx],1
jns @@2
mov si,ds:[di]
xor ax,ax
call a_playnote
@@4: lodsb
or al,al
jz @@7
jns @@6
sub al,81h
mov ds:a_chdelay[bx],al
lodsb
@@6: mov dl,al
and ax,15
mov bp,ax
add bp,bp
mov ax,ds:a_note_table[bp]
shr dl,2
and dl,not 3
add ah,dl
call a_playnote
mov al,ds:a_chdelay[bx]
mov ds:a_chdelaycnt[bx],al
mov ds:[di],si
@@2: add di,4
inc bx
loop @@1
@@0: ret
@@7: mov si,ds:[di+2]
jmp @@4
a_dorow ENDP

movit macro direction,loc, var1,var2, var3,var4, dir1,dir2,dir3,dir4
local inc1
local movedown
local inc2
local moveleft
local inc3
local moveup
local inc4
local exit
local moveright

cmp direction, 0
je moveright
cmp direction, 1
je movedown
cmp direction, 2
je moveleft
cmp direction, 3
je moveup

moveright:
cmp loc, var1
jne inc1
mov direction, dir1
jmp exit

inc1:
add loc, 1
jmp exit

movedown:
cmp loc,var2
jne inc2
mov direction, dir2
jmp exit
inc2:
add loc, 280h
jmp exit

moveleft:
cmp loc, var3
jne inc3
mov direction, dir3
jmp exit
inc3:
sub loc, 1
jmp exit

moveup:
cmp loc, var4
jne inc4
mov direction, dir4
jmp exit

inc4:
sub loc, 280h
jmp exit

exit:
endm


;=== CODE

START:

mov ax,cs
mov ds,ax
mov es,ax

mov ax,0013h ;set vid mode 320x200x256 graph
int 10h

;mov dx,offset Palette
;mov ax,1012h ; WRITE palette
;mov bx,0
;mov cx,256 ;write entire palette
;int 10h ;doesn't matter if we didnt define it all
CALL A_INIT

StarLoop:
call MakeStar ;make stars 2x as thick
call MakeStar
CALL A_DOROW
add avacount ,1
cmp avacount, 6
jl ava1
movit digidir, digiloc, 1616h, 0000h, 1600h,00h, 2,2,0,2
mov ah, 02h
mov dx,digiloc
int 10h
mov dx, offset ava
mov ah,09h
int 21h
sub avacount,6
ava1:

cmp democount,450
jg demodone

add democount,1
cmp democount, 150
jl not50
mov ah, 02h
mov dx, 0509h
int 10h
mov dx, offset digi
mov ah,09h
int 21h
cmp democount , 300
jl not50
mov ah, 02h
mov dx, 80dh
int 10h
mov dx, offset phone
mov ah,09h
int 21h
cmp democount , 450
jl not50
mov ah, 02h
mov dx,0b0bh
int 10h
mov dx, offset info
mov ah,09h
int 21h
demodone:
DeC WAITCOUNT
JZ REDO
NOT50:
mov dx,3dah
VRT:
in al,dx
test al,8
jnz VRT ;wait until Verticle Retrace starts

NoVRT:
in al,dx
test al,8
jz NoVRT ;wait until Verticle Retrace Ends

call DisplayStars

mov ah,1 ;check to see if a char is ready
int 16h
jz StarLoop ;nope, continue

mov ah,0
int 16h ;get the character & put in AX
jz StarLoop


mov ax,0003h ;set 80x25x16 char mode
int 10h
mov ah, 09h
mov dx, offset exit
int 21h
CALL A_INIT

mov ax,4c00h ;return control to DOS
int 21h
REDO:
MOV DEMOCOUNT,0
MOV WAITCOUNT, 1500
JMP NOT50

END START



  3 Responses to “Category : Recently Uploaded Files
Archive   : PCGPE.ZIP
Filename : DIGITAL.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/