Re: far string access in

 BBS: Inland Empire Archive
Date: 12-08-92 (12:08)             Number: 391
From: DIK COATES                   Refer#: NONE
  To: MARK REJHON                   Recvd: NO  
Subj: Re: far string access in       Conf: (2) Quik_Bas
>>>> QUOTING Mark Rejhon to Hugh Martin <<<<

 MR> Ugh, how cryptic...  There's an easier way to pass variables to and
 MR> from ASM routines... (I use MASM 6.0)

Use the simplified directives myself, the question came about because of
the difficulty I am having trying to get the following Function run from
within the QBX environment...

___-----------------------> SNIP <---------------------------

.Model Medium, Basic

Extrn StringAddress:Proc    ;part of PDS


.Code

; BASIC Far String Function - returns File Handle if successful, and
; DOS Critical Error if fails.  Declare as follows:
;
; DECLARE FUNCTION FCREATE% (filename$, BYVAL attribute%)
;
; ARGS: filename$ - name of file to create
;       attribute%- attribute of file as follows:
;                       0 - normal
;                       1 - read only
;                       2 - hidden
;                       4 - system
; LIB:  BAFIL.LIB
;
; REV:  92-12-04
;       92-12-07  StringLength:Proc removed, from Hugh Martin
;

FCREATE     proc    Uses bx cx dx ds es si, desrptr:dword, attrib:word
            pushf               ;save flags

            lds   si, desrptr

            push si             ;pass incoming descriptor
            CALL StringAddress  ;call the PDS routine for Segment:Offset
            push ax             ;save offset
            push dx             ;save segment
            mov  bx, cx         ;put length in bx
            pop  ds             ;retrieve segment in ds
            pop  dx             ;retrieve offset in dx
            mov  cx, attrib     ;attribute in cx
            mov  ah, 3ch        ;DOS create file
            int  21h
            jnc  @f             ;success, carry flag clear and handle in ax
            neg  ax             ;fail carry flag not clear,
ret -ve error in ax
@@:         popf                ;restore flags
            ret
FCREATE     Endp


End


___-----------------------> SNIP <---------------------------


It would be appreciated if you could take a boo at it and maybe come
up with a suggestion or two as to why it won't work through the
environment...  In mean time, will take a boo at your posting and
try substituting your method.  My first attempt at gluing ASM stuff
for far strings.  Once I have the suite completed, will post for all
to comment and/or use.  Have a whole pile of stuff for near... and
am in the process of converting... First try... bumped my head...
Regards and thanks... Dik, Oshawa, Canada

... Damn touchscreen, Anyone see my braille tagline... -Dik
___ Blue Wave/QWK v2.10

--- Maximus 2.00
 * Origin: Durham Systems (ONLINE!) (1:229/110)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET