Asm help for far strings

 BBS: Inland Empire Archive
Date: 07-17-92 (19:56)             Number: 131
From: MATT PRITCHARD @ 930/21      Refer#: NONE
  To: FRANCOIS ROY                  Recvd: NO  
Subj: Asm help for far strings       Conf: (2) Quik_Bas
FR>Hi Matt,

Uh,  Not exactly the Matt you asked, but I'm going to interject here.

FR>A while ago, you posted some ASM code to receive near strings from QB/BC
FR>programs.  I have received my PDS 7.1 and would like to try to make the
FR>QBSWAP routines work with /Fs far strings.  I wondered if you would be kind
FR>enough to post ASM code on how one would receive a QBX/BC7 far string
FR>parameter in an ASM module.

done!
;.ASM Routine to print text string to DOS console, using either ;near or far strings. To assemble for far strings, add /DFARSTRINGS ;to your MASM/TASM command line (Define symbol "FARSTRINSG") ;code by Matt Pritchard, Released to public domain 1992 .MODEL Medium, Basic ;External Routines in BASIC 7.1 for far string access IFDEF FARSTRINGS EXTRN stringaddress:far EXTRN stringlength:far ENDIF DP.Text = 0Ch ;Stack offset of Text$ ;DECLARE SUB DOSPRINTS (Text$) PUBLIC DOSPRINTS DOSPRINTS PROC FAR PUSH BP ;Save Base Pointer on Stack PUSH DS ;Save DS PUSH SI PUSH DI MOV BP,SP ;Set Base Pointer to Top of Stack MOV SI,[BP].DP_Text ;Get Addr of Text$ descriptor IFDEF FARSTRINGS PUSH SI ;Push Addr of BC7 Decriptor Ptr CALL stringaddress ;Get Address + Len of string!!! ;DX:AX = Addr CX = Len MOV DS,DX ;DS = DX = Segment of string MOV DX,AX ;DX = AX = Offset of String ELSE MOV CX,[SI] ;put its length into CX MOV DX,[SI+02] ;now DS:DX points to the String ENDIF JCXZ @DPS_Exit ;Don't Print if empty MOV BX, 1 ;1= DOS Handle for Display MOV AH,40h ;Write Text Function INT 21h ;Call DOS to do it @DPS_Exit: CLD POP DI POP SI POP DS POP BP ;Restore Base Pointer RET 2 DOSPRINTS ENDP ---------------------------------------------------------------- Hope this helps. -Matt P === * SLMR 2.1a * Hello, I am part number --- InterPCB 1.50 # Origin: CENTRAL BBS -Texas' BEST BBS! 214-393-7090 HST 3+GIGs (8:930/21) * Origin: Gateway System to/from RBBS-NET (RBBS-PC 1:10/8)
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