home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / decpro300 / probli.mac < prev    next >
Text File  |  2020-01-01  |  5KB  |  199 lines

  1.     .TITLE    KERBLI - Bliss-16 support routines
  2.     .SBTTL    Robert C. McQueen        30-November-1983
  3.  
  4. ; Version number
  5.  
  6.     .IDENT    /1.0.000/        ; IDENT
  7.  
  8. ; Directives
  9.  
  10.     .LIBRARY /KERMLB/        ; Pro/Kermit macro library
  11.  
  12.     .SBTTL    Revision History
  13.  
  14. ;
  15. ; 1.0.000    By: Robert C. McQueen            On: 30-November-1983
  16. ;        Create this module
  17. ;
  18.  
  19.     .SBTTL    System macros and other definitions
  20.  
  21. ;++
  22. ; The following will cause the external macros and symbol definitions
  23. ; to be included in this module
  24. ;--
  25.  
  26.     .MCALL    BLSRTN            ; Macro to define a BLISS routine
  27.  
  28.     .SBTTL    BL$FIL - Support CH$FILL function
  29.  
  30. ;++
  31. ; This routine will support the special case that is found in the KERMSG
  32. ; routine.  This is only for use will Pro/Kermit and may not work in any
  33. ; other case
  34. ;
  35. ; Calling sequence:
  36. ;
  37. ; Bliss:
  38. ;
  39. ;    CH$FILL(Character, Max_length, Character_pointer);
  40. ;
  41. ;--
  42.  
  43. ; Offsets
  44.  
  45.     FILCHR=    6            ; Fill character
  46.     FILLEN=    4            ; Fill length
  47.     FILPTR=    2            ; Pointer to place to store info
  48.  
  49.     .PSECT    $CODE$,    RO
  50.  
  51.  
  52.     BLSRTN    BL$FIL,2,<FILCHR,FILLEN,FILPTR>
  53.     MOV    FILLEN(SP),R1        ; Get the count of characters
  54.     BEQ    99$            ; Branch if no more characters
  55.     MOV    FILPTR(SP),R0        ; Get the pointer to store into
  56.     MOVB    FILCHR(SP),R2        ; Get the fill character
  57. 10$:    MOVB    R2,(R0)+        ; Store the character
  58.     SOB    R1,10$            ; Loop back
  59. 99$:    RTS    PC            ; Return to the caller
  60.  
  61.     .SBTTL    BL$FCH - Support the CH$FIND_CH function
  62.  
  63. ;++
  64. ; This routine will support the Bliss CH$FIND_CH function.  It will find
  65. ; the first occurance of a character within a character string.
  66. ;
  67. ; Usage:
  68. ;
  69. ; Bliss:
  70. ;
  71. ;    POINTER = CH$FIND_CH(Character, Pointer, Length);
  72. ;
  73. ;--
  74.  
  75.     BLSRTN    BL$FCH,2,<FCHCHR,FCHPTR,FCHLEN>
  76.     MOV    FCHLEN(SP),R1        ; Get the length of the string
  77.     BEQ    90$            ; If zero, character can't be there
  78.     MOV    FCHPTR(SP),R0        ; Get the address of the first byte
  79.     MOVB    FCHCHR(SP),R2        ; And get the character to search for
  80.  
  81. 10$:    CMPB    R2,(R0)+        ; Is this the character?
  82.     BEQ    95$            ; Yes, fix the pointer and return
  83.     SOB    R1,10$            ; Otherwise, loop unless out of characters
  84.  
  85. ; Here if we can't find the character
  86.  
  87. 90$:    CLR    R0            ; Flag it wasn't there
  88.     RTS    PC            ; And return
  89.  
  90. ; Here if we have found the character.  Fix the pointer back by one.
  91.  
  92. 95$:    DEC    R0            ; Back up so we point at byte we just found
  93.     RTS    PC            ; And return
  94.  
  95.     .SBTTL    BL$MOV - Support the CH$MOVE function
  96.  
  97. ;++
  98. ; This routine will support the Bliss CH$MOVE function.  This routine will
  99. ; only work the the calls from KERMSG.  It is not expected that this routine
  100. ; will work with any other Bliss module
  101. ;
  102. ; Calling sequence:
  103. ;
  104. ; Bliss:
  105. ;
  106. ;    CH$MOVE(Character_string_length, From_pointer, Dest_pointer);
  107. ;
  108. ;--
  109.  
  110.     BLSRTN    BL$MOV,2,<CHRLEN,CHRSRC,CHRDST>
  111.     MOV    CHRDST(SP),R0        ; Get the destination
  112.     MOV    CHRLEN(SP),R1        ; Get the number of characters
  113.     BEQ    99$            ; Leave if finished
  114.     MOV    CHRSRC(SP),R2        ; Get the source
  115.  
  116. 10$:    MOVB    (R2)+,(R0)+        ; Move a character
  117.     SOB    R1,10$            ; Loop if more characters
  118. 99$:    RTS    PC            ; Return to the caller
  119.  
  120.  
  121.     .SBTTL    BL$CPY - Support the Bliss CH$COPY function
  122.  
  123. ;++
  124. ; This routine will provide support for the CH$COPY function from Bliss.
  125. ; This routine will only work with the calls from KERMSG.  It is not
  126. ; expected that this routine will work correctly with any other module.
  127. ;
  128. ; Calling sequence:
  129. ;
  130. ; Bliss:
  131. ;
  132. ;    CH$COPY(Source_length, Source_pointer, Fill_character,
  133. ;        Destination_length, Destination_pointer);
  134. ;--
  135.  
  136. BLSRTN    BL$CPY,5,<SRCLEN,SRCPTR,FILCHR,DSTLEN,DSTPTR,NUMARG>
  137.     MOV    DSTPTR(SP),R0        ; Get the destination pointer
  138.     MOV    DSTLEN(SP),R1        ; Get the length
  139.     BEQ    99$            ; Zero, just get out
  140.     MOV    NUMARG(SP),R4        ; Get the number of arguments
  141.     ADD    #5,R4            ; Number of source pairs (0 to n-1)
  142.     NEG    R4            ; Complement
  143.     ASL    R4            ; Make this a word offset
  144.     ADD    SP,R4            ; Point to the argument    
  145. 10$:    MOV    SRCLEN(R4),R2        ; Get the source length
  146.     BEQ    25$            ; No characters to move?
  147.     MOV    SRCPTR(R4),R3        ; Get the pointer to the source
  148.  
  149. ; Here to loop moving characters around
  150.  
  151. 20$:    MOVB    (R3)+,(R0)+        ; Move a byte
  152.     DEC    R1            ; Count down the destination
  153.     BEQ    99$            ; If zero, then done
  154.     SOB    R2,20$            ; Loop for the rest of the source
  155.  
  156. ; Here to advance to the next source pointers
  157.  
  158. 25$:    CMP    R4,SP            ; Finished yet
  159.     BEQ    30$            ; Yes, get out
  160.     CMP    -(R4),-(R4)        ; Back up two pairs
  161.     BR    10$            ; And loop back
  162.  
  163. ; Here to fill characters as required.
  164.  
  165. 30$:    MOVB    FILCHR(SP),(R0)+    ; Move the fill character
  166.     SOB    R1,30$            ; Loop for all characters
  167.  
  168. ; Here to return to the caller
  169.  
  170. 99$:    RTS    PC
  171.  
  172.     .SBTTL    BL$ABS - Support Bliss ABS function
  173.  
  174. ;++
  175. ; This routine will provide support for the Bliss ABS function.  This routine
  176. ; is expected to work ONLY with the calls from KERMSG.
  177. ;
  178. ; Calling sequence:
  179. ;
  180. ; Bliss:
  181. ;
  182. ;    Value = ABS(.item);
  183. ;
  184. ;--
  185.  
  186. ; Argument offsets:
  187.  
  188.     ITEM=    2            ; Offset on the stack of item
  189.  
  190. BL$ABS::MOV    2(SP),R0        ; Get the argument
  191.     TST    R0            ; Test if .lt. zero
  192.     BGE    99$            ; Just reutrn if ok
  193.     NEG    R0            ; Negate the value
  194. 99$:    RTS    PC            ; Return to the caller
  195.  
  196.     .SBTTL    End of KERBLI
  197.     
  198.     .END    
  199.