Initial Commit
This commit is contained in:
17
z_gbdk_playground_original/link/Makefile
Normal file
17
z_gbdk_playground_original/link/Makefile
Normal 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) *~
|
||||
|
6
z_gbdk_playground_original/link/README.md
Normal file
6
z_gbdk_playground_original/link/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Link
|
||||
|
||||

|
||||
|
||||
Demonstrates how to use the Link Cable to send and receive bytes.
|
||||
|
30
z_gbdk_playground_original/link/link.c
Normal file
30
z_gbdk_playground_original/link/link.c
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
BIN
z_gbdk_playground_original/link/screenshot.png
Normal file
BIN
z_gbdk_playground_original/link/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user