uva-dare (digital academic repository) re-animation of ...made systems follow a similar pattern of...
TRANSCRIPT
UvA-DARE is a service provided by the library of the University of Amsterdam (http://dare.uva.nl)
UvA-DARE (Digital Academic Repository)
Re-animation of computer programs
Meijer, F.J.
Link to publication
Citation for published version (APA):Meijer, F. J. (2001). Re-animation of computer programs.
General rightsIt is not permitted to download or to forward/distribute the text or part of it without the consent of the author(s) and/or copyright holder(s),other than for strictly personal, individual use, unless the work is under an open content license (like Creative Commons).
Disclaimer/Complaints regulationsIf you believe that digital publication of certain material infringes any of your rights or (privacy) interests, please let the Library know, statingyour reasons. In case of a legitimate complaint, the Library will make the material inaccessible and/or remove it from the website. Please Askthe Library: https://uba.uva.nl/en/contact, or a letter to: Library of the University of Amsterdam, Secretariat, Singel 425, 1012 WP Amsterdam,The Netherlands. You will be contacted as soon as possible.
Download date: 01 Apr 2020
APPENDIX
A.l COMPUTER DEVELOPMENT
1 HERE ARE major differences between today's computers and its predecessors. This is true, not only in their technical aspects, but also regarding software. Computer advancements were characterised by their hardware development. Initially, relays and or vacuum tubes were used. Later, transistors replaced them. Integrated circuits then made it possible to reduce their physical size. The use of highly integrated circuits, such as: the processor on a chip further reduced their size and cost of manufacture to a level affordable by individuals.
Changes to computer hardware were paralleled by rapid advancements in software development. Software progressed from machine code assembler language. Higher-level languages rapidly became the chief method for programming and are still used today although more highly refined.
The first computers used designs based on the machine architecture of Babbage and Zuse1. They have become museum pieces. Their programs are not considered for code reconstruction in this study. The first operational computers were developed in an environment where large numbers of operations had to be performed. For example, numerical solutions to differential equations that describe heat transfer in bombs. Their relevant activity language was specialized. This implies that translation to machine code was relatively simple. The main reason for using computers was to speed up calculations that otherwise would have taken years of human effort.
The development of these machines resembles the developments found in nature. They arc characterised by successions that are not identical. Each succession was better adapted to its environment. Because of this, they were able to survive. In nature changes take place over millions of years. Man-made systems follow a similar pattern of adaptation. Weaving looms became mechanized by Jaquard's punched tape in 1728. Somewhere around 1830 the shuttle was invented. This significantly mechanized the functions of the loom.
[91]
92 RE-ANIMATION OF COMPUTER PROGRAMS
During this period their use was restricted to specific groups of users. They had to provide well-formed statements in their activity language. It was necessary for the programmers to code the appropriate statements into computer language. This was the responsibility of the first group of users. Statements in the human activity language had to be translated into machine code by programmers. This was a highly specialized and complex task. Programming was recognized by society as an elite profession and compensated accordingly.
A.2 THE INFLUENCE OF EXPANDING COMPUTER TECHNOLOGY
Over time the number and variety of users increased, with a decreasing emphasis on mathematical functions. The application of computer technology expanded to other fields such as administration, medicine, law enforcement and recreation. In the beginning of the computer era human operators played an important role. Their main task was to initialize the computer and keep it running. Furthermore, their skills were needed to access files that were usually stored on magnetic tape.
Technological developments gave more possibilities and variation. Each technical advancement was accompanied by a wave of new software. Differences in personal computer software are even more noticeable. Formerly, the user was dependent on software written by a programmer. The data, along with the program, was input into the computer via keypunched cards or tape. No interaction was possible between the user and the computer. Higher level programming languages had not yet been developed. Programmers were not supported by an operating system that alleviates many tasks. Today's programs depend on this support. Programs make use of the operating system. The next major advancement was accompanied by the development of the first operating system software. Operating systems will be the subject of the next section.
A.3 THE OPERATING SYSTEM: A SUPPORT SYSTEM
Today's computers differ markedly from their predecessors. This is true
APPENDIX 93
not only in the technical aspects, but also regarding the complexities of the software. In the early days programmers were not supported by an operating system that simplifies many tasks. Now, programmers depend on this type of support.
A.3.1 The need for an operating system
Computers contain a software package stored in an integrated circuit called R O M (Read Only Memory). This software forms part of a still larger package called the operating system. Why it has been incorporated will be further explained.
To solve a particular problem with a computer, a set of bit strings, mainly containing instructions, must be read into memory. Next the external data to be operated upon are brought into memory. In the early days of computing, the programmer was responsible for bringing the set of instructions and the data to be manipulated into main memory. Nowadays these tasks are performed by the operating system. Programmers can concentrate on the solution of problems without having to solve technical problems associated with computer operations.
A.3.2 Some personal computers and their operating system
Personal computers are equipped with an operating system. Different personal computers appeared on the market. The most widely accepted are the IBM - PC and its clones, and Apple's MACINTOSH and its successors. The AMIGA and the ATARI personal computers have not enjoyed the same success. The AMIGA is no longer produced. The Atari Corporation has licensed different manufacturers to produce its computer of which the MILAN seems the most successful2. The PC operating systems that will be discussed are that of the IBM, its clones and the ATARI. The operating system of the IBM called DOS - Disk Operating System - is similar to that of the ATARI called TOS - The Operating System. The same software house has written both. TOS uses the graphic capabilities of the ATARI.
The development of these operating systems for personal computers was gradual. The forerunner of TOS and DOS was CP/M, an operating
2 In what follows ATARI stands for ATARI and its clones.
9 4 RE-ANIMATION OF COMPUTER PROGRAMS
system used in various PCs based on the Z80 processor. The same pro
ducer developed CP/M, TOS and DOS. Therefore, there is strong
resemblance in function calls. This becomes clear from the following
table.
CP/M ATARI
func# hex function differ name function
ent*
0 00 system reset ends current program
1 0 1 console input Cconin read a character typed in
2 02 console output Cconout display a character
3 03 reader input Cauxin read RS232 port
4 04 punch output Cauxout write RS232 port
5 05 list output Cprnout write line printer
6 06 direct console I/O Crawio read and write console
7 07 get I/O byte Crawcin read character
(without echo)
8 08 set I/O byte Cnecin idem + control sign
9 09 print string Cconws write until 0 detected
10 0A read console buffer Cconrs read buffer
11 0B get console status Cconis character in buffer?
12 oc get version number 48 Sversion gives version
number of O.S.
14 0E select disk Dsetdrv set actual drive
15 OF open file 6 1 Fopen open file
16 10 close file 62 Fclose close file
17 11 search for first
occurrence of filename
58 Fsfirst search first occurrence
of filename 18 12 search for next
occurrence
59 Fsnext search filename
19 13 delete file 65 Fdelete delete file 20 14 read sequential 63 Fread read number of bytes 21 15 write sequential 64 Fwrite write number of bytes 22 16 create new file 60 Fcreate open new file 23 17 rename file 86 Frename rename file 25 19 return current disk Dgetdrv determine actual drive 26 1A set DMA address Fsetdta set DTA address 30 I E set file attributes 65 Fattrib read or set file attributes 32 20 set or get user code Super flips modus
function table
APPENDIX 9 5
A3.2.1 Differences in operating systems for personal computers
Differences in the operating systems of the ATARI and CP/M computers apply to the opening, closing, reading and writing of files. For example, the CP /M operating system splits filename and extension. If the name consists of less than six characters the file name is automatically filled up with spaces. This is not the case with the ATARI. In addition, there is a difference in the handling of files. To be sure that data files are written or read at the correct memory address the DMA (Direct Memory Address) must be made known to the computer.3 An example of a difference is the interface between the user and the computer4. Computers using the 68000 processor provide for a graphical interface. This is possible because their operating systems include functions that make it possible to use these capabilities. However, the CP/M machines used a textual interface between user and support system. It requires the user to type in textual commands5. This is not necessary with the ATARI. For example, to delete a file only requires moving the cursor to the icon representing the file, pressing the mouse and moving the file icon to the trash/dustbin
A.3.3 'Working method o f the operating system
An operating system can be conceptualised as a kernel surrounded by different layers. The kernel of the operating system contains very elementary functions, such as: deciding how much working storage is required for an application. Around the kernel each layer increases its function complexity. The next layer contains functions that were added as computers became more complex. It contains, for example, functions to define the number of colors for a color monitor. Moving outward system independence grows. The availability of these layers enables the user to be more creative. For example, graphic representations, that were formerly diffi-
3 This address, under C P / M , is the hard hexadecimal address 80. Under TOS it is BASEPAGE+80. But, under TOS this DMA address only applies to information about the files. The address has to be given separately when calling the read- or write functions. Under C P / M the same DMA address is used by all file functions. Under T O S it is called DTA (Dish Transfer Address). 4 The MACINTOSH, AMIGA, ATARI and the N E X T computer use the 68000 family processors 5 "delete filename.ext" is an example of such a command. (Ext stands for extension (of the filename)). 6 The MACINTOSH has the capability to retain the data as long as certain conditions are fulfilled. Furthermore, if the user attempts to delete an application the Macintosh asks for confirmation.
9 6 RE-ANIMATION OF COMPUTER PROGRAMS
cult to program and belonged to the domain of highly skilled program
mers, can now be easily implemented by the user.
A.3.3.1 Different levels of operating systems software
The first layer is called BIOS (Basic Input Output System. The term basic has nothing to do with the programming language BASIC). BIOS can perform elementary functions. It can read a character from the console or display it on the screen.
The following layer is called XBIOS (eXtended BIOS). As the number of input/output devices grew their routines had to be incorporated in the operating system. XBIOS contains routines to enable these devices to be used without the need of replacing the entire operating system.
The next layers are included in the operating system of the ATARI.7
They are discussed in the following two sections.
A.3.3.2 The Graphics Environment Manager The next layer after XBIOS is called GEM (Graphics Environment Manager). This layer has been added to take advantage of the possibilities offered by modern graphical terminals. It was only possible for earlier computers to output to a TELETYPE. Later a monitor performed the same functions as the TELETYPE. Both output devices could produce only characters. The next developmental stage was a monitor with an addressable screen. This meant that separate points of the screen could be made visible by displaying a dot, not only sequential as with the older apparatuses, but also randomly.8 Such a point is called a pixel, a contraction of'picture element'.
GEM is made of two parts. There was a need for graphical functions at an elementary level. These functions are incorporated in the first part called GEMDOS (GEM Disk Operating System). A number of these functions are contained in BIOS and GEM. The second part handles the mouse and manipulation of the screen. It is called line-A-emulator. This is misleading because nothing is emulated. If the processor detects the hexadecimal number 'A' as first element of an instruction it jumps automatically to a
7 Now that windows has been made possible on the IBM - FC and its clones this is only applicable
to older versions of the operating system for these computers. 8 Randomly here means at any point of the screen.
APPENDIX 97
certain address. To recapitulate, the 'mouse' and graphical functions are to
be found in GEMDOS. The next layer is called VDI (Virtual Device Interface). It makes pro
grams independent of the display apparatuses. VDI has two parts: a 'low' and 'high' level. The software of the low level is called GDOS (Graphics Device Operating System) the high part makes up the rest of VDI.
A3.33 The Applications Environment Manager.
The outermost layer of the operating system is called AES (Applications
Environment Manager). AES calls complex functions such as menu han
dling and multitasking.
A3 3.4 Direct and indirect function calls
PC operating systems can be instructed in two ways: direct from the terminal, and indirectly by applications. 'Start a program' or 'Print a file' instructions, for example, can be given to the operating system directly via the keyboard or mouse. The application program can also contain the same instruction. These instructions are called functions of the operating system. Performing them is known as system calls.
A.3.4 The working environment
The working environment of a computer is determined by its operating
system functions. Now they offer the user similar working environments.
In essence, the operating systems are basically the same. The Graphic
Environment Manager (GEM) and the Application Environment System
(AES), for example, have made windowing possible on a multitude of dif
ferent platforms.
A.4 THE COMPUTER, A SPECIAL TECHNICAL SUPPORT
SYSTEM
The computer takes a special place between other technical support systems. Most technical appliances do not communicate linguistically. The first computers communicated in a very restricted way. The only computer language available at that time was machine language: bit rows, combinations of one's and zero's. The series of events was well defined.
98 RE-ANIMATION OF COMPUTER PROGRAMS
Communication was done by switches: for every bit, one switch. This communication was restricted to experts. Only they were able to express what they wanted the machine to do. Every type had its own language.
When computers were made more accessible the possibility to express what the user wanted the computer to do in a different language, other than machine language, emerged. Higher-level languages for different purposes were developed. As a result of this development constraints emerged. Programmers had to learn numerous higher-level languages. Different types of problems required the development of still other languages. Higher-level languages made it possible to write and run programs on any machine. But, this advantage paid the price of Babylonian speech entanglement. Attempts to develop a computer-Esperanto failed, mainly due to parochial interests.
Users could make use of the higher level languages developed but direct communication with the new support system was not yet possible. Only the operator could input the programs and data that were punched on paper tape or cards. After processing the user could collect the results. The user had to ensure that there were no incorrect punches that could halt the program.
In the best of cases, an expert giving advice in case of unexpected results performed the help function. Often this person was able to find an error by inspecting the holes in the tape or cards. This ability proved of value for only a short time in the history of computing. After keypunching, communication with the computer was made possible through direct input/output via terminals. They were connected to a central computer, called mainframe. These mainframes were expensive and only large institutions could afford them. Therefore, computer time was shared. Each user was allotted a portion of available processing time, called time slice.
Technology progressed and made the development of the personal computer (PC) possible. With a PC users decided how and when to use the computer. No longer were they dependent on an operator who decided how long and when their program could run. Nor were they dependent upon a time-sharing system. They took a more central role as computer power became decentralised.
The next major development in computer technology was the mouse.
APPENDIX 99
It made it possible to give commands by simply moving a cursor over the monitor's screen and depressing its button. This eliminated the need to type commands. The next development was the track ball. It performs the same mouse functions without having to move the device.
Interactive programming became possible, albeit, by using a programming language, BASIC, that was detested by the computer establishment. It was rejected because it allowed the development of unstructured software. Other languages, such as ALGOL and PASCAL, became accepted. However, these did not permit interactivity. Users had to acquire special skills. They had to learn how to decompose and design a solution for the problem in terms of a computer language.
A. 5 THE INTERFACE
The events produced by a computer only partially replace the events expressed in the HAL (Human Activity Language) statements. The activity language has to state which events are required by the user. The events generated by the computer must stimulate the user to provide correct commands to achieve the desired result. The piano keyboard provides an example of stimuli that evokes events by the striking of its keys. The activity language of a musician indicates how the notes are to be played. The interface between musician and his instrument provides for the production of the event called music.
The interface to a support system dictates the way it constrains its users. In the case of piano playing the keyboard has evolved into a form that defines expertise quite precisely. This precise expertise in using computers is not needed and should be avoided by software developers. The role of the computer is to extend interfaces.
Initially, the notion 'interface' referred to hardware needed for machine-to-machine communication. Later, it was used to designate other forms of communication. The user is now able to choose, in a coordinated manner, from a number of functions, which control flows of data. Every support system has an interface. Only the ways it manifests itself differ.
100 HE-ANIMATION OF COMPUTER PROGRAMS
A.5.1 The importance o f interfaces
As computer systems have become more complex, the importance of interfaces has grown. They make it possible to gain access to functions to perform tasks, previously done manually, faster, more accurately and cheaper. But, to gain access users have to become more competent: a certain degree of dexterity on the part of the users is necessary such as, the ability to use a mouse, trackball or keyboard9. The interface should be designed to maximise the user's previous experiences.
As a general rule the more sophisticated the interface, the more effective. This means that computer hardware becomes relatively less important than its software. Interfaces can be linked to many different types of hardware and also link the user to the computer. This linking required the development of a user language to control the functions of the computer. It consists of terms such as: problem definition, selection of functions, end condition, and solution.
A.6 THE TECHNICAL ASPECTS OF THE PROCESS OF
TRANSFORMATION
Transformation of a machine code program by MALIN is accomplished in a series of steps. For each step a separate program had to be written. The first program is written in assembler code for the 68000 processor. (Cathey, 1986) This assembler emulates the program to be reconstructed and states, which bit strings10 are instructions and which are data. This information is further analysed by other programs of MALIN. It is unlikely that all instructions of the machine code program (P) are executed. Another emulator, written in higher-level language, offers a number of options. It can analyse registers" of the source computer (M), state breakpoints in P and single step through it. There is a difference between a plain emulator and the emulators of MALIN. The plain emulator simulates the source computer on the object computer and generated code is not retained and stored The MALIN emulator executes the source computer code and stores its information. The package gathers information
9 Competent: the ability of a human agent to judge an act in a specific environment. 10 A bit string consists of a series of zeros and ones to denote the binary representation of instructions
and data. 11 A register is a memory location in the central processor used to store data or adresses.
APPENDIX 101
from P, uses it to generate code, and executes it on the object computer. First some preliminary remarks will be made regarding the structure of
programs.
A. 6.1 Modules
As has been discussed in chapter two a computer program invokes series of events that have to take place so that the stated goal will be reached12. To achieve this instructions are arranged in such a way that the events are invoked in the correct order.
Different architectures are possible regarding computer programs. A program can be decomposed into modules." There are two types of modules: instruction and data. An instruction module is defined as a number of instructions forming a structure14. Within this module there are only instructions'5. A data module is defined as a number of consecutive locations containing only data.16 A module has only one entry point ended by only one exit point. And can contain instruction and data. Some compilers allow for a hierarchical structure in that a module may consist of a number of modules. These distinctions are of importance as MALIN tries to discern these modules. In the listings produced by MALIN a blank line separates them. On machine code level instruction modules are seldom found. This is true especially for programs written in the first era of programming.
12 Such a goal usually is formulated by a software company at the beginning of a programming cyle, or by a customer who has to solve a special problem. 13 The term module indicates a part of program code contained in a structure. Here it is applied to programs written in assembler. Source code should clearly indicate, by visual aids, these structures. (see also Opler, 1962) 14 Examples of structures are: the for-next , do-while and repeat-until loop. 15 A low level instruction can contain data. These are called immediate data. Low level programming often uses immediate data. The definition of 'block' is only applicable when computer programs are written in higher level languages. 16 After the 8080 had been developed it became clear that the processor contained an error, handling of the carry status is done faulty, in a way which is considered incorrect by literature. To circumvent this error programming on a low level had to be adapted. The Japanese firm N E C developed a processor - the N E C 8080A that did not contain above mentioned error, the same was done by the American firm AMD which developed the 9080A. Now the problem was that software written for the Intel processor delivered wrong results if run on these processors. So N E C had to produce a 8080 version with the error. The difference between the processors regarding this difficulty is that bit 5 of the status register is used to store the result of a subtraction.
102 RE-ANIMATION OF COMPUTER PROGRAMS
Grouping instructions according to their function is another method of
decomposing a program. Arithmetical, input- and output, parsing mod
ules are examples of such grouping.
A.6.2 Computers involved in this study
The package has been written for a combination of two computers using respectively an 8-bit processor, the INTEL 8080 or Z80 as the source and a 16-bits, the 68000 MOTOROLA as the target computer. The 68000 has been chosen because it is widely used in personal systems such as Apple's MACINTOSH and Atari's ST-computers17.
A.7 THE PROCESS OF TRANSFORMATION
Step one Transfer the machine code program from the CP /M machine to the object computer, use a modem or a disk. If there are data-files available to be used by the program these have to be transferred also to the object computer.
Step two Start the program called NAME. Input the name of the program (P) to be reconstructed. After entering the name of the program it is stored on the disk. All programs working on the transformation use it.
Step three MALIN's first emulator can now be started. This emulator has been written in assembler. It contains routines that put information in a file called TRACE. After the program (P) has been emulated, the program TRACE manipulates the TRACE file into a fde with the extension ANP. Then the program SPLITP splits the ANP file into different files. These contain information about the program to be transformed. These files have been discussed in the main text.
Normally all branches of the program (P) are not executed. A separate
5 ST is an acronym for sixteen-thirty two.
APPENDIX IO3
utility program will determine which branches are not being executed and where they can be found. These branches must be executed. The program (P) can be reconstructed only if all instructions and data have been examined.
A.7.1 Emulation o f branches
Step four To execute the branches a separate software emulator has been written. This emulator does not emulate the environment of the source computer. Its only task is to examine the program during execution of certain branches.
A.7.2 A software monitor
Step five After all the above steps are completed, the software emulator Z80EXE can be started. The executor starts by asking for parameters. Next the emulator asks whether the standard extension of the files to be used need to be changed. The emulator activates the monitor program.18 It provides the capability to inspect addresses of the program (P), change their contents and modify processor registers. The program (P) can be executed step-by-step, as well automatically until a breakpoint is encountered. If the monitor encounters an error situation, error information is output to the screen and stored in a file called "filename.EPvR".
Initial computers were equipped with a front-panel display. The monitor program displays information on the screen of the object computer. A sample of such a display is shown on the next page.
After starting the software monitor the above information is displayed on the screen. Because a CP /M program normally starts at address 100 the program counter points to that address. If this is not the case, manual intervention is required to insure that the program starts at the correct address. By using keys as described below the user can execute, instruction by instruction, inspect register and memory contents, and perform branches to any address in memory.
18 This monitor was originally written for CP/M-systems equipped with the 8080 processor by Lourens Blok at Woerden, Holland. This program has been translated and adapted for use in MALIN.
104 RE-ANIMATION OF COMPUTER PROGRAMS
>PC 0100 CD 62 05 31 94 13 CD 85 05 CD BD 05 CD 11 0118 C3 03 SP F FFF IE D912 D3 09 FF CB 00 00 00 00 00 00 00 00 00 00 00 IY 5FFF 5B E9 84 84 5B 84 5B 00 00 00 00 00 00 00 00 00 00 00 IX F245 00 00 00 00 00 ID 31 00 00 00 00 00 00 00 00 00 00 00 HL 0000 C3 03 E8 95 00 C3 06 00 30 20 34 56 58 05 06 44 00 22 DE EA25 ED 5B 2C EA C9 3B DD 00 DE 36 5A 3B 2C 33 05 30 AC ED BC 0020 84 5B 84 5B 84 5B 84 03 03 04 04 DE E3 4E 3A 2A DE 3E AF 0000
OOEC 00 00F4 00 OOFC 00 0104 94 010C CD 0114 CA OOED 00 00F5 00 OOFD 00 0105 13 010D 11 0115 EB OOEE 00 00F6 00 OOFE 00 0106 CD 010E 01 0116 Ol OOEF 00 00F5 00 OOFF 00 0105 85 010F 18 0115 21 OOFO 00 00F8 00 >0100 CD< 0108 05 0110 F8 0118 Dl 00F1 00 00F9 00 0101 62 0109 CD OUI CD 0119 08 00F2 00 OOFA 00 0102 05 010A BD 0112 OB 011A Ol 00F3 00 >
V
OOFB 00 0103 31 010B 05 0113 02 011B OA
The first two positions of the upper part contain the name of the register followed by its contents. The first seven registers normally function as address pointers. They show the locations of memory followed by consecutive memory contents. The flag-register designated 'F' has been decoded to show clearly which flags are set. As an example, if the flag-register contains hexadecimal FF it will display: SZ, H, VNC. This means that the Sign, Zero, Half-carry, Parity-Overflow, Add/Subtract and Carry-flags are set.
The cursor '>'in front of a register name denotes which register is open. The contents of that register can be modified by the 'R ' command in combination with the 'dot' (.) command. At any given moment the addressed memory location is also displayed in a vertical row and surrounded by '> <'. Giving the dot command moves the register pointer. Typing a hexadecimal number immediately followed by a dot can modify the content of this register. The same applies for memory locations. Typing in a hexadecimal number followed by 'M' can alter them. The memory pointer is moved by typing '+ ' (higher address) or '- ' (lower address).
APPENDIX IO5
Automatic execution takes place after entering the character 'S ' until a
breakpoint is encountered. Sometimes it is necessary to trace a program to
a certain location to make changes. For this reason the breakpoint facility
is incorporated. U p to ten breakpoints can be set after entering ' B ' fol
lowed by a hexadecimal number. Address 0 always contains a breakpoint.
Using the step-by-step tracing method one and only one instruction is
executed after typing the character '; ' followed by ' return ' . Information is
displayed on the screen. A question mark is printed w h e n input is called
for. The program waits for the user to make an input. After output to the
display the computer waits until any key is pressed before continuing.
After the key pressed, the screen is cleared, and execution of the program
resumes. If a printer is connected to the computer , output can be directed
to that device. If the character 'd' is entered before emulation of the
source program, no information is displayed about the instructions exe
cuted. This reduces processing time.
As an example a routine that emulates the 8080 stax-instruction follows.
The stax instruction loads the contents of a memory location in the accu
mulator.
PROCEDURE stax
PRINT A T ( 2 6 , 2 2 ) ; "LD (" ;
c l i s p $ = d i s p $ + " LD ("
IF B T S T ( b y t e | , 4 )
PRINT # 2 ; H E X $ ( d e _ r e g % ) ; " c h a n g e d "
POKE werkgeh%+de_reg%, ac I
PRINT "DE";
disp$=disp$+"DE"
ELSE
PRINT #2;HEX$(bc_reg%);" changed"
POKE werkgeh%+bc reg%,acj
PRINT "BC";
disp$=disp$+"BC"
ENDIF
disp$=disp$+"),A"
PRINT ") , A'S-
PRINT #2;HEX$(pc%);" instruction"
varfile
I 0 6 RE-ANIMATION OF COMPUTER PROGRAMS
INC pc%
PRINT #3;disp$
RETURN
Step six After successful completion of the above the generated files are sorted and possible duplicates are removed. A duplicate exists if part of a program is executed more than once. Next a program is run to determine which instructions and branches were not executed. To do so two files are generated. One file has the extension NOT. It contains instructions or data that have not been executed or used. It also contains a disassembly of this information. The other file uses the extension NOJ. It identifies those branches that have not been executed. This information is used to execute all instructions and branches of the source program.
Step seven When the emulator comes to a breakpoint the generated files must be concatenated and resorted. If all branches have not been executed, step five, six and seven have to be repeated. A separate utility program, contained in MALIN, disassembles instructions not executed. The user should determine whether these instructions are superfluous or not.
Step eight Sometimes programs contain text strings. Those strings applicable to comment only should be retained. A special utility program, called BRASC, is included to do this. When all instructions and text strings have been validated the next step can be made: the transformation into executable code. Different programs do this transformation. The first program gives labels to translated instructions of the source program and produces a list of labels used.
After the first program has been completed, the output can be inspected.
The second program does the final work. It transforms the reconstructed code. The following example shows how the 'stax' instruction is transformed.
APPENDIX IO7
PROCEDURE ld_reg_a
ins$="L" + HEX$ (cpm_address%)
IF BTST(byte|,4)
ins$=ins$+" move.1 #lddea,aO"
ELSE
ins$=ins$+" move.1 #ldbca,aO"
ENDIF
PRINT #3; ins$
ins$=" jsr (aO)"
PRINT #3; ins$
RETURN
First a label is generated consisting of the capital L followed by the value of the address of the instruction in the source program (P). Depending on the value of the fourth bit of the operator register DE or register BC should be loaded with the content of the accumulator. The instruction 'jsr (aO) effectuates that the subroutine to effectuate this is called.
If problems are encountered the information is stored. It is located in the file with the extension MSG.
After all instructions of the source program have been transformed, the output generated has to be processed by an assembler.
A.7.3 Possible adaptations o f the transformed program
A transformed program has been designed for the working environment of M. In chapter 5 it was explained that a new support system is never totally new. It always incorporates remnants of older systems, often in novel combinations. The TTP (Tos Takes Parameters) capability of the ATARI computers is an example.
Programmers tool kits can be used to refine the transformed program.
A.8 REQUIREMENTS T O BE POSED T O USERS OF MALIN
The support system in this study is primarily intended for use by those who are competent in developing assembler programs. They have to fulfill certain conditions. Code reconstruction can be achieved by employing
I 0 8 HE-ANIMATION OF COMPUTER PROGRAMS
their competence. They must possess sufficient knowledge of assembly languages to interpret the code produced. Necessary adjustments to this code cannot be performed without this degree of competence. Similar knowledge is also needed to evaluate old software. Knowledge of other support systems such as a debugger is also necessary. It is an indispensable tool for testing programs written in assembler, or transformed programs19. Finally, users should have a working knowledge of operating systems and comparable support systems. Without this they cannot interpret system calls, let alone adapt them.
A.9 TECHNICAL REQUIREMENTS
The package MALIN requires special hardware. It produces a multitude of information. It is necessary that the object computer has a minimum of 60-megabyte hard disk storage, and one megabyte of RAM. In addition a printer is mandatory. Without hard copies, it is difficult to get an overview or to evaluate the code produced by MALIN.
The hard and software requirements for the ATARI computer (M') are as follows:
Hardware: An ATARI computer type ST or FALCON with at least one megabyte of main memory. A hard disk with a minimum of 60 megabytes and a printer.
Software:
A word processor capable of handling plain ASCII. These are available in
the public domain.
A GFA-BASIC interpreter, preferably version 3.06. A GFA-BASIC programming development system has been given to subscribers of the English ST-FORMAT magazine.
A 68000 assembler. The Turbo assembler developed by Fritze (Hellwig, 1989) can be used as well as the DEVPAC package of which version two has also been made available to readers of ST-FORMAT
19 debugger: a computer program that supports the user in finding errors in a program.
APPENDIX IOC
CP/M programs. They are available on R O M or floppy disk in the pub-
He domain. They can be obtained from the H C C (Dutch Hobby
Computer Club), Utrecht. A CP/M emulator for the ATARI is also
available in the public domain and can be purchased through the publish
ers of the ST-news, an ATARI journal.
A. 10 FLOWCHARTS
Main flowchart
Task
make name of CP/M known to MALIN
Description
run the program called NAME
emulate CP/M-program with CP/M-operating system
Z80TRC.T0S generates trace-file
emulate CP/M-program with TOS-operating system
EMU1 emulates CP/M program, determines which bit strings are operators and operands
manipulate code SPLIT1 splits the code generated by EMU1 in the files mentioned above. This information is used to convert the machine code of the source program to plain text. This is used in the second part of the transformation process. Several programs starting with P101 also sort the files.
determine not executed branch instructions
EMU1 stores information about branches executed, instructions not executed and data not used.
NOTUSED collects instructions not executed.
BRANCHBEP collects branch information.
I I O UE-ANIMATION OF COMPUTER PROGRAMS
r—repeat EMU2 emulates the program to be reconstructed. In
addition, it identifies those branches that have not
been executed
SPLITA splits the information generated by EMU2.
This information is sorted by a number of programs
starting with P103
EMU3 executes the branches which were detected by
EMU2. This code is split, sorted and added to the
previously gathered source program information.
-until all branches
have been executed
convert code Instructions not executed and data not used are
redundant information. This information is converted
by DETCODE using static research and is added to
the already generated data. This is accomplished by
the programs CONCAT1, CONCAT2 and CONSORT.
The first addition is done by CONCAT1. Subsequent
ones by CONCAT2.
The CONSORT program then sorts all this information
verify the code The program TSTRS verifies the generated code.
transform in Z80-machine The verified source code is assembled by ASSEM code
compare code with
CP/M-program until no
errors reported.
COMCOM verifies this code with the original program
transform CP/M program TRI generates object code and a label for each
instruction of the source program.
TR2 removes superfluous labels and ensures that
correct ones are generated for each branch.
assemble
-test and debug
transformed program.
This process is repeated
-until all errors removed.
The code generated can be
assembled by any 68000
assembler and debugged by any
68000 debugger.
APPENDIX I I I
Flowchart of GENCOT
init initialise s prog close ;close files
prog open files control code
control code WHILE not all branches have been investigated
REPEAT look in nob file for not fully investigated branches
UNTIL one has been found requiring action look in PTS file whether all instructions of this branch have been processed
IF not transform code
ENDIF WEND
transform code look in not file for instructions not processed IF not
REPEAT store information for instructions not processed in filename.ANA
UNTIL last instruction of the block has been investigated END IF
A. 11 NUMBER OF EXECUTED 68000 INSTRUCTIONS
The following table depicts how many instructions are needed on the object computer (M') for each source computer instruction (M). The first column depicts the number of instructions that are executed for each transformed source computer instruction. The second column contains the instructions that can be executed by the 8080 and Z80 processor. For example the increment BC-reg instruction can be executed by both the 8080 and Z80 processor. The third contains the instructions that can be executed only by the Z80 processor. Its effectuation needs only one instruction executed on the 68000 processor.
112 RE-ANIMATION OF COMPUTER PROGRAMS
number 8080/ of 68000 Z80 instructions instructions
Z80-additional instructions
0 no-operation load reg with reg (8-bit)
increment BC-reg Increment Index-reg load reg immediate (8-bit) Increment DE-reg Increment HL-reg Decrement DE-reg Increment stack-reg Decrement stack-reg Set carry-flag Clear carry-flag Enable interrupt
load refresh reg
load interrupt reg with accu
Load BC-reg immediate Load [BC]-reg from accu Shift left accu through carry Load accu with [BC-reg] Shift right accu through carry Load DE-reg immediate Load [DE]-reg from accu Load accu from [DE-reg] Decrement DE-reg Add HL-reg to HL-reg Load [HL]-reg immediate Load [HL]-regwith reg
Set Bit
Load IX reg immediate Load IY reg immediate Add IX-reg to IX-reg Add IY-reg to IY-reg Reset bit
2/8
3
return depending on parity
Shift left accu Shift right accu Complement accu Pop reg (16 bits) Push reg (16 bits)
Jump to [HL] Load stack-reg from IY
subroutine-call [imm.]
Add IX-reg to BC-reg Add IX-reg to DE-reg Pop IX-reg Push IX-reg Jump to [IX-reg] Load stack-reg from IY
APPENDIX I I 3
3/6
3/8
Jump imm. depending on CC
4/8
4/14/26
4/10 +subroutine
5/6
Return from subroutine depending on CC
Add IX-reg to BC-reg Exchange DE-regwith HL-reg
Rotate through carry
Call subrout. imm dep. on CC Shift Load accu from Interrupt-reg Load immediate[lndex-reg+offset] Add Index-regto stackpointer Load reg with [Index-reg+offset]
Jump immediate depending on CC
Call immediate depending on CC
special input routine
Load stackpointer immediate Load [memory] immediate Load accu [immediate] And accu with reg load accu with [IY-reg+offset] Or accu with reg Compare reg with reg And accu immediate Or accu immediate
Decrement accu and jump immediate if zero
rotate reg
shift reg
5/9 special output routine +subroutine
6 Load HL-reg [immediate] And [HL-reg] Xor reg And [HL-reg] Or [HL-reg] Or reg
special input routine
rotate reg through carry
1 1 4 RE-ANIMATION OF COMPUTER PROGRAMS
Compare reg Jump immediate Return Xor immediate Compare immediate
Subtract reg Subtract reg with carry Xor[HL-reg] Compare [HL-reg] Exchange Stack-reg with HL-reg
Shift left [HL]
Shift right reg
Load DE-reg [immediate] Load BC-reg [immediate] Load IX-reg [immediate] Load [immediate] BC-reg Load [immediate] DE-reg Shift left [IX-reg +offset] Exchange registers Rotate through carry [HL] Rotate reg
Shift through [HL] Subtract HLfrom HL-reg Exchange [stack-reg] with Indexreg Load IY-reg immediate Rotate through carry [IX+offset] Shift [IX+offset]
Increment reg (8 bits) Decrement reg (8 bits)
Load HL-reg immediate Load [immediate] from HL-reg
Restart immediate
Rotate [HL-reg] Load A with refresh-reg Return N Rotate right D-reg Add with carry HL- to h HL-reg Compare [HL], inc. HL, dec BC Compare [HL], dec. HL, inc BC Rotate left D-reg And [index-reg +ofsset] Or [index-reg +ofsset] Rotate [index-reg +ofsset]
Increment [HL-reg] Decrement [HL-reg] Add accu to accu
Load interrupt-reg
negate Load stack-reg immediate Compare [HL], dec. HL, dec. BC
APPENDIX I I 5
9 Halt (see text) +subroutine
special in- output instr. Add with carry Hl-reg to reg-pair Xor [index-reg +offset] Compare [Index-reg +offset]
10 Subtract with carry Hl-reg to reg-pair Load [immediate] from stack-reg Add with carry Hl-reg to stack-reg
10 +subroutine
special input to accu instr.
11 Add with carry accu to accu subtract with carry stack-reg from HL-reg Increment [index-reg +offset] Decrement [index-reg +offset] Decrement index-reg
11 -»-subroutine
special in- output to HL-reg instr.
11 +subroutine +intemal loop
special in- output to HL-reg instr. until condition is satisfied
12 -(-internal loop
13 Load accu with reg Load accu with [HL-reg] Add accu to reg Add accu to [HL-reg] Add accu with carry to reg Add accu with carry to [HL-reg] Add to accu immediate Subtract accu from reg Subtract from accu immediate
special output to HL-reg instr. combined with decrement of regs until condition is satisfied
14 Increment D-reg Subtract [HL-reg] from accu
I l 6 RE-ANIMATION OF COMPUTER PROGRAMS
14 +intemal loop
Load [DE-reg] with [HLreg], combined with increment and decrement registers until condition is satisfied
16 Add to accu [Indexreg+offset] Subtract from accu [Index-reg +offset]
17 Add with carry to reg accu Add with carry to accu immediate Subtract with carry reg from accu Subtract with carry from accu immediate
17 +internal loop
Compare [DE-reg] with [HLreg], combined with increment and decrement registers until condition is satisfied
18 Add with carry [HL-reg] to accu Subtract with carry [HL-reg] from accu
19
20
Pop accu and status-register
Add with carry [Index-reg] to accu Subtract with carry [Index-reg] from accu
21 24
Push accu and status-register Exchange accu and status-register with alternate registers
48 Decimal adjust instruction
APPENDIX I I 7
A. 12 NUMBER OF RUNTIME INSTRUCTIONS FOR TRANSFORMED CODE
number of type instruction instructions
0 no operation load refresh register move registercontents to same register
1 move 8 bit register to register set or complement flag
2 in and decrement 16 bit register move 16 bit register to register move 16 bit immediate data to register move 8 bit register to memory rotate register left add 8 bit register to register
2/8 RPE instruction
3 rotate register right jump to content of register pop and push register load stackpointer
3/6 jump relative
3/8 return conditional from subroutine
4 add 16 bit register to register call if minus
4/8 jump conditional to address
4/14 call conditional subroutine
4/26 Call if not carry
5 logical and operations
5/6 decrement register and jump if not zero
I l 8 RE-ANIMATION OF COMPUTER PROGRAMS
6 logical or operations Jump address return from subroutine compare
7 subtract XTHL instruction
8 in and decrement 8 bit register move 8 bit immediate data to register
9 in and decrement content of memory location add
9+subroutine halt (used for call to function of operating system)
10
11
13
14
16
17
subtract with carry
add with carry subtract with carry register from register pop and push index register
move 8 bit register to register add 8 bit register to register subtract 8 bit register to register
add contents of memory location to register subtract contents of memory location to register
14+internal move contents of memory locations until condition is met loop
add contents of memory location using idex register to register subtract contents of memory location using idex register to register
add with carry 8 bit register to register subtract with carry 8 bit register to register
17+intemal EDB1 loop EDB9
APPENDIX HC
18
19
20
21
24
48
add with carry immediate to register subtract with carry immediate to register
pop status register
add with carry contents of memory location using index register to register subtract with carry contents of memory location using index register to register
push status register
exchange registers with auxiliarry registers
decimal adjust
A.13 Z-80 INSTRUCTION SET AND TRANSFORMATION F O R
THE 68000 PROCESSOR
Hex Mnemonic transformation for the 68000 processor
Hex Mnemonic transformation for the 68000 processor
8E ADC A,(HL) adcahl 83 ADD A,E adae
DD 8E dd ADC A,(IX+ddH) adcaix_d 84 ADD A,H adah
FD 8E dd ADC A,(IY+ddH) adciy_d 85 ADDA.L adal
8F ADC A,A adcaa C6nn ADD A.nnH ada_n
88 ADC A,B adcab 09 ADD HL.BC adhlbc
89 ADC A,C adcac 19 ADD HL.DE adhlde
8A ADC A,D adcad 29 ADD HL.HL adhlhl
8B ADC A,E adcae 39 ADD HL.SP adhlsp
8C ADC A,H adcah DD09 ADD IX.BC adixbc
8D ADC A,L adcal DD19 ADD IX.DE adixde
CE nn ADC A.nnH adc_n DD29 ADD IX.IX adixix
ED4A ADC HL.BC adchlbc DD39 ADD IX.SP adixsp
ED5A ADC HL.DE adchlde FD09 ADD IY.BC addiybc
ED6A ADC HL.HL adchlhl FD19 ADD IY.DE addiyde
ED7A ADC HL.SP adchlsp FD29 ADD IY.IY adiyiy
86 ADD A,(HL) adahl FD39 ADD IY.SP adiysp
DD 86 dd ADD A,(IX+ddH) adaix_d A6 AND (HL) andhl
FD 86 dd ADD A,(IY+ddH) adaiy_d DDA6 dd AND (IX+ddH) andix_d
87 ADD A,A adaa FD A6 dd AND (lY+ddH) andiy_d
80 ADDA.B adab A7 AND A anda
81 ADD A,C adac AO AND B andb
82 ADD A,D adad A l ANDC andc
120 KE-ANIMATION OF COMPUTER PROGRAMS
Hex Mnemonic transformation for the 68000 processor
Hex Mnemonic transformation for the 68000 processor
A2 ANDD andd CB66 BIT 4,(HL) bit4hl
A3 AND E ande DD CB dd 66 BIT 4,(IX+ddH) bit4ix_d
A4 AND H andh FD CB dd 66 BIT 4,(IY+ddH) bit4iy_d
A5 AND L andl CB67 BIT 4,A bit4a
E6nn AND nnH and_n CB60 BIT4.B bit4b
CB46 BITO.(HL) bitOhl CB61 BIT4.C bit4c
DD CB dd 46 BIT 0,(IX+ddFI) bitOix_d CB62 BIT4.D bit4d
FD CB dd 46 BIT 0,(IY+ddH) bitOiy_d CB63 BIT 4,E bit4e
CB47 BIT 0,A bitOa CB64 BIT 4, H bit4h
CB40 BITO.B bitOb CB65 BIT4.L bit4l
CB41 BIT 0,C bitOc CB6E BIT 5,(HL) bit5hl
CB42 BITO.D bitOd DD CB dd 6E BIT 5,(IX+ddH) bit5ix_d
CB43 BIT 0,E bitOe FD CB dd 6E BIT 5,(IY+ddH) bit5iy_d
CB44 BIT 0,H bitOh CB6F BIT 5,A bit5a
CB45 BITO.L bitOl CB68 BIT 5,B bit5b
CB4E BIT 1,(HL) bitlhl CB69 BIT 5,C bit5c
DD CB dd 4E BIT l,(IX+ddH) bitlix_d CB6A BIT 5,D bit5d
FD CB dd 4E BIT l,(IY+ddH) bitliy_d CB6B BIT5.E bit5e
CB4F BIT1.A bitla CB6C BIT 5,H bit5h
CB48 BIT1.B bitlb CB6D BIT5.L bit5l
CB49 BIT 1,C bitlc CB76 BIT6,(HL) bit6hl
CB4A BIT1.D bitld DD CB dd 76 BIT6,(IX+ddH) bit6ix_d
CB4B BIT 1,E bitle FD CB dd 76 BIT6,(IY+ddH) bit6iy_d
CB4C BIT 1,H bitlh CB77 BIT 6,A bit6a
CB 4D BIT 1,L bitl l CB 70 BIT6.B bit6b
CB56 BiT 2,(HL) bit2hl CB71 BIT6.C bit6c
DDCB dd 56 BIT 2,(IX+ddH) bit2ix_d CB 72 BIT6.D bit6d
FD CB dd 56 BIT 2.(IY+ddH) bit2iy_d CB73 BIT6.E bit6e
CB57 BIT 2,A bit2a CB74 BIT 6,H bit6h
CB50 BIT2.B bit2b CB75 BIT6.L bit6l
CB51 BIT2.C bit2c CB 7E BIT 7,(HL) bit7hl
CB52 BIT 2,D bit2d DD CB dd 7E BIT 7,(IX+ddH) bit7ix_d
CB53 BIT 2,E bit2e FD CB dd 7E BIT 7,(IY+ddH) b i t7 iy j
CB54 BIT 2,H bit2h CB 7F BIT7.A bit7a
CB55 BIT2.L bit2l CB78 BIT7.B bit7b
CB5E BIT 3,(HL) bit3hl CB 79 BIT7.C bit7c
DD CB dd 5E BIT 3,(IX+ddH) bit3ix_d CB7A BIT7.D bit7d
FD CB dd 5E BIT 3,(IY+ddH) bit3iy_d CB 7B BIT 7,E bit7e
CB5F BIT 3,A bit3a CB7C BIT 7,H bit7h
CB58 BIT3.B bit3b CB7D BIT7.L bit7l
CB59 BIT3.C bit3c DCnnnnH CALL C,nnnnH callca
CB5A BIT3.D bit3d FC nnnnH CALL M,nnnnH callm
CB5B BIT 3,E bit3e D4 nnnnH CALL NC,nnnnH callnc
CB5C BIT 3,H bit3h CD nnnnH CALL nnnnH call
CB5D BIT 3,L bit3l C4 nnnnH CALL NZ.nnnnH callnz
APPENDIX 121
Hex Mnemonic transformation for the 6 8 0 0 0 processor
Hex Mnemonic transformation for the 6 8 0 0 0 processor
F4 nnnnH CALL P,nnnnH callp EB EXDE.HL exdehl
EC nnnnH CALL PE.nnnnH callpe D9 EXX exx
E4 nnnnH CALL PO,nnnnH callpo 76 HALT
CC nnnnH CALL Z,nnnnH callz
3F CCF ccf 34 INC (HL) inchl
BE CP (HL) cphl DD34 dd INC (IX+ddH) incix_d
DDBE dd CP (IX+ddH) cpix_d FD 34 dd INC (lY+ddH) inciy_d
FDBEdd CP (lY+ddH) cpiy_d 3C INC A inca
BF CPA cpa 0 4 INCB incb
B8 CPB cpb 0 3 INC BC inebe
B9 CPC cpc OC INCC incc
BA CPD cpd 14 INC D incd
BB CPE cpe 13 INC DE incde
BC CPH cph 1C INC E ince
BD CPL cpl 24 INCH inch
FEnn CPnnH cp_n 23 INC HL inchl
EDA9 CPD c p d j n s DD23 INC IX incix
EDB9 CPDR cpdr F D 2 3 INC IY inciy
EDA1 CPI cpi 2C INC L incl
EDB1 CPIR cpir 33 INC SP incsp
2F CPL cpLac
27 DAA daa E9 JP(HL) jphl
35 DEC (HL) dechl DDE9 JP (IX) jpix
DD35 dd DEC (IX+ddH) decix_d FDE9 JP (IY) jpiy
F D 3 5 d d DEC (lY+ddH) deciy_d DA nnn JPC,nnnnH jpc
3D DEÇA deca FA nnnn JP M,nnnnH jpm
05 DEC B decb D2 nnnn JP NC,nnnnH jpnc
OB DEC BC decbc C3 nnnn JP nnnnH jpnnnn
OD DECC decc C2 nnnn JP NZ,nnnnH jpnz
15 DECD deed F2 nnnn JP P.nnnnH jpp
I B DEC DE decde EA nnnn JP PE.nnnnH jppe
I D DEC E dece E2 nnnn JP PO,nnnnH jppo
25 DEC H dech CA nnnn JPZ.nnnnH jpz
2B DEC HL dechl 38 dd JR C.ddH jrc
DD2B DEC IX decix 18 dd JRddH jrn
FD2B DEC IY deciy 30 dd JR NC.ddH jrnc
2D DECL deel 20 dd JR NZ.ddH jrnz
3B DEC SP decsp 28 dd JR Z.ddH jrze
F3 DI di 02 LD (BC),A Idbca
10 dd DJNZ ddH djnz 12 LD (DE),A Innnnea
FB El ei 77 LD (HL),A Idhla
E3 EX (SP),HL exsphl 70 LD (HL),B Idhlb
DDE3 EX (SP),IX exspix 7 1 LD (HL),C Idhlc
FDE3 EX (SP),IY exspiy 72 LD(HL),D Idhld
08 EX AF.AF exaf 73 LD (HL),E Idhle
122 RE-ANIMATION OF COMPUTER PROGRAMS
Hex Mnemonic transformation for the 68000 processor
Hex Mnemonic transformation for the 6 8 0 0 0 processor
74 LD (HL),H Idhlh 47 LDB.A Idba
75 LD (HL),L Idhll 40 LDB.B Idbb
36 nn LD (HL),nnH ldhli_n 4 1 LDB.C Idbc
DD 77 dd LD (IX+ddH),A ldix_da 42 LDB.D Idbd
DD 70 dd LD (IX+ddH),B ldix_db 43 LDB.E Idbe
DD 7 1 dd LD (IX+ddH),C ldix_dc 44 LDB.H Idbh
D D 7 2 d d LD (IX+ddH),D ldix_dd 45 LDB.L Idb
DD 73 dd LD (IX+ddH),E ldix_de 06 nn LD B.nnH ldb_n
DD 74 dd LD (IX+ddH).H ldix_dh ED 4B nnnn LD BC(nnnnH) ldj>c_n
DD75 dd LD (IX+ddH),L ldix_dl 0 1 nnnn LD BC.nnnnH ldbc_n
DD 36 dd nn LD (IX+ddH),nnH ldix_d_n 4E LD C,(HL) Idchl
FD 77 dd LD (IY+ddH),A ldiy_da DD 4E dd LD C,(IX+ddH) ldcix_d
F D 7 0 d d LD (IY+ddH),B ldiy_db FD 4 E d d LD C,(IY+ddH) ldciy_d
F D 7 1 d d LD (IY+ddH),C ldiy_dc 4F LDC.A Idea
FD 72 dd LD (IY+ddH),D ldiy_dd 48 LDC.B Idcb
F D 7 3 d d LD (IY+ddH),E ldiy_de 49 LDC.C Idee
FD 74 dd LD (IY+ddH),H ldiy_dh 4A LDC.D Idcd
FD 75 dd LD (IY+ddH),L ldiy_dl 4B LDC.E Idee
FD 36 dd nn LD (IY+ddH),nnH ldiy_d_n 4C LDC.H Idch
32 nnnn LD (nnnnH).A ld_n_a 4D LDC.L Idcl
ED 43 nnnn LD (nnnnH).BC ld_n_bc OEnn LD C.nnH Idc
ED 53 nnnn LD(nnnnH),DE ld_n_de 56 LD D,(HL) Iddhl
22 nnnn LD(nnnnH),HL ld_n_hl DD 56 dd LD D,(IX+ddH) lddix_d
DD 22 nnnn LD (nnnnH).IX ld_n_ix FD 56 dd LD D,(IY+ddH) lddiy_d
FD 22 nnnn LD(nnnnH),IY ld_n_iy 57 LDD.A Idda
ED 73 nnnn LD (nnnnH).SP ld_n_sp 50 LDD.B Iddb
OA LD A,(BC) Idabc 5 1 LDD.C Iddc
1A LD A,(DE) Idade 52 LDD.D Iddd
7E LD A,(HL) Idahl 53 LDD.E Idde
DD 7E dd LD A,(IX+ddH) ldaix_d 54 LDD.H Iddh
FD 7Edd LD A,(IY+ddH) ldaiy_d 55 LD D,L Iddl
3A nnnn LD A.(nnnnH) ldai_n 16 nn LD D.nnH Idd
7F LD A,A Idaa ED 5B nnnn LD DE.(nnnnH) ld_de_n
78 LD A,B Idab 1 1 nnnn LD DE.nnnnH ldde_n
79 LD A,C Idac 5E LD E,(HL) Idehl
7A LDA,D Idad DD 5E dd LD E,(IX+ddH) ldeix_d
7B LD A,E Idae FD 5E dd LD E,(IY+ddH) ldeiy_d
7C LD A,H Idah 5F LD E,A Idea
ED 57 LD A,l Idai 58 LDE.B Ideb
7D LD A,L Idal 59 LDE.C Idee
3E nn LD A.nnH lda_n 5A LD E,D Ided
ED5F LDA.R Idar 5B LDE.E Idee
46 LD B,(HL) Idbhl 5C LDE.H Ideh
DD 46 BC LD B,(IX+ddH) ldbix_d 5D LD E,L Idel
FD 46 BC LD B,(IY+ddH) ldbiy_d l E n n LD E.nnH Ide
A P P E N D I X 12
Hex Mnemonic transformation for the 68000 processor
Hex Mnemonic transformation for the 6 8 0 0 0 processor
66 LD H,(HL) Idhhl BO ORB orb
DD 6 6 dd LD H,(IX+ddH) ldhix_d B l ORC ore
FD 66 dd LD H,(IY+ddH) ldhiy_d B2 OR D ord
67 LDH,A Idha B3 OR E ore
60 LDH.B Idhb B4 OR H orh
6 1 LDH.C Idhc B5 OR L orl
62 LDH.D Idhd F6nn ORnnH or_n
63 LDH,E Id he
64 LD H,H Idhh F l POP AF popaf
65 LD H,L Idhl C l POP BC popbc
26 nn LD H.nnH Idh D l POP DE popde
2A nnnn LD HL.(nnnnH) ld_hl_n E l POP HL pophl
2 1 nnnn LD HL.nnnnH ldhl_n DDEl POP IX popix
ED 47 LDI.A Idia FD E l POPIY popiy
DD 2A nnnn LD IX.(nnnnH) ldixi_n F5 PUSH AF pushaf
DD 2 1 nnnn LD IX.nnnnH ldix_n C5 PUSH BC pushbc
FD 2A nnnn LD IY,(nnnnH) ld iy_n j D5 PUSH DE pushde
FD 2 1 nnnn LD lY.nnnnH ldiy_n E5 PUSH HL pushhl
6E LD L,(HL) Idlhl DDE5 PUSH IX pushix
DD 6E dd LD L,(IX+ddH) ldix_d FDE5 PUSH IY pushiy
F D 6 E d d LD L,(IY+ddH) ldiy_d C B 8 6 RES 0,(HL) resOhl
6F LDL.A Idia DDCB dd 86 RES 0,(IX+ddH) resOix_d
68 LDL.B Idlb FD CB dd 8 6 RES 0,(IY+ddH) resOiy_d
69 LDL,C Idle C B 8 7 RESO.A resOa
6A LDL,D Id Id C B 8 0 RESO.B resOb
6B LDL.E Idle C B 8 1 RES 0,C resOc
6C LDL.H Idlh C B 8 2 RESO.D resOd
6D LDL.L Idll C B 8 3 RESO.E resOe
2E nn LD L.nnH Idl C B 8 4 RESO.H resOh
ED4F LD R,A Idra C B 8 5 RESO.L resOl
ED 7B nnnn LD SP.(nnnnH) ld_sp_n CB8E RES 1,(HL) res lh l
F9 LDSP.HL Idsphl DD CB dd 8E RES 1,(IX+ddH) resl ix_d
DDF9 LD SP.IX Idspix FD CB dd 8E RES l,(IY+ddH) resl iy_d
FDF9 LD SP.IY Idspiy CB8F RES 1,A res la
3 1 nnnn LD SP.nnnnH Idsp C B 8 8 RES 1,B r e s l b
EDA8 LDD I d d j n s C B 8 9 RES1.C res l c
EDB8 LDDR Iddr CB8A RES 1,D r e s l d
EDAO LDI Idi CB8B RES 1,E r e s l e
EDBO LDIR Idir C B 8 C RES 1,H r e s l h
ED 4 4 NEG neg CB8D RES 1,L res l l
00 NOP nop C B 9 6 RES 2,(HL) res2hl
B6 OR(HL) orhl DD CB dd 96 RES 2,(IX+ddH) res2ix_d
DDB6 dd OR (IX+ddH) orix_d FD CB dd 96 RES 2,(IY+ddH) res2iy_d
F D B 6 d d OR (lY+ddH) oriy_d C B 9 7 RES 2,A res2a
B7 OR A ora C B 9 0 RES2.B res2b
1 2 4 RE-ANIMATION OP COMPUTER PROGRAMS
Hex Mnemonic transformation for the 68000 processor
Hex Mnemonic transformation for the 68000 processor
CB91 RES 2,C res 2c DD CB dd BE RES 7,(IX+ddH) res7ix_d
CB92 RES 2,D res2d FD CB dd BE RES 7,(IY+ddH) res7iy_d
CB93 RES 2,E res2e CB BF RES 7,A res7a
CB94 RES 2,H res2h CB B8 RES 7,B res7b
CB95 RES 2,L res2l CBB9 RES 7,C res7c
CB9E RES 3,(HL) res3hl CB BA RES 7,D res7d
DD CB dd 9E RES 3,(IX+ddH) res3ix_d CB BB RES 7,E res7e
FD CB dd 9E RES 3,(IY+ddH) res3iy_d CB BC RES 7,H res 7 h
CB9F RES 3,A res2a CBBD RES 7,L res7l
CB98 RES3.B res2b C9 RET ret
CB99 RES 3,C res2c D8 RETC retc
CB9A RES 3,D res 2d F8 RET M retm
CB9B RES 3,E res2e DO RET NC retnc
CB9C RES 3,H res2h CO RETNZ retnz
CB9D RES 3,L res2l FO RETP retp
CB A6 RES 4,(HL) res4hl E8 RETPE retpe
DD CB dd A6 RES 4,(IX+ddH) res4ix_d EO RETPO retpo
FD CB dd A6 RES 4,(IY+ddH) res4iy_d C8 RETZ retz
CB A7 RES 4,A res2a
CB AO RES 4,B res2b CB16 RL(HL) rlhl
CB A l RES 4,C res2c DD CB dd 16 RL (IX+ddH) rlix_d
CBA2 RES 4,D res2d FD CB dd 16 RL (lY+ddH) rliy_d
CBA3 RES 4,E res2e CB17 RLA rla
CB A4 RES 4,L res2l CB10 RLB rib
CB AE RES 5,(HL) res5hl CB11 RLC rlc
DD CB dd AE RES 5,(IX+ddH) res5ix_d CB12 RLD rid
FD CB dd AE RES 5,(IY+ddH) res5iy_d CB13 RLE rle
CB AF RES 5,A res5a CB14 RLH rlh
CB A8 RES 5,B res5b CB15 RLL ril
CB A9 RES 5,C res5c 17 RLA rl_ac
CBAA RES 5.D res5d CB06 RLC (HL) rlchl
CB AB RES 5,E res5e DD CB dd 06 RLC (IX+ddH) rlcix_d
CB AC RES 5,H res5h FD CB dd 06 RLC (lY+ddH) rlcix_d
CB AD RES 5,L res5l CB07 RLC A rlca
CB B6 RES 6,(HL) res6hl CBOO RLCB rcb
DD CB dd B6 RES 6,(IX+ddH) res6ix_d CB01 RLCC rice
FD CB dd B6 RES 6,(IY+ddH) res6iy_d CB02 RLCD rlcd
CBB7 RES 6,A res6a CB03 RLC E rice
CB BO RES 6,B res6b CB04 RLC H rich
CB B l RES 6,C res6c CB05 RLCL rlcl
CB B2 RES 6,D res6d 07 RLCA rlc_ac
CB B3 RES 6,E res6e ED6F RLD rldjns
CB B4 RES 6,H res6h CB1E RR(HL) rrhl
CBB5 RES 6,L res6l DD CB dd IE RR (IX+ddH) rrix_d
CB BE RES 7,(HL) res7hl FD CD dd IE RR (IY+ddH) rriy_d
A P P E N D I X 12
Hex Mnemonic transformation for the 6 8 0 0 0 processor
Hex Mnemonic transformation for the 6 8 0 0 0 processor
CB1F RR A ira CBC4 SET 0,H setOa
C B 1 8 RR B rrb CBC5 SET 0,L setOa
C B 1 9 RRC rrc CBCE SET1,(HL) s e t l h l
CB1A RR D rrd DD CB dd CE SET l,(IX+ddH) s e t l i x j
CB1B RR E rre FD CB dd CE SET l,(IY+ddH) set l i y_d
CB1C RR H rrh CBCF SET 1,A s e t l a
CB1D RRL rrl CBC8 SET1.B s e t l b
I F RRA rrr CBC9 SET 1,C s e t l c
CBOE RRC(HL) rrchl CBCA SET 1,D s e t l d
DD CB dd OE RRC (IX+ddH) rrcix_d CBCB S E T I , E s e t l e
FD CB dd OE RRC (lY+ddH) rrciy_d CBCC SET 1,H s e t l h
CBOF RRC A rrca CBCD S E T l . L s e t l l
C B 0 8 RRCB rrcb CBD6 SET 2,(HL) set2hl
C B 0 9 RRCC rrcc DD CB dd D6 SET 2,(IX+ddH) set2ix_d
CBOA RRC D rrcd FD CB dd D6 SET 2,(IY+ddH) set2iy_d
CBOB RRC E rrce CBD7 SET 2,A set2a
CBOC RRC H rrch CBDO SET2.B set2b
CBOD RRC L rrcl C B D 1 SET 2,C set2c
OF RRCA rrc_ac CBD2 SET 2,D set2d
ED 67 RRD rrd_ins CBD3 SET 2,E set2e
C B D 4 SET 2,H set2h
9E SBC A,(HL) sbcahl C B D 5 SET 2,L set2l
DD 9E dd SBC A,(IX+ddH) sbcaix_d CBDE SET 3,(HL) set3hl
F D 9 E d d SBC A,(IY+ddH) sbciy_d DD CB dd DE SET 3,(IX+ddH) set3ix_d
9F SBC A, A sbcaa FD CB dd DE SET 3,(IY+ddH) set3iy_d
98 SBC A,B sbcab CBDF SET 3,A set3a
99 SBC A,C sbcac C B D 8 SET3.B set3b
9A SBC A,D sbcad CBD9 SET 3,C set3c
9B SBC A,E sbcae CBDA SET 3,D set3d
9C SBC A,H sbcah CBDB SET 3,E set3e
9D SBC A,L sbcal CBDC SET 3,H set3h
DEnn SBCA,nnH sbca_n CBDD SET3.L set3l
ED 42 SBC HL.BC sbchlbc CBE6 SET 4,(HL) set4hl
ED 52 SBC HL.DE sbchlde DD CB dd E6 SET 4,(IX+ddH) set4ix_d
ED 62 SBC HL.HL sbchlhl FD CB dd E6 SET 4,(IY+ddH) set4iy_d
ED 72 SBC HL.SP sbchlsp CBE7 SET 4,A set4a
37 SCF scf CBEO SET4.B set 4b
CBC6 SET 0,(HL) setOhl C B E 1 SET 4,C set 4c
DD CB dd C6 SET 0,(IX+ddH) setOix_d CBE2 SET 4,D set4d
FD CB dd C6 SET 0,(IY+ddH) setOiy_d CBE3 SET 4,E set 4e
CBC7 SET 0,A setOa CBE4 SET 4,H set4h
CBCO SETO.B setOa CBE5 SET4.L set4l
C B C 1 SET 0,C setOa CBEE SET 5,(HL) setöhl
CBC2 SETO.D stOa DD CB dd EE SET 5,(IX+ddH) set5ix_d
CBC3 SETO.E setOa FD CB dd EE SET 5,(IY+ddH) set5ix_d
126 RE-ANIMATION OF COMPUTER PROGRAMS
Hex Mnemonic transformation for the 68000 processor
Hex Mnemonic transformation for the 68000 processor
CB EF SET5.A set5a CB29 SRAC rac
CBE8 SET 5,B set5b CB2A SRAD srad
CB E9 SET 5,C set5c CB2B SRA E srae
CB EA SET5.D set5d CB2C SRA H srah
CB EB SET 5,E set5e CB2D SRAL sral
CB EC SET 5,H set5h CB3E SRL(HL) srahl
CBED SET5.L set5l DD CB dd 2E SRL (IX+ddH) srix_d
CB F6 SET 6,(HL) set6hl FD CB dd 2E SRL (lY+ddH) srliy_d
DD CB dd F6 SET 6,(IX+ddH) set6ix_d CB3F SRL A srla
FD CB dd F6 SET 6,(IY+ddH) set6iy_d CB38 SRLB srlb
CB F7 SET 6,A set6a CB39 SRLC srlc
CB FO SET 6.B set6b CB3A SRLD srld
CB Fl SET 6,C set6c CB3B SRL E srle
CB F2 SET 6,D set6d CB3C SRL H srlh
CBF3 SET 6,E set6e CB3D SRLL srll
CB F4 SET 6,H set6h 96 SUB (HL) subhl
CB F5 SET 6,L set6l DD 96 dd SUB (IX+ddH) subix_d
CB FE SET 7,(HL) set7hl FD 96 dd SUB (lY+ddH) subiy_d
DD CB dd FE SET 7,(IX+ddH) set7ix_d 97 SUB A suba
FD CB dd FE SET 7,(IY+ddH) set7iy_d 90 SUBB subb
CB FF SET 7,A set7a 91 SUBC subc
CB F8 SET 7,B set7b 92 SUBD subd
CB F9 SET 7,C set7c 93 SUB E sube
CB FA SET 7,D set7d 94 SUB H subh
CBFB SET 7,E set7e 95 SUBL subi
CBFC SET 7,H set7h D6nn SUB nnH sub_n
CBFD SET 7,L set7l AE XOR (HL) xorhl
CB26 SLA(HL) slahl DD AE dd XOR (IX+ddH) xorix_d
DD CB dd 26 SLA (IX+ddH) slaix_d FD AE dd XOR (lY+ddH) xoriy_d
FD CB dd 26 SLA(IY+ddH) slaiy_d AF XOR A xora
CB 27 SLA A slaa A8 XORB xorb
CB2 0 SLAB slab A9 XORC xorc
CB21 SLAC slac AA XORD xord
CB2 2 SLAD slad AB XOR E xore
CB23 SLA E slae AC XOR H xorh
CB24 SLA H slah AD XORL xorl
CB25 SLAL slal EEnn XOR nnH xor_n
CB2E SRA (HL) srahl
DD CB dd 2E SRA (IX+ddH) sraix_d
FD CB dd 2E SRA(IY+ddH) sraiy_d nn 8-bit argument
CB 2F SRA A sraa nnnn 16-bit argument
CB28 SRAB srab dd 8-bit signed displacement