Commit da2ec01c authored by PoroCYon's avatar PoroCYon
Browse files

add stuff

parents
THIS PRESENTATION IS UNDER THE NEARLY ALL-PERMISSIVE 'FUCK IF I CARE' LICENSE
WANNA SELL IT? SOUNDS DUMB, BUT FUCK IF I CARE
WANNA CHANGE IT? FUCK IF I CARE
YOU DON'T HAVE TO GIVE ME CREDIT
BUT THIS MESSAGE NEEDS TO REMAIN AT THE TOP OF THE FILE
TRANS RIGHTS, FUCK TERFS, DEATH TO AMERICA
default: all
all: dmg-cgb.pdf gba.pdf gcn.pdf linux.pdf snes.pdf ti8xz80.pdf
%.pdf:
$(MAKE) -C "$*"
@cp -v "$*/bin/pres.pdf" "$@"
clean:
for x in dmg-cgb gba gcn linux snes ti8xz80; do $(MAKE) -C "$x" clean; done
mrproper: clean
.PHONY: default all clean mrproper
obj/
bin/
TODO
default: all
USE_LATEXMK := $(shell which latexmk >/dev/null 2>&1 && echo 1 || echo 0)
PDFVIEW ?= mupdf
PAGER ?= less
PDFLATEX ?= pdflatex
TARGET := pres
ifneq ($(USE_LATEXMK),0)
LATEXMK ?= latexmk
LATEXMKFLAGS ?= -pdf -Werror -f- -use-make -outdir=obj/ \
-pdflatex="$(PDFLATEX) -interaction=nonstopmode"
else
PDFLATEXFLAGS ?= -output-directory=obj/
endif
BIBSRC := $(shell find ref -type f -name "*.bib")
%/:
@mkdir -vp "$@"
obj/$(TARGET).pdf: $(TARGET).tex obj/
ifneq ($(USE_LATEXMK),0)
$(LATEXMK) $(LATEXMKFLAGS) "$<"
else
$(PDFLATEX) $(PDFLATEXFLAGS) "$<"
endif
bin/$(TARGET).pdf: obj/$(TARGET).pdf bin/
@cp -v "$<" "$@"
all: bin/$(TARGET).pdf
clean:
ifneq ($(USE_LATEXMK),0)
$(LATEXMK) -CA $(LATEXMKFLAGS) $(TARGET).tex
else
@-$(RM) -v obj/*
endif
@-$(RM) -v bin/$(TARGET).pdf TODO
view: bin/$(TARGET).pdf
$(PDFVIEW) "$<"
.PHONY: default all clean view
todo:
rg -g '*.tex' -F TODO -p -C 2 | tee TODO | $(PAGER) -RS
\documentclass[english,aspectratio=169]{beamer} % TODO: for faster compilation: ,draft
% ,handout,notes=show
% ,notes=only
\newsavebox{\verbbox}
\usepackage{babel,url,graphicx,booktabs,alltt,xcolor,listings}
\usepackage{subfig,hyperref}
\usepackage[utf8]{inputenc}
\usepackage[normalem]{ulem}
\graphicspath{ {img/} }
% hack required for TeXLive 2018
\makeatletter
\let\@@magyar@captionfix\relax
\makeatother
% page numbers
\addtobeamertemplate{navigation symbols}{}{%
\usebeamerfont{footline}%
\usebeamercolor[fg]{footline}%
\hspace{1em}%
\insertframenumber/\inserttotalframenumber
}
\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command
\title{\textbf{Lovebyte 256 second seminar: Gameboy/Gameboy Color Sizecoding}}
\author{\textbf{PoroCYon / K2\^{}TiTAN}}
\date{}
%\AtBeginSection[]
%{
% \begin{frame}
% \frametitle{Table of Contents}
% \tableofcontents[currentsection]
% \end{frame}
%}
\usetheme{Szeged}
\usecolortheme{seagull}
%\usetheme{Singapore}
%\usecolortheme{default}
%\usetheme{Hannover}
%\usecolortheme{default}
\begin{document}
\frame{\titlepage}
% frame options: plain (for large contents), shrink (lots of text), allowframebreaks, fragile
% \pause, <a-b>
% \begin{columns}[align] \begin{column}[align]{5cm} ...
% \begin{block,alertblock,exampleblock}
% \include, dan pas \input
\begin{frame}{What's a GB?}
\begin{itemize}
\item Z80-ish @ 4.2/8.4 MHz
\item 8k/32k RAM, 8k/16k VRAM
\item Background, window, 40 sprites (10/line)
\end{itemize}
\end{frame}
\begin{frame}{Toolchains}
\begin{description}
\item[Assembler]: \texttt{rgbasm} from
\texttt{rgbds}\footnote{\url{https://rgbds.gbdev.io/}}.
\item[\texttt{rgbfix}]: to fix up cart headers (included in \texttt{rgbds})
\item[HW docs]: Pan Docs\footnote{\url{https://gbdev.io/pandocs/}},
GBDev wiki\footnote{\url{https://gbdev.gg8.se/wiki/articles/Main_Page}}
\item[Emulator]: BGB, Gambatte, Sameboy, ...
\end{description}
\end{frame}
\begin{frame}{Hurdle 1: cartridge entrypoint}
\begin{itemize}
\item Entrypoint at \texttt{+0x100} in file
\item \texttt{+0x000}: RST, \texttt{+0x040}: IRQ (vblank etc)
\end{itemize}
~\\
\begin{itemize}
\item Skip RST and maybe IRQ, pad with zeros\footnote{
\url{https://www.pouet.net/prod.php?which=70163} does this, too}
\end{itemize}
\end{frame}
\begin{frame}{Hurdle 2: cartridge header}
\begin{itemize}
\item \texttt{+0x100}: Entry point
\item \texttt{+0x104..0x133}: Nintendo logo (include in safe version!
skip in emulator version)
\item \texttt{+0x134..0x14f}: Cartridge metadata (title, CGB, ROM/RAM size, ...)
\end{itemize}
~\\
\begin{itemize}
\item Drop IRQs (zeroed out) when specific metadata values (eg. CGB
mode) are needed
\end{itemize}
\end{frame}
\begin{frame}{Graphics and sound}
Graphics:
\begin{itemize}
\item Tiled background, 2bpp, scrollable
\item Window: smaller background, no transparency, less controllable
\item Sprites: similar format as background, 8x8 or 8x16
\item CGB: palette of 32768 colors
\item Init: \texttt{LCDC} register
\end{itemize}
Sound:
\begin{itemize}
\item 4-channel PSG
\item More annoying to init (\texttt{NR50}, \texttt{NR51},
\texttt{NR52})
\end{itemize}
\end{frame}
\begin{frame}{Example prod}
\begin{center}
{\large ``Pocket party''\footnote{\url{https://www.pouet.net/prod.php?which=85348}}
by PoroCYon/K2\^{}TiTAN\normalsize} (4k)
\includegraphics[height=0.5\textheight]{pparty-screen.png}
\begin{itemize}
\item Most of the ROM is background image data
\end{itemize}
\end{center}
\end{frame}
\begin{frame}{Conclusion}
\begin{center}
{\Huge \textbf{Go make an intro!}}
\end{center}
\end{frame}
%\begin{frame}{Questions}
% \begin{center}
% \Huge \textbf{Questions?}
% \end{center}
%\end{frame}
\end{document}
obj/
bin/
TODO
default: all
USE_LATEXMK := $(shell which latexmk >/dev/null 2>&1 && echo 1 || echo 0)
PDFVIEW ?= mupdf
PAGER ?= less
PDFLATEX ?= pdflatex
TARGET := pres
ifneq ($(USE_LATEXMK),0)
LATEXMK ?= latexmk
LATEXMKFLAGS ?= -pdf -Werror -f- -use-make -outdir=obj/ \
-pdflatex="$(PDFLATEX) -interaction=nonstopmode"
else
PDFLATEXFLAGS ?= -output-directory=obj/
endif
BIBSRC := $(shell find ref -type f -name "*.bib")
%/:
@mkdir -vp "$@"
obj/$(TARGET).pdf: $(TARGET).tex obj/
ifneq ($(USE_LATEXMK),0)
$(LATEXMK) $(LATEXMKFLAGS) "$<"
else
$(PDFLATEX) $(PDFLATEXFLAGS) "$<"
endif
bin/$(TARGET).pdf: obj/$(TARGET).pdf bin/
@cp -v "$<" "$@"
all: bin/$(TARGET).pdf
clean:
ifneq ($(USE_LATEXMK),0)
$(LATEXMK) -CA $(LATEXMKFLAGS) $(TARGET).tex
else
@-$(RM) -v obj/*
endif
@-$(RM) -v bin/$(TARGET).pdf TODO
view: bin/$(TARGET).pdf
$(PDFVIEW) "$<"
.PHONY: default all clean view
todo:
rg -g '*.tex' -F TODO -p -C 2 | tee TODO | $(PAGER) -RS
\documentclass[english,aspectratio=169]{beamer} % TODO: for faster compilation: ,draft
% ,handout,notes=show
% ,notes=only
\newsavebox{\verbbox}
\usepackage{babel,url,graphicx,booktabs,alltt,xcolor,listings}
\usepackage{subfig,hyperref}
\usepackage[utf8]{inputenc}
\usepackage[normalem]{ulem}
\graphicspath{ {img/} }
% hack required for TeXLive 2018
\makeatletter
\let\@@magyar@captionfix\relax
\makeatother
% page numbers
\addtobeamertemplate{navigation symbols}{}{%
\usebeamerfont{footline}%
\usebeamercolor[fg]{footline}%
\hspace{1em}%
\insertframenumber/\inserttotalframenumber
}
\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command
\title{\textbf{Lovebyte 256 second seminar: Gameboy Advance Sizecoding}}
\author{\textbf{PoroCYon / K2\^{}TiTAN}}
\date{}
%\AtBeginSection[]
%{
% \begin{frame}
% \frametitle{Table of Contents}
% \tableofcontents[currentsection]
% \end{frame}
%}
\usetheme{Szeged}
\usecolortheme{seagull}
%\usetheme{Singapore}
%\usecolortheme{default}
%\usetheme{Hannover}
%\usecolortheme{default}
\begin{document}
\frame{\titlepage}
% frame options: plain (for large contents), shrink (lots of text), allowframebreaks, fragile
% \pause, <a-b>
% \begin{columns}[align] \begin{column}[align]{5cm} ...
% \begin{block,alertblock,exampleblock}
% \include, dan pas \input
\begin{frame}{What's a GBA?}
\begin{itemize}
\item ARM7TDMI @ 16 MHz
\item ARM and Thumb(v1) code, no FPU/VFP/NEON
\item 32k fast RAM, 256k slow RAM
\item SNES-ish PPU, 96k VRAM
\item Useful routines in ``BIOS'' (\texttt{memcpy}, LZ77 decompression, ...)
\end{itemize}
\end{frame}
\begin{frame}{Toolchains}
\begin{description}
\item[Assembler]: from
devkitARM\footnote{\url{https://devkitpro.org/wiki/Getting_Started}}, or just
GNU as
\item[\texttt{gbafix}]: to fix up cart headers (included in DKA)
\item[HW docs]: GBATEK\footnote{\url{https://problemkaputt.de/gbatek.htm}}
\item[Emulator]: mGBA\footnote{\url{http://mgba.io/}}
\end{description}
\end{frame}
\begin{frame}{Hurdle 1: cartridge header}
\begin{itemize}
\item Includes a 156b Nintendo logo
\item Mandatory on hw, emulators don't care
\item My `strategy': $\le$256b emu version, $>$256b `safe' version
\item Watch out: fixed \texttt{0x96} and checksum bytes!
\end{itemize}
\begin{center}
\includegraphics[width=0.8\textwidth]{carthdr.png}
\end{center}
\end{frame}
\begin{frame}{Hurdle 2: cartridge}
\begin{itemize}
\item Entrypoint is in cartridge memory
\item \textbf{VERY} slow bus
\item $\to$ immediately relocate to IWRAM (fast 32k RAM)
\item Do Thumb modeswitch at the same time
\item Payload can be decompressed using BIOS routines!
\end{itemize}
\begin{center}
\includegraphics[width=0.4\textwidth]{memspeed.png}
\end{center}
\end{frame}
\begin{frame}{Graphics}
\begin{itemize}
\item Basically a SNES with extra features
\item Framebuffer, many sprites, `mode 7' stuff, ...
\item HBlank effects: race \texttt{VCOUNT}, don't use IRQ
\item Initialize using \texttt{DISPCNT} (1 register)
\end{itemize}
\end{frame}
\begin{frame}{Sound}
\begin{itemize}
\item GB/GBC-style, 2ch PCM
\item Much more annoying to init (\texttt{SOUNDCNT},
\texttt{SOUNDCNT\_X}, \texttt{SOUNDBIAS})
\item PCM: needs extra timer and DMA setup $\to$ not feasible in 256b
\end{itemize}
\end{frame}
\begin{frame}{Example prod}
\begin{center}
{\large ``Xmas card intro''\footnote{\url{https://www.pouet.net/prod.php?which=87662}}
by PoroCYon/K2\^{}TiTAN\normalsize}
\includegraphics[width=0.5\textwidth]{xmas-screen.png}
\begin{itemize}
\item 2 background layers, `mode 7' transforms during HBlank
\end{itemize}
\end{center}
\end{frame}
\begin{frame}{Conclusion}
\begin{center}
{\Huge \textbf{Go make an intro!}}
\end{center}
\end{frame}
%\begin{frame}{Questions}
% \begin{center}
% \Huge \textbf{Questions?}
% \end{center}
%\end{frame}
\end{document}
obj/
bin/
TODO
default: all
USE_LATEXMK := $(shell which latexmk >/dev/null 2>&1 && echo 1 || echo 0)
PDFVIEW ?= mupdf
PAGER ?= less
PDFLATEX ?= pdflatex
TARGET := pres
ifneq ($(USE_LATEXMK),0)
LATEXMK ?= latexmk
LATEXMKFLAGS ?= -pdf -Werror -f- -use-make -outdir=obj/ \
-pdflatex="$(PDFLATEX) -interaction=nonstopmode"
else
PDFLATEXFLAGS ?= -output-directory=obj/
endif
BIBSRC := $(shell find ref -type f -name "*.bib")
%/:
@mkdir -vp "$@"
obj/$(TARGET).pdf: $(TARGET).tex obj/
ifneq ($(USE_LATEXMK),0)
$(LATEXMK) $(LATEXMKFLAGS) "$<"
else
$(PDFLATEX) $(PDFLATEXFLAGS) "$<"
endif
bin/$(TARGET).pdf: obj/$(TARGET).pdf bin/
@cp -v "$<" "$@"
all: bin/$(TARGET).pdf
clean:
ifneq ($(USE_LATEXMK),0)
$(LATEXMK) -CA $(LATEXMKFLAGS) $(TARGET).tex
else
@-$(RM) -v obj/*
endif
@-$(RM) -v bin/$(TARGET).pdf TODO
view: bin/$(TARGET).pdf
$(PDFVIEW) "$<"
.PHONY: default all clean view
todo:
rg -g '*.tex' -F TODO -p -C 2 | tee TODO | $(PAGER) -RS
\documentclass[english,aspectratio=169]{beamer} % TODO: for faster compilation: ,draft
% ,handout,notes=show
% ,notes=only
\newsavebox{\verbbox}
\usepackage{babel,url,graphicx,booktabs,alltt,xcolor,listings}
\usepackage{subfig,hyperref}
\usepackage[utf8]{inputenc}
\usepackage[normalem]{ulem}
\graphicspath{ {img/} }
% hack required for TeXLive 2018
\makeatletter
\let\@@magyar@captionfix\relax
\makeatother
% page numbers
\addtobeamertemplate{navigation symbols}{}{%
\usebeamerfont{footline}%
\usebeamercolor[fg]{footline}%
\hspace{1em}%
\insertframenumber/\inserttotalframenumber
}
\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command
\title{\textbf{Lovebyte 256 second seminar: Gamecube Sizecoding}}
\author{\textbf{PoroCYon / K2\^{}TiTAN}}
\date{}
%\AtBeginSection[]
%{
% \begin{frame}
% \frametitle{Table of Contents}
% \tableofcontents[currentsection]
% \end{frame}
%}
\usetheme{Szeged}
\usecolortheme{seagull}
%\usetheme{Singapore}
%\usecolortheme{default}
%\usetheme{Hannover}
%\usecolortheme{default}
\begin{document}
\frame{\titlepage}
% frame options: plain (for large contents), shrink (lots of text), allowframebreaks, fragile
% \pause, <a-b>
% \begin{columns}[align] \begin{column}[align]{5cm} ...
% \begin{block,alertblock,exampleblock}
% \include, dan pas \input
\begin{frame}{What's a Gamecube?}
\begin{itemize}
\item PPC750CXe ``Gekko'' @ 485 MHz
\item `paired single' custom SIMD instructions
\item 24M RAM, 16M ARAM, 3M VRAM
\item `VI' CRTC, `Flipper' GPU, with TEV
\end{itemize}
\end{frame}
\begin{frame}{Toolchains}
\begin{description}
\item[Assembler]: from
devkitPPC\footnote{\url{https://devkitpro.org/wiki/Getting_Started}}, or just
GNU as
\item[HW docs]: YAGCD\footnote{\url{http://hitmen.c02.at/files/yagcd/yagcd/}},
Wiibrew\footnote{\url{https://wiibrew.org/}}, libogc headers
\item[Emulator]: Dolphin
\end{description}
\end{frame}
\begin{frame}{Hurdle: DOL header}
\begin{columns}[T]
\begin{column}{.6\textwidth}
\begin{itemize}
\item DOL: executable file format used for GCN
\item 256 bytes in size\footnotemark[1]
\item Only one section + entrypoint needed, rest can be garbage
\item Section sizes need to be zero, otherwise the loader tries to
load them!
\end{itemize}
\end{column}
\begin{column}{.4\textwidth}
\includegraphics[width=\textwidth]{dolhdr.png}
\end{column}
\end{columns}
\footnotetext[1]{\url{https://wiibrew.org/wiki/DOL}}
\end{frame}
\begin{frame}{Graphics}
\begin{itemize}
\item Flipper driver in 256b: good luck
\item Simple framebuffer (EFB): YUYV
\item VI registers need to be configured first \\~\\
\item Note: \texttt{0xCCxxxxxx}: virtual address,
\texttt{0x0Cxxxxxx}: physical address
\end{itemize}
\end{frame}
\begin{frame}{Sound}
\begin{itemize}
\item 16-channel PCM
\item Accessed through `AI', Audio Interface
\item VERY badly documented -- see libogc sources...
\end{itemize}
\end{frame}
\begin{frame}{Example prod}
\begin{center}
{\large ``xorpinski''\footnote{\url{https://www.pouet.net/prod.php?which=79677}}
by vl4d\normalsize}