rubygb 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/Gemfile.lock +13 -1
  4. data/README.md +3 -3
  5. data/lib/galp/memory.inc +153 -0
  6. data/lib/rgbds/LICENSE +32 -0
  7. data/lib/rubygb/cli.rb +26 -2
  8. data/lib/rubygb/template/template.rb +99 -0
  9. data/lib/rubygb/version.rb +1 -1
  10. data/lib/rubygb.rb +1 -0
  11. data/rubygb.gemspec +2 -0
  12. data/scrap/example/gbhw.inc +645 -0
  13. data/{lib/galp/EXAMPLE1.TXT → scrap/example/hello-world-with-comments.asm} +123 -113
  14. data/scrap/example/hello-world-with-comments.gb +0 -0
  15. data/scrap/example/hello-world-with-comments.map +65 -0
  16. data/scrap/example/hello-world-with-comments.obj +0 -0
  17. data/scrap/example/hello-world-with-comments.sym +12 -0
  18. data/scrap/example/ibmpc1.inc +2400 -0
  19. data/scrap/test/lib/gbhw.inc +645 -0
  20. data/scrap/test/lib/ibmpx1.inc +2400 -0
  21. data/scrap/test/lib/memory.inc +153 -0
  22. data/scrap/test/test.gb +0 -0
  23. data/scrap/test/test.map +65 -0
  24. data/scrap/test/test.obj +0 -0
  25. data/scrap/test/test.s +91 -0
  26. data/scrap/test/test.sym +12 -0
  27. metadata +37 -31
  28. data/lib/galp/AND.GIF +0 -0
  29. data/lib/galp/ARROW.GIF +0 -0
  30. data/lib/galp/C.BAT +0 -5
  31. data/lib/galp/CHANGES.TXT +0 -5
  32. data/lib/galp/EXAMPLE.LNK +0 -7
  33. data/lib/galp/GBSPEC.TXT +0 -1761
  34. data/lib/galp/INDEX.HTM +0 -23
  35. data/lib/galp/INSTR.HTM +0 -563
  36. data/lib/galp/MEM1.HTM +0 -199
  37. data/lib/galp/OPCODES.HTM +0 -351
  38. data/lib/galp/OR.GIF +0 -0
  39. data/lib/galp/README.TXT +0 -4
  40. data/lib/galp/REGS.HTM +0 -77
  41. data/lib/galp/RL.GIF +0 -0
  42. data/lib/galp/RLC.GIF +0 -0
  43. data/lib/galp/RR.GIF +0 -0
  44. data/lib/galp/RRC.GIF +0 -0
  45. data/lib/galp/SETUP.BAT +0 -7
  46. data/lib/galp/SLA.GIF +0 -0
  47. data/lib/galp/SRA.GIF +0 -0
  48. data/lib/galp/SRL.GIF +0 -0
  49. data/lib/galp/START.HTM +0 -24
  50. data/lib/galp/SWAP.GIF +0 -0
  51. data/lib/galp/VID1.HTM +0 -34
  52. data/lib/galp/XOR.GIF +0 -0
  53. /data/lib/galp/{GBHW.TXT → gbhw.inc} +0 -0
  54. /data/lib/galp/{IBMPC1.TXT → ibmpx1.inc} +0 -0
  55. /data/{lib/galp/MEMORY.TXT → scrap/example/memory.asm} +0 -0
data/lib/galp/REGS.HTM DELETED
@@ -1,77 +0,0 @@
1
- <!DOCTYPE HTML PUBLIC "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN">
2
- <HTML><HEAD><TITLE>GameBoy Assembly Language Primer - Registers</TITLE></HEAD>
3
- <BODY><CENTER><H2>GameBoy Assembly Language Primer</H2></CENTER>
4
- <HR>
5
- <CENTER><H2>GameBoy CPU Registers</H2></CENTER>
6
- <P>The GameBoy has instructions &amp; registers similar to the Intel 8080,
7
- Intel 8085, &amp; Zilog Z80 microprocessors. It has eight 8-bit registers
8
- A,B,C,D,E,F,H,L and two 16-bit registers SP &amp; PC:</P>
9
- <CENTER><TABLE BORDER="1" WIDTH="200"><TR><TD COLSTART="1" ALIGN="CENTER">15....8</TD>
10
- <TD COLSTART="2" ALIGN="CENTER">7......0</TD></TR><TR><TD
11
- COLSTART="1" WIDTH="10" ALIGN="CENTER"><STRONG>A</STRONG></TD><TD
12
- COLSTART="2" ALIGN="CENTER"><STRONG>F</STRONG></TD></TR><TR><TD
13
- COLSTART="1" ALIGN="CENTER"><STRONG>B</STRONG></TD><TD
14
- COLSTART="2" ALIGN="CENTER"><STRONG>C</STRONG></TD></TR><TR><TD
15
- COLSTART="1" ALIGN="CENTER"><STRONG>D</STRONG></TD><TD
16
- COLSTART="2" ALIGN="CENTER"><STRONG>E</STRONG></TD></TR><TR><TD
17
- COLSTART="1" ALIGN="CENTER"><STRONG>H</STRONG></TD><TD
18
- COLSTART="2" ALIGN="CENTER"><STRONG>L</STRONG></TD></TR><TR><TD
19
- COLSTART="1" COLSPAN="2" ALIGN="CENTER"><STRONG>SP</STRONG></TD></TR><TR><TD
20
- COLSTART="1" COLSPAN="2" ALIGN="CENTER"><STRONG>PC</STRONG></TD></TR></TABLE></CENTER>
21
- <P>Some instructions, however, allow you to use the registers A,B,C,D,E,H, &amp;
22
- L as 16-bit registers by pairing them up in the following manner: <STRONG>AF,BC,DE,
23
- &amp; HL</STRONG>. The <STRONG>F</STRONG> register is indirectly accessible by
24
- the programmer and is used to store the results of various math operations.</P>
25
- <P>The <STRONG>PC</STRONG>, or Program Counter, register points to the next
26
- instruction to be executed in the GameBoy memory. The <STRONG>SP</STRONG>, or
27
- Stack Pointer, register points to the current stack position.</P>
28
- <HR>
29
- <H2>Program Counter</H2>
30
- <P>On power up, the GameBoy Program Counter is initialized to $100 (100 hex)
31
- and the instruction found at this location in ROM is executed. The Program
32
- Counter from this point on is controlled, indirectly, by the program
33
- instructions themselves that were generated by the programmer of the ROM cart.</P>
34
- <H2>Stack Pointer</H2>
35
- <P>A big key to understanding programming in assembly language on the GameBoy
36
- is understanding the concept of a stack pointer. A familiarity with assembly
37
- language for other processors helps greatly as the concepts are the same.</P>
38
- <P>The GameBoy Stack Pointer is used to keep track of the top of the &quot;stack&quot;.
39
- The stack is used for saving variables, saving return addresses, passing
40
- arguments to subroutines, and various other uses that might be conceived by the
41
- individual programmer.</P>
42
- <P>The instructions CALL, PUSH, and RST all put information onto the stack. The
43
- instructions POP, RET, and RETI all take information off of the stack.
44
- (Interrupts put a return address on the stack and remove it at their completion
45
- as well.) As information is put onto the stack, the stack grows downward in RAM
46
- memory. As a result, the Stack Pointer should always be initialized at the
47
- highest location of RAM space that has been allocated for use by the stack. For
48
- instance, if a programmer wishes to locate the Stack Pointer at the top of low
49
- RAM space ($C000-$DFFF) he would set the Stack Pointer to $E000 using the
50
- command <STRONG>LD SP,$E000</STRONG>. (The Stack Pointer automatically
51
- decrements before it puts something onto the stack so it is perfectly acceptable
52
- to assign it a value which points to a memory address which is one location past
53
- the end of available RAM.)</P>
54
- <P>The GameBoy stack pointer is initialized to $FFFE on power up but a
55
- programmer should not rely on this setting and rather should explicitly set its
56
- value.</P>
57
- <H2>Flag Register</H2>
58
- <CENTER><TABLE BORDER="1" WIDTH="200"><TR><TD COLSTART="1">7</TD><TD
59
- COLSTART="2">6</TD><TD COLSTART="3">5</TD><TD COLSTART="4">4</TD><TD
60
- COLSTART="5">3</TD><TD COLSTART="6">2</TD><TD COLSTART="7">1</TD><TD
61
- COLSTART="8">0</TD></TR><TR><TD COLSTART="1"><STRONG>Z</STRONG></TD><TD
62
- COLSTART="2"><STRONG>N</STRONG></TD><TD COLSTART="3"><STRONG>H</STRONG></TD><TD
63
- COLSTART="4"><STRONG>C</STRONG></TD><TD COLSTART="5"><STRONG>0</STRONG></TD><TD
64
- COLSTART="6"><STRONG>0</STRONG></TD>
65
- <TD COLSTART="7"><STRONG>0</STRONG></TD><TD COLSTART="8"><STRONG>0</STRONG></TD></TR></TABLE></CENTER>
66
- <UL>
67
- <LI><STRONG>Zero Flag (Z)</STRONG> - This bit is set when the result of a math
68
- operation is zero or two values match when using the CP instruction. </LI>
69
- <LI><STRONG>Subtract Flag (N)</STRONG> - This bit is set if a subtraction was
70
- performed in the last math instruction.</LI>
71
- <LI><STRONG>Half Carry Flag (H)</STRONG> - This bit is set if a carry occurred
72
- from the lower nibble in the last math operation.</LI>
73
- <LI><STRONG>Carry Flag (C)</STRONG> - This bit is set if a carry occurred from
74
- the last math operation or if register A is the smaller value when executing the
75
- CP instruction.</LI>
76
- </UL>
77
- <HR></BODY></HTML>
data/lib/galp/RL.GIF DELETED
Binary file
data/lib/galp/RLC.GIF DELETED
Binary file
data/lib/galp/RR.GIF DELETED
Binary file
data/lib/galp/RRC.GIF DELETED
Binary file
data/lib/galp/SETUP.BAT DELETED
@@ -1,7 +0,0 @@
1
- mkdir example1
2
- copy c.bat example1\c.bat
3
- copy example.lnk example1\example.lnk
4
- copy example1.txt example1\example.asm
5
- copy gbhw.txt example1\gbhw.inc
6
- copy ibmpc1.txt example1\ibmpc1.inc
7
- copy memory.txt example1\memory.asm
data/lib/galp/SLA.GIF DELETED
Binary file
data/lib/galp/SRA.GIF DELETED
Binary file
data/lib/galp/SRL.GIF DELETED
Binary file
data/lib/galp/START.HTM DELETED
@@ -1,24 +0,0 @@
1
- <!DOCTYPE HTML PUBLIC "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN">
2
- <HTML><HEAD><TITLE>GameBoy Assembly Language Primer - Registers</TITLE></HEAD>
3
- <BODY><CENTER><H2>GameBoy Assembly Language Primer</H2></CENTER>
4
- <HR>
5
- <CENTER><H2>Getting Started</H2></CENTER>
6
- <P>This primer is geared towards beginners but it might be helpful to those
7
- that have more advanced knowledge as well. It is designed to let a person
8
- immediately try the samples to familiarize them with GameBoy Programming.</P>
9
- <P>The samples in this primer are geared around the RGBDS GameBoy Assembler
10
- written by Carsten Sorensen. This assember was chosen because it is by far the
11
- most powerful GameBoy assembler currently available and it is also currently
12
- free as well. To compile the samples found in these examples you need the
13
- following files from the RGBDS distribution somewhere in the DOS path: <STRONG>RGBASM.EXE,
14
- RGBFIX.EXE, </STRONG>and <STRONG>XLINK.EXE</STRONG> (or RGBLINK.EXE). If you
15
- are not sure how to include these in the DOS path then just copy them to
16
- C:\WINDOWS and you should be set.</P>
17
- <P>The samples you see in the following pages are automatically put into their
18
- own directory for compiling/testing by going to the DOS directory that contains
19
- these html pages and just typing: <STRONG>SETUP</STRONG>. Then, to compile
20
- Example 1 (for instance) you just do a <STRONG>cd example1</STRONG> and then
21
- just type <STRONG>c</STRONG> to compile Example 1 into a standard .GB ROM file.
22
- This ROM file is then useable on a GameBoy Emulator or on the real GameBoy
23
- hardware with a suitable flash cartridge or other setup.</P>
24
- <HR></BODY></HTML>
data/lib/galp/SWAP.GIF DELETED
Binary file
data/lib/galp/VID1.HTM DELETED
@@ -1,34 +0,0 @@
1
- <!DOCTYPE HTML PUBLIC "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN">
2
- <HTML><HEAD><TITLE>GameBoy Assembly Language Primer - Registers</TITLE></HEAD>
3
- <BODY><CENTER><H2>GameBoy Assembly Language Primer</H2></CENTER>
4
- <HR>
5
- <CENTER><H2>GameBoy Video Hardware</H2></CENTER>
6
- <P>The GameBoy has physical memory space from $0000 to $FFFF:</P>
7
- <CENTER><TABLE BORDER="1"><TR><TD COLSTART="1">$9800</TD><TD COLSTART="2">$9801</TD>
8
- <TD COLSTART="3">$9802</TD><TD COLSTART="4">$9803</TD><TD COLSTART="5">....</TD><TD
9
- COLSTART="6">$981F</TD></TR><TR><TD COLSTART="1">$9820</TD><TD COLSTART="2">$9821</TD>
10
- <TD COLSTART="3">$9822</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
11
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">$9840</TD><TD COLSTART="2">$9841</TD>
12
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
13
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">$9860</TD><TD COLSTART="2">....</TD>
14
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
15
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">....</TD><TD COLSTART="2">....</TD>
16
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
17
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">$9BE0</TD><TD COLSTART="2">....</TD>
18
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
19
- COLSTART="6">$9BFF</TD></TR></TABLE></CENTER>
20
- <CENTER><TABLE BORDER="1"><TR><TD COLSTART="1">$9C00</TD><TD COLSTART="2">$9C01</TD>
21
- <TD COLSTART="3">$9C02</TD><TD COLSTART="4">$9C03</TD><TD COLSTART="5">....</TD><TD
22
- COLSTART="6">$9C1F</TD></TR><TR><TD COLSTART="1">$9C20</TD><TD COLSTART="2">$9C21</TD>
23
- <TD COLSTART="3">$9C22</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
24
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">$9C40</TD><TD COLSTART="2">$9C41</TD>
25
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
26
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">$9C60</TD><TD COLSTART="2">....</TD>
27
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
28
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">....</TD><TD COLSTART="2">....</TD>
29
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
30
- COLSTART="6">....</TD></TR><TR><TD COLSTART="1">$9FE0</TD><TD COLSTART="2">....</TD>
31
- <TD COLSTART="3">....</TD><TD COLSTART="4">....</TD><TD COLSTART="5">....</TD><TD
32
- COLSTART="6">$9FFF</TD></TR></TABLE></CENTER>
33
- <HR>
34
- </BODY></HTML>
data/lib/galp/XOR.GIF DELETED
Binary file
File without changes
File without changes
File without changes