Initial Commit

This commit is contained in:
2020-07-11 08:41:14 -05:00
parent 55c0f7f3cd
commit 1478a597cf
176 changed files with 11933 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
AS = lcc -c
CC = lcc -Wa-l -Wl-m
BIN = link.gb
OBJS = link.o
all: $(BIN)
%.s: %.ms
maccer -o $@ $<
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(OBJS)
clean:
rm -rf $(BIN) $(OBJS) *~

View File

@@ -0,0 +1,6 @@
# Link
![](screenshot.png)
Demonstrates how to use the Link Cable to send and receive bytes.

View File

@@ -0,0 +1,30 @@
#include <stdio.h>
#include <gb/gb.h>
void main(void) {
printf("A: Send\nB: Receive\n\n");
_io_out = 1;
while (1) {
if (joypad() == J_A) {
waitpadup();
send_byte(); // send _io_out
printf("Sending...\n");
while (_io_status == IO_SENDING); // Wait for Send
if (_io_status == IO_IDLE) // If IO status returns to Idle then success
printf("Sent %d\n", (int)_io_out);
else
printf("Error\n"); // Else print error code
_io_out++;
}
if (joypad() == J_B) {
waitpadup();
receive_byte(); // receive _io_in
printf("Receiving...\n");
while (_io_status == IO_RECEIVING); // Wait for Receive
if (_io_status == IO_IDLE) // If IO status returns to Idle then success
printf("Received %d\n", (int)_io_in);
else
printf("Error\n"); // Else print error
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB