ZX ASSEMBLER INTRODUCTION The aim of ZX ASSEMBLER is to simplify the whole process of machine code programming on ZX computers. It provides comprehensive, easy for use facilities whilst retaining a surprisingly large amount of user-available RAM. The program occupies 7K and locates itself at the top of memory: thus BASIC is very nearly the same as without the ASSEMBLER present, enabling the use of Assembly code subroutines within BASIC programs. GENERAL DESCRIPTION There are two main sections to the program: (1) The EDITOR/ASSEMBLER. You may enter and edit your assembly code with the EDITOR then assemble it with the ASSEMBLE command. The EDITOR has been designed specially for the entering of assembly code: it employs up and down screen scrolling; search for a string; allows insertion/deletion of lines/characters; auto-repeat on all keys; label indentation system & cursor up, down, left and right. It will allow up to 31 characters per line. The ASSEMBLER is highly versatile: it provides for full mnemonic and label assembling, allows entry of numbers in hex and decimal, and it allows entry of text and comments. (2) The MONITOR. This provides facilities to test debug and run your machine-code program. It also provides a number of useful subroutines (such as Keyboard input, print on screen ... etc. This manual is intended to explain how to operate the EDITOR/ ASSEMBLER and MONITOR, also giving tips and routines for beginners, and a list of Z80 instruction sets. ZX ASSEMBLER is a powerful piece of software and used correctly could increase your programming speed and ability enormously. GETTING STARTED Read the relevant chapter in the Sinclair Manual for LOADing a program from tape cassette. The program is LOADed using LOAD "" . The program takes approximately 3 1/4 minutes to LOAD. Once the program has LOADed it executes a NEW, and the K Cursor is displayed. To RUN the program you must type: RAND USR 3E4 when the program will introduce itself. You are now in the COMMAND MODE of the ASSEMBLER. All commands are initiated with SINGLE KEY press from here. To return to BASIC type Q (Quit) twice. If you wish to continue editing an incomplete program: LOAD the Assembler as described above. Now LOAD the incomplete program in the usual way. Then type: RAND USR 3E4 If the program present leaves the ASSEMBLER with too little memory, error 4 is given on typing RAND USR 3E4. 1 SAVING PROGRAMS To SAVE a complete or incomplete program, press Q twice to return to BASIC. You will find a two line BASIC program, plus any other that you have entered. 1 REM 2 REM Line 1 contains the machine code. Line 2 contains the assembly language. You may wish at this point to delete either line as necessary and to SAVE the remaining program in the usual way. The Assembler will not be saved. This program may be LOADED after the Assembler has been LOADed for further editing as necessary. (See getting started). If you have not finished your program, you can delete the object code (line 1) and SAVE only the source code. However it is best so SAVE a backup tape containing only the source code for future ammendments. 2 THE EDITOR When you invoke the EDITOR a screen of text entered so far, is displayed. This will be either at the place where you last left the EDITOR or from an error during Assembling. (SEE ASSEMBLING) The EDITOR provides the user with several functions apart from simply entering text. All the functions are obtained with the SHIFT Key held down. Functions: Press SHIFT 6 to move the cursor down SHIFT 7 to move the cursor up SHIFT 8 to move the cursor right SHIFT 5 to move the cursor left SHIFT 0 to RUBOUT the last character SHIFT 9 to INSERT a character at current position SHIFT A to enter a LABEL. Moves cursor to extreme left of screen. Only works if cursor in 7th character position and if no label is there yet. SHIFT D DELETES current line. SHIFT E INSERTS a line at current cursor position SHIFT G prints text from cursor position onto ZX printer.. SHIFT Q QUITS from Search, Line or Editor. Suppose you make an error in a line, SHIFT Q restores a line to its original state. SHIFT S SEARCH for a string from cursor position. Press SHIFT A to search for a label. If not found, cursor left in same position. SHIFT T moves the cursor to the top of the text. There is an AUTO REPEAT on all keys after 1 second. The EDITOR allows a maximum of 31 characters per line. If you run out of memory, you will return to COMMAND MODE, and an OUT OF MEMORY message will appear; the line you have just typed will have been deleted so that you can return to the EDITOR to squeeze things up! If a label is to be changed, SHIFT A won't move the cursor to the left, so use CURSOR LEFT. SYNTAX OF ASSEMBLER Once the program has introduced itself, you have the choice of several commands for the monitor, but we shall first examine the Editor/Assembler. To enter the Editor, you type E. The screen will clear and display a graphic space, seven characters in from the left hand side of the screen. You are now ready to enter your Assembly Language. 3 LABELS The Assembler will accept labels of any string of letters or numbers starting with a letter immediately followed by: = constant or Assembly language or - space To enter a label, type SHIFT 'A' and the cursor will move to the extreme left hand side of the screen. This gives the effect of indenting the Assembly language and making it easier to read. Example: Score routine SCORE1 = 5000 JR BEGIN ; jump to beginning. SCORE 00 00 ; save 2 bytes for score. BEGIN LD HL,(SCORE) ; get the contents of score. INC HL ; increment it LD (SCORE),HL ; store new score LD (SCORE1),HL ; store copy of score at 5000 HEX RET A label may be accessed with an offset of -9 to +9. e.g. LD A,(PTR +4) JP 7A3C ; jump to MONITOR PTR 1 2 3 4 5 6 A will have the value of 5. If no offset specified, assume it is zero. A = 1. |------------------------------------------------------------------------| |N.B. It is advisable not to use a label with the same name as a register| |e.g. BC or as a legal number. | |e.g. ABCD as you will either have error messages on relative jumps | |or potentially disastrous consequences. | |------------------------------------------------------------------------| TEXT Any text within speech marks " (SHIFT P) will be Assembled directly into HEX. This provides both an easy way of entering messages to be printed, and you may also use text in Assembly language commands. Example : Print a message CALL 7E99 ; print text "HERE WE ENTER TEXT" FF Example: Text in Assembly language LD A,0 ; get initial value CHECK INC A ; add 1 to it CP "*" ; check for * JR NZ CHECK ; if not goto check CALL 7EAA ; print character CALL 7E99 ; print text " IS A * SIGN" FF Hence it is not necessary to know the character codes. Any HEX Bytes typed in are also Assembled so if you wish to save memory, you may type E5 C5 instead of PUSH HL PUSH BC. 4 NUMBERS The Assembler defaults to HEXidecimal (base 16) 8 bit numbers 0 to FF 16 bit numbers 000 to FFFF (must be 3 or 4 digits) Decimal numbers may also be used with a '+' or '-' sign. They will always be 16 bit numbers. e.g. +1 is represented by 0001. The Assembler is intelligent in many respects, in that it treats a number, wherever possible, as an 8 bit or 16 bit, including decimal, when needed. Example: label loads. TEST = +64 LD HL, TEST ; 16 bit expected LD A, TEST ; 8 bit expected The label TEST is treated as a 16 bit and 8 bit number where indicated. If however the Assembler expects an 8 bit number when the number is greater than FF or +255, a NUMBER ERROR will be reported when Assembling. Example: Numbers LD HL,1 ; OK LD A,+13 ; OK LD A,101 ; Error When you wish to load a register with a number which is also a register, you must prefix the number with a 0. Example LD A,B ; stores register B in A LD A,0B ; stores the number B in A SEPARATORS Each instruction may be separated by spaces or end of line. Spaces may be replaced by multiple spaces with the exception of the following instructions, which must be entered exactly as below. LD_A,I LD_I,A _ space LD_R,A LD_A,R EX_AF =EX AF,AF' EX_DE,HL EX_(SP),HL NON STANDARD MNEMONICS The following mnemonics are non standard Z80 EX AF = EX AF,AF' IM0 instead of IM_0 IM1 instead of IM_1 IM2 instead of IM_2 JP and JR have NO commas e.g. JR NZ +7 COMMENTS Comments must be preceded with a semi colon ; text after this will be ignored by the Assembler. 5 ASSEMBLING Once you have typed in your Assembly language, you are now ready to Assemble it, Exit from the Editor using SHIFT Q. To assemble your program, type A when ASSEMBLE will be printed. Now press NEWLINE and your program will be Assembled. The program is Assembled to start at address 4084 HEX or 16516 DECIMAL. This is REM line 1 when you return to BASIC. If you make an error, an error message will be printed. Typing 'E' will display the text from the line at which the error occurred. The error messages you may get are the following: LABEL ERROR (1) Undefined label. (2) Illegal label definition, e.g. beginning with a number. If you mis- spell a mnemonic, you will probably get this error as it thinks you are trying to access a label. RELATIVE JUMP ERROR This occurs if the relative jump is out of range. i.e. the jump is > +127 or < -128 bytes, or if the jump is out of range. OFFSET ERROR (1) Loading a register with a label plus an offset. e.g. LD HL,(FRED + 10) only +- 9 allowed. (2) Using the index registers plus an offset which is too large. IX, IY > +127 or < -128 NUMBER ERROR This error is reported when you try to use a number too large for the relevant instruction. e.g. LD A,1000 OUT OF MEMORY (1) In Editor when Assembly language is too long. (2) During Assembling when not enough room to Assemble the program. STACK ERROR At the end of execution when too much has been taken or left on the stack . (See following notes) SYNTAX ERROR Reporting all other errors. e.g. ADD A,*. While developing routines it is not necessary to put a RET at the end of your routine, as the Assembler ends the routine with a Jump to the Monitor. This means if there is a Stack error, the system will not crash. The RET at the end of your program returns you to BASIC. To RUN your routine, press 'R' RUN FROM ADDR 4084 will be displayed. Press NEWLINE to run to your routine. The default address is 4084 (the beginning of the machine code routine). This may be changed by typing in any address. |-----------------------------------------------------------------| |NOTE: ** If an error is reported during assembly, the program can| |NOT be RUN as it may be only be partly assembled, or not at all | |-----------------------------------------------------------------| 6 MONITOR ZX-ASSEMBLER also provides a useful Monitor to enable you to test, de-bug and run your machine code programs. All commands are initiated with SINGLE KEY press and many may need a 4 digit HEX address. Press NEWLINE to enter this address. Any entry may be aborted by pressing Q before NEWLINE. COMMANDS A To ASSEMBLE your program C This copies a block of memory from one place to another. COPY BLOCK: FIRST ADDR ... The first address of the block to be copied. LAST ADDR ... The last address of the block to be copied. TO ADDR ... The destination address. M This is the Memory EDIT mode, you can enter/edit M/C directly. Down the left hand side of the screen is a column of 24 2-byte addresses, and beside these is a column of the contents of each address. The cursor half-way down indicates the address of the memory location that you can changes. To do this, type in a HEX number and press NEWLINE. If you press Q before NEWLINE then the entry of that number will be aborted. The commands in this mode are: J Calculates jump displacement for relative jumps: enter the last 2 digits of the destination address, press NEWLINE and the displacement will be entered at the cursor address. L moves cursor down continuously through memory {repeated NEWLINE) NEWLINE moves cursor down a single step. O moves cursor up continuously (repeated P) P moves cursor up a single step. R repeats the entry of a value: enter your value then press NEWLINE. The contents of any address to which the cursor points will be changed to your value - any of the cursor move- ment commands can be used. To cancel Repeat press Q. I Inspect and modify registers. Displays register pairs BC, DE, HL and AF. F is also displayed in binary with each flag labelled (S=sign, Z=zero, H=half-carry, O=parity/overflow, N=negative or minus, C=carry). When you RUN a machine code program, the values displayed are put into the registers, and on return the values of the registers are recorded. The HEX number you enter will be put into the register to which the cursor points. To enter a number and move the cursor, press NEWLINE. 7 S SEARCH FOR ... 2 byte number to be searched for. FROM ADDR ... address from which to start search. Searches through all 64K except stack. Displays address of the first occurrence of the number - if you press M, it goes straight into the Memory edit mode at that address, or Q to return to COMMAND mode. 'NOT FOUND' is displayed if the number does not occur. R Runs a machine code routine from address 4084 or the address you enter. Return to monitor is by a jump instruction Assembled by the Assembler. The jump address is 7AC3. The screen is cleared before the program is run. On return to the Monitor waits for any Key to be pressed before clearing the screen again and returning to COMMAND mode. |-----------------------------------------------------------------| |NOTE. Pressing Q (or SHIFT Q in the EDITOR) will always abort | |what you are doing whenever the Assembler is waiting for a Key to| |be pressed. | |-----------------------------------------------------------------| 8 USEFUL ASSEMBLER SUBROUTINES The Assembler contains many subroutines which you may wish to use in your program. Here is a list of the more useful ones. The contents of all the Registers (except F) are preserved unless otherwise stated. Use the CALL instruction to call the subroutine within your program, the HEX address is given besides the subroutine name. CLEAR SCREEN - 7FB5 Clears screen & homes screen cursor. HOME - 7D7D Returns screen cursor to top left on screen. DISPLAY CHAR - 7EAA Display Character code in register A. Increments screen cursor (address 7FD0). Cursor characters (70 - 73 HEX) can be used, screen automatically scrolls up or down as necessary. SCROLL UP - 7F50 SCROLL DOWN - 7F6A DISPLAY TEXT - 7E99 Displays text following CALL instruction. End with FF. e.g. CALL 7E99 "HELLO" FF displays HELLO at screen cursor. HEX NUMBER - 7E7E Displays register A in HEX. KEYBOARD - 7E0F Scans keyboard once. Returns character code in A; A=FF if no key was pressed. 1 HEX IN - 7DC0 Returns the value in A register. D=FF if Q pressed. 2 HEX IN - 7DB7 Returns the value in HL. A is corrupted. CREATE REM - 7B4E Creates a REM line in BASIC DE Max addr that can be over written. BC line number. HL length not including the EA 76. FIND LINE - 7AEE Finds the address of a line in BASIC. Input line number in BC. Output address in HL. DELETE LINE - 7B76 Deletes a line in BASIC Input line number in BC. COPY BLOCK - 7BEE Copies a block of memory as in the COPY command in the Monitor. 1st Address in BC beginning of block. 2nd Address in DE end of block. 3rd Address in HL new start address. NEWLINE - 7F8A Causes a NEWLINE (carriage return) - 7A3C Return address to Assembler. 9 HINTS FOR THE BEGINNER |---------------| |DON'T PANIC !!!| |---------------| Machine code is not a mysterious art practised by ice-cool whizz kids with electrons coursing through their veins, it is just another means of programming like BASIC. You must be more careful than with BASIC as there are no error messages when you actually execute a program. If you make bad mistakes, the usual result is the system Crashing. However, using the Assembler and Monitor and following a few simple rules, you will soon be able to write, de-bug and success- fully execute machine code. RULES (1) Preserve your environment. Save all the registers within Sub- routines by PUSHing them on the Stack. Before Returning recover them in the opposite order to which they were SAVEd. e.g. LD A,27 ; set A to a value PUSH HL ; save HL PUSH BC ; save BC CALL 7EAA ; print character in A POP BC ; recover BC POP HL ; recover HL Remember : with Stacks - last ON, first OFF. (2) Everything placed on the Stack, within a Subroutine, must be taken off within the same routine, or before a RET is met. Suppose FRED is a printing Subroutine FRED LD A,17 ; set A to a value PUSH AF ; save AF CALL 7EAA ; print character RET ; return ? This routine would Crash as there should be a POP AF before the RET. (3) Remember where your Stack is. Don't locate a machine code routine too close to the Stack, this is because the Stack may corrupt the routine when it fills up. (4) Relative jumps have a limit from the current position +127 bytes forward -128 bytes backwards. (5) Read as much information as you can about programming. (6) Put things in subroutines as mach as reasonably possible. RECOMMENDED BOOKS Machine Language programming made simple for your Sinclair. Understanding your ZX81 ROM Melbourne House Programming the Z80 ZAKS Sybex Z80 Instruction Handbook. 10 SAMPLE PROGRAMS This program shows you how the galaxy may look in a space ship. LD BC,+7680 ; counter for number of repeats BEG1 CALL RND ; get random number CP B JR NC STAR LD A, 97 ; store code for * JR AGAIN STAR CP C JR NC BLAN FREE LD A,80 ; store code for graphic space JR AGAIN BLAN CALL RND CP 7D JR C FREE LD A,9B ; store code for graphic AGAIN CALL 7EAA ; print stored character DEC BC ; decrement counter LD A,B OR C ; check if zero JR NZ BEG1 ; if not repeat RET RND LD A,R ; put random number in A RES 7,A ; make in range 0-128 RET This program slowly lands a space ship: LD DE,+700 LOOP CALL 7E99 "++=-" 72 72 72 72 FF ; print space ship DEC DE LD B,0 ; delay DJNZ -2 LD A,D OR E ; count = 0 JR NZ LOOP ; if no, loop back CALL 7E99 76 "**LANDED**" FF 11 MYSTERY PROGRAM START LD HL,START LD DE, NEXT+1 LD B,5 LOOP PUSH BC LD B,0 LD A,(DE) LD C,A PUSH HL ADD HL,BC LD A,(HL) LD H,+57 SCF CALL 7EAA LD L,0 DEC HL CONT DEC HL LD A,H OR L JR Z 3 SCF JR CONT POP HL POP BC INC DE DJNZ LOOP DEC D NEXT RLB LD (DE),A LD DE,1C16 JP 7A3C 12 This program displays message vertically in large letters. JR START MES "HI THERE THIS IS" ; message "YOUR ZX81" FF ; end with FF TMP 00 START LD DE,MES ; DE is character pointer NXTC LD A,(DE) ; get character CP FF ; is end ? JR Z END AND 7F ; ignore reverse LD H,0 LD L,A ADD HL,HL ; multiply by 8 to ADD HL,HL ; give offset into ADD HL,HL ; character table LD BC,1E00 ; Add in base address ADD HL,BC ; of character table LD B,8 ; loop for character NXTL PUSH BC ; save count LD A,(HL) ; get row in this character LD (TMP),A ; store it at TMP LD B,8 ; bit count of row NXTB LD A,(TMP) RLA LD (TMP),A ; check bit LD A,(DE) JR C DISP ; if set GOTO DISP BIT 7,A ; check for inverse JR Z 4 LD A,80 JR 1 ; A=80 for inverse XOR A ; A=0 for non inverse DISP CALL 7EAA ; print character DJNZ NXTB ; next bit CALL 7E99 76FF ; display newline INC HL POP BC DJNZ NXTL ; next row of character INC DE JR NXTC ; get next character END ; of message 13 Z80 INSTRUCTION CODES --------------------------------- --------------------------------- |OBJ SOURCE | |OBJ SOURCE | |CODE STATEMENT | |CODE STATEMENT | | | | | |8E ADC A,(HL) | |E620 AND n | |DD8E05 ADC A,(IX+d)| |CB46 BIT 0,(HL) | |FD8E05 ADC A,(IY+d)| |DDCB0546 BIT 0,(IX+d)| |8F ADC A,A | |FDCB0546 BIT 0,(IY+d)| |88 ADC A,B | |CB47 BIT 0,A | |89 ADC A,C | |CB40 BIT 0,8 | |8A ADC A,D | |CB41 BIT 0,C | |8B ADC A,E | |CB42 BIT 0,D | |8C ADC A,H | |CB43 BIT 0,E | |8D ADC A,L | |CB44 BIT 0,H | |CE20 ADC A,n | |CB45 BIT 0,L | |ED4A ADC HL,BC | |CB4E BIT 1,(HL) | |ED5A ADC HL,DE | |DDCB054E BIT 1,(IX+d)| |ED6A ADC HL,HL | |FDCB054E BIT 1,(IY+d)| |ED7A ADC HL,SP | |CB4F BIT 1,A | |8E ADD A,(HL) | |CB48 BIT 1,B | |DD8605 ADD A,(IX+d)| |CB49 BIT 1,C | |FD8605 ADD A,(IY+d)| |CB4A BIT 1,D | |87 ADD A,A | |CB4B BIT 1,E | |80 ADD A,B | |CB4C BIT 1,H | |81 ADD A,C | |CB4D BIT 1,L | |82 ADD A,D | |CB56 BIT 2,(HL) | |83 ADD A,E | |DDCB0556 BIT 2,(IX+d)| |84 ADD A,H | |FDCB0556 BIT 2,(IY+d)| |85 ADD A,L | |CB57 BIT 2,A | |C62D ADD A,n | |CB50 BIT 2,3 | |09 ADD HL,BC | |CB51 BIT 2,C | |19 ADD HL,DE | |CB52 BIT 2,D | |29 ADD HL,HL | |CB53 BIT 2,E | |39 ADD HL,SP | |CB54 BIT 2,H | |DD09 ADD IX,BC | |CB55 BIT 2,L | |DD19 ADD IX,DE | |CB5E BIT 3,(HL) | |DD29 ADD IX,IX | |DDCB055E BIT 3,(IX+d)| |DD39 ADD IX,SP | |FDCB055E BIT 3,(IY+d)| |FD09 ADD IY,BC | |C35F BIT 3,A | |FD19 ADD IY,DE | |CB58 BIT 3,B | |FD29 ADD IY,IY | |CB59 BIT 3,C | |FD39 ADD IY,SP | |CB5A BIT 3,D | |A6 AND (HL) | |CB5B BIT 3,E | |DDA605 AND (IX+d) | |CB5C BIT 3,H | |FDA605 AND (IY+d) | |CB5D BIT 3,L | |A7 AND A | |CB66 BIT 4,(HL) | |A0 AND B | |DDCB0566 BIT 4,(IX+d)| |A1 AND C | |FDCB0566 BIT 4,(IY+d)| |A2 AND D | |CB67 BIT 4,A | |A3 AND E | |CB50 BIT 4,B | |A4 AND H | |CB61 BIT 4,C | |A5 AND L | |CB62 BIT 4,D | --------------------------------- --------------------------------- 14 |-------------------------------| |-------------------------------| |OBJ SOURCE | |OBJ SOURCE | |CODE STATEMENT | |CODE STATEMENT | | | | | |CB63 BIT 4,E | |ADB1 CPIR | |CB64 BIT 4,H | |EDA1 CPI | |CB65 BIT 4,L | |2F CPL | |CB6E BIT 5,(HL) | |27 DAA | |DDCB056E BIT 5,(IX+d)| |35 DEC (HL) | |FDCB056E BIT 5,(IY+d)| |DD3505 DEC (IX+d) | |CB6F BIT 5,A | |FD3505 DEC (IY+d) | |CB68 BIT 5,B | |3D DEC A | |CB69 BIT 5,C | |05 DEC B | |CB6A BIT 5,D | |0B DEC BC | |C86B BIT 5,E | |0D DEC C | |C86C BIT 5,H | |15 DEC D | |C86D BIT 5,L | |1B DEC DE | |CB76 BIT 6,(HL) | |1D DEC E | |DDCB0576 BIT 6,(lX+d)| |25 DEC H | |FDCB0576 BIT 6,(IY+d)| |2B DEC HL | |CB77 BIT 6,A | |DD2B DEC IX | |CB70 BIT 6,B | |FD2B DEC IY | |CB71 BIT 6,C | |2D DEC L | |CB72 BIT 6,D | |3B DEC SP | |CB73 BIT 6,E | |F3 DI | |CB74 BIT 6,H | |FB EI | |CB75 BIT 6,L | |102E DJNZ e | |CB7E BIT 7,(HL) | |E3 EX (SP),HL | |DDCB057E BIT 7,(IX+d)| |DDE3 EX (SP),IX | |FDCB057E BIT 7,(IY+d)| |FDE3 EX (SP),IY | |CB7F BIT 7,A | |08 EX AF | |CB78 BIT 7,B | |EB EX DE,HL | |CB79 BIT 7,C | |D9 EXX | |CB7A BIT 7,D | |76 HALT | |CB7B BIT 7,E | |ED46 IM0 | |CB7C BIT 7,H | |ED56 IM1 | |CB7D BIT 7,L | |ED5E IM2 | |DC8405 CALL C,nn | |ED78 IN A,(C) | |FC8405 CALL M,nn | |ED40 IN B,(C) | |D48405 CALL NC,nn | |ED48 IN C,(C) | |C48405 CALL NZ,nn | |ED50 IN D,(C) | |F48405 CALL P,nn | |ED58 IN E,(C) | |EC8405 CALL PE,nn | |ED60 IN H,(C) | |E48405 CALL PO,nn | |ED6B IN L,(C) | |CCB405 CALL Z,nn | |34 INC (HL) | |CD8405 CALL nn | |DD3405 INC (IX+d) | |3F CCF | |FD3405 INC (IY+d) | |BE CP (HL) | |3C INC A | |DDBE05 CP (IX+d) | |04 INC B | |FDBE05 CP (IY+d) | |03 INC BC | |BF CP A | |0C INC C | |B8 CP B | |14 INC D | |B9 CP C | |13 INC DE | |BA CP D | |1C INC E | |BB CP E | |24 INC H | |BC CP H | |23 INC HL | |BD CP L | |DD23 INC IX | |FE20 CP n | |FD23 INC IY | |EDA9 CPD | |2C INC L | |EDB9 CPDR | |33 INC SP | | | |DB20 IN A,(n) | |-------------------------------| |-------------------------------| 15 |-------------------------------| |-------------------------------| |OBJ SOURCE | |OBJ SOURCE | |CODE STATEMENT | |CODE STATEMENT | | | | | |FDAA IND | |DD7E05 LD A,(IX+d)| |ED8A INDR | |FD7E05 LD A,(IY+d)| |EDA2 INI | |3A8405 LD A,(nn) | |EDB2 INIR | |7F LD A,A | |C38405 JP nn | |78 LD A,B | |F9 JP (HL) | |79 LD A,C | |DDE9 JP (IX) | |7A LD A,D | |FDE9 JP (IY) | |7B LD A,E | |DA8405 JP C,nn | |7C LD A,H | |FA8405 JP M,nn | |ED57 LD A,I | |D28405 JP NC,nn | |7D LD A,L | |C28405 JP NZ,nn | |3E20 LD A,n | |F28405 JP P,nn | |ED5F LD A,H | |EA8405 JP PE,nn | |46 LD B,(HL) | |E28405 JP PO,nn | |DD4605 LD B,(IX+d)| |CA8405 JP Z,nn | |FD4605 LD B,(IY+d)| |382E JR C,e | |47 LD B,A | |302E JR NC,e | |40 LD B,B | |202E JR NZ,e | |41 LD B,C | |282E JR Z,e | |42 LD B,D | |182E JR e | |43 LD B,E | |02 LD (BC),A | |44 LD B,H | |12 LD (DE),A | |45 LD B,L | |32 LD (HL),a | |0620 LD B,n | |70 LD (HL),B | |ED488405 LD BC,(nn) | |71 LD (HL),C | |018405 LD BC,nn | |72 LD (HL),D | |4E LD C,(HL) | |73 LD (HL),E | |DD4E05 LD C,(IX+d)| |74 LD (HL),H | |FD4E05 LD C,(IY+d)| |75 LD (HL),L | |4F LD C,A | |3620 LD (HL),n | |48 LD C,B | |DD7705 LD (IX+d),A| |49 LD C,C | |DD7005 LD (IX+d),B| |4A LD C,D | |DD7105 LD (IX+d),C| |4B LD C,E | |DD7205 LD (IX+d),D| |4C LD C,H | |DD7305 LD (IX+d),E| |4D LD C,L | |DD7405 LD (IX+d),H| |0E20 LD C,n | |DD7505 LD (IX+d),L| |56 LD D,(HL) | |DD360520 LD (IX+d),n| |DD5605 LD D,(IX+d)| |FD7705 LD (IY+d),A| |FD5605 LD D,(IY+d)| |FD7005 LD (IY+d),B| |57 LD D,A | |FD7105 LD (IY+d),C| |50 LD D,B | |FD7205 LD (IY+d),D| |51 LD D,C | |FD7305 LD (IY+d),E| |52 LD D,D | |FD7405 LD (IY+d),H| |53 LD D,E | |FD7505 LD (IY+d),L| |54 LD D,H | |FD360520 LD (IY+d),n| |55 LD D,L | |328405 LD (nn),A | |1620 LD D,n | |ED438405 LD (nn),BC | |ED588405 LD DE,(nn) | |ED538405 LD (nn),DE | |118405 LD DE,nn | |228405 LD (nn),HL | |5E LD E,(HL) | |DD228405 LD (nn),IX | |DD5E05 LD E,(IX+d)| |ED228405 LD (nn),IY | |FD5E05 LD E,(IY+d)| |ED238405 LD (nn),SP | |5F LD E,A | |0A LD A,(BC) | |58 LD E,B | |1A LD A,(DE) | |59 LD E,C | |7E LD A,(HL) | |5A LD E,D | |-------------------------------| |-------------------------------| 16 |-------------------------------| |-------------------------------| |OBJ SOURCE | |OBJ SOURCE | |CODE STATEMENT | |CODE STATEMENT | | | | | |5B LD E,E | |EDB3 OTIR | |5C LD E,H | |ED79 OUT (C)A | |5D LD E,L | |ED41 OUT (C)B | |1E20 LD E,n | |ED48 OUT (C)C | |66 LD H,(HL) | |ED51 OUT (C)D | |DD6605 LD H,(IX+d)| |ED49 OUT (C)E | |FD6605 LD H,(IY+d)| |ED61 OUT (C)H | |67 LD H,A | |ED69 OUT (C)L | |60 LD H,B | |D320 OUT (n)A | |61 LD H,C | |EDAB OUTD | |62 LD H,D | |EDA3 OUTI | |63 LD H,E | |F1 POP AF | |64 LD H,H | |C1 POP BC | |65 LD H,L | |D1 POP DE | |2620 LD H,n | |E1 POP HL | |2A8405 LD HL(nn) | |DDE1 POP IX | |218405 LD HL,nn | |FDE1 POP IY | |ED47 LD I,A | |F5 PUSH AF | |DD2A8405 LD IX,(nn) | |C5 PUSH BC | |DD218405 LD IX,nn | |D5 PUSH DE | |FD2AB405 LD IY,(nn) | |E5 PUSH HL | |FD218405 LD IY,nn | |DDE5 PUSH IX | |6E LD L,(HL) | |FDE5 PUSH IY | |DD6E05 LD L,(IX+d)| |CB86 RES 0,(HL) | |FD6E05 LD L,(IY+d)| |DDCB0586 RES 0,(IX+d)| |6F LD L,A | |FDCB0586 RES 0,(IY+d)| |68 LD L,B | |CB87 RES 0,A | |69 LD L,C | |CB80 RES 0,B | |6A LD L,D | |CB81 RES 0,C | |6B LD L,E | |CB82 RES 0,D | |6C LD L,H | |CB83 RES 0,E | |6D LD L,L | |CB84 RES 0,H | |2E20 LD L,n | |CB85 RES 0,L | |ED4F LD R,A | |CB8E RES 1,(HL) | |ED7B8405 LD SP,(nn) | |DDCB058E RES 1,(IX+d)| |F9 LD SP,HL | |FDCB058E RES 1,(IY+d)| |DDF9 LD SP,IX | |CB8F RES 1,A | |FDF9 LD SP,IY | |CB88 RES 1,B | |318405 LD SP,nn | |CB89 RES 1,C | |EDA8 LDD | |CB8A RES 1,D | |EDB8 LDDR | |CB8B RES 1,E | |EDA0 LDI | |CB8C RES 1,H | |EDB0 LDIR | |CB8D RES 1,L | |ED44 NEG | |CB96 RES 2,(HL) | |00 NOP | |DDCB0596 RES 2,(IX+d)| |B6 OR (HL) | |FDCB0596 RES 2,(IY+d)| |DDB605 OR (IX+d) | |CB97 RES 2,A | |FDB605 OR (IY+d) | |CB90 RES 2,B | |B7 OR A | |CB91 RES 2,C | |B0 OR B | |CB92 RES 2,D | |B1 OR C | |CB93 RES 2,E | |B2 OR D | |CB94 RES 2,H | |B3 OR E | |CB95 RES 2,L | |B4 OR H | |CB9E RES 3,(HL) | |B5 OR L | |DDCB059E RES 3,(IX+d)| |F620 OR n | |FDCB059E RES 3,(IY+d)| |ED8B OTDR | | | |-------------------------------| |-------------------------------| 17 |-------------------------------| |-------------------------------| |OBJ SOURCE | |OBJ SOURCE | |CODE STATEMENT | |CODE STATEMENT | | | | | |CB9F RES 3,A | |ED4D RETI | |CB98 RES 3,B | |ED45 RETIM | |CB39 RES 3,C | |CB16 RL (HL) | |C89A RES 3,D | |DDC80516 RL (IX+d) | |CB9B RES 3,E | |FDC80516 RL (IY+d) | |CB9C RES 3,H | |CB17 RL A | |CB9D RES 3,L | |CB10 RL B | |CBA6 RES 4,(HL) | |CB11 RL C | |DDCB05A6 RES 4,(IX+d)| |CB12 RL D | |FDCB05A6 RES 4,(IY+d)| |CB13 RL E | |CBA7 RES 4,A | |CB14 RL H | |CBA0 RES 4,B | |CB15 RL L | |CBA1 RES 4,C | |17 RLA | |CBA2 RES 4,D | |CB06 RLC (HL) | |DBA3 RES 4,E | |DDCB0506 RLC (IX+d) | |CBA4 RES 4,H | |FDCB0506 RLC (IY+d) | |CBA5 RES 4,L | |CB07 RLC A | |CBAE RES 5,(HL) | |CB00 RLC B | |DDCB05AE RES 5,(IX+d)| |CB01 RLC C | |FDCB05AE RES 5,(IY+d)| |CB02 RLC D | |CBAF RES 5,A | |CB03 RLC E | |CBA8 RES 5,8 | |CB04 RLC H | |CBA9 RES 5,C | |CB05 RLC L | |CBAA RES 5,D | |07 RLCA | |CBAB RES 5,E | |ED6F RLD | |CBAC RES 5,H | |CB1E RR (HL) | |CBAD RES 5,L | |DDCB051E RR (IX+d) | |CBB6 RES 6,(HL) | |FDCB051E RR (IY+d) | |DDCB05B6 RES 6,(IX+d)| |CB1F RR A | |FDCB05B6 RES 6,(IY+d)| |CB18 RR B | |CBB7 RES 6,A | |CB19 RR C | |CBB0 RES 6,B | |CB1A RR D | |CBB1 RES 6,C | |CB1B RR E | |CBB2 RES 6,D | |CB1C RR H | |C6B3 RES 6,E | |CB1D RR L | |CBB4 RES 6,H | |1F RRA | |CBB5 RES 6,L | |CB0E RRC (HL) | |CBBE RES 7,(HL) | |DDCB050E RRC (IX+d) | |DDCB05BE RES 7,(IX+d)| |FDCB050E RRC (IY+d) | |FDCB05BE RES 7,(IY+d)| |CB0F RRC A | |CBBF RES 7,A | |CB08 RRC B | |CBB8 RES 7,B | |CB09 RRC C | |CBB9 RES 7,C | |CB0A RRC D | |C8BA RES 7,D | |CB0B RRC E | |CBBB RES 7,E | |CB0C RRC H | |CBBC RES 7,H | |CB0D RRC L | |CBBD RES 7,L | |0F RRCA | |C9 RET | |ED67 RRD | |D8 RET C | |C7 RST 00H | |F8 RET M | |CF RST 08H | |D0 RET NC | |D7 RST 10H | |C0 RET NZ | |DF RST 18H | |F0 RET P | |E7 RST 20H | |E8 RET PE | |EF RST 28H | |E0 RET PO | |F7 RST 30H | |C8 RET Z | |FF RST 38H | | | |DE20 SBC A,n | |-------------------------------| |-------------------------------| 18 |-------------------------------| |-------------------------------| |OBJ SOURCE | |OBJ SOURCE | |CODE STATEMENT | |CODE STATEMENT | | | | | |9E SBC A,(HL) | |DDCB05E6 SET 4,(IX+d)| |DD9E05 SBC A,(IX+d)| |FDCB05E6 SET 4,(IY+d)| |FD9E05 SBC A,(IY+d)| |CBE7 SET 4,A | |9F SBC A,A | |CBE0 SET 4,B | |98 SBC A,B | |CBE1 SET 4,C | |99 SBC A,C | |CBE2 SET 4,D | |9A SBC A,D | |CBE3 SET 4,E | |9B SBC A,E | |CBE4 SET 4,H | |9C SBC A,H | |CBE5 SET 4,L | |9D SBC A,L | |CBEE SET 5,(HL) | |ED42 SBC HL,BC | |DDCB05EE SET 5,(IX+d)| |ED52 SBC HL,DE | |FDCB05EE SET 5,(IY+d)| |ED62 SBC HL,HL | |CBEF SET 5,A | |ED72 SBC HL,SP | |CBE8 SET 5,B | |37 SCF | |CBE9 SET 5,C | |CBC6 SET 0,(HL) | |CBEA SET 5,D | |DDCB05C6 SET 0,(IX+d)| |CBEB SET 5,E | |FDCB05C6 SET 0,(IY+d)| |CBEC SET 5,H | |CBC7 SET 0,A | |CBED SET 5,L | |CBC0 SET 0,B | |CBF6 SET 6,(HL) | |CBC1 SET 0,C | |DDCB05F6 SET 6,(IX+d)| |CBC2 SET 0,D | |FDCB05F6 SET 6,(IY+d)| |CBC3 SET 0,E | |CBF7 SET 6,A | |CBC4 SET 0,H | |CBF0 SET 6,B | |CBC5 SET 0,L | |CBF1 SET 6,C | |CBCE SET 1,(HL) | |CBF2 SET 6,D | |DDCB05CE SET 1,(IX+d)| |CBF3 SET 6,E | |FDCB05CE SET 1,(IY+d)| |CBF4 SET 6,H | |CBCF SET 1,A | |CBF5 SET 6,L | |CBC8 SET 1,B | |CBFE SET 7,(HL) | |CBC9 SET 1,C | |DDCB05FE SET 7,(IX+d)| |CBCA SET 1,D | |FDCB05FE SET 7,(IY+d)| |CBCB SET 1,E | |CBFF SET 7,A | |CBCC SET 1,H | |CBF8 SET 7,B | |CBCD SET 1,L | |CBF9 SET 7,C | |CBD6 SET 2,(HL) | |CBFA SET 7,D | |DDCB05D6 SET 2,(IX+d)| |CBFB SET 7,E | |FDCB05D6 SET 2,(IY+d)| |CBFC SET 7,H | |CBD7 SET 2,A | |CBFD SET 7,L | |CBD0 SET 2,B | |CB26 SLA (HL) | |CBD1 SET 2,C | |DDCB0526 SLA (IX+d) | |CBD2 SET 2,D | |FDCB0526 SLA (IY+d) | |CBD3 SET 2,E | |CB27 SLA A | |CBD4 SET 2,H | |CB20 SLA B | |CBD5 SET 2,L | |CB21 SLA C | |CBD8 SET 3,B | |CB22 SLA D | |CBDE SET 3,(HL) | |CB23 SLA E | |DDCB05DE SET 3,(IX+d)| |CB24 SLA H | |FDCB05DE SET 3,(IY+d)| |CB25 SLA L | |CBDF SET 3,A | |CB2E SRA (HL) | |CBD9 SET 3,C | |DDCB052E SRA (IX+d) | |CBDA SET 3,D | |FDCB052E SRA (IY+d) | |CBDB SET 3,E | |CB2F SRA A | |CBDC SET 3,H | |CB28 SRA B | |CBDD SET 3,L | |CB29 SRA C | |CBE6 SET 4,(HL) | |CB2A SRA D | |-------------------------------| |-------------------------------| 19 |-------------------------------| |OBJ SOURCE | |CODE STATEMENT | | | |CB2B SRA E | |CB2C SRA H | |CB2D SRA L | |CB3E SRL (HL) | |DDCB053E SRL (IX+d) | |FDCB053E SRL (IY+d) | |CB3F SRL A | |CB38 SRL B | |CB39 SRL C | |CB3A SRL D | |CB3B SRL E | |CB3C SRL H | |CB3D SRL L | |96 SUB (HL) | |DD9605 SUB (IX+d) | |FD9605 SUB (IY+d) | |97 SUB A | |90 SUB B | |91 SUB C | |92 SUB D | |93 SUB E | |94 SUB H | |95 SUB L | |D620 SUB n | |AE XOR (HL) | |DDAE05 XOR (IX+d) | |FDAE05 XOR (IY+d) | |AF XOR A | |A8 XOR B | |A9 XOR C | |AA XOR D | |AB XOR E | |AC XOR H | |AD XOR L | |EE20 XOR n | |-------------------------------| 20 OCR'd and converted to text format by Gerard Sweeney, 13/01/05 for World of Spectrum. Proof-reading has been done to the best of my ability, given the fairly low resolution of the original scans. If you do find any errors, the Speccy scene would appreciate it if you could upload a corrected version to WoS.