Results 1 to 6 of 6

Thread: Controller/keyboard input without KOS

                  
   
  1. #1
    DCEmu Coder fox68k's Avatar
    Join Date
    Aug 2004
    Location
    Spain
    Posts
    100
    Rep Power
    73

    Default Controller/keyboard input without KOS

    Hi,

    i need basic input (controller or keyboard, keyboard preferred) in my program, but since it is big to upload it through serial cable (i don't own a BBA :-/) i don't want to use KOS.

    I've been looking at Marcus notes, but i can't figure it out.

    Anyone knows an easy way to get access to the state of the controller/keyboard without KOS?

    Thanks in advance.
    - fox68k -

  2. #2
    Dream Coder
    Join Date
    Apr 2004
    Location
    Miami, FL
    Age
    37
    Posts
    4,675
    Rep Power
    50

    Default Re: Controller/keyboard input without KOS

    kos isnt that big... it will only take a bit more to link in with kos and save lots of time from writing your own functions.

    Also, I would reccomend visiting www.DCEmulation.com and the forums there. There is a much larger user base there and most of the current DC coders visit there more regularly than here.
    If anyone is looking to buy, sell, trade games and support a developer directly at the same time, consider joining Goozex. Enjoy!

  3. #3
    DCEmu Coder fox68k's Avatar
    Join Date
    Aug 2004
    Location
    Spain
    Posts
    100
    Rep Power
    73

    Default Re: Controller/keyboard input without KOS

    My program is currently big. It is because the jump table in the emu core.
    I don't want to get it bigger since i am testing the core and i need to upload it so many times while i fix errors, etc.
    I only need a function to control the execution flow, nothing complex.

    I will ask for this in dcemulation.com too.
    - fox68k -

  4. #4
    Sir Digby Chicken Caesar Darksaviour69's Avatar
    Join Date
    Mar 2004
    Location
    Armagh, Ireland
    Age
    41
    Posts
    7,005
    Rep Power
    50

    Default Re: Controller/keyboard input without KOS

    Dan and a few other coders vist consolevision.com

    CSV is the only DC scene site dan goes to

  5. #5
    DCEmu Coder
    Join Date
    Apr 2004
    Posts
    227
    Rep Power
    74

    Default Re: Controller/keyboard input without KOS

    You could try libdream, or libronin. libdream is the predecessor of KOS, and it a lot smaller. It's also a lot less functional and difficult to use, but if you just want something you can use to debug the emulator core, it should be fine. libronin is like libdream, but it was originally part of DreamSNES.

  6. #6
    DCEmu Coder
    Join Date
    Apr 2004
    Location
    Botoru Battalion
    Age
    51
    Posts
    257
    Rep Power
    75

    Default Re: Controller/keyboard input without KOS

    Deja Vu???? posted this at the other spot already...
    but I like this place so..

    here you go.. Kosfree.. if you're using Marcus's Maple stuff,
    just make sure you re-organise the parameters, mine is sent
    as it is seen on the maple, this should be enough to get the keyboard
    going as well.. same location as digital, except 1byte=shift/alt status
    next byte is the LEDs, and then 6chars of 6 keys being pressed..
    a note of caution, if you start getting back 0xFFFF's then toss the
    data and poll it again.. it does that sometimes...

    Code:
    #include <math.h> 
    
    unsigned char dmabuffer[2128]; 
    
    void *maple_docmd(int port, int unit, int cmd, int len, void *data) 
    { 
     *unsigned long *sbuf, *rbuf; 
     *int dst, src; 
     *src = port << 6; 
     *if(unit==0){ 
     * * * *dst=0x0020; 
     *}else{ 
     * * * *dst=((1<<(unit-1))&0x1f); 
     *} 
     *dst=((port<<6)+dst); 
    
     *rbuf = (unsigned long *) ((((unsigned long)dmabuffer+0x20)& 0xffffffe0)|0xa0000000); 
     *sbuf = (unsigned long *) (((unsigned char *)rbuf) + 1024); 
     * while((*(volatile unsigned long *)(0xa05f6c18)) & 1);//DMA Busy? 
     **(volatile unsigned long *)(0xa05f6c04) = ((unsigned long)sbuf) & 0xfffffff; 
     **sbuf++ = len + (port * 0x10000) + 0x80000000; 
     **sbuf++ = ((unsigned long)rbuf) & 0xfffffff; 
     **sbuf++ = (cmd & 0xff) + (dst * 0x100) + (src *0x10000) + (len * 0x1000000); 
     * if(len > 0) { 
     * * * * *unsigned long *param = data; 
     * * * * *int i; 
     * * * * *for(i=0; i<len; i++)*sbuf++ = *param++; 
     *} 
     **(volatile unsigned long *)(0xa05f6c18) = 1;//do dma.. 
     * while((*(volatile unsigned long *)(0xa05f6c18)) & 1); 
     * return rbuf; 
    }//end 
    
    
    
    void delay(int t){ 
     * * *float x = 1; 
     * * *while(t-->0)x=cos(x); 
    }//end delay 
    
    
    void main(void) 
    { 
     *unsigned int i=0,params[2]; 
     *unsigned short *res,digital,trigger,joystick; 
    
     *//maple init 
     **(volatile unsigned long *)(0xa05f6c8c)= 0x6155404f; 
     **(volatile unsigned long *)(0xa05f6c10) = 0; 
     **(volatile unsigned long *)(0xa05f6c80) = 0xc3500000; 
     **(volatile unsigned long *)(0xa05f6c14) = 1; 
    
    while(i==0){ 
     * * * * *params[0]=0x01000000; //controller 
     * * * * *do res = maple_docmd(0, 0, 9, 1, params); 
     * * * * *while(*res == -4); 
     * * * * *res+=4;//Dpad and buttons 
     * * * * *digital=*res; //for explination purposes.. 
     * * * * **res++; * * * //but just make this a simple struct 
     * * * * *trigger=*res; 
     * * * * **res++; 
     * * * * *joystick=*res;//didn't bother.. but same as triggers 
     * * * * *
     * * * * *printf("RT:%d\n",(trigger&0x00ff)); 
     * * * * *printf("LT:%d\n\n",(trigger/=0x100)); 
    
     * * * * *if(!(digital&0x0010))printf("Up\n"); 
     * * * * *if(!(digital&0x0020))printf("Down\n"); 
     * * * * *if(!(digital&0x0080))printf("Right\n"); 
     * * * * *if(!(digital&0x0040))printf("Left\n"); 
     * * * * *if(!(digital&0x0200))printf("Y\n"); 
     * * * * *if(!(digital&0x0004))printf("A\n"); 
     * * * * *if(!(digital&0x0002))printf("B\n"); 
     * * * * *if(!(digital&0x0400))printf("X\n"); 
     * * * * *if(!(digital&0x0008)){ 
     * * * * * * * * * * * * printf("START\n"); 
     * * * * * * * * * * * *i=1;//and exit 
     * * * * *} 
     * * * * *delay(500000); 
    }//end while

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •