home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / krt11.zip / krtcdf.mac < prev    next >
Text File  |  1997-10-17  |  2KB  |  74 lines

  1.     .sbttl    KRTCDF    Define command macro
  2. ;    .ident    "V03.63"        ; this is an .include file
  3.  
  4. ; /63/    27-Sep-97  Billy Youdelman  V03.63
  5. ;
  6. ;    modify optional prompt arg to use address of prompt string
  7. ;    allows longer strings to be used and eliminates redundancy
  8. ;    drop $CMGLOBAL
  9.  
  10. ; /62/    27-Jul-93  Billy Youdelman  V03.62
  11. ;
  12. ;    $$trip hack to avoid "ndf/df" tests blowing up .LST output
  13.  
  14. ; /BBS/     1-Dec-91  Billy Youdelman  V03.61
  15. ;
  16. ;    dump unused argtyp
  17.  
  18.  
  19. ;    usage example:
  20. ;
  21. ;    command    cmdlst    SEND ,3 ,c$send ,optional_prompt_addr
  22. ;
  23. ;    Would define the SEND command with a minimum length of
  24. ;    three characters, and dispatch it to c$send.  Use of a
  25. ;    prompt will cause  same  to appear when the command is
  26. ;    given without argument(s).  cmdlst is the listhead for
  27. ;    all commands and is  only  used once, but must be used
  28. ;    in all entries to keep other arguments in place.
  29.  
  30.  
  31.     KRTCDF    =  1            ; used to detect an .include error
  32.     $LISTL    == 4            ; number of args stuffed in list here
  33.     $$TRIP    =  0            ; /62/ init trip counter
  34.  
  35.     .macro    command    list ,name ,min ,address ,arg
  36.     .list me
  37.     .save
  38.     .nlist me
  39.     .if b <name>            ; command name supplied this time?
  40.     .list me
  41.     .psect    cmddsp    ,ro,d,lcl,rel,con ; no, at end of list
  42.     .nlist me
  43.     .word    0            ; /62/ mark it with a null
  44.     .list me            ; /63/
  45.     .psect    cmdtxt    ,ro,d,lcl,rel,con ; /63/ save a few bytes by only
  46.     .even                ; /63/ doing this at the end of a list
  47.     .nlist me            ; /63/
  48.     $$trip    = 0            ; /62/ reset trip counter for next cmd
  49.     .iff    ; b <name>        ; ya, process args into command data
  50.     .list me
  51.     .psect    cmdtxt    ,ro,d,lcl,rel,con
  52.     .nlist me
  53.     $$name    = .
  54.     .asciz    #name#            ; store the command name
  55.     .psect    cmddsp    ,ro,d,lcl,rel,con
  56.     .nlist me
  57.       .if eq $$trip            ; /62/ if first pass label listhead
  58. 'list:                    ; global flag was not set
  59.       $$trip = 1            ; /62/ not first time through anymore
  60.       .endc                ; no
  61.     .word    $$name            ; store address of command name text
  62.     .word    min            ; min number of chars to match
  63.     .word    address            ; the command routine's address
  64.       .if b <arg>            ; /63/ optional_prompt address given?
  65.       .word    0            ; /63/ no, say so with a null here
  66.       .iff
  67.       .word    arg            ; /63/ ya, stuff in its location
  68.       .endc
  69.     .endc    ; b <name>
  70.     .list me
  71.     .restore
  72.     .nlist me
  73.     .endm
  74.