Nintendo DMG-01 Manual - Page 31

Serial I/O - gameboy serial

Page 31 highlights

Game BoyTM CPU Manual 2.11. Serial I/O 2.11. Serial I/O The serial I/O port on the Gameboy is a very simple setup and is crude compared to standard RS-232 (IBMPC) or RS-485 (Macintosh) serial ports. There are no start or stop bits so the programmer must be more creative when using this port. During a transfer, a byte is shifted in at the same time that a byte is shifted out. The rate of the shift is deter- mined by whether the clock source is internal or external. If internal, the bits are shifted out at a rate of 8192Hz (122 microseconds) per bit. The most significant bit is shifted in and out first. When the internal clock is selected, it drives the clock pin on the game link port and it stays high when not used. During a transfer it will go low eight times to clock in/out each bit. A programmer initates a serial transfer by setting bit 7 of $FF02. This bit may be read and is automatically set to 0 at the completion of transfer. After this bit is set, an interrupt will then occur eight bit clocks later if the serial interrupt is enabled. If internal clock is selected and serial interrupt is enabled, this interrupt occurs 122*8 microseconds later. If external clock is selected and serial interrupt is enabled, an interrupt will occur eight bit clocks later. Initiating a serial transfer with external clock will wait forever if no external clock is present. This by DP Page 31

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139

Game Boy
TM
CPU Manual
2.11. Serial I/O
2.11.
Serial I/O
The serial I/O port on the Gameboy is a very simple
setup and is crude compared to standard RS-232 (IBM-
PC) or RS-485 (Macintosh) serial ports. There are no
start or stop bits so the programmer must be more
creative when using this port.
During a transfer, a byte is shifted in at the same
time that a byte is shifted out. The rate of the shift
is deter- mined by whether the clock source is
internal or external. If internal, the bits are
shifted out at a rate of 8192Hz (122 microseconds) per
bit. The most significant bit is shifted in and out
first.
When the internal clock is selected, it drives the
clock pin on the game link port and it stays high when
not used. During a transfer it will go low eight times
to clock in/out each bit.
A programmer initates a serial transfer by setting bit
7 of $FF02. This bit may be read and is automatically
set to 0 at the completion of transfer. After this bit
is set, an interrupt will then occur eight bit clocks
later if the serial interrupt is enabled.
If internal clock is selected and serial interrupt is
enabled, this interrupt occurs 122*8 microseconds
later.
If external clock is selected and serial interrupt is
enabled, an interrupt will occur eight bit clocks
later.
Initiating a serial transfer with external clock will
wait forever if no external clock is present. This
by DP
Page 31