Menu

mouse use IN PC-Basic

Anonymous
2017-12-19
2020-03-26
  • Anonymous

    Anonymous - 2017-12-19

    Hi,
    many years ago I wrote a suite of programs which, when used with an overley card, provided subtitling and such to videos. quite something all those years ago. Now that I am retired, I recently came across this set of programs again and thought it would be fun to run them in the excellent PC-Basic emulator. Unfortunately I cant get a mouse to work inside the programs. At the time i used the following to do it:
    40 DEFINT A-Z
    50 DEF SEG=0
    60 MSEG=256PEEK(514+3)+PEEK(514+2)
    70 MOUSE=256
    PEEK(514+1)+PEEK(514)+2
    80 IF MSEG OR (MOUSE-2) THEN 100
    90 PRINT " De muis is niet aktief":END etc etc
    a well know method at the time. I could reptram everything to work strictly with keyboard choices but thats a massive job and it strikes me that if it worked all those years ago I should be able to get a mouse working in PC-Basic. alas I am stuck. any suggestions?
    i know the cut and paste works fine.

     
  • Rob Hagemans

    Rob Hagemans - 2017-12-20

    Hi, that code won't work in PC-BASIC at present. It looks like it addresses some mouse driver in memory, but that really assumes you are running GW-BASIC on a DOS computer with a specific mouse driver loaded. Any PEEK calls in PC-BASIC only work if the memory address has been specifically implemented in the emulator. If you send me the program I can have a look if it makes sense to do so in this case, but it would take a while before I'd get to that.

    However, PC-BASIC can read the mouse position as if it's a light pen, i.e. by giving a PEN ON statement at the start and using the PEN function. See the documentation for details on these.

     
    • Anonymous

      Anonymous - 2017-12-20

      thank you for your quick reply. I had in fact been wondering if the PEN function could be used. I am going to look into that rather than bother you with my programs. If I cant resolve then, if I may, I will come back to you.
      thanks for the reply.

       
  • Anonymous

    Anonymous - 2017-12-20

    OK got the PEN function PEN(6) to work. I have assigned variable N to it. it works great first time, PEN waits for the keypress and I check the result and then goto the relevant subroutine and open the relevant program.
    however the PEN variable seems to be retained. so if I then reload the initial master program and RUN it immediately loads the second program.
    I cant seem to clear or reassign the variable. Tried everything, introducing a PEN OFF statement, assigning 0 to N, nothing works. the original choice seems retained.
    10 REM ** MASTER **
    20 CLEAR
    25 SCREEN 0,0,0
    30 REM (this once only sets op the menu screen not shown in this short listing) GOSUB 400
    35 PEN ON
    40 N = PEN(6)
    210 IF N = 8 THEN CLOSE:GOTO 290
    220 IF N = 10 THEN CLOSE: GOTO 310
    230 IF N = 12 THEN CLOSE: GOTO 330
    240 IF N = 14 THEN CLOSE: GOTO 350
    250 IF N = 16 THEN CLOSE: GOTO 370
    260 IF N = 18 THEN CLOSE: GOTO 380
    270 GOTO 35
    290 LOAD "dubbel.bas",R
    etc
    etc
    etc

     
  • Rob Hagemans

    Rob Hagemans - 2017-12-21

    PEN(6) returns the position of the last click, so it will not change. You'll need PEN(0) to check if there has been a new click since last time. Maybe something like this:

    40 N=-1: IF PEN(0) THEN N=PEN(6)
    
     
  • Anonymous

    Anonymous - 2017-12-21

    thanks. its been almost 30 years since I last wrote BASIC so hence my stupidity :)
    now I see this example the 'mist' is lifting. By the way I just like to thank you for this emulator I have come to quit late, but that has enabled me to pick up an old hobby in my retirement.

     
  • Smithdoor

    Smithdoor - 2020-03-26

    Try the above but I get a error message "Syntax error in 60 "
    So what is the problem

    **run
    Syntax error in 60 
    60 MSEG=256 PEEK(514+3)+PEEK(514+2)
    list
    10 REM MASTER
    20 CLEAR
    25 SCREEN 0,0,0
    30 REM (this once only sets op the menu screen not shown in this short listing) GOSUB 400
    35 PEN ON
    40 DEFINT A-Z
    50 DEF SEG=0
    60 MSEG=256 PEEK(514+3)+PEEK(514+2)
    70 MOUSE=256 PEEK(514+1)+PEEK(514)+2
    80 IF MSEG OR (MOUSE-2) THEN 100
    90 PRINT " De muis is niet aktief":END ETC ETC40 DEFINT A-Z
    Ok 

     
    • Marc 'BlackJack' Rintsch

      I don't think peeking the mouse stuff from where a real DOS mouse driver might put the values in memory will work. At least in 2017 it did not work as Rob wrote back then.

      The syntax error is the missing operator between 256 and PEEK. If you take a look at the whole line it's easy to guess that theres a * missing. But again, that doesn't work anyway.

       
  • Smithdoor

    Smithdoor - 2020-03-26

    I was hopping is something I was doing wrong
    I have back around 1985 program and used a mouse in basic but since then I have lost all my notes on how to . I think got from PC magazine on how to.

    Thank you for your reply

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.