BBS: Inland Empire Archive Date: 09-09-92 (10:47) Number: 52 From: STEVE GARTRELL Refer#: NONE To: LUIS ESPINOZA Recvd: NO Subj: CALL InterruptX Conf: (2) Quik_Bas
;This is about 12% faster than the QB/PDS "CALL InterruptX" ; per Microsoft's (indubitably registered and copyrighted) ; "Source Profiler"...Note that this doesn't take any ; special precautions for 24h/25h/26h...It's just trying ; to be quick about it...|-} ;Created 9/4/92 by Steve Gartrell ;Declaration: DECLARE SUB FastInt (BYVAL IntNum%, SEG DemRegs AS ANY) ; ; QB/PDS TYPE Declaration ; TYPE SKGregs ; ax AS INTEGER ; bx AS INTEGER ; cx AS INTEGER ; dx AS INTEGER ; si AS INTEGER ; di AS INTEGER ; es AS INTEGER ; ds AS INTEGER ; flags AS INTEGER ; bp AS INTEGER ; END TYPE .model medium, basic .code FastInt PROC start: push bp ;save entry registers mov bp, sp pushf push ds push es push di push si push dx push cx push bx push ax IntRegs: sub sp, 14H ;make room on stack for 10 regs mov ax, [bp + 0Ah] push cs ;gonna modify code seg bytes pop ds ASSUME ds:SEG FastInt mov bx, OFFSET IntNum mov BYTE PTR [bx + 1], al ;low byte intnum to code mov si, [bp + 8] ;seg of Reg TYPE mov ds, si mov si, [bp + 6] ;offset of reg TYPE mov di, sp ;Low stack mark in SP to di push ss ;playing in stack pop es cld ;paranoia mov cx, 0Ah ;copy reg TYPE to stack rep movsw pop ax ;pop reg TYPE to registers pop bx pop cx pop dx pop si pop di pop es pop ds popf pop bp IntNum: int 0FFh ;Duh...Interrupt push bp ;Save regs after Int mov bp, sp pushf push ds push es push di push si push dx push cx push bx push ax mov di, [bp + 1Ch] ;get reg TYPE seg mov es, di mov di, [bp + 1Ah] ; and offset mov si, sp ;Low stack mark in SP to si push ss pop ds cld ;paranoia mov cx, 0Ah ;PUSHed regs to reg TYPE rep movsw add sp, 14h ;Zap stack back to entry pop ax ; saved registers pop bx pop cx pop dx pop si pop di pop es pop ds popf pop bp retf 6 ;return to QB/PDS FastInt ENDP END ;Just the end of the code, FIDO!!! --- D'Bridge 1.30/071082 * Origin: RadioLink! Columbus, OH (614)766-2162 HST/DS (1:226/140)
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