Misplaced Pages

Comal

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

COMAL ( Common Algorithmic Language ) is a computer programming language developed in Denmark by Børge R. Christensen and Benedict Løfstedt and originally released in 1975. It was based on the BASIC programming language , adding multi-line statements and well-defined subroutines among other additions.

#46953

45-407: Comal may refer to: COMAL , a computer programming language Comal (cookware) , a type of griddle Places [ edit ] Comal River (Indonesia) Comal County, Texas , U.S. Comal River , Texas, U.S. Comal Springs (Texas) , U.S. See also [ edit ] All pages with titles containing Comal Topics referred to by

90-492: A code obfuscation technique as a measure against disassembly and tampering. The principle is also used in shared code sequences of fat binaries which must run on multiple instruction-set-incompatible processor platforms. This property is also used to find unintended instructions called gadgets in existing code repositories and is used in return-oriented programming as alternative to code injection for exploits such as return-to-libc attacks . In some computers,

135-498: A desktop PC called " Compis " for the educational sector. An enhanced version of COMAL was supplied as the standard programming language for this PC. Versions were created for both CP/M-86 and MS-DOS . The latter version is available for Windows XP . The (Swedish) reference manual is ISBN   91-24-40022-X . In 1990, Thomas Lundy and Rory O'Sullivan produced the definitive text on COMAL Programming. They matched and compared COMAL with BBC Structured Basic . As of 2016, COMAL

180-416: A direct map between the numerical machine code and a human-readable mnemonic. In assembly, numerical opcodes and operands are replaced with mnemonics and labels. For example, the x86 architecture has available the 0x90 opcode; it is represented as NOP in the assembly source code . While it is possible to write programs directly in machine code, managing individual bits and calculating numerical addresses

225-486: A machine with a single accumulator , the accumulator is implicitly both the left operand and result of most arithmetic instructions. Some other architectures, such as the x86 architecture, have accumulator versions of common instructions, with the accumulator regarded as one of the general registers by longer instructions. A stack machine has most or all of its operands on an implicit stack. Special purpose instructions also often lack explicit operands; for example, CPUID in

270-433: A one-to-one mapping to machine code. The assembly language decoding method is called disassembly . Machine code may be decoded back to its corresponding high-level language under two conditions: The first condition is to accept an obfuscated reading of the source code. An obfuscated version of source code is displayed if the machine code is sent to a decompiler of the source language. The second condition requires

315-400: A paging based system, if the current page actually holds machine code by an execute bit — pages have multiple such permission bits (readable, writable, etc.) for various housekeeping functionality. E.g. on Unix-like systems memory pages can be toggled to be executable with the mprotect() system call, and on Windows, VirtualProtect() can be used to achieve a similar result. If an attempt

360-414: A program desires to run three instructions if a particular value is greater than 10, the typical solution is: This sort of construct hides the true intention of the program, the decision is based on the opposite logic of what the programmer actually wants to accomplish. Additionally, to understand what will happen in this case, the reader has to find line 50, which in real programs might be much further into

405-444: A tag and a Y field. In addition to transfer (branch) instructions, these machines have skip instruction that conditionally skip one or two words, e.g., Compare Accumulator with Storage (CAS) does a three way compare and conditionally skips to NSI, NSI+1 or NSI+2, depending on the result. The MIPS architecture provides a specific example for a machine code whose instructions are always 32 bits long. The general type of instruction

450-411: Is different from Wikidata All article disambiguation pages All disambiguation pages COMAL COMAL was originally written for minicomputers , but was small enough to run on early microcomputers as well. It is one of the few structured programming languages that were available for and comfortably usable on 8-bit home computers . "COMAL Kernel Syntax & Semantics" contains

495-477: Is generally different from bytecode (also known as p-code), which is either executed by an interpreter or itself compiled into machine code for faster (direct) execution. An exception is when a processor is designed to use a particular bytecode directly as its machine code, such as is the case with Java processors . Machine code and assembly code are sometimes called native code when referring to platform-dependent parts of language features or libraries. From

SECTION 10

#1732852491047

540-449: Is given by the op (operation) field, the highest 6 bits. J-type (jump) and I-type (immediate) instructions are fully specified by op . R-type (register) instructions include an additional field funct to determine the exact operation. The fields used in these types are: rs , rt , and rd indicate register operands; shamt gives a shift amount; and the address or immediate fields contain an operand directly. For example, adding

585-428: Is made to execute machine code on a non-executable page, an architecture specific fault will typically occur. Treating data as machine code , or finding new ways to use existing machine code, by various techniques, is the basis of some security vulnerabilities. Similarly, in a segment based system, segment descriptors can indicate whether a segment can contain executable code and in what rings that code can run. From

630-425: Is rarely a problem. Systems may also differ in other details, such as memory arrangement, operating systems, or peripheral devices . Because a program normally relies on such factors, different systems will typically not run the same machine code, even when the same type of processor is used. A processor's instruction set may have fixed-length or variable-length instructions. How the patterns are organized varies with

675-617: Is still actively in use as an educational programming language. Some high schools in the United Kingdom continue to use it to teach the subject of computing. COMAL was created as a mixture of the prevalent educational programming languages of the time, BASIC , Pascal , and, at least in the Commodore and Compis versions, the turtle graphics of Logo . The language was meant to introduce structured programming elements in an environment where BASIC would normally be used. In early versions,

720-512: Is tedious and error-prone. Therefore, programs are rarely written directly in machine code. However, an existing machine code program may be edited if the assembly source code is not available. The majority of programs today are written in a high-level language . A high-level program may be translated into machine code by a compiler . Every processor or processor family has its own instruction set . Instructions are patterns of bits , digits, or characters that correspond to machine commands. Thus,

765-558: Is the binary representation of a computer program which is actually read and interpreted by the computer. A program in machine code consists of a sequence of machine instructions (possibly interspersed with data). Each machine code instruction causes the CPU to perform a specific task. Examples of such tasks include: In general, each architecture family (e.g., x86 , ARM ) has its own instruction set architecture (ISA), and hence its own specific machine code language. There are exceptions, such as

810-419: Is typically set to a hard coded value when the CPU is first powered on, and will hence execute whatever machine code happens to be at this address. Similarly, the program counter can be set to execute whatever machine code is at some arbitrary address, even if this is not valid machine code. This will typically trigger an architecture specific protection fault. The CPU is oftentimes told, by page permissions in

855-534: The Kruskal count , sometimes possible through opcode-level programming to deliberately arrange the resulting code so that two code paths share a common fragment of opcode sequences. These are called overlapping instructions , overlapping opcodes , overlapping code , overlapped code , instruction scission , or jump into the middle of an instruction . In the 1970s and 1980s, overlapping instructions were sometimes used to preserve memory space. One example were in

900-678: The VAX architecture, which includes optional support of the PDP-11 instruction set; the IA-64 architecture, which includes optional support of the IA-32 instruction set; and the PowerPC 615 microprocessor, which can natively process both PowerPC and x86 instruction sets. Machine code is a strictly numerical language, and it is the lowest-level interface to the CPU intended for a programmer. Assembly language  provides

945-591: The Zilog Z80 processor, the machine code 00000101 , which causes the CPU to decrement the B general-purpose register , would be represented in assembly language as DEC B . The IBM 704, 709, 704x and 709x store one instruction in each instruction word; IBM numbers the bit from the left as S, 1, ..., 35. Most instructions have one of two formats: For all but the IBM 7094 and 7094 II, there are three index registers designated A, B and C; indexing with multiple 1 bits in

SECTION 20

#1732852491047

990-485: The source code . This is one of the major reasons that BASIC programs are referred to as " spaghetti code ", as to follow the logic one moves around the program as if following a series of random spaghetti noodles. COMAL addresses this issue through the use of blocks. To accomplish this same series of instructions, in COMAL one would write: In this case, the author writes the decision they are actually trying to accomplish, and

1035-599: The first version included multi-line IF...THEN...ELSE...ENDIF statements, and the PROC...ENDPROC definitions and the EXECUTE statement to call them. The first proof-of-concept implementation (running a five-line loop) was ready on 5 August 1974, and the first release (on paper tape ) was ready in February 1975. Development costs had been around US$ 300 . Only now did the system (which had previously used an internal Danish name) pick up

1080-452: The formal definition of the language. Further extensions are common to many implementations. COMAL was originally developed in Denmark by mathematics teacher Børge R. Christensen. The school in which he taught had received a Data General Nova 1200 minicomputer in 1972, with the expectation that the school would begin to teach computer science . Christensen, who had taken a short course on

1125-464: The implementation of error tables in Microsoft 's Altair BASIC , where interleaved instructions mutually shared their instruction bytes. The technique is rarely used today, but might still be necessary to resort to in areas where extreme optimization for size is necessary on byte-level such as in the implementation of boot loaders which have to fit into boot sectors . It is also sometimes used as

1170-511: The instruction set is specific to a class of processors using (mostly) the same architecture . Successor or derivative processor designs often include instructions of a predecessor and may add new additional instructions. Occasionally, a successor design will discontinue or alter the meaning of some instruction code (typically because it is needed for new purposes), affecting code compatibility to some extent; even compatible processors may show slightly different behavior for some instructions, but this

1215-436: The language's definition was complete but Christensen was unsuccessful in attracting interest from software firms in developing an implementation. Over the next six months he worked with two of his students, to whom he had taught NOVA 1200 machine language , to write an implementation themselves. One of the first things added was the ability to use eight-character variable names, up from the typical one or two. Later additions in

1260-519: The machine code of the architecture is implemented by an even more fundamental underlying layer called microcode , providing a common machine language interface across a line or family of different models of computer with widely different underlying dataflows . This is done to facilitate porting of machine language programs between different models. An example of this use is the IBM System/360 family of computers and their successors. Machine code

1305-515: The name COMAL , for Common Algorithmic Language , inspired by ALGOL , with which Christensen had been experimenting. The first release was therefore named COMAL 75 . Christensen subsequently wrote a textbook on the language which evolved into Beginning COMAL . In 1978, Christensen began to adapt COMAL such that it would run on microcomputers , which were becoming available. He was worried that without such an implementation he would be required to teach and use BASIC again as Danish schools acquired

1350-497: The new machines. By 1980, a version of COMAL developed in conjunction with a college group was able to run on the Zilog Z80 , and thus COMAL 80 was released. Around the same time, a Danish firm introduced the Comet , a very capable microcomputer for the time, which would be the first machine to run a version of what would look like the later COMAL releases. Christensen subsequently stepped back from COMAL development around 1980-81, which

1395-412: The other four index registers. The effective address is normally Y-C(T), where C(T) is either 0 for a tag of 0, the logical or of the selected index regisrs in multiple tag mode or the selected index register if not in multiple tag mode. However, the effective address for index register control instructions is just Y. A flag with both bits 1 selects indirect addressing; the indirect address word has both

Comal - Misplaced Pages Continue

1440-529: The particular architecture and type of instruction. Most instructions have one or more opcode fields that specify the basic instruction type (such as arithmetic, logical, jump , etc.), the operation (such as add or compare), and other fields that may give the type of the operand (s), the addressing mode (s), the addressing offset(s) or index, or the operand value itself (such constant operands contained in an instruction are called immediate ). Not all machines or individual instructions have explicit operands. On

1485-657: The point of view of a process , the code space is the part of its address space where the code in execution is stored. In multitasking systems this comprises the program's code segment and usually shared libraries . In multi-threading environment, different threads of one process share code space along with data space, which reduces the overhead of context switching considerably as compared to process switching. Various tools and methods exist to decode machine code back to its corresponding source code . Machine code can easily be decoded back to its corresponding assembly language source code because assembly language forms

1530-501: The point of view of the CPU, machine code is stored in RAM, but is typically also kept in a set of caches for performance reasons. There may be different caches for instructions and data, depending on the architecture. The CPU knows what machine code to execute, based on its internal program counter. The program counter points to a memory address and is changed based on special instructions which may cause programmatic branches. The program counter

1575-650: The primary additions to the language were block versions of IF...THEN, and the PROC construct. In most previous versions of BASIC, the only block construct was the FOR...NEXT loop. For instance: This example performs a loop ten times, and performs two instructions every time through the loop. In contrast, almost every other instruction in BASIC, or statement , has to be accomplished on a single line. This can make multi-line statements difficult to perform on an all-or-nothing basis. For instance, if

1620-479: The reader can follow the logic simply by looking for the ENDIF . This is aided by COMAL's use of leading spaces to visually indicate blocks. COMAL was available for: Machine language In computer programming , machine code is computer code consisting of machine language instructions , which are used to control a computer's central processing unit (CPU). For conventional binary computers , machine code

1665-412: The registers 1 and 2 and placing the result in register 6 is encoded: Load a value into register 8, taken from the memory cell 68 cells after the location listed in register 3: Jumping to the address 1024: On processor architectures with variable-length instruction sets (such as Intel 's x86 processor family) it is, within the limits of the control-flow resynchronizing phenomenon known as

1710-416: The result of a constant expression freed up by replacing it by that constant) and other code enhancements. A much more human-friendly rendition of machine language, named assembly language , uses mnemonic codes to refer to machine code instructions, rather than using the instructions' numeric values directly, and uses symbolic names to refer to storage locations and sometimes registers . For example, on

1755-446: The same term [REDACTED] This disambiguation page lists articles associated with the title Comal . If an internal link led you here, you may wish to change the link to point directly to the intended article. Retrieved from " https://en.wikipedia.org/w/index.php?title=Comal&oldid=1135844875 " Categories : Disambiguation pages Place name disambiguation pages Hidden categories: Short description

1800-477: The subject at university, was expected to lead the program and to maintain the computer system. The NOVA was supplied with Data General Extended BASIC , and Christensen quickly became frustrated with the way in which the unstructured language led students to write low-quality code that was difficult to read and thus mark. While complaining about these problems to computer scientist Benedict Løfstedt, Løfstedt encouraged Christensen to read Systematic Programming ,

1845-443: The tag subtracts the logical or of the selected index registers and loading with multiple 1 bits in the tag loads all of the selected index registers. The 7094 and 7094 II have seven index registers, but when they are powered on they are in multiple tag mode , in which they use only the three of the index registers in a fashion compatible with earlier machines, and require a Leave Multiple Tag Mode ( LMTM ) instruction in order to access

Comal - Misplaced Pages Continue

1890-461: The then-new book on programming language design by Niklaus Wirth , the creator of Pascal . Christensen was impressed, but found that he could not use Pascal directly, as it lacked the interactive shell that made BASIC so easy for students to develop with. Over the next six months Christensen and Løfstedt corresponded by mail to design an alternative to BASIC which retained its interactive elements but added structured elements from Pascal. By 1974,

1935-406: The x86 architecture writes values into four implicit destination registers. This distinction between explicit and implicit operands is important in code generators, especially in the register allocation and live range tracking parts. A good code optimizer can track implicit and explicit operands which may allow more frequent constant propagation , constant folding of registers (a register assigned

1980-493: Was handed over to groups including UniComal, started by Mogens Kjaer, who had written to Christensen with critiques of COMAL and subsequently ported it to the Commodore PET for release 0.14. At this time, Danish schools insisted that COMAL be available on any microcomputer they purchased. In the early 1980s, Apple Computer won a contract to supply Apple II computers running CP/M and COMAL to Irish secondary schools. It

2025-461: Was popular for education and some textbooks were locally written. In 1984, Acornsoft released a COMAL implementation, by David Christensen, Jim Warwick and David Evers, for their 8-bit BBC Micro and Acorn Electron computers (with a manual by Paul Christensen and Roy Thornton ) Between 1984-1987, TeleNova , a subsidiary of the industrial arm of the Swedish Telecoms system, manufactured

#46953