Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Unsigned Integers/Hex, and Mouse

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

  • Unsigned Integers/Hex, and Mouse

    In the below snippet there seems to be a problem with using unsigned integers and hex. When I query "A" for it's value I get 4294950912 and the value of "B" is 4294967295. With D I get an overflow error. Why are these values incorrect and why do I get an overflow error?

    DIM A AS DWORD
    DIM B AS DWORD
    DIM D AS WORD

    A = &HC000
    B = &HFFFF

    PRINT A;B
    D = &HC000

    PRINT D
    -----------------------------------------------------------------

    When changing video mode to 640x480x256 using int 10h, service 4F02h video mode 101h the mouse cursor disappears. I've tried getting it back using int 33h service 028h but that hasn't worked. Other than displaying the cursor myself, is there another way to get it back?


    Thanks for your help and patience.
    Walt Decker

  • #2
    Immediate values above 32767 (Hex 7FFF) are considered to be
    signed values by default by PowerBASIC, even when assigning them
    to unsigned variable types. So PowerBASIC is trying to assign a
    signed value to an unsigned variable, which is where the problem
    is occuring. You can specify an unsigned immediate value by including
    a leading 0 (zero) in the number.

    So:
    &HC000 = -16384 decimal.
    &H0C000 = 49152 decimal.

    As for the mouse, I'm not sure I can help there. Do you have a DOS
    mouse driver loaded and enabled?

    According to Ralph Brown's interrupt list:

    INT 33h, function 1 will show the mouse cursor.
    AX = 1

    INT 33h, function 2 will hide the mouse cursor.
    AX = 2
    **Multiple calls to this function will require multiple calls to
    function 1 to unhide it.

    INT 33h, function 4 will position the mouse cursor.
    AX = 4
    CX = column
    DX = row

    INT 33h, function 7 sets the horizontal cursor range.
    AX = 7
    CX, DX = min, max column
    INT 33h, function 8 sets the vertical cursor range.
    AX = 8
    CX, DX = min, max row

    INT 33h, function 10h sets the screen region for updating the cursor.
    AX = 10h
    CX, DX = x, y coordinates of upper left corner
    SI, DI = x, y coordinates of lower right corner
    **The mouse cursor will be hidden by this function, and must be
    explicitly turned on again.


    Hope that helps.

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

    Comment


    • #3
      Thank you, Mr. Grant. Hee, hee. I actually found out that adding a leading zero to the hex worked. I first moved the hex number to AX then moved it to the variable and it worked fine. So I thought that there must be some quirky thing about pb that was causing it, maybe considering the hex number to be longer than it really was. So I added the leading zero to indicate that it really was a 4-digit hex number and it worked.

      Using INT 33, FUNCTION 10h didn't get the mouse cursor back, at least on my lap-top, but I'll try it on my old 486 to see if it works. I'll keep looking. Hopefully I'll find a generic function that will enable me to display it. If nothing else, I'll just have to display it myself.

      Thanks again.

      ------------------
      Walt Decker

      Comment


      • #4
        Walter, have you looked at the MOUSUNIT.BAS code in your \PB35\EXAMPLES folder? It contains a whole bunch of mouse-related functions that utilize INT &H33.

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Thanks for the tip, Lance. I looked at MOUSUNIT.BAS. It does not contain any code that I'm not using already. Perhaps the problem is with the driver. I'm trying to get the mouse to dispaly at 640x480x256 on a Thinkpad 310ed. When I look at the windows devices there is no mouse driver loaded but when I query the bios it states that there is a version 8.10 driver (what driver I don't know). It may be that I'll have to reset the cursor and screen masks. Anyway, I'll keep looking.



          ------------------
          Walt Decker

          Comment

          Working...
          X