Difference between revisions of "Send byte across link cable"

From GbdevWiki
Jump to: navigation, search
(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 <…')
(No difference)

Revision as of 06:47, 9 October 2014

/*
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);
}