CAP-X
(Redirected from COMP-X)
CAP-X is an assembly language for the imaginary computer architecture COMP-X that had been adopted for Japan Information Technology Engineers Examination since the first examination in 1970 until the language got replaced by CASL in 1985.
Specifications for COMP-X
This section is translated from Wikipedia article.
Uses 16-bit 2's complement integer for data word and address word. Word unit addresses. Most significant bit is bit 0; least significant bit is bit 15.
Registers
- General-purpose registers GR0-GR3
- 16 bits. For arithmetic and bitwise operations and indexing effective address (GR1-GR3 only).
- Base register BR
- Stores top 8 bits of effective address; 0 is set for bottom 8 bits.
- Sequence counter SC
- Aka program counter. Stores currently executing address.
- Conditional code register CC
- 1 bit. Indicates signness of result of last arithmetic operation.
Operation structure
Every operators has 1 word, and consists of these fields from significant bits:
- 4 bits of OP field to specify operation kind;
- 2 bits of GR field to specify operand register;
- 2 bits of XR field to modify address; and
- 8 bits of AD field to specify bottom 8 bits of effective address.
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Examples
Stores sum of four items in label IA to GR0 (with WRITE command):
IA CONST 0001 CONST 0003 CONST 0005 CONST 0009 S LAI 0,0 LAI 1,0 B01 ADD 0,IA,1 LAI 1,1,1 LAI 3,252,1 JNZ 3,B01 WRITE 0,10 HJ 0,Á END S
Implementation
Z80 assembly implementation available, as well as four additional commands as extension on page 87-96 on 工学社, I/O 昭和55年5月号, ISSN 0337-6675
Bibliography
- Wikipedia contributors. (2020, June 6). CAP-X. In Wikipedia. Retrieved 11:19, July 22, 2025, from https://ja.wikipedia.org/w/index.php?title=CAP-X&oldid=77884804