Skip to content

Commit

Permalink
Merge pull request #12 from ISSOtm/patch-2
Browse files Browse the repository at this point in the history
Clarify that "words" are unrelated to strings
  • Loading branch information
ahrnbom committed Nov 26, 2020
2 parents 3ec828d + e34aa94 commit 6966720
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gbasmdev.tex
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ \section{Defining data}
\label{defdata}
When you write code, it will be compiled into simple numbers to be stored in the ROM file. It is possible to generate arbitrary numbers into the ROM file, which can be used for many things that are not necessarily game code to be executed on the CPU. Since the Game Boy CPU is so limited, it is often a good idea to precompute any complicated calculations, if possible, and store the results in a table in the ROM, where the Game Boy can simply read the results instead of trying to compute them. This can be useful for things like trigonometric functions (to have an object move like a sine-wave across the screen, for example). Computing a sine-wave in real-time on the Game Boy CPU would probably be a lot slower than just having a pre-computed one which can be read from the ROM.

To define such a table, it is a good idea to create a label at the top, so that the table can be referred to in code. There exist compiler commands for defining such data: |db| (to define data as bytes, 8-bit numbers) and |dw| (to define so-called words”, meaning 16-bit numbers). For example
To define such a table, it is a good idea to create a label at the top, so that the table can be referred to in code. There exist compiler commands for defining such data: |db| (to define data as bytes, 8-bit numbers) and |dw| (to define 16-bit numbers, called "words"; nothing to do with strings!). For example

\begin{code}
SomeTable:
Expand Down

0 comments on commit 6966720

Please sign in to comment.