In my post about the CASIO AI-1000, the only pocket computer that can be programmed in PROLOG and LISP natively, the observant reader may have noticed a reference to a CASL language ROM module (OM-54A). This language is also available in many pocket computers manufactured by CASIO or SHARP during the past decades, as well as on PCs. So, what is this CASL? CASL is the assembler of the COMET virtual machine. Although I would name COMET an ISA, the idea behind CASL is brilliant. Imagine you are in Japan during the ’90s and you want a technician or engineering degree to land an IT job. Whichever exam, wherever you pass it, when it comes to the programming test, you will have to do it in CASL. This way, your future employer can be sure that the A grade you scored is somehow equal to the A grade of the other candidates he is interviewing. Something the holder of a French baccalaureate can value for its universality ;-).
In 2001, a new CASL specification has been released to cope with technology’s evolution (CASL II and COMET II). The same way CAP-X/COMP-X was swapped in 1985 for CASL/COMET. CASIO and SHARP manufactured until recently several educational pocket computers (for example the VX or G series), and most of them support the CASL language. As a student, you could practice and sharpen your CASL skills on the go and get ready for the exams during your daily commutes in the subway. Because COMET doesn’t exist as a hardware implementation – that I am aware of –, it is always available as an interpreter. Note that in addition, the native assembler of the computer’s processor was also available for raw speed-sensitive applications. If you want to play around with CASL II, you can download a JAVA based emulator from the Japan Information Technology Examination Center (JITEC) here.
COUNT1 START ;
; Input GR1:Bits to be tested
; Process Count '1' bits in GR1
; Output GR0:Number of '1' bits in GR1
SUBA GR2,GR2 Count = 0
AND GR1,GR1 Test if all zeros or not
JZE RETURN Return if all zeros
MORE LAD GR2,1,GR2 Count += 1
LAD GR0,-1,GR1 Change
AND GR1,GR0 one '1' to '0'
JNZ MORE Loop if not all zeros
RETURN LD GR0,GR2 GR0 = Count
RET ; Return to caller