home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY2 / TOOLFX.ZIP / TOOLBOX.FIX
Text File  |  1990-03-31  |  10KB  |  287 lines

  1. Dear Turbo Database Toolbox User,
  2.  
  3. Here are the changes that need to be made to the database toolbox files
  4. so that you may compile and run under PowerBASIC.  There are six "blocks"
  5. of changes that need to be made.  The assembly routines that are commented
  6. in changes 2 and 4 need not be written into your code, but we suggest that
  7. you do so for future reference.  Please call me if you have any questions
  8. or comments.  Good programming!
  9.  
  10. Sincerely,
  11.  
  12. Tim McFarland
  13. Technical Support
  14. (408) 730-9291
  15.  
  16. ===========================================================================
  17.  
  18. Change One:
  19.  
  20. In file FEXISTS.BOX, DEF fnFileExists, replace:
  21.  
  22.   SaveDS% = REG(8)
  23.   REG 8, (PEEK(1) * ...
  24.   I% = VARPTR(FileSpec1$)
  25.   REG 4, (PEEK(I% + 3) * ...
  26.   CALL INTERRUPT &H21
  27.   REG 8, SaveDS%
  28.  
  29. with:
  30.  
  31.   REG 8, STRSEG(FileSpec1$)
  32.   REG 4, STRPTR(FileSpec1$)
  33.   CALL INTERRUPT &H21
  34.  
  35. ===========================================================================
  36.  
  37. Change Two:
  38.  
  39. In file SCRNASM.BOX, sub WriteVid INLINE, remove all of the $INLINE
  40. statements and replace them with:
  41.  
  42.   $INLINE &H55, &H8B, &HEC, &H6 , &H1E, &HC5
  43.   $INLINE &H76, &HA , &H8E, &H4 , &HC5, &H76, &H6 , &H8B, &H3C, &HC5
  44.   $INLINE &H76, &H22, &H8B, &H4 , &H50, &HC5, &H76, &HE , &H8B, &H4
  45.   $INLINE &HC5, &H76, &H12, &H8B, &H1C, &H3 , &HD8, &HC5, &H76
  46.   $INLINE &H26, &H8B, &HC , &HC5, &H76, &H1A, &H8B, &H34, &H3
  47.   $INLINE &HF0, &HD1, &HE7, &HFC, &H58, &H3D, &H0 , &H0
  48.   $INLINE &H74, &H28, &HBA, &HDA, &H3 , &H57, &HC5, &H7E, &H1E, &H8E
  49.   $INLINE &H1D, &HAC, &HC5, &H7E, &H16, &H8E, &H1D, &H8A, &H27, &H43
  50.   $INLINE &H50, &HB4, &H09, &HEC, &HD0, &HD8, &H72, &HFB, &HFA, &HEC
  51.   $INLINE &H22, &HC4, &H74, &HFB, &H58, &H5F, &HAB, &HFB, &HE2, &HDD
  52.   $INLINE &HEB, &H13, &H57, &HC5, &H7E, &H1E, &H8E, &H1D, &HAC, &HC5
  53.   $INLINE &H7E, &H16, &H8E, &H1D, &H8A, &H27, &H43, &H5F, &HAB, &HE2
  54.   $INLINE &HED, &H1F, &H07, &H5D
  55.  
  56.  
  57.  
  58. The assembly code for the above is:
  59. '    push bp
  60. '    mov  bp,sp
  61. '    push es
  62. '    push ds
  63. '    lds  si,[bp+10]
  64. '    mov  es,[si]    ;dest seg into ES
  65. '    lds  si,[bp+6]
  66. '    mov  di,[si]    ;dest disp into DI
  67. '    lds  si,[bp+34]
  68. '    mov  ax,[si]    ;Retracemode% to AX
  69. '    push ax
  70. '    lds  si,[bp+14]
  71. '    mov  ax,[si]    ;Stringdisp%
  72. '    lds  si,[bp+18]
  73. '    mov  bx,[si]    ;addr of attr string into BX
  74. '    add  bx,ax      ;add string displacement
  75. '    lds  si,[bp+38]
  76. '    mov  cx,[si]    ;Numbytes% to CX
  77. '    lds  si,[bp+26]
  78. '    mov  si,[si]    ;source ptr to SI
  79. '    add  si,ax      ;add string displacement
  80. '    shl  di,1       ;displ * 2 for dest
  81. '    cld             ;string direction forwd
  82. '    pop  ax
  83. '    cmp  ax,0
  84. '    jz   h          ;not retracemode
  85. '    mov  dx,03dah   ;DX to CGA status port
  86. ' z:
  87. '    push di
  88. '    lds  di,[bp+30] ;source seg addr
  89. '    mov  ds,[di]    ;source seg
  90. '    lodsb           ;grab a video byte
  91. '    lds  di,[bp+22] ;attr seg addr
  92. '    mov  ds,[di]    ;attr seg
  93. '    mov  ah,[bx]
  94. '    inc  bx
  95. '    push ax
  96. '    mov  ah,9       ;save retrace mask
  97. ' o: in   al,dx      ;get 6845 status
  98. '    rcr  al,1       ;check horiz retrace
  99. '    jb   o          ;loop if in horiz retr:
  100. '                   ; Prevents starting in
  101. '                   ; mid-retr, since there
  102. '                   ; is enough time for 1
  103. '                   ; & only 1 STOSW during
  104. '                   ; horizontal retrace.
  105. '    cli             ;no ints, critical sect
  106. ' t: in   al,dx      ;get 6845 status
  107. '    and  al,ah      ;chk horiz & vert retr:
  108. '                   ; If the video board
  109. '                   ; doesn t report horiz
  110. '                   ; retr while in vert,
  111. '                   ; retr, this will allow
  112. '                   ; several chars to be
  113. '                   ; stuffed in during
  114. '                   ; vertical retrace.
  115. '    jz   t          ;loop if 0
  116. '    pop  ax         ;get the video byte
  117. '    pop  di
  118. '    stosw           ;store the video word
  119. '    sti             ;allow interrupts
  120. '    loop z          ;go do next word
  121. '    jmp  short f
  122. ' h: push di
  123. '    lds  di,[bp+30]
  124. '    mov  ds,[di]    ;source seg
  125. '    lodsb           ;grab a video byte.
  126. '    lds  di,[bp+22]
  127. '    mov  ds,[di]    ;attr seg
  128. '    mov  ah,[bx]
  129. '    inc  bx
  130. '    pop  di
  131. '    stosw           ;video word into screen
  132. '    loop h          ;repeat for len in CX
  133. ' f: pop ds
  134. '    pop es
  135. '    pop bp
  136.  
  137. ===========================================================================
  138.  
  139. Change Three:
  140.  
  141. In file SCRNSUBS.BOX, sub WriteScreenArea, replace:
  142.  
  143. CALL WriteVid(NumberOfCols, Scrn.Retrace, Text$, Attr$, SavePtr, _
  144.      Scrn.Segment, ScreenDisplacement + ((i - 1) * 80))
  145.  
  146. with:
  147.  
  148. CALL WriteVid(NumberOfCols, Scrn.Retrace, STRSEG(Text$), STRPTR(Text$), _
  149.      STRSEG(Attr$), STRPTR(Attr$), SavePtr, _
  150.      Scrn.Segment, ScreenDisplacement + ((i - 1) * 80))
  151.  
  152.  
  153. >>> A note to toolbox users: If you call WriteVid yourself, instead of via
  154. WriteScreenArea, be sure to change your parameters so that you pass the
  155. segment and offset of the text and attribute strings, instead of the
  156. strings themselves.  Also, the CLIENT.BAS demonstration program needs
  157. more than the default amount of stack space.  Increase it by putting a
  158. $STACK metastatement at the beginning of CLIENT.BAS.  $STACK 32000
  159. definitely works, much smaller values are likely to work as well.
  160.  
  161. ===========================================================================
  162.  
  163. Change Four:
  164.  
  165. In file SCRNASM.BOX, sub ReadVid INLINE, remove all of the $INLINE
  166. statements and replace them with:
  167.  
  168. $INLINE &H55,&H8B,&HEC,&H1E,&H06,&HC5,&H76,&H26,&H8B,&H0C,&HC5,&H76,&H12
  169. $INLINE &H8B,&H1C,&HC5,&H7E,&H0E,&H8B,&H05,&H03,&HD8,&HC5,&H7E,&H06
  170. $INLINE &H8B,&H15,&HC5,&H7E,&H1A,&H8B,&H3D,&H03,&HF8,&HC5,&H76,&H22,&H8B
  171. $INLINE &H04,&HC5,&H76,&H0A,&H8E,&H1C,&H8B,&HF2,&HBA,&HDA,&H03,&HD1
  172. $INLINE &HE6,&HFC,&H0B,&HC0,&H74,&H26,&HB4,&H09,&HEC,&HD0,&HD8,&H72,&HFB
  173. $INLINE &HFA,&HEC,&H22,&HC4,&H74,&HFB,&HAD,&HFB,&H56,&HC4,&H76,&H1E
  174. $INLINE &H26,&H8E,&H04,&HAA,&HC4,&H76,&H16,&H26,&H8E,&H04,&H26,&H88,&H27
  175. $INLINE &H43,&H5E,&HE2,&HDC,&HEB,&H16,&HAD,&H56,&HC4,&H76,&H1E,&H26
  176. $INLINE &H8E,&H04,&HAA,&HC4,&H76,&H16,&H26,&H8E,&H04,&H26,&H88,&H27,&H43
  177. $INLINE &H5E,&HE2,&HEA,&H07,&H1F,&H5D
  178.  
  179.  
  180. The assembly code for the above is:
  181.  
  182. '    push bp
  183. '    mov  bp,sp
  184. '    push ds
  185. '    push es
  186. '    lds  si,[bp+38] ;NumBytes%
  187. '    mov  cx,[si]    ; to CX
  188. '    lds  si,[bp+18] ;disp of attr str
  189. '    mov  bx,[si]    ; to BX
  190. '    lds  di,[bp+14]
  191. '    mov  ax,[di]    ;Stringdisp%
  192. '    add  bx,ax      ;add string displacement
  193. '    lds  di,[bp+6]  ;Disp%
  194. '    mov  dx,[di]    ; to DX for now (SI later)
  195. '    lds  di,[bp+26] ;disp of text str
  196. '    mov  di,[di]    ; to DI
  197. '    add  di,ax      ;add string displacement
  198. '    lds  si,[bp+34] ;Retracemode%
  199. '    mov  ax,[si]    ; to AX
  200. '    lds  si,[bp+10] ;Sourceseg%
  201. '    mov  ds,[si]    ; to DS
  202. '    mov  si, dx     ;Disp% to SI
  203. '    mov  dx,03dah   ;point DX to CGA status port
  204. '    shl  si,1       ;displacement * 2 for source
  205. '    cld             ;set string direction to forward
  206. '    or   ax,ax
  207. '    jz   .7         ;not retmode, use simpler routine
  208. '.5: mov  ah,9       ;move horiz. + vertical retrace
  209. '            ; mask to fast storage
  210. '.9: in   al,dx      ;get 6845 status
  211. '    rcr  al,1       ;check horizontal retrace
  212. '    jb   .9         ;loop if in horizontal retrace:
  213. '            ; this prevents starting in mid
  214. '            ; retrace, since there is enough
  215. '            ; time for 1 and only 1 STOSW
  216. '            ; during horizontal retrace
  217. '    cli             ;no ints during critical section
  218. '.6: in   al,dx      ;get 6845 status
  219. '    and  al,ah      ;check for both kinds of retrace:
  220. '            ; if the video board does not
  221. '            ; report horizontal retrace while
  222. '            ; in vertical retrace, this will
  223. '            ; allow several characters to be
  224. '            ; stuffed in during vertical
  225. '            ; retrace
  226. '    jz   .6         ;loop if zero. else clear to
  227. '            ; access video ram
  228. '    lodsw           ;grab char + attribute).
  229. '    sti             ;allow interrupts
  230. '    push si
  231. '    les  si, [bp+30]
  232. '    mov  es, es:[si]
  233. '    stosb           ;get character
  234. '    les  si, [bp+22]
  235. '    mov  es, es:[si]
  236. '    mov  es:[bx],ah ;get screen attribute
  237. '    inc  bx         ;increment ptr to scr attribute
  238. '    pop  si
  239. '    loop .5         ;do cx (numbytes) times
  240. '    jmp  short .8
  241. '.7: lodsw           ;grab character + attribute
  242. '    push si
  243. '    les  si, [bp+30]
  244. '    mov  es, es:[si]
  245. '    stosb           ;get character
  246. '    les  si, [bp+22]
  247. '    mov  es, es:[si]
  248. '    mov  es:[bx],ah ;get screen attribute
  249. '    inc  bx         ;increment ptr to scr attribute
  250. '    pop  si
  251. '    loop .7         ;do cx (numbytes) times
  252. '.8: pop  es
  253. '    pop  ds
  254. '    pop  bp
  255.  
  256. ===========================================================================
  257.  
  258. Change Five:
  259.  
  260. In file SCRNSUBS.BOX, sub SaveScreenArea, replace:
  261.  
  262. CALL ReadVid(NumberOfCols, Scrn.Retrace, SaveText$, SaveAttr$, SavePtr, _
  263.      Scrn.Segment, ScreenDisplacement + ((i - 1) * 80))
  264.  
  265. with:
  266.  
  267. CALL ReadVid(NumberOfCols, Scrn.Retrace, STRSEG(SaveText$), _
  268.      STRPTR(SaveText$), STRSEG(SaveAttr$), STRPTR(SaveAttr$), SavePtr, _
  269.      Scrn.Segment, ScreenDisplacement + ((i - 1) * 80))
  270.  
  271.  
  272. >>> A note to toolbox users: If you call ReadVid yourself, instead of via
  273. SaveScreenArea, be sure to change your parameters so that you pass the
  274. segment and offset of the text and attribute strings, instead of the
  275. strings themselves.
  276.  
  277. ===========================================================================
  278.  
  279. Change Six:
  280.  
  281. The CLIENT.BAS demonstration program needs more than the default amount of
  282. stack space.  Increase it by putting a $STACK metastatement at the beginning
  283. of CLIENT.BAS.  $STACK 32000 definitely works, much smaller values are
  284. likely to work as well.
  285.  
  286. ===========================================================================
  287.