FPL-4
Information
I expect FPL-4 stands for Fred Programming Language, version 4.
FPL-4 is used in the game 'Computer Bowling' running on the FRED 2 machine.
V0-F are stored on memory locations 0100-011F.
Note: E... is not defined.
Definitions
| aaa | 12 bit address |
| kk | 8 bit constant |
| d | 4 bit constant |
| l | 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
| Opcode | Mnemonic | Parameter | Definition |
|---|---|---|---|
| 5xkk | ADD | Vx, kk | Vx = Vx + kk |
| 8xy4 | ADD | Vx, Vy | Vx = Vx + Vy, V0 is carry / not borrow |
| 8xy2 | AND | Vx, Vy | Vx = Vx AND Vy |
| Ddn. | BEEP | F=n, d n, d |
Beep with a frequency n and duration d |
| 1aaa | CALL | aaa | Call subroutine at aaa. The subroutine must end in 0200 (which is the 'FPL-4' equivalent of RETURN) |
| 9xln | DRW | Vx, l, n | Draw pattern, [RA] = pattern address in page 3, Vx = tv cell address, l = number of lines, n = number of graphics |
| C.74 | INCA | RA = RA + 1 | |
| C.76 | INCB | RB = RB + 1 | |
| Faaa | JP | aaa | Jump to address aaa |
| 6xaa | JNK | Vx, kk | Check if key number stored in Vx is pressed, if not jump to kk (same page) |
| Cx78 | LD | BP, RA, Vx | Store BCD Pattern value of Vx in RA, RA+1 and RA+2 |
| Aaaa | LD | RA, aaa A, aaa |
RA = aaa |
| Baaa | LD | RB, aaa B, aaa |
RB = aaa |
| Cx71 | LD | RA.0, Vx A.0, Vx |
RA.0 = Vx |
| Cx65 | LD | RB.0, Vx B.0, Vx |
RB.0 = Vx |
| Cx68 | LD | RB.1, Vx B.1, Vx |
RB.1 = Vx |
| 2xkk | LD | Vk, kk | Vx = kk |
| Cx6B | LD | Vx, RB.0 Vx, B.0 |
Vx = RB.0 |
| Cx6E | LD | Vx, RB.1 Vx, B.1 |
Vx = RB.1 |
| Cx59 | LD | Vx, [RA] Vx, [A] |
Vx = [RA], RA = RA + 1 |
| Cx5C | LD | Vx, [RB] Vx, [B] |
Vx = [RB], RB = RB + 1 |
| 4xy1 | LD | Vy, Vx | Vy = Vx |
| Cx5F | LD | [RA], Vx [A], Vx |
[RA] = Vx, RA = RA + 1 |
| Cx62 | LD | [RB], Vx [B], Vx |
[RB] = Vx, RB = RB + 1 |
| 8xy1 | OR | Vx, Vy | Vx = Vx OR Vy |
| 0200 | RETURN | Return from subroutine | |
| 7xkk | RND | Vx, kk | Vx = random AND kk |
| 8xy6 | SHR | Vx, Vy | Vx = Vy SHR, V0 is carry / not borrow |
| 3xkk | SNE | Vx, kk | Skip next instruction if Vx != kk |
| 4xy0 | SNE | Vx, Vy | Skip next instruction if Vx != Vy |
| 8xy5 | SUB | Vx, Vy | Vx = Vx - Vy, V0 is carry / not borrow |
| 8xy7 | SUBN | Vx, Vy | Vx = Vy - Vx, V0 is carry / not borrow |
| 0aaa | SYS | aaa | Call CDP1801 code at aaa. The subroutine must end in a RET (D4) |
| 8xy3 | XOR | Vx, Vy | Vx = Vx XOR Vy |