summaryrefslogtreecommitdiffstats
path: root/manual/plugins/chip8emulator.tex
blob: 7f927effafa0f5e86c99c0d99d549d5b828695be (plain)
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
\subsection{\label{ref:Chip8emulator}Chip{}-8 Emulator}
Chip8 is a kind of assembly language for a long-gone architecture.
This plugin runs games written using the chip8 instructions.
To start a game open a \fname{.ch8} file in the \setting{File Browser}

There are lots of tiny Chip8 games (usually only about 256 bytes to a
couple of KB) which were made popular by the HP48
calculator's emulator for them. The original Chip8 had
64x32 pixel graphics, and the new superchip emulator supports 128x64
graphics.

The only problem is that they are based on a 4x4 keyboard, but since most
games do not use all of the buttons, this can easily be worked around.

To do this, one may put a \fname{.c8k} file with the same name as the
original program which contains new key mappings (for \fname{BLINKY.ch8}, one
writes a \fname{BLINKY.c8k} file). That \fname{.c8k} file contains 16
characters describing the mapping from the Chip8 keyboard to the default key
mapping (that way, several Chip8 keys can be pressed using only one
Rockbox key). For example, a file containing the single line:
\begin{code}
    0122458469ABCDEF
\end{code}
would correspond to the following non-default mappings:

3 $\rightarrow$ 2, 6 $\rightarrow$ 8, 7 $\rightarrow$4, 8 $\rightarrow$ 6.

The default keymappings are:
\begin{table}
    \begin{center}
    \begin{tabularx}{.9\textwidth}{c|ccccccccccccccccc}
    \toprule 
    Chip8 & Off & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 
        & A & B & C & D & E & F\\
    \midrule
    \begin{sideways}Key\end{sideways}
        &
        % key "off"
        \begin{sideways}
        \opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOff}
        \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonMenu}
        \opt{IAUDIO_X5_PAD}{\ButtonPower}
        \end{sideways} 
        &
        % Key "0"
        &
        % "Key "1"
        \begin{sideways}
        \opt{RECORDER_PAD}{\ButtonFOne}\opt{ONDIO_PAD}{\ButtonUp}
        \end{sideways}
        &
        % Key "2"
        \begin{sideways}
        \opt{RECORDER_PAD,ONDIO_PAD}{\ButtonUp}
        \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollBack}
        \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD}{\ButtonUp}
        \end{sideways}
        &
        % Key "3"
        \begin{sideways}
        \opt{RECORDER_PAD}{\ButtonFThree}
        \end{sideways}
        % Key "4"
        \begin{sideways}
        \opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonLeft}
        \opt{IPOD_4G_PAD,IPOD_3G_PAD,IAUDIO_X5_PAD}{\ButtonLeft}
        \end{sideways}
        &
        % Key "5"
        \begin{sideways}
        \opt{RECORDER_PAD}{\ButtonPlay}\opt{ONDIO_PAD}{\ButtonMenu}
        \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD}{\ButtonSelect}
        \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonPlay}
        \end{sideways}
        &
        % Key "6"
        \begin{sideways}
        \opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonRight}
        \opt{IPOD_4G_PAD,IPOD_3G_PAD,IAUDIO_X5_PAD}{\ButtonRight}
        \end{sideways}
        &
        % Key "7"
        \begin{sideways}
        \opt{RECORDER_PAD}{\ButtonFTwo}
        \end{sideways}
        &
        % Key "8"
        \begin{sideways}
        \opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonDown}
        \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollFwd}
        \opt{IAUDIO_X5_PAD}{\ButtonDown}
        \end{sideways}
        &
        % Key "9"
        \begin{sideways}
        \opt{RECORDER_PAD}{\ButtonOn}
        \end{sideways}
        &
        % Key "A"
        &
        % Key "B"
        &
        % Key "C"
        &
        % Key "D"
        &
        % Key "E"
        &
        % Key "F"
        &
    \\\bottomrule
    \end{tabularx}
    \end{center}
\end{table}

Some places where can you can find \fname{.ch8} files:
\begin{itemize}
\item The PluginChip8 page on www.rockbox.org has several attached:
\wikilink{PluginChip8}
\item Check out the HP48 chip games section:
\url{http://www.hpcalc.org/hp48/games/chip/}
\item PC emulator by the guy who wrote the HP48 emulator:
\url{http://www.pdc.kth.se/~lfo/chip8/CHIP8.htm}
\item Links to other chip8 emulators: 
\url{http://www.zophar.net/chip8.html}
\end{itemize}