GPL-A (2K RAM) Syntax

Information

I expect GPL-A stands for Game Programming Language, version A.

The two GPL-A versions described here are very similar, obviously the 2K RAM version will fit into that whereas the 2K ROM version will need RAM located at hex 800-9FF as it uses screen location 0900-09FF and V0-F are stored on 0880-088F. Interrupt routines are different and they have slightly different code for the timers. Command syntax is more or less the same for both with differences in:

This info is also available online on the Emma 02 site.

Definitions

aaa 12 bit address
kk 8 bit constant
d 4 bit constant
n 4 bit constant
x Register number Vx (x = 0 to F)
y Register number Vy (y = 0 to F)
z Register number Vz (y = 0 to F)
[8aa] Memory value of address aa within page 8 (RAM)
[Vy] Memory value of address in register Vy within in page 8 (RAM)
F= Tone frequency
. Not used, value doesn't matter
1..9, A..F Hexadecimal digits

Syntax

6xyz ADD Vz, Vx+Vy Vz = Vx + Vy, V0 = carry
6xyx ADD Vx, Vy Vx = Vx + Vy, V0 = carry
Bxyx ADD8 Vx, Vy, Vz If (Vx+Vy)&7 = 8 THEN Vz = hex FF ELSE Vx = Vx+Vy
9dkk BEEP F=kk, d
kk, d
Beep with a frequency kk and duration d
1aaa CALL aaa Call subroutine at aaa. The subroutine must end in C0 (which is the 'GPL' equivalent of RETURN)
Axyn DRW Vx, Vy, n Draw 8*8 graphics:
n: bit 0-2, specify the number of graphics to draw - 1 (0 will draw one graphic, 7 will draw 8 graphics)
n: bit 3, 0 = next graphic, 1 = repeat same graphic
Page 6 [Vx to Vx+8] contains the graphic memory location start, calculated as:
- bit 0 defines the lower byte of graphic memory location bit 3
- bit 1-3 defines page number 0=Page 5, 1=Page 4, 2=Page 3, 3=Page 2 etc.
- bit 4-7 defines the lower byte of graphic memory location bit 4-7 e.g. B0 points to memory 5B0, B2 points to 4B0, B3 points to 4B8.
Graphic memory location bit 0-2 are always 0, the graphic memory should contain 8 bytes to make up the 8*8 graphic which will be stored on screen location Vy-hex A0. Where hex A0 is top left corner, hex A8 the right corner, hex D0 bottom left corner and hex D8 bottom right corner. The memory location values used (from page 6) are copied to hex 8A0-8D8 RAM
Faaa JP aaa Jump to address aaa
5xy. LD B, Vy, Vx Store BCD value of Vx in Vy, Vy+1 and Vy+2, Vy will point to last byte of the converted number
Ex.0 LD Vx, COIN Load status coin detector to Vx, no coin Vx = 0, coin Vx = 1
Ex.1 LD Vx, FIREA Load status fire key player A to Vx, no fire pressed Vx = 0, fire pressed Vx = 1
Ex.2 LD Vx, FIREB Load status fire key player B to Vx, no fire pressed Vx = 0, fire pressed Vx = 1
Ex.4 LD Vx, JOYA Load status joystick keys player A to Vx
Ex.8 LD Vx, JOYB Load status joystick keys player B to Vx
4xkk LD Vx, kk Vx = kk
C8y. LD Vy, PAR Load input parameter switch to Vy
6xyz LD Vz, Vx+Vy Same as ADD: Vz = Vx + Vy, V0 = carry
7xyz LD Vz, Vy-Vx Same as SUB: Vz = Vy - Vx, V0 = carry
Dxaa LD [6aa], Vx
6aa, vx
Memory Location [6aa] = Vx
C4 NO OP Do nothing (same as CC)
C0 RETURN Return from subroutine
8xkk RND Vx, kk Vx = random AND kk
2xkk SE Vx, [6aa]
Vx, 6aa
Skip next instruction if Vx == memory location [8aa]
3xaa SNE Vx, [6aa]
Vx, 6aa
Skip next instruction if Vx != memory location [8aa]
7xyz SUB Vz, Vy-Vx Vz = Vy - Vx, V0 = carry
7xyx SUB Vx, Vy Vx = Vx - Vy, V0 = carry
0aaa SYS aaa Call CDP1801 code at aaa. The subroutine must end in a RET (D4)
C1kk TONE F=kk
kk
Tone on with frequency kk (same as C3kk, C5kk, C7kk, C9kk, CBkk, CDkk, CFkk)
C2.. TONE OFF Tone off (same as C6.., CA.., CE..)