CASL
The assembly language of COMET, a fictional 16-bit computer that Japan's national Information Technology Engineers Examination invented so that no candidate's real-world CPU would give them an advantage — taught to generations of Japanese programmers from 1986 until CASL II was dropped from the exam in 2023.
Created by Defined for Japan's Information Technology Engineers Examination (情報処理技術者試験), the national IT exam run under the Ministry of International Trade and Industry, now the Ministry of Economy, Trade and Industry. No individual designer is credited
CASL is an assembly language for a computer that was never built. From 1986, Japan’s national Information Technology Engineers Examination (情報処理技術者試験) needed a way to test assembly-language programming without favouring any manufacturer. Its answer was a fictional 16-bit machine called COMET, with CASL as its assembler. The language was revised as CASL II for COMET II in 2001 and was one of the programming options in the Fundamental IT Engineer exam until April 2023. For more than three decades it was the first, and often the only, assembly language that large numbers of Japanese programmers learned.
A note on the date
The master list gives CASL a year of 1966. That date is almost certainly wrong. The exam itself was first held in 1969. Before CASL, its assembly questions used a different language, CAP-X, for a different fictional machine, COMP-X. The Japanese Wikipedia article dates CASL to 1986 (昭和61年), citing Amari Naoyuki’s CASL Programming (Ohmsha, 1986). The CiNii Books union catalogue supports that date: a search for “CASL” before 1986 returns nothing, while 1986 alone has seven CASL textbooks, several subtitled for the Class 1 and Class 2 exams. This page therefore uses 1986. The exact exam session in which CASL questions first appeared is not confirmed here.
The master list’s “Last Commercial ~1990” is also misleading. CASL was never a commercial product, and its revised form stayed in the national exam until 2022.
History and origins
A level playing field
In the national exam’s programming section, candidates choose the language they are strongest in. Over the years the options have included COBOL, FORTRAN, C, Java, Python and a spreadsheet. The goal is that expertise in one particular language gives nobody an edge.
Assembly language breaks this. It is tied to a specific processor, so asking questions in the assembler of a real machine, such as an IBM-compatible mainframe, a Japanese mainframe, or a Z80 or 8086 microcomputer, would favour candidates who worked with that machine. The exam therefore defined its own machine. Its first attempt was COMP-X, a 16-bit word-addressed computer with twelve instructions, 8-bit address fields, a base register, and no input/output at all, programmed in an assembler called CAP-X.
COMET and CASL (1986)
According to summaries of the specification, CASL and its machine COMET kept COMP-X’s basics: 16-bit words, word addressing, two’s-complement integers, and bits numbered 0 at the most significant end. They added what CAP-X lacked:
- Four general registers plus a stack register. GR0–GR4, with GR1–GR4 usable as index registers and GR4 as the stack pointer.
- A flat 16-bit address. Each instruction occupied two words, and the second word held the full address, so there was no base register.
- A stack, with
PUSH,POP,CALLandRET. - Logical as well as arithmetic operations, comparisons and four kinds of shift.
- Character I/O, through the
INandOUTmacros, plusEXITto end a program.
Summaries of the original spec count 23 machine instructions, four assembler directives (START, END, DC, DS), and three macros (IN, OUT, EXIT). Japanese sources often explain the change from CAP-X as a response to the spread of microprocessors: COMP-X looked like a 1960s minicomputer, while COMET is closer to a 1980s microprocessor.
The specification was published in advance and printed again with the exam questions. A candidate who had never studied CASL could in principle learn it in the exam room. In practice, a large book industry grew up around it. CiNii Books holds about fifty catalogue records for CASL titles (counting new editions) dated 1986–1990, including simulator-based books for the NEC PC-9801 (1988) and a pocket-computer edition (Pokekon-ban CASL nyūmon, Corona, 1989).
CASL II (2001)
In 2001 the exam system was reorganised. The Class 2 Information Processing Engineer exam became the Fundamental Information Technology Engineer Examination (基本情報技術者試験, FE), and COMET and CASL were revised into COMET II and CASL II. The revision is significant enough that CASL II code will not assemble as CASL, and the reverse:
| COMET / CASL (1986) | COMET II / CASL II (2001) | |
|---|---|---|
| General registers | GR0–GR4 | GR0–GR7 |
| Stack pointer | GR4 doubles as SP | Dedicated SP register |
| Flag register | 2 bits (sign, zero) | 3 bits: OF, SF, ZF |
| Bit numbering | Bit 0 = most significant | Bit 15 = most significant |
| Instruction length | Fixed two words | One or two words |
| Register-to-register ops | No | Yes (ADDA GR1,GR2) |
| Renamed | ADD, SUB, EOR, JMP | ADDA, SUBA, XOR, JUMP |
| Removed | — | LEA, JPZ, EXIT |
| Added | — | LAD, ADDL, SUBL, JPL, JOV, SVC, NOP, macros RPUSH/RPOP |
The first CASL II textbooks are catalogued with a 2000 date, and several more followed in 2001.
Design philosophy
CASL was designed as an examination instrument, not a production tool, and nearly every design choice follows from that:
- Neutral. It is modelled on no real processor. Japanese hobbyist descriptions say the register handling feels like the Motorola 68000 family and the control flow like the Intel 80x86. That is a comparison people have drawn, not a stated design influence.
- Small enough to learn quickly. Exam-prep guides routinely describe CASL II as one of the quickest FE options to learn, because the entire instruction set fits on one page of the specification.
- Fully specified on paper. The official specification defines the registers, instruction semantics, flag settings, directives and macros, and even the character code table (JIS X 0201). Anything else a question needs, such as an unusual character code, is given in the question itself.
- No hidden hardware. There are no interrupts, no memory management and no devices beyond the abstract input and output behind
INandOUT. Everything a program does can be traced by hand, which is what an exam requires.
Key features
The machine: COMET II
The following is from the official specification (IPA, Ver. 4.3, Appendix 2):
- Word: 16 bits, numbered 15 (sign) down to 0. Numbers are two’s complement.
- Memory: 65,536 words, addresses 0–65535, word-addressed. There is no byte addressing, so the question of endianness never arises.
- Registers:
GR0–GR7, 16-bit general registers.GR1–GR7can also serve as index registers.SP, the stack pointer.PR, the program register.FR, a 3-bit flag register holdingOF(overflow),SF(sign) andZF(zero).
- Instructions: one or two words long. Register-to-register forms (
r1,r2) take one word; register-to-memory forms (r,adr[,x]) take two. - Arithmetic vs. logical:
ADDA/SUBA/CPAtreat operands as signed values in −32768…32767.ADDL/SUBL/CPLtreat them as unsigned values in 0…65535.OFis set when a result falls outside the relevant range.
The language: CASL II
Each line has an optional label, then an opcode, then operands, then an optional comment introduced by ;. Labels are 1–8 characters: the first must be an upper-case letter and the rest upper-case letters or digits. GR0–GR7 are reserved.
| Kind | Instructions |
|---|---|
| Assembler directives | START [entry], END, DS n (reserve n words), DC const[,const]… (decimal, #hex, 'string', or a label address) |
| Macros | IN buf,len (read one record of up to 256 characters), OUT buf,len (write a record), RPUSH/RPOP (save or restore GR1–GR7) |
| Load / store | LD, ST, LAD |
| Arithmetic / logic | ADDA, ADDL, SUBA, SUBL, AND, OR, XOR |
| Compare | CPA, CPL |
| Shift | SLA, SRA, SLL, SRL |
| Branch | JPL, JMI, JNZ, JZE, JOV, JUMP |
| Stack / call | PUSH, POP, CALL, RET |
| Other | SVC, NOP |
Strings are stored one character per word: each character goes in the low 8 bits and the high 8 bits are zero. DC 'ABC' therefore uses three words, not two.
Example: Hello, World
HELLO START
OUT MSG,LEN ; write LEN characters from MSG
RET ; return to the "OS"
MSG DC 'Hello, World!'
LEN DC 13
END
START names the program and marks its entry point. RET hands control back to whatever called it, because CASL II has no EXIT macro. OUT takes the addresses of the text and of a word holding its length, not the values themselves.
Example: summing an array
SUM START
LAD GR0,0 ; running total
LAD GR1,0 ; index
LOOP ADDA GR0,DATA,GR1 ; GR0 += DATA[GR1]
LAD GR1,1,GR1 ; GR1++ (LAD with index = add immediate)
CPA GR1,CNT ; compare index with count
JMI LOOP ; loop while GR1 < CNT
ST GR0,ANS
RET
DATA DC 3,1,4,1,5
CNT DC 5
ANS DS 1
END
This shows two idioms every CASL II student learns:
LAD GR1,1,GR1as increment.LADloads an effective address, and the effective address of1indexed byGR1is simplyGR1 + 1. UnlikeADDA,LADleaves the flags untouched.- Indexed addressing as array access.
DATA,GR1addresses the word atDATA + GR1.
Evolution
| Period | Language | Machine | Where used |
|---|---|---|---|
| 1969 – c. 1986 | CAP-X | COMP-X (12 instructions, 8-bit address field + base register) | Early national IT exams |
| 1986 – 2000 | CASL | COMET (two-word instructions, GR0–GR4) | Class 1 and Class 2 Information Processing Engineer exams |
| 2001 – 2022 | CASL II | COMET II (GR0–GR7, SP, 3-bit FR) | Fundamental IT Engineer exam |
| April 2023 – | — | — | FE programming questions set in IPA’s pseudo-language only |
How the specification was documented also changed over time. From 2008, IPA’s booklet Terms, symbols and programming languages used in the examinations carried the COMET II / CASL II specification as an appendix. Ver. 4.3 of that booklet (8 October 2021) was the last to include it. On 25 April 2022, IPA announced that the FE exam would become a year-round, computer-based test from April 2023, and that questions in “individual programming languages (C, Java, Python, assembler language, spreadsheet software)” would be replaced by questions in a pseudo-language meant to test “universal, essential programming thinking”. Ver. 5.0 (4 August 2022) deleted the assembler appendix.
Current relevance
CASL no longer appears in any national exam. It survives in three places:
- Teaching. COMET II remains a convenient model computer for introductory architecture courses in Japan. It is completely specified, small, and free of the historical baggage of x86 or ARM. Osaka University, for example, has used it in its information-science courses.
- Tools. The Ver. 4.3 specification is still downloadable from IPA. Several open-source CASL II assemblers and COMET II emulators are maintained, including YACASL2 (C, updated as recently as August 2026), Scala and JavaScript implementations, and editor support for Vim and Visual Studio Code. Any CASL II program from an old exam paper can still be assembled and run.
- Memory. For many Japanese programmers who trained between 1986 and 2022, CASL or CASL II was their first real look at registers, flags and the stack. It is the Japanese counterpart of the textbook machines used elsewhere, such as Knuth’s MIX and MMIX, the LC-3 and the Little Man Computer. The difference is that CASL was examined nationally, on a very large scale.
There is no official Docker image. The open-source implementations listed above are the practical way to run CASL II today.
Why it matters
CASL is an unusual kind of programming language: one whose only intended user was an examiner. Its whole design follows from a policy goal, fairness between candidates who worked on different hardware, rather than from any engineering need. It still achieved real reach. It generated a substantial textbook industry, its own simulators on PC-9801s and pocket computers, and university courses. It also gave generations of Japanese candidates a shared first assembly language that belonged to no vendor.
Its removal in 2023 marks a wider change as well. The exam dropped assembly language together with C, Java and Python, in favour of language-neutral pseudocode. CASL began as a way to keep assembly language vendor-neutral, and in the end the exam extended that neutrality to all of its programming questions.
Sources and unverified points
Verified:
- COMET II / CASL II specification details on this page (registers, flags, 65,536-word memory, one- or two-word instructions, labels of 1–8 characters, directives, the
IN/OUT/RPUSH/RPOPmacros, one character per word): IPA, 試験で使用する情報技術に関する用語・プログラム言語など Ver. 4.3, Appendix 2. - Revision dates (Ver. 1.0 on 27 Oct 2008, Ver. 4.0 on 1 Jul 2019, Ver. 4.3 on 8 Oct 2021, Ver. 5.0 on 4 Aug 2022): the revision histories in Ver. 4.3 and Ver. 5.1. Ver. 5.1 contains no assembler specification.
- 2022 announcement and the April 2023 change: IPA’s notice of 25 April 2022.
- Book dates: CiNii Books catalogue.
- Date of the first certification notice (25 March 1970): Japanese Wikipedia’s article on the exam.
Not independently verified:
- The 1986 date rests on Japanese Wikipedia (citing Amari 1986) and the CiNii publication pattern. The exact exam session in which CASL was first set was not confirmed.
- The original 1986 COMET/CASL details (23 instructions, GR0–GR4, the
EXITmacro, bit 0 as most significant) come from Japanese Wikipedia and hobbyist summaries, not from the original MITI specification, which was not located. - The 2001 changeover is supported by WDIC, Japanese Wikipedia and the textbook dates, but the exact announcement date of the CASL II specification was not found.
- The claim that CAP-X was used “from the start” of the exam, and the microprocessor rationale for replacing it, are unsourced statements in Japanese Wikipedia.
- The IPA simulator’s details (version 2.0, ZIP distribution, the DLL-loading warning) come from search-engine snippets of the jitec.ipa.go.jp download page, which did not resolve when fetched directly.
Timeline
Notable Uses & Legacy
Japan's Information Technology Engineers Examination
CASL's reason to exist. It was one of the languages Class 2 candidates could choose for the programming section, and CASL II later filled the same role in the Fundamental IT Engineer exam. Candidates chose one language, and the assembler option used a machine that exists only on paper, so it favoured no one's employer or hardware
Exam-preparation publishing
CASL created a publishing genre of its own. CiNii Books holds about fifty catalogue records for CASL titles (counting new editions) dated 1986-1990 alone, from Ohmsha, Kyoritsu, Gijutsu-Hyoron, CQ Publishing, SoftBank and others, and CASL II books were still in print for the last exams in 2022
IPA CASL II Simulator
The exam body itself reportedly distributed a Java-based CASL II simulator (latest version 2.0, according to its download page) so candidates could assemble and step through programs. It was later reissued as a plain ZIP after IPA warned that an older self-extracting package was vulnerable to DLL hijacking
University computer-architecture teaching
Because COMET II is small and fully specified, universities use it to teach how machines work. Osaka University's information-science course reportedly used a CASL II assembler specification in its 2009 exercises, and a 2023 student dev-container sets up CASL2/COMET2 for a first-year Osaka course
Open-source CASL II implementations
Takagi's YACASL2 (C, command line), node-casl2 and a Visual Studio Code extension (2017), a Scala implementation, and comet2.js in the browser all implement the same published spec, so exam-book programs run unchanged on modern machines