home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol058 / music1.sqc / MUSIC1.SRC
Text File  |  1985-02-09  |  8KB  |  320 lines

  1. ;       MUSIC - Musicraft Development System
  2.  
  3. ;               copyright 1981 by COMPUTERCRAFT
  4.  
  5.         IF      NOT TRS80
  6.         ORG     100H
  7.         ELSE
  8.         ORG     7000H
  9.         ENDIF
  10.  
  11. MAIN$LINE:
  12.         JMP     RESTART
  13.         IF      NOT TRS80
  14. BOOTER:
  15.         LXI     SP,RESTART
  16.         LXI     D,80H
  17.         MVI     C,26
  18.         CALL    CPM
  19.         LXI     D,FCB           ; READ FIRST
  20.         MVI     C,20            ; BLOCK AND  
  21.         CALL    CPM             ; IGNORE IT
  22.         DMVI    BI,180H
  23. BLOOP1:
  24.         LXI     D,FCB           ; READ A
  25.         MVI     C,20            ; PROGRAM
  26.         CALL    CPM             ; BLOCK
  27.         ORA     A
  28.         JNZ     BDONE
  29.         LHLD    BI
  30.         LXI     D,80H
  31.         MVI     B,80H
  32. BLOOP2:
  33.         LDAX    D
  34.         MOV     M,A
  35.         INX     H
  36.         INX     D
  37.         DCR     B
  38.         JNZ     BLOOP2
  39.         SHLD    BI
  40.         JMP     BLOOP1
  41. BDONE:
  42.         LXI     D,SONG$NAME-1   ; PASS
  43.         LXI     H,80H
  44.         MVI     B,13            ; ANY
  45. BLOOP:
  46.         LDAX    D               ; SONG
  47.         MOV     M,A
  48.         INX     D               ; NAME
  49.         INX     H
  50.         DCR     B               ; GIVEN
  51.         JNZ     BLOOP
  52.         JMP     RESTART
  53. BI:     DW      0
  54.         DB      0,0
  55.         ENDIF
  56. SONG$NAME:
  57.         DB      'copyright 1981 by computercraft'
  58.  
  59.         ORG     MAIN$LINE+80H
  60. RESTART:
  61.         LXI     SP,STACK
  62.         CALL    GET$NAME
  63.         CALL    BEGIN
  64. MNLN01:
  65.         CALL    CLR$SCR
  66.         WRTLN   MAIN$MENU
  67.         GTCH    CH
  68.         MOV     B,A
  69.         MIFI    'E',EDIT,BOOTER
  70.         MIFI    'C',COMP,BOOTER
  71.         MIFI    'P',PLAY,BOOTER
  72.         MIFI    'W',WAVE,BOOTER
  73.         MIFI    'S',SETUP,BOOTER
  74.         MIFI    'U',UTIL,BOOTER
  75.         MIFI    'H',HELP,MNLN01
  76.         MIFI    'N',NEW$NAME,MNLN01
  77.         MIFI    'Q',0,MNLN01
  78.         JMP     MNLN01
  79. CH:     DB      0
  80.  
  81. MAIN$MENU:
  82.         DB      13,10
  83.         DB      13,10
  84.         DB      '  *** Welcome to Musicraft 1.3 ***'
  85.         DB      13,10
  86.         DB      '            written by'
  87.         DB      13,10
  88.         DB      '          Paul J. Medlock'
  89.         DB      13,10
  90.         DB      13,10
  91.         DB      '    Type a...'
  92.         DB      13,10
  93.         DB      13,10
  94.         DB      '      E to create or edit a song'
  95.         DB      13,10
  96.         DB      '      C to compile an edited song'
  97.         DB      13,10
  98.         DB      '      P to play a compiled song'
  99.         DB      13,10
  100.         DB      '      W to synthesize a waveform'
  101.         DB      13,10
  102.         DB      '      S to setup or modify your'
  103.         DB      13,10
  104.         DB      '         configuration'
  105.         DB      13,10
  106.         DB      '      U for jukebox edit, song '
  107.         DB      13,10
  108.         DB      '        print, modem transfers'
  109.         DB      13,10
  110.         DB      '        and other useful functions'
  111.         DB      13,10
  112.         DB      '      H for helpful information'
  113.         DB      13,10
  114.         DB      '      N to work with a new song'
  115.         DB      13,10
  116.         DB      '      Q to quit the Musicraft system'
  117.         DB      13,10
  118.         DB      13,10
  119.         DB      '      ...>'
  120.         DB      '$'
  121.  
  122. NEW$NAME:
  123.         CALL    CLR$SCR
  124.         WRTLN   NWNML1
  125.         REDLN   SONG$NAME,12
  126.         RET
  127. NWNML1: DB      'Enter name of song  >','$'
  128.  
  129. GET$NAME:
  130.         IF      NOT TRS80
  131.         DMVI    SONG$NAME-1,0
  132.         FCHI    SONG$NAME,12,SPACE
  133.         LDA     TBUF
  134.         ORA     A
  135.         RZ
  136.         STA     SONG$NAME-1
  137.         LXI     H,TBUF+1
  138.         LXI     D,SONG$NAME
  139.         CALL    MOVELEFT
  140.         ENDIF
  141.         RET
  142.         
  143. EDIT:
  144.         RESET   FCB,EDIT$NAME,'C','O','M'
  145.         RET
  146.         
  147. COMP:
  148.         RESET   FCB,COMP$NAME,'C','O','M'
  149.         RET
  150.  
  151. PLAY:
  152.         RESET   FCB,PLAY$NAME,'C','O','M'
  153.         RET
  154.  
  155. WAVE:
  156.         RESET   FCB,WAVE$NAME,'C','O','M'
  157.         RET
  158.  
  159. SETUP:
  160.         RESET   FCB,SETP$NAME,'C','O','M'
  161.         RET
  162.  
  163. UTIL:
  164.         RESET   FCB,UTIL$NAME,'C','O','M'
  165.         RET
  166.  
  167.         DB      4,4
  168. EDIT$NAME:
  169.         DB      'EDIT'
  170.         
  171.         DB      4,4
  172. COMP$NAME:
  173.         DB      'COMP'
  174.         
  175.         DB      4,4
  176. PLAY$NAME:
  177.         DB      'PLAY'
  178.         
  179.         DB      4,4
  180. WAVE$NAME:
  181.         DB      'WAVE'
  182.         
  183.         DB      5,5
  184. SETP$NAME:
  185.         DB      'SETUP'
  186.         
  187.         DB      4,4
  188. UTIL$NAME:
  189.         DB      'UTIL'
  190.  
  191. HELP:
  192.         RESET   FCB,HELP$NAME,'M','U','S'
  193.         CALL    LOAD$TEXT
  194.         MOVI    EXTKEY,'$'
  195.         FCHI    HLDKEY,20,SPACE
  196.         CALL    INTERACT
  197.         RET
  198.         DB      4,4
  199. HELP$NAME:
  200.         DB      'HELP'
  201.  
  202. LOAD$TEXT:
  203.         CALL    CLR$SCR
  204.         WRTLN   LOAD$MSSG
  205.         DMVI    LDI,0
  206. LDLOOP:
  207.         READF   FCB,CH
  208.         RC
  209.         XPUT    TEXT$WORK,LDI
  210.         DINC    LDI
  211.         JMP     LDLOOP
  212. LDI:    DW      0
  213. LOAD$MSSG:
  214.         DB      13,10
  215.         DB      'Loading..please stand by.'
  216.         DB      '$'
  217.  
  218. INTERACT:
  219.         CALL    NEXT$MSSG               ; DISPLAY
  220.         CALL    CLR$SCR                 ; NEXT
  221.         LHLD    INTMSSG                 ; FRAME
  222.         CALL    FWRTLN
  223.         GTCH    CH
  224.         MCPI    JMPKEY,SPACE            ; TAKE
  225.         JZ      INTDPR                  ; ANY
  226.         LMVI    JMPKEY,CALKEY,20        ; JUMP
  227.         JMP     INTERACT
  228. INTDPR:
  229.         MCPI    CH,0DH
  230.         JZ      INTQUIT
  231.         LMVI    HLDKEY,CALKEY,20
  232.         DMVI    INTI,-1
  233. INTLOOP:
  234.         DINC    INTI                    ; DESCEND
  235.         XGET    CALKEY,INTI
  236.         CPI     SPACE                   ; INTO
  237.         JNZ     INTLOOP
  238.         LDA     CH                      ; THE
  239.         XPUT    CALKEY,INTI
  240.         LMVI    HLDKEY,EXTKEY,20        ; STRUCTURE
  241.         LMVI    CALKEY,HLDKEY,20
  242.         JMP     INTERACT
  243.  
  244. INTQUIT:
  245.         MCPI    EXTKEY,'$'              ; CHECK FOR
  246.         RZ                              ; RETURN
  247.         LMVI    EXTKEY,CALKEY,20
  248.         LMVI    EXTKEY,HLDKEY,20        ; ASCEND
  249.         DMVI    INTI,20
  250. INTQLOOP:                               ; OUT
  251.         DDEC    INTI
  252.         DCPI    INTI,0
  253.         JZ      INTDLR
  254.         XGET    EXTKEY-1,INTI           ; OF
  255.         CPI     SPACE
  256.         JZ      INTQLOOP                ; THE
  257.         MVI     A,SPACE 
  258.         XPUT    EXTKEY-1,INTI           ; STRUCTURE
  259.         JMP     INTERACT
  260. INTDLR:
  261.         MOVI    EXTKEY,'$'
  262.         JMP     INTERACT
  263. INTI:   DW      0
  264. INTJ:   DW      0
  265. INTC1:  DB      0
  266. INTC2:  DB      0
  267. INTMSSG: DW     0
  268.  
  269. NEXT$MSSG:
  270.         MOVI    JMPKEY,SPACE
  271.         DMVI    INTI,-1
  272. FNDLOP1:
  273.         DINC    INTI            ; FIND LINE FEED
  274.         XGET    TEXT$WORK,INTI
  275.         CPI     0AH
  276.         JNZ     FNDLOP1
  277.         DINC    INTI            ; FIND SCREEN MARK
  278.         XGET    TEXT$WORK,INTI
  279.         CPI     '$'
  280.         JNZ     FNDLOP1
  281.         DINC    INTI
  282.         XGET    TEXT$WORK,INTI  ; TEST FOR 
  283.         CPI     '$'
  284.         JZ      INTQUIT         ; END OF SCREENS
  285.         DDEC    INTI
  286.         DMVI    INTJ,-1
  287. FNDLOP2:
  288.         DINC    INTI
  289.         DINC    INTJ
  290.         XGET    CALKEY,INTJ
  291.         CPI     SPACE
  292.         JZ      FNDONE
  293.         STA     INTC1
  294.         XGET    TEXT$WORK,INTI
  295.         MOV     B,A
  296.         LDA     INTC1
  297.         CMP     B
  298.         JNZ     FNDLOP1
  299.         JMP     FNDLOP2
  300. FNDONE:
  301.         XGET    TEXT$WORK,INTI
  302.         CPI     ':'
  303.         JZ      FNDJMP
  304.         CPI     0DH
  305.         JNZ     FNDLOP1
  306. FNDEXT:
  307.         DADI    INTMSSG,INTI,TEXT$WORK+2
  308.         RET
  309. FNDJMP:
  310.         DMVI    INTJ,-1
  311. FNDJLP:
  312.         DINC    INTI
  313.         DINC    INTJ
  314.         XGET    TEXT$WORK,INTI
  315.         CPI     0DH
  316.         JZ      FNDEXT
  317.         XPUT    JMPKEY,INTJ
  318.         JMP     FNDJLP
  319.  
  320.