home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / setio.lbr / SETIO.AZM / SETIO.ASM
Encoding:
Assembly Source File  |  1993-10-25  |  17.0 KB  |  781 lines

  1.     TITLE 'SETIO  SETS THE CP/M IOBYTE'
  2.  
  3.     ; This program is intended to replace the IOBYTE set/view 
  4.     ; functions found in the standard CP/M program STAT.  With the
  5.     ; advent of multitudinous directory programs which provide 
  6.     ; size and attribute information, the use of the STAT program
  7.     ; has been reduced to altering IOBYTEs and changing $SYS and $RO
  8.     ; attributes.  This program and its accompanying "SETATTR" program
  9.     ; announce the death knell of the STAT program.
  10.     ;
  11.     ; WRITTEN BY:     Thomas N. Hill
  12.     ;        Alaska Micro Systems
  13.     ;        200 Oklahoma St.
  14.     ;        Anchorage, Alaska   99504
  15.     ;        (907) 337-1984  (9 AM - 5 PM, AST)
  16.     ;
  17.     ;Modification and Update List:
  18.     ;
  19.     ; 06/20/82    Version 1.0 (TNH)
  20.     ;
  21.     ; system equates
  22.  
  23.         ; SYSTEM EQUATES
  24.  
  25.         CPM     EQU     0
  26.         BDOS    EQU     CPM+5H    ; bdos entry point
  27.         FCB1    EQU     CPM+5CH    ; first File Control Block
  28.         FCB2    EQU     CPM+6CH    ; second FCB
  29.         CBUF    EQU     CPM+80H    ; command buffer
  30.     TPA    EQU    CPM+0100H
  31.  
  32.         ; NON-DISK I/O FUNCTIONS
  33.  
  34.         CONIN   EQU     1       ; CONSOLE INPUT
  35.         CONOUT  EQU     2       ; CONSOLE OUTPUT
  36.         LSTOUT  EQU     5       ; LIST DEVICE OUTPUT
  37.         PRTBUF  EQU     9       ; SEND A STRING TO THE CONSOLE
  38.         RDBUF   EQU     10      ; GET A STRING FROM THE CONSOLE
  39.         CONSTAT EQU     11      ; CONSOLE STATUS
  40.     GETIOB     EQU    7    ; get iobyte
  41.     SETIOB    EQU    8    ; set iobyte
  42.         VERS    EQU     12      ; RETURN CP/M (MP/M) VERSION NUMBER
  43.  
  44.         ; DISK I/O FUNCTIONS
  45.  
  46.         SELDSK  EQU     14      ; SELECT DISK
  47.         OPENF   EQU     15      ; OPEN FILE
  48.         CLOSEF  EQU     16      ; CLOSE A FILE
  49.         DELETF  EQU     19      ; DELETE A FILE
  50.     RENAME    EQU    23    ; rename a file
  51.         READF   EQU     20      ; READ A RECORD
  52.         WRITEF  EQU     21      ; WRITE A RECORD
  53.         MAKEF   EQU     22      ; CREATE A FILE
  54.         SETDMA  EQU     26      ; SET DISK DMA ADDRESS
  55.         SIZEF   EQU     35      ; COMPUTE FILE SIZE
  56.  
  57.         ; THOSE FUNCTIONS REQUIRING A BYTE ARGUMENT WILL EXPECT THAT BYTE
  58.         ; TO BE IN THE E REGISTER.  ADDRESS ARGUMENTS ARE PASSED IN THE
  59.         ; DE REGISTER.  RETURN CODES ARE PASSED IN THE ACC.  IN GENERAL,
  60.         ; A RETURN OF ZERO INDICATES SUCCESS, WHILE A OFFH INDICATES FAILURE.
  61.  
  62.         ; character equates
  63.  
  64.         CR      EQU     0DH     ; carriage return
  65.         LF      EQU     0AH     ; line feed
  66.         ESC     EQU     1BH     ; escape code
  67.         EOF     EQU     1AH     ; end-of-file, control-z
  68.         BELL    EQU     07H     ; terminal bell
  69.         BS      EQU     08H     ; backspace
  70.     TAB    EQU    09H    ; tab char
  71.         ;
  72.     FALSE    EQU    00H
  73.     TRUE    EQU    0FFH
  74.     ;
  75.  
  76.  
  77.     ORG    TPA
  78.  
  79.     ; main program loop
  80.  
  81. SETIO:    CALL    INIT        ; initialize things
  82. MAIN:    CALL    COMMAND        ; get the input command
  83.     JNZ    PCERR        ; print command error
  84.     CALL    EXECUTE        ; execute the command
  85.     LDA    CFLAG        ; was command from CP/M input buffer?
  86.     ORA    A
  87.     JNZ    FINPROG        ; yes, return to CP/M
  88.     JMP    MAIN        ; no, do it again.
  89.  
  90. PCERR:    LXI    D,CERMSG
  91.     CALL    PSTRING
  92.     LXI    D,MENU
  93.     CALL    PSTRING
  94.     JMP    MAIN
  95.  
  96.     ; subroutines begin here.
  97.  
  98.     ; here is the command interpreter
  99.     ; it examines the contents of the buffer at 80H and if there is
  100.     ; a command string fromthe CP/M command line, it returns to the
  101.     ; main program for execution, else it requests the command from
  102.     ; the user.
  103.  
  104. COMMAND:
  105.     LDA    CFLAG        ; was a command on the input line?
  106.     ORA    A
  107.     JZ    COMM0        ; nope.
  108.     LXI    H,CBUF
  109.     LXI    D,CBUF+1    ; must absorb extra space on line
  110.     MOV    B,A        ; convert to upper case
  111. LP1:    INX    H
  112.     INX    D
  113.     LDAX    D
  114.     CALL    UCASE
  115.     MOV    M,A
  116.     DCR    B
  117.     JNZ    LP1
  118.     LDA    CBUF        ; adjust count
  119.     DCR    A
  120.     STA    CBUF        ; for lost space
  121.     JMP    COMM1
  122.  
  123.     ; no command on input, must get one.
  124.  
  125. COMM0:    LXI    D,PROMPT
  126.     CALL    PSTRING
  127.     LXI    D,IBUF        ; use internal command buffer
  128.     MVI    C,RDBUF
  129.     CALL    BDOS        ; get the command
  130.     CALL    CRLF
  131.     LXI    H,IBUF+1    ; prepare to move command string
  132.     MOV    A,M        ; command length
  133.     ORA    A        ; any thing there?    
  134.     JZ    FINPROG        ; finish program
  135. COMM2:    LXI    D,CBUF
  136.     INR    A
  137.     MOV    B,A        ; put length + 1 in B and use for move count
  138. COMM3:    MOV    A,M
  139.     CALL    UCASE        ; CONVERT TO UPPERCASE
  140.     STAX    D
  141.     INX    H
  142.     INX    D
  143.     DCR    B
  144.     JNZ    COMM3
  145.     XRA    A
  146.     STAX    D        ; mark line end
  147.  
  148.     ; have a command, figure out what it is.
  149.  
  150. COMM1:    LXI    H,CBUF
  151.     MOV    B,M        ; get the length for use
  152.     INX    H
  153.     LXI    D,CTABLE    ; point to command table
  154. LOOK:    PUSH    H        ; save command pointer
  155. LOOK0:    LDAX    D    
  156.     ORA    A        ; zero byte from table?
  157.     JZ    FOUND
  158.     CPI    TRUE        ; else is end?
  159.     JZ    COMERR        ; command error
  160.     CMP    M
  161.     JNZ    NEXTCOM        ; can't be this one, go to next 
  162.     INX    H
  163.     INX    D
  164.     JMP    LOOK0        ; else check next char
  165. NEXTCOM:
  166.     INX    D
  167.     LDAX    D
  168.     ORA    A        ; advance to next command in table
  169.     JNZ    NEXTCOM
  170.     INX    D        ; first byte of command address
  171.     INX    D        ; second byte
  172.     INX    D        ; first of next command
  173.     POP    H        ; re-point to command buffer start
  174.     JMP    LOOK        ; try next command
  175. FOUND:    SHLD    CPTR        ; save current loc. in command string
  176.     POP    H        ; clean stack
  177.     RET
  178.     
  179. COMERR:    POP    H        ; clean off stack
  180.     XRA    A
  181.     STA    CBUF        ; set command length to zero
  182.     STA    CFLAG
  183.     INR    A        ; reset zero flag
  184.     RET
  185.  
  186.     ; here is the EXECUTE routine.  It recovers the command address
  187.     ; fromthe command table and branches to it, placing a return
  188.     ; address on the stack first.
  189.  
  190. EXECUTE:
  191.     INX    D        ; past end-of-command byte
  192.     XCHG
  193.     MOV    E,M
  194.     INX    H
  195.     MOV    D,M        ; command address to DE
  196.     LXI    H,FINEXC    ; proper return address
  197.     PUSH    H
  198.     XCHG
  199.     PCHL            ; do the command
  200. FINEXC:    RET
  201.  
  202. FINPROG:LDA    ALTFLAG        ; did we change a definition?
  203.     ORA    A
  204.     JZ    CPM
  205.  
  206.     ; if a definition has been changed, then we have to re-write
  207.     ; the program to disk in order to save the altered names.
  208.  
  209.     LXI    D,SAVEMSG
  210.     CALL    PSTRING        ; check a bout saving new definitions
  211.     MVI    C,CONIN
  212.     CALL    BDOS
  213.     PUSH    PSW
  214.     CALL    CRLF
  215.     POP    PSW
  216.     ANI    5FH        ; upper case
  217.     CPI    'Y'
  218.     JZ    FIN1        ; yes, save it.
  219.     CPI    'N'
  220.     JZ    CPM        ; nope, ignore changes
  221.     JMP    MAIN        ; else continue with program
  222. FIN1:    LXI    D,PFCB
  223.     MVI    C,MAKEF
  224.     CALL    BDOS
  225.     INR    A
  226.     JZ    PRERR
  227.     LXI    D,PFCB
  228.     MVI    C,OPENF        ; open the output file
  229.     CALL    BDOS
  230.     INR    A
  231.     JZ    PRERR        ; disk error, cannot save new names
  232.     LXI    H,SETIO
  233.     LXI    B,(IBUF-SETIO)/128    ; sectors to save
  234.     INX    B            ; plus one (safety sake)
  235. SAVE1:    PUSH    B
  236.     PUSH    H
  237.     XCHG
  238.     MVI    C,SETDMA
  239.     CALL    BDOS
  240.     LXI    D,PFCB
  241.     MVI    C,WRITEF    ; write a sector
  242.     CALL    BDOS
  243.     CPI    0        ; error?
  244.     JNZ    PRERR
  245.     POP    H
  246.     LXI    D,80H
  247.     DAD    D
  248.     POP    B
  249.     DCR    C
  250.     JNZ    SAVE1        ; do some more
  251.     LXI    D,PFCB
  252.     MVI    C,CLOSEF
  253.     CALL    BDOS        ; close it
  254.     INR    A
  255.     JZ    PRERR
  256.     LXI    D,OLDFCB
  257.     MVI    C,DELETF    ; erase old file name
  258.     CALL    BDOS
  259.     LXI    D,RENFCB
  260.     MVI    C,RENAME
  261.     CALL    BDOS        ; rename the new file
  262.     JMP    CPM        ; finished
  263.  
  264. PRERR:    ORA    A
  265.     JZ    PRERR1
  266.     LXI    D,DSKERR0
  267.     CALL    PSTRING
  268.     JMP    CPM
  269. PRERR1:    LXI    D,DSKERR1
  270.     CALL    PSTRING
  271.     JMP    CPM
  272.  
  273.     
  274.  
  275.  
  276.  
  277.  
  278.     ; here are the various command routines.
  279.  
  280.     ; this command displays the current IOBYTE device assignments.
  281.     ; the intial program uses the standard CP/M device names, but
  282.     ; the user has the option of using his own names, thru the 
  283.     ; "DEFINE" command.
  284.  
  285. WHERE:    MVI    C,GETIOB
  286.     CALL    BDOS        ; current IOBYTE setting
  287.     STA    IOBYTE        ; save it
  288.     LXI    D,CONSOLE    ; tell about console field
  289.     CALL    PSTRING
  290.     LDA    IOBYTE
  291.     MVI    B,03H        ; console field mask
  292.     LXI    H,CNAMES    ; console names
  293.     CALL    FIELD        ; find the proper name string
  294.     CALL    PSTRING        ; print the name
  295.     CALL    CRLF
  296.     LXI    D,READER
  297.     CALL    PSTRING
  298.     LDA    IOBYTE
  299.     MVI    B,0CH        ; reader field mask
  300.     LXI    H,RNAMES    ; reader names
  301.     CALL    FIELD
  302.     CALL    PSTRING
  303.     CALL    CRLF
  304.     LXI    D,PUNCH
  305.     CALL    PSTRING
  306.     LDA    IOBYTE        ; same for punch
  307.     MVI    B,30H
  308.     LXI    H,PNAMES    ; punch names
  309.     CALL    FIELD
  310.     CALL    PSTRING
  311.     CALL    CRLF
  312.     LXI    D,LIST
  313.     CALL    PSTRING
  314.     LDA    IOBYTE        ; and the list field
  315.     MVI    B,0C0H
  316.     LXI    H,LNAMES
  317.     CALL    FIELD
  318.     CALL    PSTRING
  319.     CALL    CRLF
  320.     RET            ; return to MAIN
  321.  
  322.     ; this routine displays the possible logical to physical device
  323.     ; assignments.
  324.  
  325. WHAT:    LXI    D,CONMSG1
  326.     CALL    PSTRING        ; console first
  327.     LXI    H,CNAMES
  328.     MVI    B,4        ; four total devices
  329.     CALL    DEVPRNT        ; print the device list
  330.     LXI    D,RDRMSG1
  331.     CALL    PSTRING
  332.     LXI    H,RNAMES
  333.     MVI    B,4        ; and the reader list
  334.     CALL    DEVPRNT
  335.     LXI    D,PNCMSG1
  336.     CALL    PSTRING
  337.     LXI    H,PNAMES
  338.     MVI    B,4
  339.     CALL    DEVPRNT        ; ... and the punch list
  340.     LXI    D,LSTMSG1
  341.     CALL    PSTRING
  342.     LXI    H,LNAMES
  343. DEVPRNT:LXI    B,0431H
  344. DVPT0:    PUSH    B
  345. DVPT1:    MOV    E,M
  346.     INX    H
  347.     MOV    D,M        ; pick up string address
  348.     INX    H
  349.     PUSH    H        ; save pointer
  350.     PUSH    D
  351.     MOV    E,C
  352.     MVI    C,CONOUT
  353.     CALL    BDOS
  354.     MVI    E,' '
  355.     MVI    C,CONOUT
  356.     CALL    BDOS
  357.     POP    D
  358.     CALL    PSTRING        ; print the console assignment
  359.     CALL    CRLF
  360.     POP    H
  361.     POP    B
  362.     INR    C
  363.     DCR    B        ; done yet?
  364.     JNZ    DVPT0
  365.     RET
  366.  
  367.     ; here is the DEFINE routine.  IT allows the user to define 
  368.     ; his own names for each of the physical devices.  A limit of
  369.     ; 24 chars is set on the length of the input string.
  370.  
  371. DEFINE:    LXI    D,DEFWHAT
  372.     CALL    PSTRING        ; ask which logiacl device to change
  373.     MVI    C,CONIN
  374.     CALL    BDOS        ; accept a numeric entry, 1 - 4.
  375.     PUSH    PSW
  376.     CALL    CRLF
  377.     POP    PSW
  378.     CALL    NUMCHK        ; check for valid digit
  379.     JZ    DEFINE        ; not right, try again.
  380.     CALL    DEFGET
  381.     PUSH    D
  382.     LXI    D,CURMSG
  383.     CALL    PSTRING        ; "currently is:"
  384.     POP    D
  385.     MVI    B,4
  386.     LXI    H,CNAMES    ; point to start of address table
  387.     DAD    D        ; now pointing to logical device list
  388. DEFG:    MOV    E,M
  389.     INX    H        ; get address of current phy. device name
  390.     MOV    D,M
  391.     INX    H
  392.     PUSH    B
  393.     PUSH    H        ; save pointer
  394.     PUSH    D        ; save string address again
  395.     CALL    PSTRING        ; "..."
  396. DEFG0:    LXI    D,CHANGE
  397.     CALL    PSTRING        ; "change to->"
  398.     LXI    D,IBUF
  399.     MVI    C,RDBUF
  400.     CALL    BDOS
  401.     CALL    CRLF        ; get new name
  402.     LDA    IBUF+1        ; check string length
  403.     ORA    A
  404.     JZ    DEFG4
  405.     CPI    24        ; to big?
  406.     JC    DEFG1        ; nope, so OK.
  407.     LXI    D,TOOBIG
  408.     CALL    PSTRING
  409.     CALL    CRLF
  410.     JMP    DEFG0
  411. DEFG1:    LXI    H,IBUF+2    ; move string to proper place
  412.     POP    D        ; string address
  413.     MOV    B,A        ; bytes to move
  414.     ORA    A        ; if length is zero, then null assignment
  415.     JZ    DEFG3        ; mark as null string
  416. DEFG2:    MOV    A,M
  417.     STAX    D
  418.     INX    H
  419.     INX    D
  420.     DCR    B
  421.     JNZ    DEFG2        ; move the string
  422. DEFG3:    MVI    A,'$'
  423.     STAX    D        ; mark the end
  424.     PUSH    D
  425. DEFG4:    POP    D
  426.     POP    H        ; recover string address table pointer
  427.     POP    B        ; and device count
  428.     DCR    B
  429.     JNZ    DEFG        ; do another one
  430.     MVI    A,TRUE
  431.     STA    ALTFLAG        ; tell program definitions were altered
  432.     RET
  433.  
  434. NUMCHK:    CPI    '1'
  435.     JC    BADNUM
  436.     CPI    '5'
  437.     JNC    BADNUM
  438.     ORA    A        ; reset zero
  439.     RET
  440. BADNUM:    XRA    A        ; set zero
  441.     RET
  442.  
  443.     ; here is the set routine.  It will display the currently stored
  444.     ; selections for the logical device selected and alter the IOBYTE
  445.     ; to reflect the users choice.
  446.  
  447. SETIBYTE:
  448.     LXI    D,DEFWHAT
  449.     CALL    PSTRING
  450.     MVI    C,CONIN
  451.     CALL    BDOS
  452.     PUSH    PSW
  453.     CALL    CRLF
  454.     POP    PSW
  455.     CALL    NUMCHK
  456.     JNZ    SETI0
  457.     JMP    SETIBYTE    ; invalid selection, try again
  458. SETI0:    STA    LDEVNUM        ; save the logical device number
  459.     CALL    DEFGET        ; get the proper logical device printed
  460.     LXI    H,CNAMES
  461.     DAD    D        ; point to phys. device add. table
  462.     PUSH    H        ; save it
  463.     LXI    D,CURMSG
  464.     CALL    PSTRING
  465.     POP    H
  466.     MVI    B,4
  467.     CALL    DEVPRNT        ; print device names
  468.     CALL    CRLF
  469. SETI1:    LXI    D,SELASK    ; ask about selection
  470.     CALL    PSTRING
  471.     MVI    C,CONIN
  472.     CALL    BDOS        ; get an answer
  473.     PUSH    PSW
  474.     CALL    CRLF
  475.     POP    PSW
  476.     CALL    NUMCHK
  477.     JZ    SETI1    
  478.     PUSH    PSW
  479.     MVI    C,GETIOB
  480.     CALL    BDOS        ; get current io byte
  481.     MOV    C,A
  482.     POP    PSW
  483.     SUI    '0'
  484.     DCR    A
  485.     MOV    B,A        ; phys. device number
  486.     LDA    LDEVNUM        ; recover logical device
  487.     SUI    '0'
  488.     DCR    A        ; convert to pure binary
  489.     CPI    0
  490.     JZ    SETICON        ; set console
  491.     CPI    1
  492.     JZ    SETIRDR        ; set reader
  493.     CPI    2
  494.     JZ    SETIPUN        ; set punch
  495. SETILST:
  496.     STC
  497.     CMC            ; clear carry
  498.     MOV    A,B        ; phys. device
  499.     RAR
  500.     RAR            ; rotate list device into place
  501.     RAR            ; one more to pass carry
  502.     MOV    B,A
  503.     MOV    A,C        ; recover IOBYTE
  504.     ANI    03FH        ; remove old list assignments
  505.     ORA    B        ; combine with new    
  506.     JMP    SETI3
  507. SETICON:
  508.     MOV    A,C        ; recover IOBYTE
  509.     ANI    0FCH        ; remove the old console
  510.     ORA    B        ; combine with the new    
  511.     JMP    SETI3
  512. SETIRDR:
  513.     STC
  514.     CMC            ; clear carry
  515.     MOV    A,B        ; phys. device
  516.     RAL    
  517.     RAL            ; rotate to reader position
  518.     MOV    B,A
  519.     MOV    A,C
  520.     ANI    0F3H        ; remove old reader
  521.     ORA    B        ; combine with new
  522.     JMP    SETI3
  523. SETIPUN:
  524.     STC
  525.     CMC            ; clear carry
  526.     MOV    A,B        ; phys. device
  527.     RAL
  528.     RAL
  529.     RAL
  530.     RAL            ; postion at punch field
  531.     MOV    B,A
  532.     MOV    A,C
  533.     ANI    0CFH        ; out with the old,....
  534.     ORA    B        ; in with the new.
  535. SETI3:    MOV    E,A
  536.     MVI    C,SETIOB
  537.     CALL    BDOS        ; set new IOBYTE
  538.     RET
  539.  
  540.  
  541. DEFGET:    SUI    '0'        ; make to binary
  542.     DCR    A        ; adjust for range
  543.     RAL            ; times 2
  544.     PUSH    PSW
  545.     MOV    E,A        ; first, find proper logical device name
  546.     MVI    D,0
  547.     LXI    H,LOGDEV
  548.     DAD    D
  549.     MOV    E,M
  550.     INX    H
  551.     MOV    D,M
  552.     CALL    PSTRING        ; and print it
  553.     POP    PSW
  554.     RAL
  555.     RAL            ; final count times 8
  556.     MOV    E,A
  557.     MVI    D,0
  558.     RET    
  559.  
  560. FIELD:    STC
  561.     CMC            ; clear the carry flag
  562.     MOV    C,A        ; save iobyte
  563.     MOV    A,B        ; get mask
  564.     MVI    E,0        ; clear counter for rotates
  565. FIELD1:    RAR            ; rotate until carry is set,
  566.     INR    E
  567.     JNC    FIELD1
  568.     DCR    E        ; then back up one rotate
  569.     RAL
  570.  
  571.     ; field mask no aligned on bits 0 & 1, and E = count of rotates
  572.  
  573.     MOV    B,A        ; put mask back
  574.     MOV    A,C        ; recover origianl field mask
  575.     DCR    E
  576.     INR    E        ; check for already zero
  577.     JZ    FIELD3
  578. FIELD2:    RAR
  579.     DCR    E        ; rotate to count in E
  580.     JNZ    FIELD2
  581. FIELD3:    ANA    B        ; now isolate bits
  582.     ADD    A        ; double it
  583.     MOV    E,A
  584.     MVI    D,0
  585.     DAD    D        ; fianlly find index
  586.     MOV    E,M        ; get the real address
  587.     INX    H
  588.     MOV    D,M
  589.     RET
  590.  
  591.     
  592.  
  593.     ; initialize routine.  Print opening remarks and clear and/or set
  594.     ; various counters & flags.
  595.  
  596. INIT:    LDA    CBUF        ; if a command on command line, user knows
  597.     ORA    A        ; what he is doing, so don't
  598.     JNZ    INIT1        ; print things he already knows.
  599.     LXI    D,OPNMSG
  600. INIT0:    CALL    PSTRING        ; print titles, etc.
  601.     XRA    A
  602. INIT1:    STA    CFLAG        ; set flag for command line input.
  603.     XRA    A
  604.     STA    ALTFLAG
  605.     CALL    CRLF
  606.     LXI    H,OFCBX
  607.     MVI    B,24        ; fill FCBs with zeros
  608. INIT2:    MVI    M,0
  609.     INX    H
  610.     DCR    B
  611.     JNZ    INIT2
  612.     LXI    H,PFCBX
  613.     MVI    B,24
  614. INIT3:    MVI    M,0
  615.     INX    H
  616.     DCR    B
  617.     JNZ    INIT3
  618.     RET
  619.  
  620. UCASE:    CPI    'a'
  621.     RC
  622.     CPI    'z'+1
  623.     RNC
  624.     ANI    5FH
  625.     RET
  626.  
  627.  
  628. PSTRING:
  629.     MVI    C,PRTBUF
  630.     JMP    BDOS        ; print the string pointed to by DE
  631.  
  632. CRLF:    LXI    D,CRLFMSG
  633.     JMP    PSTRING        ; print a CR,LF on the console
  634.  
  635.  
  636.  
  637.  
  638.     ;data areas
  639.  
  640. OPNMSG:    DB    tab,tab,'IOBYTE Control Utility, Version 1.0',cr,lf
  641.     db    tab,tab,'   Written by Thomas N. Hill',cr,lf
  642.     DB    tab,tab,'        June 20, 1982',cr,lf,lf,lf
  643. MENU:    DB    'COMMAND MENU:',cr,lf,lf
  644.     DB    tab,'WHERE    Displays current IOBYTE device assignments'
  645.     DB    cr,lf
  646.     DB    tab,'WHAT    Displays available IOBYTE assignment options'
  647.     DB    cr,lf
  648.     DB    tab,'SET    Allows the user to alter IOBYTE settings'
  649.     DB    cr,lf
  650.     DB    tab,'DEFINE    Allows the user to define IOBYTE device names'
  651.     DB    cr,lf
  652.     DB    tab,'<CR>    RETURN at the prompt returns user to CP/M.'
  653.     DB    cr,lf,'$'
  654. PROMPT:    DB    CR,LF,'-->$'
  655.  
  656. SAVEMSG:DB    'Save new definitions to disk or return to menu (Y/N/R)?'
  657. CRLFMSG:DB    CR,LF,'$'
  658. CONSOLE:DB    'Console is currently assigned to --> $'    
  659. READER:    DB    'Reader is currently assigned to ---> $'
  660. PUNCH:    DB    'Punch is currently assigned to ----> $'
  661. LIST:    DB    'List is currently assigned to -----> $'
  662. CONMSG1:DB    'CONSOLE may be assigned to the following:',cr,lf,'$'
  663. RDRMSG1:DB    'READER may be assigned to the following:',cr,lf,'$'
  664. PNCMSG1:DB    'PUNCH may be assigned to the following:',cr,lf,'$'
  665. LSTMSG1:DB    'LIST may be assigned to the following:',cr,lf,'$'
  666. DEFWHAT:DB    'Enter number of logical device:',cr,lf
  667.     DB    tab,'1.    CONSOLE',cr,lf
  668.     DB    tab,'2.    READER',cr,lf
  669.     DB    tab,'3.    PUNCH',cr,lf
  670.     DB    tab,'4.    LIST',cr,lf,lf,'$'
  671. CURMSG:    DB    '   Current assignments are:',cr,lf,'$'
  672. CHANGE:    DB    '       Change to -> ','$'
  673. TOOBIG:    DB    bell,'Name as entered is too long, make less than 24 chars.'
  674.     DB    cr,lf,'$'
  675. DSKERR0:DB    BELL,'OPEN OR CLOSE ERROR DURING PROGRAM UPDATING.',CR,LF,'$'
  676. DSKERR1:DB    BELL,'DISK WRITE ERROR DURING PROGRAM UPDATE.',CR,LF,'$'
  677. SELASK:    DB    'Enter the number of the new I/O device: ','$'
  678. CERMSG:    DB    bell,'Invalid Command, please re-enter from the Menu.'
  679.     DB    cr,lf,'$'
  680.  
  681.     ; iobyte field names
  682.  
  683.     ; lookup table of string addresses
  684.  
  685. CNAMES:    DW    CTTY,CCRT,CBAT,CUC1
  686. RNAMES:    DW    RTTY,RPTR,RUR1,RUR2
  687. PNAMES:    DW    PTTY,PPTP,PUP1,PUP2
  688. LNAMES:    DW    LTTY,LCRT,LLPT,LUL1
  689.  
  690. LOGDEV:    DW    CONS
  691.     DW    READ
  692.     DW    PUN
  693.     DW    LST
  694.  
  695. CONS:    DB    'CONSOLE$'
  696. READ:    DB    'READER$'
  697. PUN:    DB    'PUNCH$'
  698. LST:    DB    'LIST$'
  699.  
  700.     ; name strings here.
  701.     ; since user may assign new names, allow up to 24 chars per name.
  702.  
  703.     ; CONSOLE field names
  704.  
  705. CTTY:    DB    'TTY:$'
  706.     DS    20
  707. CCRT:    DB    'CRT:$'
  708.     DS    20
  709. CBAT:    DB    'BAT:$'
  710.     DS    20
  711. CUC1:    DB    'UC1:$'
  712.     DS    20
  713.  
  714.     ; READER field names
  715.  
  716. RTTY:    DB    'TTY:$'
  717.     DS    20
  718. RPTR:    DB    'PTR:$'
  719.     DS    20
  720. RUR1:    DB    'UR1:$'
  721.     DS    20
  722. RUR2:    DB    'UR2:$'
  723.     DS    20
  724.  
  725.     ; PUNCH field names
  726.  
  727. PTTY:    DB    'TTY:$'
  728.     DS    20
  729. PPTP:    DB    'PTP:$'
  730.     DS    20
  731. PUP1:    DB    'UP1:$'
  732.     DS    20
  733. PUP2:    DB    'UP2:$'
  734.     DS    20
  735.  
  736.     ; LIST field names
  737.  
  738. LTTY:    DB    'TTY:$'
  739.     DS    20
  740. LCRT:    DB    'CRT:$'
  741.     DS    20
  742. LLPT:    DB    'LPT:$'
  743.     DS    20
  744. LUL1:    DB    'UL1:$'
  745.     DS    20
  746.  
  747.     ; command table and addresses
  748.  
  749. CTABLE:    DB    'WHERE',0
  750.     DW    WHERE
  751.     DB    'WHAT',0
  752.     DW    WHAT
  753.     DB    'SET',0
  754.     DW    SETIBYTE
  755.     DB    'DEFINE',0
  756.     DW    DEFINE
  757.     DB    0FFH
  758.  
  759.     ; file control blocks
  760.  
  761. OLDFCB:    DB    0,'SETIO   COM'
  762. OFCBX:    DW    0,0,0,0,0,0,0,0,0,0,0,0
  763. PFCB:    DB    0,'SETIO   $$$'
  764. PFCBX:    DW    0,0,0,0,0,0,0,0,0,0,0,0
  765. RENFCB:    DB    0,'SETIO   $$$',0,0,0,0
  766.     DB    0,'SETIO   COM',0,0,0,0
  767.  
  768.     ; flags and address storage
  769.  
  770. CFLAG:    DB    0
  771. CPTR:    DS    2
  772. IOBYTE:    DB    0
  773. ALTFLAG:DB    0
  774. LDEVNUM:DB    0
  775.     ; buffer(s)
  776.  
  777. IBUF:    DB    80H
  778.     DS    80H
  779.  
  780.     END
  781.