home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / pcmtlsrc / pcmtlsrc.arj / PCM.ARJ / MACRO.INC < prev    next >
Text File  |  1992-07-29  |  5KB  |  316 lines

  1. ;$Author:   BCRANE  $
  2. ;$Date:   29 Jul 1992 16:57:42  $
  3. ;$Header:   W:/sccs/sdkapp/macro.inv   1.0   29 Jul 1992 16:57:42   BCRANE  $
  4. ;$Log:   W:/sccs/sdkapp/macro.inv  $
  5. ;
  6. ;   Rev 1.0   29 Jul 1992 16:57:42   BCRANE
  7. ;Initial revision.
  8. ;$Logfile:   W:/sccs/sdkapp/macro.inv  $
  9. ;$Modtimes$
  10. ;$Revision:   1.0  $
  11. ;$Workfile:   macro.inc  $ 
  12.  
  13. ;;    'macro.inc: copyright Shark, 1992', 00h
  14. GETDOSVECTOR equ 35h
  15. SETDOSVECTOR equ 25h
  16.  
  17. VIDEOSCREEN equ 0B000h
  18.  
  19. pushall macro
  20.     push bx
  21.     push cx
  22.     push si
  23.     push di
  24.     push es
  25.     push ds
  26.     push bp
  27.     endm
  28.  
  29. popall macro
  30.     pop bp
  31.     pop ds
  32.     pop es
  33.     pop di
  34.     pop si
  35.     pop cx
  36.     pop bx
  37.     endm
  38.  
  39. dspmonochar macro at, char
  40.     push bx
  41.     push es
  42.     mov bx, VIDEOSCREEN
  43.     mov es, bx
  44.     mov bx, at
  45.     mov es:[bx], byte ptr char
  46.     pop es
  47.     pop bx
  48.     endm
  49.  
  50. ;; macro.inc - defined macros 
  51. ;;
  52. dstring    macro string
  53.         ifnb <string>
  54.     push dx
  55.     mov dx, offset string
  56.         endif
  57.     mov ah, 09h
  58.     int 21h
  59.         ifnb <string>
  60.     pop dx
  61.         endif
  62.     endm
  63.  
  64. monoclrscrn macro attribute
  65.     push cx
  66.     push di
  67.     push es
  68.     
  69.     mov di, VIDEOSCREEN
  70.     mov es, di
  71.  
  72.     mov di, 0
  73.  
  74.     mov cx, 80*25
  75.  
  76.         ifnb <attribute>
  77.     mov ax, attribute
  78.         endif
  79.     cld
  80.     rep stosw
  81.  
  82.     pop es
  83.     pop di
  84.     pop cx
  85.     endm
  86.  
  87. monoflipscreen macro attribute
  88.     push cx
  89.     push di
  90.     push es
  91.     
  92.     mov di, VIDEOSCREEN
  93.     mov es, di
  94.     mov di, 0
  95.     mov cx, 80*25
  96.  
  97.         ifnb <attribute>
  98.     mov al, attribute
  99.         endif
  100.  
  101.     cld
  102.     @@:
  103.     inc di
  104.     stosb
  105.     loop @B
  106.  
  107.     pop es
  108.     pop di
  109.     pop cx
  110.     endm
  111.  
  112. ;; terminate - returning to DOS with an exit code
  113. ;;    [mov al, [code]]
  114. ;;
  115. ;; Syntax:
  116. ;;
  117. ;;    terminate        mov 0 to al and terminate
  118. ;;
  119. ;;    terminate [constant]    mov "constant" to al and terminate
  120. ;; 
  121. ;;    terminate using [reg]    mov register to al and terminate
  122. ;;
  123.  
  124. terminate    macro    using, reg
  125.     mov ah, 4Ch
  126.             ifb <using>
  127.     mov al, 00h
  128.             elseifidn <using>, <resident>
  129.     resident using reg
  130.     exitm
  131.              elseifnb <reg>
  132.     mov al, reg
  133.             else
  134.     mov al, using
  135.             endif
  136.     int 21h
  137.         endm
  138.  
  139. ;; resident - going TSR with an exit code
  140. ;;    [mov al, [code]]
  141. ;;
  142. ;; Syntax:
  143. ;;
  144. ;;    resident [size]            move size to dx, return 0 
  145. ;;
  146. ;;    resident size [retval]        move size to dx, return retval
  147. ;; 
  148. ;;    resident size using [reg]    move size to dx, register to al 
  149. ;;
  150. ;;    if specified size is moved to dx (paragraphs of resident code)
  151. ;;
  152.  
  153. resident    macro    size, using, reg
  154.             ifnb <size>
  155.     mov dx, size
  156.             endif
  157.             ifb <using>
  158.     mov ax, 03100h
  159.             else
  160.              ifnb <reg>
  161.     mov ah, 031h
  162.     mov al, reg
  163.              else
  164.     mov ah, 031h
  165.     mov al, using
  166.              endif
  167.             endif
  168.     int 21h
  169.         endm
  170.  
  171. ;; pushem - push a list of registers to be popped off by popem
  172. ;; the list for pushem and popem is in the same order, but the
  173. ;; actual pushes and pops are in reverse order
  174. pushem macro r1, r2, r3, r4, r5, r6, r7, r8
  175.     ifnb <r1>
  176.     push r1
  177.     ifnb <r2>
  178.     push r2
  179.     ifnb <r3>
  180.     push r3
  181.     ifnb <r4>
  182.     push r4
  183.     ifnb <r5>
  184.     push r5
  185.     ifnb <r6>
  186.     push r6
  187.     ifnb <r7>
  188.     push r7
  189.     ifnb <r8>
  190.     push r8
  191.     endif
  192.     endif
  193.     endif
  194.     endif
  195.     endif
  196.     endif
  197.     endif
  198.     endif
  199.     endm
  200.     
  201. ;; popem - pop a list of registers (pushed by pushem)
  202. ;; the list for pushem and popem is in the same order, but the
  203. ;; actual pushes and pops are in reverse order
  204. popem macro r1, r2, r3, r4, r5, r6, r7, r8
  205.     ifnb <r8>
  206.     pop r8
  207.     endif
  208.     ifnb <r7>
  209.     pop r7
  210.     endif
  211.     ifnb <r6>
  212.     pop r6
  213.     endif
  214.     ifnb <r5>
  215.     pop r5
  216.     endif
  217.     ifnb <r4>
  218.     pop r4
  219.     endif
  220.     ifnb <r3>
  221.     pop r3
  222.     endif
  223.     ifnb <r2>
  224.     pop r2
  225.     endif
  226.     ifnb <r1>
  227.     pop r1
  228.     endif
  229.     endm
  230.  
  231. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;z
  232. ;; dsp_hex - display a byte as a hex number
  233. dsp_hexbyte    macro num
  234.     local loniblt10, hiniblt10
  235.     ifnb <num>
  236.         mov al, num
  237.     endif
  238.     
  239.     mov dl, al
  240.     mov dh, al
  241.  
  242.     shr dl, 1
  243.     shr dl, 1
  244.     shr dl, 1
  245.     shr dl, 1
  246.     and dl, 00Fh
  247.     add dl, '0'
  248.     cmp dl, 10 + '0'
  249.     jl loniblt10
  250.     add dl, 'A' - '0' - 10
  251.  
  252. loniblt10:
  253.     mov ah, 02h
  254.     int 021h
  255.  
  256.     mov dl, dh
  257.     and dl, 00Fh
  258.     add dl, '0'
  259.     cmp dl, 10 + '0'
  260.     jl hiniblt10
  261.     add dl, 'A' - '0' - 10
  262. ;    sub dl, '0'
  263. ;    sub dl, 10
  264. ;    add dl, 'A'
  265.  
  266. hiniblt10:
  267.     mov ah, 02h
  268.     int 021h
  269.         endm
  270.  
  271. ;; mono_hex - display a byte as a hex number on monochrome screen at es:di
  272. mono_hexbyte    macro num
  273.     local loniblt10, hiniblt10
  274.     ifnb <num>
  275.         mov al, byte ptr num
  276.     endif
  277.  
  278.     push cx
  279.     push ax
  280.     
  281.     mov cl, 4
  282.     shr al, cl
  283.     and al, 0Fh
  284.  
  285.      add al, '0'
  286.     cmp al, 10 + '0'
  287.     jl hiniblt10
  288.     add al, 'A' - '0' - 10
  289.  
  290. hiniblt10:
  291.     mov ah, monoatr
  292.     cld
  293.     stosw
  294.     
  295.     pop ax
  296.     push ax
  297.  
  298.     and al, 0Fh
  299.  
  300.     add al, '0'
  301.     cmp al, 10 + '0'
  302.     jl loniblt10
  303.     add al, 'A' - '0' - 10
  304.  
  305. loniblt10:
  306.     mov ah, monoatr
  307.     cld
  308.     stosw
  309.  
  310.     pop ax
  311.     pop cx
  312.         endm
  313.  
  314.  
  315.  
  316.