home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Large Pack of OldSkool DOS MOD Trackers
/
hsc14ecr.zip
/
TESTHSC.ASM
< prev
next >
Wrap
Assembly Source File
|
1994-01-30
|
10KB
|
202 lines
MASM
COMMENT *
───────────────────────────────────────────────────────────────────────────────
This is just a short assembler file that shows the usage of the HSCTracker
FM routines, What IS strange about this file is that the jnc instruction
used at line 37 (or so) assembles to jnb using tasm, which is strange to say
the least...... I dont want it to change my shitty code! :))
Anyways, this should give everyone an idea how to use the FM routines in thier
own asm programs, and for my part, I think these routines are real cool, a
big thanks to chicken!!
Phil Carlisle - pc@espr.demon.co.uk
Umm, dig the modular style!, where's the bloody incbin, thanks for the patch
program chicken!
───────────────────────────────────────────────────────────────────────────────
*
;───────────────────────────────────────────────────────────────────────────────
; Dont forget to change the directories of the include files!! :)
;───────────────────────────────────────────────────────────────────────────────
include c:\assemble\fmhsc.inc ;fm routines include file
include c:\assemble\dosstdhd.inc ;dos header include file
dataseg ;start the data segment
include "bomb.bin" ;the HSC music file data
include "done.dat" ;the screen file 4000 bytes
ends ;end data segment
codeseg ;start code segment
adlibthere db 0 ;byte to store adlib flag
include "c:\assemble\macros.inc" ;include my macro's
include "c:\assemble\retrace.inc" ;and my retrace code
include "c:\assemble\adlibtst.inc" ;and the adlibdetect proc
Equalizers db 9 dup (0) ;where to put the equ data!
;not really needed but I use it
;because I wasnt sure what I was
;doing with hsc at first...
;───────────────────────────────────────────────────────────────────────────────
; Proc Startmusic, funnily enough starts the HSC music playing, in timer
; mode... detectadlib returns carry set if no adlib...
; everything else SHOULD be preserved.
;───────────────────────────────────────────────────────────────────────────────
PROC Startmusic ;called to start FM music
call Detectadlib ;detect CF=Set on not there...
jc @@notmusic ;carry flag set, no music
@@noprob: ;
mov [cs:adlibthere],1 ;store a flag about music
mov ax,seg bomb ;adlibthere=1 = music ok...
mov es,ax ;point es to segment of music-
mov ax,offset bomb ;data, si=offset
mov si,ax ;
mov ah,0 ;zero ah (Use XOR next time! )
mov bx,0 ;and bx
call hscplayer ;call music routine
@@notmusic: ;jmp here if no music allowed
ret ;return from proc
ENDP ;end of proc
;───────────────────────────────────────────────────────────────────────────────
; Proc DoGreetz, just blasts a 4000byte file in the form of an SBD file (mine)
; char:1byte Attrib:1byte format, uses rep movsw to write it...
; All regs preserved...
;───────────────────────────────────────────────────────────────────────────────
PROC DoGreetz ;routine to show screen
pusha ;save regs
mov ax,seg Screenfile ;point ds:si to screenfile
mov ds,ax ;address
mov ax,offset screenfile ;
mov si,ax ;
mov ax,0b800h ;es to text screen segment b800h
mov es,ax ;
mov di,0 ;di to start of that seg
mov cx,2000 ;4000 bytes = 1 screen
rep movsw ;moved in words
;hide cursor
mov dh,24 ;use an int to set cursor pos'n
mov dl,0
mov ah,02
int 10h ;so we cant see it flashing
popa
ret ;end of proc
ENDP
;───────────────────────────────────────────────────────────────────────────────
; Proc Dobars just sets up equalizer bars horizontally, as its easier!
; All regs preserved NOTE: It checks keyboard as well.... only an example!
;───────────────────────────────────────────────────────────────────────────────
PROC Dobars ;equalizer bars for hscplayer
pusha ;save regs
mov bp,0
@@equloop:
mov ax,seg hscplayer ;move segment of hscplayer
mov ds,ax ;into ds
mov si,0a48h
mov ax,cs
mov es,ax
mov di,offset cs:equalizers
mov cx,9
rep movsb ;data for EQU's copied
mov ax,0b800h ;es=>screen mem (text)
mov es,ax ;
mov di,0 ;di points to start
@@eqloop:
xor cx,cx ;clear cx
mov cl,[cs:equalizers+bp] ;ch = value in equ (n) see address
mov ch,0h ;given in hscdoc
inc cx
and cx,1fh ;take ch value from ff
shl cx,2 ;divide cl by for to keep in
mov al,220 ;al = bar character
mov ah,12 ;ah= colour attrib byte
rep stosw ;write the data
add bp,1
xor ax,ax
mov ax,bp
mov dx,160
mul dx
mov di,ax
cmp bp,8
jle @@eqloop
Call WaitVsyncStart ;wait again, at least a frame
;(Might be better to wait_de!!)
mov di,0
mov ax,0
mov cx,2000
Call WaitVsyncStart
rep stosw
mov bp,0
mov di,0 ;so that we see the bar
in al,60h ;check keyboard
cmp al,01 ;is esc pressed?
jne @@equloop ;no, so loop...
popa ;restore regs
ret ;end it all.. :)
ENDP ;end of proc..
;───────────────────────────────────────────────────────────────────────────────
; Proc Deinitmusic (amazingly stops the music playing), it first
; checks a flag we set in the adlib detect part to know wether to bother.
;───────────────────────────────────────────────────────────────────────────────
PROC Deinitmusic ;de initialise FM and free timers
cmp [adlibthere],1 ;if no adlib there dont bother
jne @@dontbother ;otherwise
mov ah,2 ;use function 2
call hscplayer ;of FM routines to free timers
@@dontbother: ;etc....
ret ;end
ENDP
;───────────────────────────────────────────────────────────────────────────────
; Proc Gotoit (Our main program), calls all the other procs,
; then loops around in dobars until esc is pressed...
;───────────────────────────────────────────────────────────────────────────────
PROC Gotoit ;Main program starts
Call Startmusic ;
Call Dobars ;dobars checks escape...
Call Deinitmusic ;restore machine state
textmode ;reset the mode (cls)
Call DoGreetz ;Display the greetings (huh! :)
; Waitferescape ;Wait for the world to end...
; textmode ;set 24bit colour cga mode
quittodos ;exit to dos macro....
ENDP ;end procedure
ENDS ;end code segment
END Gotoit ;end program
MASM
COMMENT *
───────────────────────────────────────────────────────────────────────────────
Note to User:
=============
I only use this as an example, dont take it as gospel, but the value
does change, I'm not sure what range it is supposed to be in though,
I use shr 2 to divide it by 4, so that its always in my range....
Obviously the code for the tracker is copyright chicken, so dont bring youre
problems to me! :)), errrm, use this at youre own rick, errm, dont drink n drive
dont cheek your elders etc.... um, this code is public domain, if you make ANY
money off of it, youre a better man than I... :))
───────────────────────────────────────────────────────────────────────────────
*
IDEAL ; dont we all wish life was more ideal?? :)