home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / uploads / gst03.lbr / ISEC.ZZ0 / ISEC.Z80
Encoding:
Text File  |  1993-06-07  |  3.6 KB  |  175 lines

  1. ;********************************************************************
  2. ;
  3. ;    ISEC: A ZCPR 3.3+ compatible routine, using the version 4
  4. ;        libraries, to draw an intersection character  
  5. ;        on the screen, for use in alias scripts.
  6. ;
  7. ; Version 3.0D (July 7, 1990) - Updated and re-linked based upon 
  8. ;  VLIB4D and version 4 libraries.  Assembled with SLR's Z80ASM and 
  9. ;  linked with DRI's LINK.  Thanks go to Dave Ramsey for producing
  10. ;  an excellent set of command-level graphics tools.   Bob Dean
  11. ;
  12. ; Author: Dave Ramsey            Date: May 25, 1989
  13. ;  Versions 1.0 and 2.0.    
  14. ;
  15. ;********************************************************************
  16. ;
  17. ; VLIB/Z3LIB/SYSLIB references:
  18. ;
  19.     ext    gz3init,tinit,dinit,at,ltisec,rtisec,uisec,lisec,isec,vpstr
  20.     ext    eval10,argv
  21. ;
  22. ; Constants defined:
  23. ;
  24. VERSION    equ     1
  25. MONTH    equ     7
  26. DAY    equ     5
  27. YEAR    equ     90
  28. ;
  29. DOS    equ    5
  30. BUFFER    equ    080h
  31. CR    equ    13
  32. LF    equ    10
  33. ARGCNT    equ    3
  34. start:
  35.     jp    main
  36.     db    'Z3ENV'
  37.     db    1
  38. z3eadr:    ds    2
  39. main:
  40.     ld    hl,(z3eadr)
  41.     call    gz3init
  42.     and    a,0fh        ; check for presence of exended tcap
  43.     jr    nz,stack
  44.     ld    hl,oldtcpmsg
  45.     call    vpstr        ; print old tcap warning message
  46.     ret            ; return to CCP
  47. ;
  48. ; setup stack...
  49. ;
  50. stack:
  51.     ld    hl,0
  52.     add    hl,sp
  53.     ld    (oldsp),hl
  54.     ld    hl,(DOS+1)
  55.     ld    l,0
  56.     ld    a,h
  57.     add    a,-8
  58.     ld    h,a
  59.     ld    sp,hl
  60. ;
  61. ; Get command line parms, there should be 3 and store results
  62. ;
  63.     ld    a,0ffh        ; null terminate argument strings
  64.     ld    hl,BUFFER+1
  65.     ld    de,tokentbl
  66.     call    argv
  67.     ld    a,(numtok)
  68.     cp    a,ARGCNT    ; did the user get it right?
  69.     jp    nz,gethelp    ; nope, tell him how to call us.
  70. ;
  71. ; Else, store parm results directly inline for the drbox call and execute
  72. ;
  73.     ld    hl,(parm1)
  74.     call    eval10
  75.     ld    (type),a
  76.     ld    hl,(parm2)
  77.     call    eval10
  78.     ld    (row),a        ; save row number
  79.     ld    hl,(parm3)
  80.     call    eval10
  81.     ld    (col),a        ; save column number
  82. ;
  83. ; else... init terminal as per V4 lib conventions
  84. ;
  85.     call    tinit
  86. ;
  87. ; Call AT to position cursor.
  88. ;
  89.     call    at
  90. row:    db    0
  91. col:    db    0
  92. ;
  93. ; Now select the intersection character to draw.
  94. ;
  95. left:
  96.     ld    a,(type)
  97.     cp    a,1
  98.     jr    nz,right
  99.     call    ltisec
  100.     jp    fini
  101. right:
  102.     cp    a,2
  103.     jr    nz,upper
  104.     call    rtisec
  105.     jp    fini
  106. upper:
  107.     cp    a,3
  108.     jr    nz,lower
  109.     call    uisec
  110.     jp    fini
  111. lower:
  112.     cp    a,4
  113.     jr    nz,inter
  114.     call    lisec
  115.     jp    fini
  116. inter:
  117.     cp    a,5
  118.     jr    nz,badval
  119.     call    isec
  120.     jp    fini
  121. badval:
  122.     ld    hl,badchmsg
  123.     call    vpstr
  124.  
  125. ;
  126. ; deinit terminal and restore stack
  127. ;
  128. fini:
  129.     call    dinit
  130. ;
  131. fini2:
  132.     ld    hl,(oldsp)
  133.     ld    sp,hl
  134.     ret
  135. ;
  136. ;
  137. gethelp:
  138.     ld    hl,helpmsg
  139.     call    vpstr
  140.     jp    fini2
  141.  
  142. ;
  143. oldsp:    ds    2
  144. ;
  145. tokentbl:
  146. maxtok: db    ARGCNT    ; I don't want to see more than 5 arguments,
  147. numtok: db    0    ; but how many were there really?
  148. parm1:    ds    2    ; address arg 1 - intersection char
  149. parm2:    ds    2    ; address arg 2 - row
  150. parm3:    ds    2    ; address arg 3 - col
  151. ;
  152. type:    db    0
  153. ;
  154. helpmsg:
  155.     db    'ISEC, Version ',VERSION/10+'0','.',VERSION MOD 10+'0',CR,LF
  156.     db    'ISEC - Draws an intersection character on the screen.',CR,LF
  157.     db    'Syntax:',CR,LF
  158.     db    '     ISEC <type> <row> <col> ',CR,LF
  159.     db    'Where:',CR,LF
  160.     db    '     <type> is an integer 1 for a left intersection, ',CR,LF
  161.     db    '            an integer 2 for a right intersection, ',CR,LF
  162.     db    '            an integer 3 for an upper intersection, ',CR,LF
  163.     db    '            an integer 4 for a lower intersection,',CR,LF
  164.     db    '            an integer 5 for a center intersection;',CR,LF
  165.     db    '     <row>  is the row on the screen to place the char;',CR,LF
  166.     db    '     <col>  is the column on the screen to place the char.'
  167.     db    CR,LF,0
  168. ;
  169. badchmsg:
  170.     db    'Invalid intersection character requested.',CR,LF,0
  171. oldtcpmsg:
  172.     db    'Extended TCAP not present.',CR,LF,0
  173.     end
  174.