BBS: Inland Empire Archive Date: 12-22-92 (23:01) Number: 333 From: MATT HART Refer#: NONE To: EARL MONTGOMERY Recvd: NO Subj: QB & ASM Conf: (2) Quik_Bas
EM> I need to know how to use ASM source with QB 4.5. I have a few ; ASCII.ASM by Matt Hart ; Returns the ASCII code of a string ; like ASC does BUT will return a -1 if ; the string is NULL rather than bombing out with ; an ILLEGAL FUNCTION CALL. ; .Model Medium, BASIC .Code ; Ascii PROC USES SI, Strg:Word MOV BX,Strg ; Pointer to descriptor MOV CX,[BX] ; Length CMP CX,0 ; Is the string null? JE NullString ; Yes - jump to NullString MOV SI,[BX+2] ; Address of the string into SI XOR AX,AX ; Clear AX to receive the character MOV AL,[SI] ; First character of the string JMP Ending ; Back to BASIC NullString: MOV AX,0FFFFh ; Return a -1 to the function Ending: RET ; Back to BASIC Ascii ENDP END C:\>masm ascii.asm or C:\>ml /c ascii.asm 'TEST.BAS DEFINT A-Z DECLARE FUNCTION Ascii(Strg$) PRINT Ascii(COMMAND$) C:\>bc test; C:\>link test+ascii,,,brun45; C:\>test A 65 --- * Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)
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