#32243 - ghostils - Mon Dec 20, 2004 12:35 am
I figure most of you folks out there are probably familiar with the Xboo program and xcomms. I'm using my GBA for a remote control (Well thats the idea if I can get some communication working with it and my pc)
What I want to do is control the gba via the xboo cable after my software is loaded either from rom or multi-boot does really matter. I've written a simple test program on the gba to repeatedly send 1 byte of data over the port in polling mode.
I wrote another simple program in C to read the LPT1 port. On the data register 0x378+0 I don't get data, which isn't strange after reading the xboo documentation text file showing what pins are used. (mosly control register pins 0x378 + 2)
I read the status register 0x378+1 and I show that the gba is sending data because when I unplug it the byte value changes.
Now here is where I need the help.
When I try and do any operation on the Control register read/write whatever my code either throws an exception or something else causes it to crash. I'm compiling it in Visual C++ 6.0.
Both data and status register operations work fine, control register access crashes it..
I'll post my code below for the windows app.
(OS Specs: Windows XP SP2)
(Programming IDE MSVC 6.0) compiled as a win32 console app. (which is probably part of the problem)
I may try and work it out in some 16bit asm but that's really rusty hehe.
What do you all think?
Thanks,
-ghost[iLs]
What I want to do is control the gba via the xboo cable after my software is loaded either from rom or multi-boot does really matter. I've written a simple test program on the gba to repeatedly send 1 byte of data over the port in polling mode.
I wrote another simple program in C to read the LPT1 port. On the data register 0x378+0 I don't get data, which isn't strange after reading the xboo documentation text file showing what pins are used. (mosly control register pins 0x378 + 2)
I read the status register 0x378+1 and I show that the gba is sending data because when I unplug it the byte value changes.
Now here is where I need the help.
When I try and do any operation on the Control register read/write whatever my code either throws an exception or something else causes it to crash. I'm compiling it in Visual C++ 6.0.
Both data and status register operations work fine, control register access crashes it..
I'll post my code below for the windows app.
(OS Specs: Windows XP SP2)
(Programming IDE MSVC 6.0) compiled as a win32 console app. (which is probably part of the problem)
I may try and work it out in some 16bit asm but that's really rusty hehe.
Code: |
#include <stdio.h> //-old dos.h causes compile errors: //-ASM routines: //-Taken from Userport example file for test purposes: void outportb(unsigned int portid, unsigned char value) { __asm mov edx,portid __asm mov al,value __asm out dx,al } unsigned char inportb(unsigned int portid) { unsigned char value; __asm mov edx,portid __asm in al,dx __asm mov value,al return value; } //-LPT registers for SPP mode: #define PORTADDR 0x378 #define DATA PORTADDR + 0 #define STATUS PORTADDR + 1 #define CONTROL PORTADDR + 2 void main(void) { unsigned char c = 0x00; while(1) { inportb(DATA); printf("DATA = %c\r\n", c); inportb(STATUS); printf("STATUS = %c\r\n", c); //-FIXME: Crashes program! inportb(CONTROL); printf("CONTROL = %c\r\n", c); } } |
What do you all think?
Thanks,
-ghost[iLs]