home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / AO3.LST < prev    next >
File List  |  1990-10-03  |  8KB  |  236 lines

  1. Microsoft (R) Macro Assembler Version 5.10                  10/3/90 23:50:19
  2.                                                              Page     1-1
  3.  
  4.  
  5.                 ; ASCII Organ III
  6.                 
  7.  = 0042                timer   equ     42h
  8.  = 0061                speaker equ     61h
  9.  = 004F                sponmsk equ     4fh
  10.  = 004C                spofmsk equ     4ch
  11.  = 00B6                settim  equ     0b6h
  12.  = 0060                keyport equ     60h
  13.                 
  14.                 doscall macro   x
  15.                         mov     ah,x
  16.                         int     21h
  17.                         endm
  18.                 
  19.                 pout    macro   x,y
  20.                         mov     al,y
  21.                         out     x,al
  22.                         endm
  23.                 
  24.  0000                code    segment
  25.  0100                        org     100h
  26.                         assume  cs:code,ds:code
  27.                 
  28.  0100  EB 75 90            start:  jmp     begin           ; bypass variab
  29.                 le storage
  30.                 
  31.                 ;----- Music data -----
  32.                 
  33.  0103  11 04 10 04 0F 04    song    db      17,4,16,4,15,4,16,4,17,4,17,4,1
  34.                 7,8
  35.        10 04 11 04 11 04    
  36.        11 08            
  37.  0111  10 04 10 04 10 08            db      16,4,16,4,16,8,17,4,19,4,19,8
  38.        11 04 13 04 13 08    
  39.  011D  11 04 10 04 0F 04            db      17,4,16,4,15,4,16,4,17,4,17,4,1
  40.                 7,4
  41.        10 04 11 04 11 04    
  42.        11 04            
  43.  012B  11 04 10 04 10 04            db      17,4,16,4,16,4,17,4,16,4,15,4
  44.        11 04 10 04 0F 04    
  45.                 
  46.                 ;----- Timer divisor data (Pitch) ------
  47.                 
  48.                 ;               C-1  D-2  E-3  F-4  G-5  A-6  B
  49.                 -7  C-8  D-9  E-10 F-11
  50.  0137  0000 23A1 1FBE 1C47    divsors dw 0000,9121,8126,7239,6833,6088,5423,4
  51.                 832,4560,4063,3620,3417
  52.        1AB1 17C8 152F 12E0    
  53.        11D0 0FDF 0E24 0D59    
  54.                 ;               G-12 A-13 B-14 C-15 D-16 E-17 F
  55.                 -18 G-19 A-20 B-21 C-22
  56.  014F  0BE4 0A98 0970 08E8            dw      3044,2712,2416,2280,2031,1810,1
  57.                 708,1522,1356,1208,1140
  58.        07EF 0712 06AC 05F2    
  59. Microsoft (R) Macro Assembler Version 5.10                  10/3/90 23:50:19
  60.                                                              Page     1-2
  61.  
  62.  
  63.        054C 04B8 0474        
  64.                 ;               D-23 E-24 F-25 G-26 A-27 B-28
  65.  0165  03F8 0389 0356 02F9            dw      1016, 905, 854, 761, 678, 604
  66.        02A6 025C        
  67.                 
  68.                 ;----- Variables ------
  69.                 
  70.  0171  0000            notecnt dw      0                              
  71.                  ; counter for notes played
  72.  0173  0000            beatcnt dw      0                              
  73.                  ; counter for beats
  74.  0175  0000            tbtn    dw      0                              
  75.                  ; n beats
  76.                 
  77.                 ;----- Initialize ------
  78.                 
  79.  0177  A0 0104 R        begin:  mov     al, [song+1]                   
  80.                  ; length of first note
  81.  017A  98                    cbw
  82.  017B  A3 0175 R                mov     tbtn,ax
  83.  017E  E8 01CB R                call    playnot                        
  84.                  ; begin first note
  85.  0181  BA 018F R                mov     dx,offset target1c
  86.  0184  B0 1C                    mov     al,1ch                         
  87.                  ; get timer interrupt
  88.                         doscall 25h
  89.  0186  B4 25                 1            mov     ah,25h 
  90.  0188  CD 21                 1            int     21h 
  91.  018A  BA 01F6 R                mov     dx,offset lbyte+1
  92.  018D  CD 27                    int     27h                            
  93.                  ; end, make resident
  94.                 
  95.                 ;----- target for interrupt 1Ch ------
  96.                 
  97.  018F                target1c:
  98.  018F  0E                    push    cs                      ; synch
  99.                 ronize execution time
  100.  0190  1F                    pop     ds     
  101.  0191  FF 06 0173 R                inc     beatcnt 
  102.  0195  A1 0175 R                mov     ax,tbtn     
  103.  0198  3B 06 0173 R                cmp     ax,beatcnt              ; end o
  104.                 f note?
  105.  019C  74 01                    je      in2                     ; yes, 
  106.                 jump next note
  107.  019E  CF                    iret                            ; no...
  108.  019F  81 3E 0171 R 001A    in2:    cmp     notecnt,(offset divsors - offse
  109.                 t song) / 2
  110.  01A5  75 06                    jne     in3                     ; if no
  111.                 t equal continue
  112.  01A7  C6 06 018F R CF                mov     byte ptr target1c,0cfh
  113.  01AC  CF                    iret
  114.                 
  115.                 ; to play following note
  116.                 
  117. Microsoft (R) Macro Assembler Version 5.10                  10/3/90 23:50:19
  118.                                                              Page     1-3
  119.  
  120.  
  121.  01AD  56            in3:    push    si                      ; store
  122.                  ds,dx,ax
  123.  01AE  FF 06 0171 R                inc     notecnt                 ; advan
  124.                 ce to next note
  125.  01B2  C7 06 0173 R 0000            mov     beatcnt,0               ; reset
  126.                  beatcount=0
  127.  01B8  8B 36 0171 R                mov     si,notecnt
  128.  01BC  D1 E6                    shl     si,1                    ; 2 ele
  129.                 ments for each note
  130.  01BE  8A 84 0104 R                mov     al,[si+offset song+1]   ; durat
  131.                 ion of the note
  132.  01C2  98                    cbw
  133.  01C3  A3 0175 R                mov     tbtn,ax
  134.  01C6  E8 01CB R                call    playnot
  135.  01C9  5E                    pop     si
  136.  01CA  CF                    iret
  137.                 
  138.  01CB  8B 36 0171 R        playnot: mov     si,notecnt
  139.  01CF  D1 E6                    shl     si,1
  140.  01D1  8A 84 0103 R                mov     al,[si+offset song]     ; AL = 
  141.                 number of note
  142.  01D5  0A C0                    or      al,al                   ; force
  143.                  pointers
  144.  01D7  75 05                    jnz     pn1                     ; note 
  145.                 0 is a pause
  146.                         pout    speaker,spofmsk
  147.  01D9  B0 4C                 1            mov     al,spofmsk 
  148.  01DB  E6 61                 1            out     speaker,al 
  149.  01DD  C3                    ret
  150.  01DE  98            pn1:    cbw                             ; AH in
  151.                  one byte
  152.  01DF  8B F0                    mov     si,ax
  153.  01E1  D1 E6                    shl     si,1                    ; divis
  154.                 or table
  155.                         pout    timer+1,settim
  156.  01E3  B0 B6                 1            mov     al,settim 
  157.  01E5  E6 43                 1            out     timer+1,al 
  158.  01E7  8B 84 0137 R                mov     ax,[si+offset divsors]
  159.  01EB  E6 42                    out     timer,al
  160.  01ED  8A C4                    mov     al,ah
  161.  01EF  E6 42                    out     timer,al
  162.                         pout    speaker,sponmsk
  163.  01F1  B0 4F                 1            mov     al,sponmsk 
  164.  01F3  E6 61                 1            out     speaker,al 
  165.  01F5  C3            lbyte:  ret
  166.                 
  167.  01F6                code    ends
  168.                         end     start
  169.  
  170. Microsoft (R) Macro Assembler Version 5.10                  10/3/90 23:50:19
  171.                                                              Symbols-1
  172.  
  173.  
  174. Macros:
  175.  
  176.         N a m e            Lines
  177.  
  178. DOSCALL  . . . . . . . . . . . .         2
  179. POUT . . . . . . . . . . . . . .         2
  180.  
  181. Segments and Groups:
  182.  
  183.                 N a m e             Length     Align    Combine Class
  184.  
  185. CODE . . . . . . . . . . . . . .      01F6    PARA    NONE    
  186.  
  187. Symbols:            
  188.  
  189.                 N a m e             Type     Value     Attr
  190.  
  191. BEATCNT  . . . . . . . . . . . .      L WORD    0173    CODE
  192. BEGIN  . . . . . . . . . . . . .      L NEAR    0177    CODE
  193.  
  194. DIVSORS  . . . . . . . . . . . .      L WORD    0137    CODE
  195.  
  196. IN2  . . . . . . . . . . . . . .      L NEAR    019F    CODE
  197. IN3  . . . . . . . . . . . . . .      L NEAR    01AD    CODE
  198.  
  199. KEYPORT  . . . . . . . . . . . .      NUMBER    0060    
  200.  
  201. LBYTE  . . . . . . . . . . . . .      L NEAR    01F5    CODE
  202.  
  203. NOTECNT  . . . . . . . . . . . .      L WORD    0171    CODE
  204.  
  205. PLAYNOT  . . . . . . . . . . . .      L NEAR    01CB    CODE
  206. PN1  . . . . . . . . . . . . . .      L NEAR    01DE    CODE
  207.  
  208. SETTIM . . . . . . . . . . . . .      NUMBER    00B6    
  209. SONG . . . . . . . . . . . . . .      L BYTE    0103    CODE
  210. SPEAKER  . . . . . . . . . . . .      NUMBER    0061    
  211. SPOFMSK  . . . . . . . . . . . .      NUMBER    004C    
  212. SPONMSK  . . . . . . . . . . . .      NUMBER    004F    
  213. START  . . . . . . . . . . . . .      L NEAR    0100    CODE
  214.  
  215. TARGET1C . . . . . . . . . . . .      L NEAR    018F    CODE
  216. TBTN . . . . . . . . . . . . . .      L WORD    0175    CODE
  217. TIMER  . . . . . . . . . . . . .      NUMBER    0042    
  218.  
  219. @CPU . . . . . . . . . . . . . .      TEXT  0101h        
  220. @FILENAME  . . . . . . . . . . .      TEXT  ao3        
  221. @VERSION . . . . . . . . . . . .      TEXT  510        
  222.  
  223. Microsoft (R) Macro Assembler Version 5.10                  10/3/90 23:50:19
  224.                                                              Symbols-2
  225.  
  226.  
  227.  
  228.     108 Source  Lines
  229.     116 Total   Lines
  230.      27 Symbols
  231.  
  232.   47792 + 281596 Bytes symbol space free
  233.  
  234.       0 Warning Errors
  235.       0 Severe  Errors
  236.