BBS: Inland Empire Archive Date: 12-10-92 (15:07) Number: 393 From: HUGH MARTIN Refer#: NONE To: DIK COATES Recvd: NO Subj: Far string access Conf: (2) Quik_Bas
Dik, saw your post to Mark Rejhon with your code. Try using this. I didn't test it so let me know how it works. -------------------------> 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 ds, desrptr:word, attrib:word Mov bx, desrptr push bx ;pass FileName$ descriptor word CALL StringAddress ;call the PDS routine for Segment:Offset mov cx, attrib ;attribute in cx for DOS call mov ds,dx ;set FileName$ segment mov dx,ax ;set FileName$ offset mov ah, 3ch ;DOS create file int 21h jnc Exit ;carry flag clear and handle in ax neg ax ;carry flag not clear, -(error) in ax Exit: ret FCREATE Endp End ;Notes: The string descriptor is a word, not a double word. ; No need to save and restore flags, since direction flag is ; not changed. ; No need for extra pushes and pops. ; The length of FileName$ is not used by DOS function 3Ch. ; FileName$ MUST be passed as an ASCIIZ string, i.e. ; FileName$ + chr$(0). --------------------------> SNIP <--------------------------- Of course, having to pass an ASCIIZ string for the file name is not as convenient as passing the file name and letting the routine create the ASCIIZ string. The BBB routines I wrote do this for you, and you might consider adding the same functionality to your routine. --- Maximus 2.01wb * Origin: COSUG BBS: Colorado Springs PC User Group 719-632-2566 (1:128/13)
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