Send byte across link cable

From GbdevWiki
Revision as of 05:47, 9 October 2014 by A cat (Talk | contribs) (Created page with '<pre> shows how to send a byte across a link cable if the gameboy that the byte is being sent to is not trying to receive a byte the program will give a error: #include <…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
/*
shows how to send  a byte across a link cable
if the gameboy that the byte is being sent to is not 
trying to receive a byte the program will give a error
*/

#include <stdio.h>
#include <gb/gb.h>

void main(void){
puts("Press start to send byte");
waitpad(J_START);

_io_out = 102;//set _io_out to 102
send_byte();//send the value of _io_out

while(_io_status == IO_SENDING){;}//wait untill sent

if(_io_status == IO_IDLE)//if sent successfully 
	printf("Byte Sent!\n");
else
	printf("error: %d\n", _io_status);
}