home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
asm_programming
/
AO3.LST
< prev
next >
Wrap
File List
|
1990-10-03
|
8KB
|
236 lines
Microsoft (R) Macro Assembler Version 5.10 10/3/90 23:50:19
Page 1-1
; ASCII Organ III
= 0042 timer equ 42h
= 0061 speaker equ 61h
= 004F sponmsk equ 4fh
= 004C spofmsk equ 4ch
= 00B6 settim equ 0b6h
= 0060 keyport equ 60h
doscall macro x
mov ah,x
int 21h
endm
pout macro x,y
mov al,y
out x,al
endm
0000 code segment
0100 org 100h
assume cs:code,ds:code
0100 EB 75 90 start: jmp begin ; bypass variab
le storage
;----- Music data -----
0103 11 04 10 04 0F 04 song db 17,4,16,4,15,4,16,4,17,4,17,4,1
7,8
10 04 11 04 11 04
11 08
0111 10 04 10 04 10 08 db 16,4,16,4,16,8,17,4,19,4,19,8
11 04 13 04 13 08
011D 11 04 10 04 0F 04 db 17,4,16,4,15,4,16,4,17,4,17,4,1
7,4
10 04 11 04 11 04
11 04
012B 11 04 10 04 10 04 db 17,4,16,4,16,4,17,4,16,4,15,4
11 04 10 04 0F 04
;----- Timer divisor data (Pitch) ------
; C-1 D-2 E-3 F-4 G-5 A-6 B
-7 C-8 D-9 E-10 F-11
0137 0000 23A1 1FBE 1C47 divsors dw 0000,9121,8126,7239,6833,6088,5423,4
832,4560,4063,3620,3417
1AB1 17C8 152F 12E0
11D0 0FDF 0E24 0D59
; G-12 A-13 B-14 C-15 D-16 E-17 F
-18 G-19 A-20 B-21 C-22
014F 0BE4 0A98 0970 08E8 dw 3044,2712,2416,2280,2031,1810,1
708,1522,1356,1208,1140
07EF 0712 06AC 05F2
Microsoft (R) Macro Assembler Version 5.10 10/3/90 23:50:19
Page 1-2
054C 04B8 0474
; D-23 E-24 F-25 G-26 A-27 B-28
0165 03F8 0389 0356 02F9 dw 1016, 905, 854, 761, 678, 604
02A6 025C
;----- Variables ------
0171 0000 notecnt dw 0
; counter for notes played
0173 0000 beatcnt dw 0
; counter for beats
0175 0000 tbtn dw 0
; n beats
;----- Initialize ------
0177 A0 0104 R begin: mov al, [song+1]
; length of first note
017A 98 cbw
017B A3 0175 R mov tbtn,ax
017E E8 01CB R call playnot
; begin first note
0181 BA 018F R mov dx,offset target1c
0184 B0 1C mov al,1ch
; get timer interrupt
doscall 25h
0186 B4 25 1 mov ah,25h
0188 CD 21 1 int 21h
018A BA 01F6 R mov dx,offset lbyte+1
018D CD 27 int 27h
; end, make resident
;----- target for interrupt 1Ch ------
018F target1c:
018F 0E push cs ; synch
ronize execution time
0190 1F pop ds
0191 FF 06 0173 R inc beatcnt
0195 A1 0175 R mov ax,tbtn
0198 3B 06 0173 R cmp ax,beatcnt ; end o
f note?
019C 74 01 je in2 ; yes,
jump next note
019E CF iret ; no...
019F 81 3E 0171 R 001A in2: cmp notecnt,(offset divsors - offse
t song) / 2
01A5 75 06 jne in3 ; if no
t equal continue
01A7 C6 06 018F R CF mov byte ptr target1c,0cfh
01AC CF iret
; to play following note
Microsoft (R) Macro Assembler Version 5.10 10/3/90 23:50:19
Page 1-3
01AD 56 in3: push si ; store
ds,dx,ax
01AE FF 06 0171 R inc notecnt ; advan
ce to next note
01B2 C7 06 0173 R 0000 mov beatcnt,0 ; reset
beatcount=0
01B8 8B 36 0171 R mov si,notecnt
01BC D1 E6 shl si,1 ; 2 ele
ments for each note
01BE 8A 84 0104 R mov al,[si+offset song+1] ; durat
ion of the note
01C2 98 cbw
01C3 A3 0175 R mov tbtn,ax
01C6 E8 01CB R call playnot
01C9 5E pop si
01CA CF iret
01CB 8B 36 0171 R playnot: mov si,notecnt
01CF D1 E6 shl si,1
01D1 8A 84 0103 R mov al,[si+offset song] ; AL =
number of note
01D5 0A C0 or al,al ; force
pointers
01D7 75 05 jnz pn1 ; note
0 is a pause
pout speaker,spofmsk
01D9 B0 4C 1 mov al,spofmsk
01DB E6 61 1 out speaker,al
01DD C3 ret
01DE 98 pn1: cbw ; AH in
one byte
01DF 8B F0 mov si,ax
01E1 D1 E6 shl si,1 ; divis
or table
pout timer+1,settim
01E3 B0 B6 1 mov al,settim
01E5 E6 43 1 out timer+1,al
01E7 8B 84 0137 R mov ax,[si+offset divsors]
01EB E6 42 out timer,al
01ED 8A C4 mov al,ah
01EF E6 42 out timer,al
pout speaker,sponmsk
01F1 B0 4F 1 mov al,sponmsk
01F3 E6 61 1 out speaker,al
01F5 C3 lbyte: ret
01F6 code ends
end start
Microsoft (R) Macro Assembler Version 5.10 10/3/90 23:50:19
Symbols-1
Macros:
N a m e Lines
DOSCALL . . . . . . . . . . . . 2
POUT . . . . . . . . . . . . . . 2
Segments and Groups:
N a m e Length Align Combine Class
CODE . . . . . . . . . . . . . . 01F6 PARA NONE
Symbols:
N a m e Type Value Attr
BEATCNT . . . . . . . . . . . . L WORD 0173 CODE
BEGIN . . . . . . . . . . . . . L NEAR 0177 CODE
DIVSORS . . . . . . . . . . . . L WORD 0137 CODE
IN2 . . . . . . . . . . . . . . L NEAR 019F CODE
IN3 . . . . . . . . . . . . . . L NEAR 01AD CODE
KEYPORT . . . . . . . . . . . . NUMBER 0060
LBYTE . . . . . . . . . . . . . L NEAR 01F5 CODE
NOTECNT . . . . . . . . . . . . L WORD 0171 CODE
PLAYNOT . . . . . . . . . . . . L NEAR 01CB CODE
PN1 . . . . . . . . . . . . . . L NEAR 01DE CODE
SETTIM . . . . . . . . . . . . . NUMBER 00B6
SONG . . . . . . . . . . . . . . L BYTE 0103 CODE
SPEAKER . . . . . . . . . . . . NUMBER 0061
SPOFMSK . . . . . . . . . . . . NUMBER 004C
SPONMSK . . . . . . . . . . . . NUMBER 004F
START . . . . . . . . . . . . . L NEAR 0100 CODE
TARGET1C . . . . . . . . . . . . L NEAR 018F CODE
TBTN . . . . . . . . . . . . . . L WORD 0175 CODE
TIMER . . . . . . . . . . . . . NUMBER 0042
@CPU . . . . . . . . . . . . . . TEXT 0101h
@FILENAME . . . . . . . . . . . TEXT ao3
@VERSION . . . . . . . . . . . . TEXT 510
Microsoft (R) Macro Assembler Version 5.10 10/3/90 23:50:19
Symbols-2
108 Source Lines
116 Total Lines
27 Symbols
47792 + 281596 Bytes symbol space free
0 Warning Errors
0 Severe Errors