home *** CD-ROM | disk | FTP | other *** search
- '┌───────────────────────────────────────────────────────────────────────────┐
- '│ QB-TO-TB: written by Richard Guion & Norm Scroggins, │
- '│ Borland International Technical Support │
- '│ A simple procedure that demonstrates the assembly language interface │
- '│ with Turbo Basic. It uses the assembly code in the file called │
- '│ QB-TO-TB.ASM to find the last non-blank character in a string. │
- '│ The main purpose of it is to demonstrate how to access the length │
- '│ byte of the string from the stack and also return an integer from │
- '│ the assembly program to the Basic program. │
- '│ │
- '│ The QB-TO-TB.ASM file might also be of interest to users who are │
- '│ converting their MicroSoft QuickBasic assembly routines to Turbo │
- '│ Basic. We have included the original assembly code used by │
- '│ QuickBasic so that these users can compare the differences and see │
- '│ the alterations that have to be made. │
- '│ │
- '│ Take the QB-TO-TB.ASM file and use the Macro Assembler prepare it │
- '│ with these steps: │
- '│ 1. MASM QB-TO-TB 'should be 0 errors │
- '│ 2. LINK QB-TO-TB 'a stack warning appears, just ignore it │
- '│ 3. EXE2BIN QB-TO-TB 'afterwards, the .BIN file is on the disk │
- '│ │
- '│ Then, run this sample program to get the correct result │
- '└───────────────────────────────────────────────────────────────────────────┘
-
-
- SUB GetBlank INLINE '( Position%, AnyStr$ )
- ' Position% is uninitialized when called,
- ' but contains the position of the last non-blank
- ' character in AnyStr$.
- ' AnyStr$ can contain any string that you have
- ' assigned something to.
-
- $INLINE "QB-TO-TB.BIN" 'load the file prepared with the Macro Assembler
-
- END SUB 'end GetBlank
-
-
-
- CLS
- AnyStr$ = "01234567890123456789 " 'the last non-blank character is 20
-
- CALL GetBlank ( Position%, AnyStr$ ) 'call the assembly routine
-
- PRINT Position% 'print the position of the last non-blank character