Announcement

Collapse
No announcement yet.

Multiplex

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiplex

    Having given up in self disgust for a week or two on making the POPUP MULTIPLEX work, I have come back to it and I'm about ready to give up again...would some kind soul post a simple bit of code showing how the darn thing works from both ends? I've pushed values into the registers till I ran out of numbers and get no response from it

    Also..

    slightly but not directly related, I have a bit of code to access a tsr that requires puts a value in CX and gets an answer in either EAX, ECX, EBX or EDX. Ummm....is this possible in PB? All the PB related examples I have seen use two letter register ID's...

    Remember, I'm still learning this raw DOS stuff (I've been crippled by Paint-It-By-Numbers Windows programming)so be gentle with me...

    ------------------

  • #2
    Here is some really old code I wrote that uses the multiplex interrupt to detect a previous instance of the TSR... I hope it helps!
    Code:
    $COMPILE EXE
    $OPTION cntlbreak OFF
    $error ALL ON
    
        RANDOMIZE TIMER
        IF VAL(COMMAND$) < 10 THEN
        PRINT "Incorrect time parameter!"
        PRINT "Format: SLEEP n  (where n is the number of seconds to activate, > 10)"
        END
        END IF
    
        Dummy& = setmem(-700000)
    
        POPUP MULTIPLEX &HC000, 254   ' reg AX and DX get this pattern as an ID
        REG 1, &HC000 : REG 4, 254    ' set pattern to check for already installed
        CALL INTERRUPT &H2F           ' do the multiplex interrrupt
        IF REG(1) <> &HC000 AND REG(4) <> 254 THEN
        PRINT "Screen Saver already installed."
        PRINT "Popup using ALT-F10 and then press ALT-F10 again to de-install."
        END                     ' We were already installed
        END IF
    
        popup key CHR$(8,&H44,&H73)
        popup quiet CLNG(18.2 * VAL(COMMAND$))
        SwapName$ = LEFT$(CURDIR$,2) + "\SLEEP$$$.SWP"
    
        PRINT "Screen Saver installing with a" CLNG(VAL(COMMAND$)) "Second delay."
        PRINT "(Use ALT-F10 to pop-up the screen saver if required)"
        popup SLEEP USING ems, SwapName$
    
    '***************************************************************************
    
    DO
        IF popup(4) = 16 AND REG(1) = &HC000 AND REG(4) = 254 THEN
        reg(1), &HC001
        reg(4), 252
        popup SLEEP
        END IF
        Mx% = pos
        My% = csrlin
        $INCLUDE "SERIALNĀ§.BAS"
    
        DisplayAddress& = (pbvScrnBuff \ &H010000)
    
        def seg = DisplayAddress&               ' Save copy of screen
        ScreenSaverTemp$ = PEEK$(0,4000)            ' Save screen
    
        LOCATE 1,1,0 : PRINT "A";               ' Display test char
        ForeGrnd% = PEEK(1) MOD 16          ' Calculate fore color
        BackGrnd% = PEEK(1) \ 16                ' Calculate back color
        POKE$ 0, ScreenSaverTemp$               ' Overwrite test char
        RANDOMIZE TIMER
    
        z$ = "Screen Saver running"
    
        DO
        y% = RND(1,24)
        x% = RND(1,80- LEN(z$))
        COLOR 0,0
        CLS
        COLOR RND(1,15), RND(1,15)
        LOCATE y%, x%     : PRINT z$;
        LOCATE y% + 1, x% : PRINT "Press any key...";
        COLOR 7
        SLEEP 1
        a$ = INKEY$
        COLOR 15,4
        LOCATE 25,1
        IF a$ = CHR$(0,113) AND ISTRUE popup(1) THEN
            PRINT SPACE$(26) "Screen saver uninstalling..." SPACE$(26);
            delay 1
        ELSEIF a$ = CHR$(0,113) THEN
            PRINT SPACE$(20) "Unable to Uninstall,  vectors blocked!" SPACE$(21);
            delay 2
            a$ = CHR$(32)
        END IF
        LOOP WHILE a$ = ""
    
        LOCATE My%, Mx%, 1                  ' Restore location
        COLOR ForeGrnd%, BackGrnd%          ' Restore colors
        sound 0,0
        POKE$ 0, ScreenSaverTemp$
        def seg
    
        IF a$ = CHR$(0,113) THEN EXIT LOOP
        clear
        popup SLEEP
    LOOP UNTIL 0
    END
    
    '***************************************************************************
    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X