BBS: Inland Empire Archive Date: 03-23-92 (10:19) Number: 182 From: MATT HART Refer#: 162 To: MICHAEL MALLEY Recvd: NO Subj: NULL Strings Conf: (2) Quik_Bas
In a message to Matt Hart <22 Mar 92 13:04> Michael Malley wrote: >MH>IF ASC(S1(1)) THEN >MH>An assembly routine would be good in this case, and not too >MH>difficult. Let me know if you need one like that. MM> Isn't that like planting a flower seed with a bulldozer? ;) Nahhh.. That kind of assembly is pretty quick and simple.. Hmmm... Let's see if I can do it on the fly... Fortunately not on-line - using the eXpress Response System offline Reader/Editor for a couple of days now. ; IsNull.ASM by Matt Hart ; ; DECLARE FUNCTION IsNull%(Strg$) .MODEL MEDIUM,BASIC .CODE IsNull PROC Strg:Word MOV BX,Strg ; Pointer to descriptor into BX MOV CX,[BX] ; Length into CX XOR AX,AX ; Zero AX NOT AX ; Set to true CMP CX,0 ; Is Length 0? JE Ending ; Yes - it's null and end MOV SI,[BX+2] ; Address of first char into SI Top: CMP BYTE PTR [SI],0 ; Is that character null? JNE SetNotNull ; No - zero function and end INC SI ; Next char LOOP Top ; Continue to test for CX times JMP Ending ; Done - remain true SetNotNull: NOT AX ; Set to false Ending: RET ; Back to BASIC IsNull ENDP END Actually I cheated a little and tested it - this code works. :-) --- * 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