Difference between revisions of "Code Examples"

From GbdevWiki
Jump to: navigation, search
(Simple GBBasic 2.10 example)
(Add internal link to gbbasic)
 
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
 
== Simple GBBasic 2.10 example ==
 
== Simple GBBasic 2.10 example ==
 +
[[GBBasic 2.10]]
  
 
+
<pre>
<nowiki>
+
[code]
+
 
10 rem Simple example
 
10 rem Simple example
 
20 for i=1 to 16
 
20 for i=1 to 16
Line 12: Line 10:
 
60 next i
 
60 next i
 
70 end
 
70 end
[/code]
+
</pre>
</nowiki>
+
 
 +
== GBDK C examples ==
 +
[https://github.com/mrombout/gbdk_playground GBDK Playground] - Simplified GBDK Examples
 +
 
 +
[[Simple paint program]]
 +
 
 +
[[Tic Tac Toe]]
 +
 
 +
[[Convert string to integer]]
 +
 
 +
[[Send byte across link cable]]
 +
 
 +
[[receive byte across link cable]]
 +
 
 +
== Simple GBDK example ==
 +
 
 +
<pre>
 +
 
 +
#include <gb/gb.h>
 +
#include <stdio.h>
 +
 
 +
void main()
 +
{
 +
printf("nHello World!");
 +
}
 +
 
 +
</pre>
 +
 
 +
== Assembler examples ==
 +
 
 +
* [[ASM Init| GB Initialization]]
 +
* [[ASM Joypad| Reading the joypad]]
 +
* [[ASM Snippets]]

Latest revision as of 01:10, 24 June 2021

Simple GBBasic 2.10 example

GBBasic 2.10

10 rem Simple example
20 for i=1 to 16
30 u=rnd(1)*16
40 print u
50 delay 20
60 next i
70 end

GBDK C examples

GBDK Playground - Simplified GBDK Examples

Simple paint program

Tic Tac Toe

Convert string to integer

Send byte across link cable

receive byte across link cable

Simple GBDK example


#include <gb/gb.h>
#include <stdio.h>

void main()
{
printf("nHello World!");
}

Assembler examples