EMMA 02

PSEUDO CODE

  • Home
  • Download
  • Change Log
  • Help
  • Compilation
    • Windows
    • OS X
    • Ubuntu
    • Fedora
    • openSUSE
  • Forums
  • Tape Conversion
  • Machine Code
    • SYSTEM00
    • CDP1801
    • CDP1802
    • CDP1804
    • CDP1805
    • Differences
  • Pseudo Code
    • AMVBAS
    • AM4KBAS
    • CARDTRAN
    • Chip-8, 8X, ETI-660 & Elf
    • FEL-1
    • FPA-1
    • FPL-2
    • FPL-4
    • GPL-2
    • GPL-3
    • GPL-4
    • GPL-A (2K RAM)
    • GPL-A (2K ROM)
    • ST2
    • ST4
    • STK
    • Test-Word
    • Super-chip
  • XML Code
    • Main Elements
    • I/O
    • System
    • A/D Convertor
    • BASIC
    • Batch wav
    • Bootstrap
    • Cassette
    • CD4536B
    • CDP1851
    • CDP1852
    • CDP1854
    • CDP1855
    • CDP1877
    • CDP1878
    • CDP1879
    • Debugger
    • COMX Diagnostic
    • Dip switch
    • Disk
    • EF Buttons
    • Flip Flop
    • Front Panel
    • GUI
    • HEX Modem
    • I/O Group
    • Keyboard
    • Keyfile
    • Locations
    • Memory
    • MM57109
    • Printer
    • RTC
    • Sound
    • Splash
    • USB
    • Video
    • Videodump
    • vt
    • X Modem
  • BASIC
    • General Information
    • COMX BASIC V1.00
    • Floating Point BASIC 2.2
    • Pecom 32 BASIC
    • Pecom 64 BASIC 1.0 & 4.0
    • Quest Super BASIC 1.4
    • Quest Super BASIC 3.0
    • Quest Super BASIC 5.0
    • Quest Super BASIC 6.0
    • RCA BASIC3 V1.1
    • Telmac SBASIC v24.3
    • Error Messages
  • Computer List

 

 

 

 

 

 

 

 

 

 

 

 

STK

Information

At least 2 versions of STK were made, I have called them STK-1 and STK-2. Syntax of both is more or less the same except for the LD and LDW command which are switched around:

  • 1x0y is LD [Vy], [Vx] on STK-1 but LDW [Vy], [Vx] on STK-2
  • 1x8y is LDW [Vy], [Vx] on STK-1 but LD [Vy], [Vx] on STK-2

STK can be used on a VIP with printer output and a hex keypad as input. This is the only pseudo language using 12 bit variables and 16 bit arithmetic functions.

V0-F are stored on memory locations 0780-079F, where V0 is stored on 0780-0781 and VF on 079E-079F.

Definitions

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)
[Vx] Memory value of address in register Vx, in 'W' commands this is a 16 bit value where [Vx] is highest byte and [Vx+1] lowest
[Vy] Memory value of address in register Vy, in 'W' commands this is a 16 bit value where [Vy] is highest byte and [Vy+1] lowest
. Not used, value doesn't matter
1..9, A..F Hexadecimal digits

Syntax

Opcode Mnemonic Parameter Definition
5xkk ADD Vx, kk Vx = Vx + kk
7xkk ADD [Vx], kk [Vx] = [Vx] + kk
9x0y ADDW [Vx], [Vy] [Vx] = [Vx] + [Vy], both [Vx] and [Vy] are 16 bit values
2aaa CALL aaa Call subroutine at aaa. The subroutine must end in RETURN
9x4y DIVW [Vx], [Vy] [Vx] = [Vx] / [Vy], [Vx] is a 16 bit values, [Vy] 8 bit
Baaa JP aaa Jump to address aaa
Ex8. KEY [Vx] Wait for a hex key, return value in [Vx] and send it to the printer
Ax4y LD B, [Vy], [Vx] Store 4 digit BCD value on [Vx] in [Vy]->[Vy+3]
Ax2y LD H, [Vy], [Vx] Store 16 bit hexadecimal of 4 digit BCD value of [Vx]->[Vx+3] in [Vy]->[Vy+1]
Ax8y LD N, [Vy], [Vx] Store 4 nibbles of [Vx]->[Vx+1] in [Vy]->[Vy+3], i.e. [Vy] = [Vx].n1, [Vy+1] = [Vx].n0, [Vy+2] = [Vx+1].n1, [Vy+3] = [Vx+1].n0
0aaa LD V0, aaa
V0 = aaa
3x.y LD Vy, Vx Vy = Vx
8xkk LD [Vx], kk [Vx] = kk
1x0y (STK-1)
1x8y (STK-2)
LD [Vy] , [Vx} [Vx] = [Vy]
1x8y (STK-1)
1x0y (STK-2)
LDW [Vy] , [Vx} [Vx] = [Vy], both [Vx] and [Vy] are 16 bit values
9x8y MULW [Vx], [Vy] [Vx] = [Vx] * [Vy], [Vx] is a 16 bit values, [Vy] 8 bit
Ex4. PRINT [Vx] Print character on [Vx]
Ex1. PRINT A, [Vx] Print ASCII value of lowest nibble on [Vx]
E.0n PRINT n Print character n
E.2n PRINT 2n Print character 2n
E.3n PRINT 3n Print character 3n
A.0. RETURN Return from subroutine
4... RESET Reset computer
Cxkk SE [Vx], kk Skip next instruction if [Vx] = kk
Dxkk SNE [Vx], kk Skip next instruction if [Vx] != kk
6xkk SUB [Vx], kk [Vx] = [Vx] - kk
9x2y SUBW [Vx], [Vy] [Vx] = [Vx] - [Vy], both [Vx] and [Vy] are 16 bit values
F... SYS Call CDP1801 at address following F... instruction, first byte needs to be 00, second is the address it will call.