www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/16/10:30:22

From: "Lee Owens" <assembly AT swbell DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: I need help to convert my inline asm over to djgpp
Date: Wed, 15 Jul 1998 16:06:47 -0500
Organization: Programmer
Lines: 48
Message-ID: <6oj5t2$4mb$1@nnrp3>
NNTP-Posting-Host: ppp-207-193-22-59.stlsmo.swbell.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'am making my own 2d game kit and I need help to convert my inline asm
over.. here is the code I need to be convert over.

unsigned int Joystick(unsigned char stick)
{
// reads the joystick values manually by conting how long the capacitors
take
// to charge/discharge
// let's use the inline assembler.  It's Cool!

__asm
    {
    cli                       ; disable interupts

    mov ah, byte ptr stick ; get mask into ah to selct joystick to read
    xor al,al              ; zero out al, xor is a trick
    xor cx,cx             ; same with cx which we will use as a counter
    mov dx,JOYPORT         ; dx is used by inp and outp
    out dx,al              ; write 0's to the port
    discharge:
    in al,dx               ; read the data back from port
    test al,ah             ; has the bit in question changed?
    loopne discharge       ; if the stick isn't ready then --cx and loop

    sti                    ; re-enable interrupts
    xor ax,ax              ; zero out ax
    sub ax,cx              ; ax now holds the position of the axis switch

    } // end asm

// since ax has the result the function will return it properly

} // end Joystick

i just been with djgpp for 3 days now.. Trying to convert my inline asm
codes over..

PS I'am not using allegro.. I'am making my own 2d game kit..

Thanks..

assembly AT swbell DOT net






- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019