FPL-2
Information
I expect FPL-2 stands for Fred Programming Language, version 2.
FPL-2 is used in the game 'Curses Foiled Again' running on the FRED 2 machine.
V0-F are stored on memory locations 0690-06AF.
Definitions
. | 4 bit value but not used |
aaa | 12 bit address |
kk | 8 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) |
[6aa] | Memory value of address aa within page 6 (RAM) |
F= | Tone frequency |
. | Not used, value doesn't matter |
1..9, A..F | Hexadecimal digits |
Syntax
Opcode | Mnemonic | Parameter | Definition |
---|---|---|---|
6xyx | ADD | Vx, Vy | Vx = Vx + Vy, V0 = carry |
Ddkk | 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 E000 (which is the 'FPL-2' equivalent of RETURN) |
E010 | CLS | Clear display | |
Axkk | DRW | Vx, kk | Draw 8*8 graphics: Draw on screen location kk (i.e. memory address 7kk). Pattern location will be fetched from memory [6aa] (and onwards) where aa is stored on 06[Vx|0x80]. |
Bxyn | DRW | Vx, Vy, n | Draw 8*8 graphics: Draw on screen location Vy (i.e. memory address 7aa, where aa is stored in Vy). Pattern location will be fetched from [naa] (and onwards) where aa is stored in Vx. |
Cxy0 | DRW0 | VF, Vx, Vy | Draw 8*16 graphics and 'OR' bit pattern with what is already shown on screen: Draw on screen position [Vx-1]+Vy, i.e. 7aa where aa = Vx-1 + Vy. Pattern location will be fetched from [6aa] (and onwards) where aa is stored in VF. |
Cxy1 | DRW1 | Vx, Vy | Draw 16*24 graphics: Draw on screen location Vx (i.e. memory address 7aa, where aa is stored in Vx). Pattern location will be fetched from [5aa] (and onwards) where aa is stored on [6bb] where bb = 0x50 + highest nibble Vy. |
Cxy2 | DRW2 | Vx, Vy | Draw 16*24 graphics: Draw on screen location Vx (i.e. memory address 7aa, where aa is stored in Vx). Pattern location will be fetched from [5aa] (and onwards) where aa is stored on [6bb] where bb = 0x54 + highest nibble Vy. |
Cxy4 | DRW4 | VE, Vx, Vy | Draw 8*16 graphics and 'OR' bit pattern with what is already shown on screen: Draw on screen position [Vx+2]+Vy, i.e. 7aa where aa = Vx+2 + Vy. Pattern location will be fetched from [6aa] (and onwards) where aa is stored in VE. |
E.08 | KEY | OFF | Switch hex keypad off |
Ex.1 | KEY | Vx | Check if key is pressed if so return key value in Vx otherwise Vx is not changed |
Faaa | JP | aaa | Jump to address aaa |
9xy. | 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 |
4xkk | LD | Vx, kk | Vx = kk |
6xyz | LD | Vz, Vx+Vy | Same as ADD: Vz = Vx + Vy, V0 = carry |
7xyz | LD | Vz, Vx-Vy | Same as SUB: Vz = Vx - Vy, V0 = carry |
5xaa | LD | LD [6aa], Vx LD 6aa, vx |
Memory Location [6aa] = Vx |
E000 | RETURN | Return from subroutine | |
8xkk | RND | Vx, kk | Vx = random AND kk |
2xkk | SNE | Vx, kk | Skip next instruction if Vx != kk |
3nkk | SNE | n, kk | Skip next instruction if kk != memory location [6En] |
7xyz | SUB | Vz, Vx-Vy | Vz = Vx - Vy, 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) |
E.04 | VIDEO | OFF | Video display disabled |
E.02 | VIDEO | ON | Video display enabled |