24
01 RESEflRl:H Post Office Box 579, Pacific Grove, California 93950, (408) 373-3403 CP /M DYNAMIC DEBUGGING TOOL (DDT) USER'S GUIDE COPYRIGHT © 1976, 1978 DIGITAL RESEARCH

01 RESEflRl:H - preterhuman.net

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

01 [)~[j~Tfll RESEflRl:H Post Office Box 579, Pacific Grove, California 93950, (408) 373-3403

CP/M DYNAMIC DEBUGGING TOOL (DDT)

USER'S GUIDE

COPYRIGHT © 1976, 1978

DIGITAL RESEARCH

Copyright © 1976, 1978 by Digital Research. All rights reserved. No part of this pUblication may be reproduced, transmitted, transcribed, stored in a retrieval system, or trans­lated into any language or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise, without the prior written permission of Digital Research, Post Office Box 579, Pacific Grove, California 93950.

Disclaimer

Digital Research makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. Further, Digital Research reserves the right to revise this publication and to make changes from time to time in the content hereof without obligation of Digital Research to notify any person of such revision or changes.

Table of Contents

Section Page

I. INl'IDoocrlOO ••••••••••••••••••••••••••••••••••••• II. ODr CI>MMANIS •••••••••••••••••••••••••••••••••••••

1. The A (Assemble) Command ••••••••••••••••••••• 2. The D (Display) Command •••••••••••••••••••••• 3. The F (Fill) Command ••••••••••••••••••••••••• 4. The G (Go) Canmaoo ••••••••••••••••••••••••••• 5. The I (Input) Canmand •••••••••••••••••••••••• 6. The L (List) Command ••••••••••••••••••••••••• 7. The M (Move) Command ••••••••••••••••••••••••• 8. The R (Read) Canmand ••••••••••••••••••••••••• 9. The S (Set) Commaoo •••••••••••••••••••••••••• 10. The T (Trace) Command •••••••••••••••••••••••• 11. The U (Untrace) Command •••••••••••••••••••••• 12. The X (Examine) Command ••••••••••••••••••••••

III. IMPLEMENTATION NOTES ••••••••••••••••••••••••••••• IV. AN EXAMPLE •••••••••••••••••••••••••••••••••••••••

1 3 3 4 4 4 5 6 6 6 7 7 8 8 9 10

CP/M Dynamic Debugging Tool (DOr)

User's Guide

I. Introduction.

The DDT proqram allows dynamic interactive testing and debugging of programs generated in the CP/M environment. The debuqqer is initiated by typinq one of the following canmands at the CP/M Console Command level

oor DDT filename.HEX DDT filename.COM

\\here "filename" is the name of the program to be loaded and tested. In both cases, the ODr proqram is brouqht into rrain ~mory in the place of the Console Command Processor (refer to the CP/M Interface Guide for standard memory orqanization), and thus resides directly below the Basic Disk Operating System portion of CP/M. The BOOS starting ~dress, \\hich is located in the address field of the JMP instruction at location 5H, is altered to reflect the reduced 'rr ansient Program Area size.

The second am third forms of the Dor command shown above ~rform the same actions as the first, except there is a subsequent automatic load of the s~cified HEX or <X>M file. The action is identical to the sequence of commands

Dor Ifilename.HEX or Ifilename.COM R

where the I and R carunands set up and read the s~cified program to test (see the explanation of the I and R commands below for exact details).

Upon initiation, Dna' prints a sign-on message in the format

nnK DDr-s VER m. m

where nn is the nemory size (which must JTlatch the CP/M system being used), s is the hardware system which is assumed, corresponding to the codes

D Digital Research standard version M MDS version I IMSAI standard version o Qrrocon systems S Digital Systems standard version

and m. m is the revi sion nurrber.

1

Followirg the sign on nessage, DDr prompts the operator with the character .'_It and waits for input canrnands from the console. The operator can tyy:e any of several single charactercanmands, terminated by a carriaqe return to execute the canmarrl. Each line of input can be line-edited usinq the standard C p 1M controls

rubout ctl-U ctl-C

remove the last character typed remove the entire line, ready for re-typing system reboot

Any command can be up to 32 characters in lenqth (an automatic carriaqe return is inserted as the 33rd dlaracter), where the first cnaracter determines the command ty~

A enter assembly lanquaqe mnemonics with operands o display memory in hexadecimal and ASCII F fill memory with constant data G begin execution "with optional breakpoints I set up a standard in?ut file control block L Ii st nemory usinq assembler rmemonics M move a memory segment from source to destination R read pcogram for subsequent testing S substitute memory values T trace program execution U LIltraced program nonitoring X examine and optionally alter the CPU state

'l'he canmand character, in some cases, is followed by zero, one, two, or three hexadecimal values which are separated by canmas or single blank characters. All our numeric ootpJt is in hexadecimal form. In all cases, the commands are not executed until the carriage return is typed at the end of the command.

At any p:>int in the debug run, the operator can stop execution of DIJI' usinq either" a ctl-C or G0 (jmp to location 0000H), and save the current memory image using a SAVE command of the form

SAVE n filename.COM

where n is the nunber of pages (256 byte blocks) to be saved on disk. 'rhe nunt>er of blocks can be determined by taking the high order byte of the top load address am converting this nurrber to decimal. For example, if the highest a-:ldressin the Transient Program Area is 1234H then the nunber of pages is 12H, or 18 in decimal. Thus the operator could type a ctl-C during the debug run, returning to the Console Processor level, followed by

SAVE 18 X.COM

The nemory image is saved as X.COM on the diskette, am can be directly executed by simpl y typing the name X. If further testing is required, the memory image can be recalled by typing

2

Dor X.COM

which reloads IXeviously saved program from loaction l00H through P3ge 18 (12FFH) • The machine state is not a part of the COM file, and thus the proqram must be restarted from the beginning in order to properly test it.

I I. DDl' ml-1MANC6.

'l'he irdividual canmands are given below in some detail. In each case, the operator must wait for the prompt character (-) before enterinq the command. If control is p3ssed to a p:-ogram under test, and the program has not reached a break{X)int, control can be returned to DlJI' by executing a RST 7 from the front panel (note that the rubout key should be used instead if the program is executing a T or U canmand). In the explanation of each command, the command letter is srown in rome cases with nunbers separated by canmas, \\here the nllIliJers are represented by lower case letters. 'lhese nurrt>ers are always assumed to be in a hexadecimal radix, and from one to four digi ts in length (longer numbers will be automatically truncated on the right).

Many of the canmands operate utx>n a "CPU state" which corresp:>nds to the proqram under test. 'llhe CPU state holds the registers of the program beinq debuqqed, ard initially contains zeroes for all registers and flags except for the p:-oqram counter (P) and stack p:>inter (S), \\hich default to 100H. The prCXJram counter is slbsequently set to the starting address given in the last record of a HEX file if a file of this form is loaded (see the I and R commaros) •

1. The A (Assemble) ConL'land.' DOl' allows inline assembly languaqe to be inserted into the current rremory image using the A command which takes the form

As

where s is the hexadecimal starting ajdress for the inline assembly. DDT pranpts the console wi th the crldress of the next instruction to fill, and reads the console , looking for assembly language nnemonics (see the Intel 8080 Assembly language Reference Card for a list of mnemonics), followed by register references and operands in absolute hexadecimal form. Each sucessive load address is printed before reading the console. The A command terminates when the first empty line is input from the console.

Upon canpletion of a ssemb I y language input, the operator can review the memory segment using the DOl' disassembler (see the L cormnand).

Note that the assembler/disassembler tnrtion of DDT can be overlayed by the transient program being tested, in which case the DO!' program responds wi th an error condi tion \\hen the A and L commands are used (refer to Section IV).

3

2. 'rhe D (Display) Commarrl. 'I'he 0 command allows the operator to view the contents of memory in hexadecimal and ASCII formats. The forms are

o Os Ds,f

In the first case, memory is displayed from the current display crldress (initially l00H), ana continues for 16 display lines. Each display line takes the fa rm shown below

aaaa bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb cccccccccccccccc

where aaaa is the display address in hexadecimal, and bb represents data present inrnemory starting at aaaa. The ASCII characters starting at aaaa are given to the riqht (represented by the sequence of c"s), ¥.here' non-qraphic characters are ~inted as a ~riod (.) symbol. Note' that both upper and lower case alphabetics are displayed, and thus will appear as upoer ca'se symbols on a console device that supyx>rts only uq::>er case. Each display line gives the values of 16 bytes of data, except that the first line displayed is truncated so that the next line begins at an address which is a multiple of 16.

The second form of the D canmand shown above is similar to the first, except that the display crldress is first set to address s. The third form causes the display to continue from address s through crldress f. In all cases, the display crldress, is set to the first crldress not displayed in this command, so that a continuing display can be accomplished by issuinq successive D canmaoos with no explicit addresses.

Excessively long displays can be aborted by pushinq the rubout key.

3. The F (Fill) Command. The F command takes the form

Fs,f,c

where s is the starting address, f is the final address, and c is a hexadecimal byte constant. The effect is as follows: ODr stores the constant c at a::Idress s, increments the value of s and tests against f. If s exceeds f then the operation terminates, otherwise the q:>eration is repeated. Thus, the fill command can be used to set a memory block to a specific constant value.

4. The G (Go) Command. Program execution is started using the G comand, wi th up to two ~tional breakpoint addresses. The G command takes one ot the forms

G Gs Gs,b

4

Gs,b,c G,b G,b,c

'llhe first form starts execution of the program under test at the current value of the {roqram counter in the current machine state, wi th no breakrx>ints set (the only way to re;Jain control in om' is through a RST 7 execution). The current {X"ogram counter can be viewed by typing an X or XP command. The second form is similar to the first except that the program counter in the cur rent machine state is set to crldress s before execution begins. The third form is the same as the second, except that program execution stops when address b is encountered (b must be in the area of the program under test). 'rhe instruction at location b is not executed when the breakpoint is encountered. The fourth form is identical to the third, except that two breakInints are s~tified, one at b and the other at c. Encountering either breakp:>int causes execution to stop, and both breaklX)ints are subsequently cleared. 'llhe last two forms take the program counter fran the current machine state, and set one and two breakpoints, respectively.

Execution continues from the starting address in real-time to the next breakpJint. That is, there is no intervention between the startinq address and the break address by oor. Thus, if the program under test does not reach a breakpoint, control cannot return to our wi thout executing a RST 7 instruction. Upon encountering a breakpoint, DDT stops execution and types

*d

where d is the stop address. The machine state can be examined at this t;X)int using the X (Examine) command. The cperator must s~cify breakp:)ints which differ from the y;xogram counter crldress at the beginning of the G command. Thus, if the current program counter is 1234H, then the commands

G,1234 and

G400,400

both produce an immediate breakpoint, without executinq any instructions whatsoever.

5. The I (Input) Command. The I canmand allows the operator to insert a file name into the default file control block at SCH (the file control block created by CP/M for transient ~ograms is placed at this location; see the CP/M Interface Guide). The default FCB can be used by the {X"ogram under test as if it hcrl been passed by the CP/M Console Processor. Note that this file name is also used by nor for reading addi tional HEX and COM files. The form of the I canmand is

Ifilename or

5

Itilename.filetype

If the second form is used, and the filetype is either HEX or COM, then sUbsequent R commands can be used to read the pure binary or hex format machine code (see the R command for further details).

6. 'fhe L (List) Command. The L canmand is used to list assembly lanquaqe mnemonics in a particular program region. The forms are

L Ls Ls,f

'I'he first canmand lists twelve lines of disassembled machine code from the current list crldress. r£he second form sets the list adoress to s, and then lists twelve lines of code. 'rhe last form lists disasseroled code from s throuqh address f. In all three cases, the list address is set to the next unlisted locat.ion in preparation for a subsequent L command. Upon encountering an execution breakp;:>int, the list address is set to the current value of the p:-ogram counter (see the G and T cOmmands). Aqain, lonq typeouts can be aborted usinq the rubout key during the list process •

. 7. The ~1 (Move) Command. The M command allows block moveITIent of proqram or data areas from one location to another in memory. The form is

Ms,f,d

where s is the start address of the nove, f is the final address of the rove, and d is the destination crldress. Data is first roved from s to d, and both addresses are incremented. It s exceeds f then the nove operation stops, otherwise the nove operation is repeated.

8. The R (Read) Command. The R command is used in conjunction wi th the I command to read COM and HEX files fran the diskette into the transient program area in p:eparation for the debuq run. The forms are

R Rb

where b is an q;>tional bias address \\bich is added to each program or data address as it is loaded. 'l'he load q:>eration must not overwrite any of the system parameters from 000H throuqh 0FFH (i.e., the first page of memory). If b is anitted, then b=0000 is assumed. The R command requires a Irevious I command, s~cifying the name of a HEX or COM file. The load address for each record is obtained from each individual HEX record, \\bile an assumed load address of l00H is taken for COM files. Note that any nurrber of R commands can be issued followin:;J the I command to re-read the proqram under test,

6

assuminq the tested proqram does not destroy the default area at SCH. Further, any file sp=cified wi tn the filetn;e "COM" is assumed to contain machine code in pure binary form (created wi th the LQ2\D or SAVE command), and a 11 others are assumed to contain machine code in Intel hex format. (produced, for example, wi th the ASrll command) •

Recall that the canmand

oor filename.filetype

which initiates the OD1\ program is equivalent to the commands

DDr -Ifilenarne.filetype -R

Whenever the R command is issued, DDT responds with either the error indicator "? .. (file cannot be cpened, or a checksum error occurred in a HEX file), or with a load me ssaqe tak ing the fo rm

NEXT PC nnnn PWP

where nnnn is the next address following the loaded program, and pppp is the assumed program counter (l00H for COM files, or taken from the last record if a HEX file is specified).

9. The S (Set) Command. examined and optionally altered.

Ss

The S cCl'TUTland allows memory locations to be The form of the canmand is

where s is the hexadecimal starting address for examination and alteration of memory. oor res1?Onds wi th a numeric prompt, qivinq the memory location, along with the data currently held in the nemory location. If the operator types a carriage return, then the data is not altered. If a byte value is typed, then the value is stored at the ~anpted address. In either case, DDT continues to pranpt wi th successive addresses and values until either a t:eriod (.) is typed by the operator, or an invalid input value is detected.

10. The T (Trace) Command. The T command allows selective tracing of program execution for 1 to 65535 program steps. The forms are

T Tn

In the first case, the CPU state is displayed, and the next p=ogram step is executed. The p=ogram terminates immediately, with the termination address

7

·displayed as

*hhhh

Where hhhh is the next crldress to execute. The display address (used in the D cornmaM) is set to the value of Hand L, and the list address (used in the L cornmaoo) is set to hhhh. The CPU state at program termination can then be examined using the X command.

The second form of the T command is similar to the first, except that execution is traced for n steps (n is a hexadecimal va!ue) before a IXogram break~int is occurs. A breakp:>int can be forced in the trace rode by typing a rubout cnaracter. The CPU state is displayed before each program step is taken in trace rrode. The format of the display is the same as described in the X canrnand.

Note that proqram tracing is discontinued at the interface to CP/M, and resumes after return from CP/M to the program under test. Thus, CP/M functions which access I/O devices, such as the diskette drive, run in real-tiIre, avoiding I/O timing problems. Pr(XJrarns runninq in trace rode execute approximately 500 times slower than real time since our gets control after each user instruction is executed. Interrupt processing routines can be traced, but it must be noted that camnands which use the breakpoint facility (G, T, and U) accomplish the break using a RST 7 instruction, which means that the tested ~ogram cannot use this interrupt location. Further, the trace mode always runs the tested rcogram with interrupts enabled, W1ich may cause problems if asynchronous interrupts are received durinq tracinq.

Note also that the operator should use the rubout key to get control back to our dur ing trace, rather than executinq a RS'r 7, in order to ensure that the trace for the rurrent instruction is completed before interruption.

11. The U (Untrace) Command. The U command is identical to the T command except that intermediate tx"ogram steps are not displayed. The lIltrace node allows from 1 to 65535 (0FFFFH) steps to be executed in monitored mode, and is used IX'incipally to retain control of an executing {X'oqram while it reaches steady state conditions. All conditions of the T command apply to the u canmand.

12. The X (Examine) Command. The X command allows selective display and alteration of the 'current CPU state for the pcogram under test. The forms are

X Xr

where r is one of the 8080 CPU registers

C Carry Flag Z Zero Flag

(0/1) (0/1)

8

M Minus Flag (0/1) E Even Par i ty Flag (0/1) I Interdigit Carry (0/1) A Accumulator (0-FF) B BC register pair (0-FFFF) 0 DE register pair (0-FFFF) H HL register p:lir (0-FFFF) S Stack Pointer (0-FFFF) P Program Counter (0-FFFF)

In the first case, the CPU register state is displayed in the format

CfZfMfEfIf A=bb B=dddd D=dddd H=dddd S=dddd P=dddd inst

where f is a 0 or 1 flag value, bb is a byte value, and dddd is a double byte quantity corresp:>nding to the register pair. The II instil field contains the disassembled instruction \\hich occurs at the location addressed by the CPU state's program counter.

The second form allows display and optional alteration of register values, where r is one of the registers given above (C, z, M, E, I, A, B, D, H, S, or P) • In each case, the flag or register value is· first displayed at the console. The DDT program then accepts input from the console. If a carriage return is typed, then the flag or register value is not altered. If a value in the proper range is typed, then the flag or register value 15 altered. Note that BC, DE, and HL are displayed as register pairs. Thus, the operator ty~s the entire r~ister pair \\hen B, C, or the BC pair is altered.

I II. IMPLEMENTATIOO NOI'ES.

The organization of DDT allows certain non-essential portions to be overlayed in order to gain a larger transient program area for debugging large programs. The DDl' program consists of two parts: the Dm nucleus an:] the assent>ler/disassembler nodule. The Dur nucleus is loaded over the Console Canmand Processor, arrl, al though loaded wi th the our nucleus, the assembler/disassembler is overlayable unless used to assemble or disassemble.

In particular, the BJ)(S address at location 6H (address field of the JMP instruction at location 5H) is nodified by our to address the base location of the DDT nucleus Which, in turn, contains a JMP instruction to the BDOS. Thus, progr ams ~ich use this address field to size rremory see the logical end of memory at the base of the DDT nucleus rather than the base of the BDOS.

The asserrbler /disassent>ler rrodule resides eli rectI y below the oor nucleus in the transient p:'ogram area. If the A, L, T, or X commands are used during the debuggin;J process then the our program again alters the crldress field at 6H to include this nodule, thus further reducinq the logical end of' memory. If a program loads beyond the beginning of the assent>ler/disassent>ler nodule, the A and L camnarrls are lost (their use };Coduces a U?" in response), and the

9

, trace arrl display fT and X) commands list the Itinst" field of the display in hexadecimal, rather than as a decoded instruction •.

IV. AN EXAMPLE.

The followiB:} example srows an edit, assenble, arrl debug for a simple program which reads a set of data values and determines the largest value in the set. The largest value is taken from the vector, and stored into "lARGE" at the termination of the p::-ogram

2...2 j,.J VEeT: LEN LARGE:

ta"' B0PI1

LOOf':

HFOUND:

TEST DB EQU !.§. ENr." ORC MVI MVI LXI "Oll SUB JNC HELl MOV IHX nCR JNZ

;REBQOTJ

DATA 20' 00' 4, 3J 5 .. 60' 1 of 5.) I.-VECT iLEHGTH.2

CY'tak SOU-fat.

1'(C6V(l~" (}.~e({,~~ c~4(dcluS "bptc(

~ 1M:J5vn.YYlmet: IIJ " VePl~ {!{J'(fio11.

(f..(ufK.,.

~ ;LARGEST YALUE OHEXITJ

le0H iSTART OF TRANSIENT AREA e,lEN ;l£HGTH OF YECTOR TO SCAN CJ0 ;lARGEST VALUE SO FAR H,YECT i8ASE OF YECTOR A,M ;CET YALUE C iLARGER YALUE IN C? NFOUH D i J LIMP tlF L AR G ER 'YA LUE NOT FO UND

LARGEST YALUE,STORE IT TO C CIA H B lOOP

iTO NEXT ELEMENT il'lORE TO SCAN? iFOR ANOTHER

10

END OF SCAN .. STORE C MOY A,C ;CET LARGEST VALUE STA LARGE JMP e ;REBOOT

TEST DATA VEeT: DB 2 .• 0J413,5,6 .. 1 ... 5 LEN LARGE:

E Q U $ -VEe TiL E H G T H DS 1 ;LARGEST YALUE ON EXIT END • ..- [:: kli r1 \i;lL t

CP/M ASSEMBLER - YER 1.0

0122 002H USE FACTOR END OF ASSEMBLY'

TYPE SCAN.PRN - ~

CJeAJJs~ . e 1 a 0 t-JGck~t Cc.dt

( SaU(ft ;R~rCM

elee 9688,) 0102 8E8e

~ ORG teeH iSTART OF TRANSIENT AREA

8184 211981 9187 7E 018S 91 0189 D28D81

LOOP:

"YI B,LEN ;LEHGTH OF VECTOR TO SCAN "VI cle ;LARGEST VALUE SO FAR L~I H,YECT ;BASE OF YECTOR MOY A,M iGET VALUE SUB C ;LARGER VALUE IN C? JHC HFOUHD ;JUMP IF LARGER VALUE HOT FOUND HEW LARGEST YALUE .. STORE IT TO C MOYC .. A 91ec 4F

e18D 23 018E 85 810F C20781

H F ° UN D: I H )( H ;TO HEXT ELEt1EHT ;"ORE TO SCAN? iFOR ANOTHER

0112 79 9113 322181 9116 C 3,. ~8' t •

cdt/dak h~~j ; ~td ~i

9119 829ge40395YECT: 098e = <L\ LEN e 1 2 1 Value ~ '") L A R G E : 0122 Equ.crk

A}

DCR B JNZ . LOOP

END OF SCAH, STORE C "0\1 A,e ;GET LARGEST VALUE STA LARGE J"P 0 ;REBOOT

TEST DATA DB 2,0,4,3,5,6,1,5 EQU $~YECT ;LEHGTH DS 1 ;LARGEST YALUE OH EXIT END

\\

ri !t T ~:; C (;: N. H E :x; ,- . ~

1 .; K II II T ..... E ~: 1. 0 Hr::y.~T PC:

~~~. :~: 2 1, B e 0 0

-~

-'Ll~f(1 -J

r'PC. ~ot1d. P :: tl 1 f: ~3 r1 V I 8., (1 ::!)

~ 114vudlo"Y\ C0Z0M0E0I0 A=0e 8=0e00 D=B000 H=0000 $=0100

-to Mett\t crl p(!=\OO t~i6el t-1 V i B/08 0102 M V I C .• e0 0194 LXI H .. ells! 01@7 NOV A .t1 (11€tB SUB c: 'D~~~ltJ M.4~l~t 011219 .JNC e 1 e II l110e MOV C .. A Code c1~ loo" 010D 1 .. 0·: H te SaJfrL l.t~~ ~10E IleR B &ieF JNZ 01B7 iJI~tSO.u e 112 MOV Ale -L -~

"2..

e 11 (' NOP 81 18 t40P 0119 STA~: B .31 1 A t40P (1 11 B INR B ell (: I H~: B

-'L~ ~ at '{~l~(S C0Z0M0E010 A=00 8=0080 D=8000 H=0000 8=0100 P~0100 MVI B,B8

-1-.1 blc.u.~ fY~(Cl~ -f" Ov\l.. ~kf. l~lna.f CRu. sirtie., J b~(€ J ;\ ~ecu.kd C0zeM0E010 A=80 B~e0e0 D=9000 H=00e0 8=0100 p=~10e MY) BJ08*0102

-J..~ lira oat ~p ~;\1 (MlOJ\.( in g) auh'NAitL k(t4kt'~\~J j C(1ZBM0E010 A=00 8=0880 D=se00 H=000B S=0100 p~01e2 t1 v I C.100*0104 _. T .

-) lr«t CljG.\V\ (R~H~~ C ~~ C('(A(ta) C0Z0M0E010 A=00 B=0800 D=@008 H=0000 s= 01.00 P=0104 L X I H " 0 1 1 9 :+: 0 1 8 7

-, !.lall"Yac.t -H'wtl .tjkfs C0Z(1t10E010 A=00 8=080e D=0800 H=0119 s=e10~3 P::0107 MOV A.I M CeZ(1M0E010 A=02 8=8800 D=0000 H=0119 S=0100 P=010S SUB C ceZ0M8E011 A=02 8=0888 D=030a H=0119 8=0100 P::0109 \-INC 010D*310D -It11'~· ~~' aI: IIqw. deJ,.. O.i.r\o_ b1(ak1'o,rtt- ~1 j OD~---' ~~ Dl~Ql~ Mt~ \' V\

e 119 82 Be 04 (13 05 06 01 ~~~~~. ,

, .. "!, .,.,. W. t .. '@' 0120 05 1 1 00 22 21 80 02 7E EB 77 1 3 23 EB 0B 78 £11 '3 €I C2 27 01 C3 03 29 00 00 as 00 00 €10 00 08 00 €Ie • J • • • ) . , , , , , • • ••

0140 Be 00 80 00 00 00 00 80 00 00 00 e0 00 00 00 00 D«k. ~ di~1>lgJtd : : : : 01S0 00 80 00 00 00 0e 00 30 00 00 00 013 ee 138 00 €Ie

0160 130 00 00 00 08 80 00 00 00 00 00 00 00 08 00 Be . A!L11 '-\-k \" , l\l' . 'Wt. a: •.. [11 '7 €I 00 00 30 00 00 00 00 00 08 00 00 00 00 08 00 80 'L\A ~ ~~l-b6'; of ' . , 0180 00 00 00 08 00 Be 80 00 08 00 '00 e0 00 08 00 B0 ~~Il 90 Be 00 00 08 08 B0 00 00 0a 00 B0 00 00 00 00 ee :v\LJ~:" 6(Op~~(: :.: : : : : {~1 Ae a8 00 00 00 08 0e 00 00 08 08 B0 00 00 08 00 80 e~(~$ ... ", '" 0180 00 00 00 08 ae Be 8e 00 00 08 00 00 00 08 90 B0 ....................... 81ce Be 00 00 00 00 88 00 00 00 00 90 00 00 08 00 90 ....................

-1:../ Cu«M CPa ~-\t, I, cezecM0E0Il A=02 8=8800 D=000B H=0119 8=0100 P=010D I N)t: H -T5

l(QlI ~ c;t ps ~YD'M CU.fftJ CPU sklc, -, ceZ0M8E011 A=02 8=8880 D =8000 H=0119 8=0100 P=010D INX H ceZ0M0E011 A=02 9=0880 D=8098 H=011A 8=0100 P=810E DCR B ~-k: ceZ0M8E011 A=82 8=8780 D=8008 H=011A S=0100 P=010F JHZ 01g~6i.ct C0zeM8E011 A=02 8=8780 D=808e H=011A 8=0100 P=8107 MOV AIM ceZBM8E9Il A=ee 8=8700 D =8 0 08 H=011A S=0100 P=9108 SUB C*0189 -us .

\l~~ ~\t~td~~ -, \tact UA~~-\ (:021"'0E111 A=e0 B=8788 D=800e H=011A 8=0100 P=@109 JHC 010D*0108

-'3..J CRu. ~k o.t fkd.of uS ~ ceZ0MBE111 A=04 8=8688 D=8809 H=8118 S=0100 P=0108· SUB C

. C J ltun ?(ojrtA~ -t~ CLl~-t fc \AK-nl CP~~lttU;A (l~ tOO-+v'\I~e) ,.. 0 1 1 ~~ 'otett k.po~J: Q.t ll6~ JC~t! ~ ~-hr}, 1(csr 1 \~ YrI~dA(li~ caJ~ .- ::< J rPu ~ k . at ewi t! Prf! tlm C0Z1MBEl11 A~eB B~0ee0 D=a00B H=0121 8=0100 P=0116 RST 07

-:::.E:l l~iIIl~ (lvrf. C.WM~l ~ eov.~W' f' .~. €il 1 6 1 el '\,

... ~.:' . :.:...;

=~f~;O~~ l~=~::l\ D;;0a~I:~::;J;.r :;J~iMV:~~~{p C (I Z .1 ~1 ij Ell 1 ~;:- ::. 1 ~1 1;.1 p:; ~!I 1 tl~.::1 !'1 V 1 i.::" \:1 :::

C~j;':l MetE 1 I 1 C (I :? 1 t1 0 Ell 1 COZIM£!ElIl C0Z1 NI1E 111 C€1ZBM0Eell C'3Z(H'1EtE0Il A=€I2 C:02C1Mt3E0Il A=02 cozer1BE011 A=02 C'3Z0MI~EeI 1 A=02

8=€1806 8=080'21 B=€17B0 B=07B0 B=078£1 B={;700 8=0780 B:::070~

B=€168e 9:=0690

II =0 0 00 D==Seee D=0000 D=P.l000 II=ft000 II=0000 D=0000 D =0 0 a0 D=PJ000 II=B000

:;: ::!. (I 1 ~3 ti ~:: :;" (t 1 tZl 1?1

S::: lZ11 fd (1

H=01 19 8=0100 H=etl 19 8=0100 H = 01 lA 8=0100 H=01 lEi S=0100 H=01 lA :3=0100 H=01 1A ::;:::01 ~30 H=01 lA !:;=€t100 H=01 lA S=€t100 H=01 lEe S=0100 H=01 1B :::=eI100 H=01 18 S=01(-u3

F':: .2: 1 0 r~ t'1 v:t ,'. ~1 t1 ...... "

P::~II04 L. ;..; 1 P::01f;1'? ~'10 I,t p:: ~2: 1 er 8 :;UB ~,.

PI: 0 1 (1:3 ,J N 010It p:: li.l 1 el If 1 N:X: H p::: 010 E nCR 8 P:::01C'lF ·-'NZ 010'1 F':: iii 1 tl 7 ~1 OV A,. M p:: tIl €I :3 SUB C P:::0109 ,JNC ~110I1

P::010D I N~: H P=010E D CF.: ... :::. P::010F \.INZ 0107 P=0107 t10\l

. C:0Z0t1€tE011 A==e10 C0Z1Mt3Elll A=00 (:: €I 21M 13 Ell 1 A ::; 0 €I caZl t1BE 111 A=00 C0Zett1f1E 111 A=00 c:eZ0Mr,E 111 A=00 - A 1171'~

---::.-;..~ ~ tl ~ kt ptrtc.klt

• \~ 1't~tu\\~~{L ~Ul ~U ~(, o 1 :~t 9 • ..1 c: . 1 a It.7 -HAl lWlc~Ute ~ (A·' L •

-rn c \U.hu~ ~e.- Vt -riO't\1. 1'\ lWV C. 5\ KC( A ') e · '~l i (I Ci l"oc 10 ~(. 5u~.~ {kis C4J.e. u.tt.S nt t){lw.td.)

-0l ~ ~ tOT ~~{ fA v~ of it appt'AVf> -kI- -+ttt .::rt.1(. 4.o .... 1t1 -tf,e p~r(~r~ Ctl., w sa.vtrI ~\l! i,u", fA.. J'C ,~~

S A VEl seA f~ . C (I t·t;) 1103Vilt1l ytS~t 5 (M {l~t Alfjtl 'SO ~~ i 1'tl~.

A > II n T sc: Ii N. COM,., 'i< ... 4.rf"&Ur tAl J\. -tl.t ~ lfl!ri 'trltMti!l 1 ~ -10 (0", -hl'l~ -M~ i6r.. IIDT VER 1. (3

NE;r.:T PC 02€1(1 0100 _. L 1 (1 e J L~+ ~~c,de

81ea MVI B .. 08 01e2 MVI C" 0 (1 . £1104 L>n H., 0 1 1 9 17veVlCJCAS PA+~

. 1'1e5td X,Ol~ l' lY\

til 07 t10V A.'M~ ~;t 1 0 B SlIB C ))11219 ..Je e10

010C MOV CJA e1 er, INX H 010E DCR B 910F JNZ 0107 0112 MOV A.I C

-~;

P=010BJ

- T I 0 ~ T \1.ict -b ~ \"oW prdc4td. VetSLI~ opu~ Thdu ~ ~d trDM A 1> c C€tZ0M0E010 B=0080 D=8000 H=0€100 MVI 8 .. 08 ceZ0M0E010 8=0800 D=@000 H=0000 P:::0102 MVI C.' €I0 c:eZ(1MBE010 B=0800 It =0 0 00 H=0£te0 P:::0104 Lin H.·0119 C0Z0M0E010 B=0800 D=0000 H=0119 P=0107 MOV A .• M c:eZ0MBE010 8=0800 D=0000 H=0 8=0100 P=~1108 SUB C C0Z0M0E011 A=02 B· IS8e D=80 119 8=0100 P=0109 JC a 10 II ceZ0M0E011 A=02 8=0 00 D 00 H=0119 S=0100 P=010C MOV C.' ~I ceZ0M0E011 A=02 8:=0 0 D =0 e 08 H=0119 S=0100 P=Bl€ID INX H ceZ0M0E011 A=02 B=e8 2 D=0000 H=011A S=01et0 P=010E nCR B c:ezeM0E011 A=02 B=0702 D=8ge0 H=011A $=0100 P=010F • ..1 NZ o 10'( ceZ0M0E011 A=02 B=8782 D=8000 H=011A $=0100 P=0107 MOV A., t1 ceZ0MBE011 A=00 8=8782 D=800e H=011A S=0100 P=0108 SUB C ClzeMlE010 A=FE 8=8782 D=0000 H=011A $=0100 P=8109 JC 010D C1ZEtMIE0I0 A=FE 8=8782 D=8008 H=011A S=0100 P=810D I H)c: H C1Z0MIE010 A=FE 8=8702 D=000e H=011B 8=0100 P=010E nCR B C1Z0M0El11 A=FE B=8682 D=0000 H=8118 S=0108 P=010F JHZ 0107*0107 _. -:AI

:..:..,) ~R>iarl h 'bS~ C1Z0M0EIll A=FE 9=0602 D=0008 H=011B 8=0100 P=0107 MOY A}M

- G., 108 ~ 12(41 ..f",M cu.tvt~ 'PC avu! ~ve~po;~ at I0C6H *0108 -:t... i C1Z0M8El11 -T -l

CIZBM0El11 -T -i

CeZ8M9E011 -X -I

. ,W ~JCJA.< A=04 8=8682 D=0000 H=011B 8=0100 P=0108

~ l~lt '5tc:p +0( tl £w ~df5 A=84 8=0692 D=08ee H=011B S=0100 P=01BS

A=02 B=8682 D=800e H=811B S=0100 P=0109

SUB C

SUB C*0189

JC 010D~cflt10C

CeZ0M0E0Il A=82 8=8682 D=88e9 H=011B S=0100 P=010C MOY CIA

-£, t<~ it> c.ntpldu~ *0116 -X-J

C0Z1M0El11 A=03 9=3883 D=0000 H=0121 5=0100 P=0116 RST 07

- §.ll1., . look. ttt i\..le\4ll&t rJ "UeGe" e 1 2 1 0 3" WVcN\J lJ1\"", !

/'5"

0122 B0;

0123 22;

0124 21J

0125 8("l

&126 B2J ,5 ~~CiH~ s GIt'I~ (1127 7£

.!.~ -L100 -~

0100 ~1VI

0102 M'v'I 0104 LXI 8107 !'IOV 0108 SlIE: 0109 JC a10C MOV 010I1 IHX 810E DCR €lIeF JHZ 0112 MOV -L -J

STA RST

B .. 08 C.t ee H .. 0119 A.I M (:

BleD C .. A H B 8107 A .• C

8121 87

0113 a 116 0117 e 118 0119 011 A ell B e 11 c: (111 D

HOP HOP STAX B HOP 1 HR IHX DCR

811E MVl 0120 DCR -xp -J

p = ell 6 1 0 0 Qtstt -1\te. l'e -J

-1. J S\~lt ~, aM Wt.\'\tlt dak VallLl5 ceZ1M0EI11 A=83 8=0083 D=80e8 Hz 9121 -T -J

ceZlM0E1Il A=83 8=8883 D=80e8 H=0121 -T (Ctl~~ID..~·'d -i

(:021118El11 A=03 B=88e\ Dae8ee H-e121

S=8180 Pa:0100

S=0100 P=0102

S=9108 P=8104 -T r·t.v Q~ Ii dt$ .t -~ C0Z1t18EIIi A=83 8=8880 D=898e H=el19 S=8100 P=8107

"

MV1 8.· 08*0102

I1VI C .. 00*0104

LXI H .. 0119*8187

HOV A.I H*e 108

-T -J

CeZ1M8El11 -1..,

C0ZeM8EEtIl -T -J

CeZeMBEEtl1 -T -~

CIZ!ZeiM0E0l1 -T -J C0ZBM8EeJll -T -J

C0ZEtMBE011 -T '-J

tez0MftE0Il -T -J CeZEtM9E011 -T -J (:129M1E010 -T -~

, C-~l';~ tiA~ ~ \,v~ltt1l ~ A=92 9=8880 D=8gee H=0119 8=0109 P=0108 SUB

A=02 B=8see II=8800 H=0119 8=0100 P=€tlB9 JC

A=82 B=8808 D=8008 H=0119 5=0100 P=810C MOV

r.~ d$. ~ ~ttl 4t c. ~'fu.:tlj A=92 B=0882 D=8809 H=0119 S=0100 P=810D INX

A=€t2 8=&882 D=0008 H=011A 8=0100 P=€t10E DCR

A=02 B=07B2 D =8 e 08 H=011A 8=0100 P=010F ·JNZ

A=02 9=0792 D=3eee H=@tlR S=6100 p=e107 r1DV

r st.tovvl ~ l~ \o,ou."Ltt -kt A A=00 S=0702 D=8008 H=011A S=0100 P=9108 SUB

r sui,fytla d.~CJ8S ~ vtJ(d, l,Jk\~ w~s lO4titc( /// ~=FE 8=0782 Dzseee H=011A 8=0100 P=0109 JC

C*Et189

010D*01BC

C .. A*810It

H*010E

8*010F

0107*0107

C1Z8M1EeI0 A=FE B=9782 D=8ee8 H=011A 8=0100 P=018D IHX H*01BE -L1B0 -J

0108 0102 9104 0107 0198 0109 B10C 018n 010E 010F a 1 12 -Ales -~

0108

e 109i

MYI MYI LXI 1'10'1 SUB JC MOY INX DCR JHZ I'IOY

CMP C

B .. 9S e .. 80 HA119

~ .. " ..... -~ ~DJd ~LlIl lot'" (l CMP so -tkt+ rf8t'5~r A e 1 e D lU?UJd \Ut \at cit..tr09td . . C .. A H 9 9187 A .. C

~

-~J s\bp wr .fa. SIIiC

'7

SAVE 1 SCAN. COM,>

A >IlriT S(:f~N. COM ~

16 ~~ II £t T V E R 1. 0 nE}~T PC

-.~~

p:.: () 1 ~3 £1~

-.bJJ...§.;

87 (1116 (11 1 ? e118

RST NOP N(IP

(1119 STA~~: B i.:t11A HOP

loo~ tA.t eck. +0 ~e "l f i+ WGS ?~lJ\)&~ L0a6.tl! (lO\\5j .~~ollt ak~{ LAn~ yu.loM ')

_. ( \1.L\o~t )

... G· 1 1 6 ~ ~UVl ~ VV~ to(M +O~~Vlt+ld~ *0116

-ll ~ lQ?~ qt u.~ (OCtw.k..1 bpD) Cl~

-'li.i lODk a.t ~u ~t. CIZIM8E1Il A=96 B=eee6 D=0000 H=0121 8=0100 P=9116 RST 07

-2.lll~ loo~ at" la{j(. O .,. it- afPeaJS -k Ire Cerrta:

0121 B6J

0122 eeJ

012322.;

E D seA N. A S fit -------; *~i *lli; It: s::;u ,

;LARGER YALUE IN C?

C iLARGER VALUE IN C?

HFOUND ;JUMP IF LARGER VALUE NOT FOUND

HFOUND iJUMP IF LARGER VALUE NOT FOUND

"

i

~I

AS" SCAN. AAJ~-. ~-4~w.Wt .. wch~ ~(J(uU ~nM'\ dl~ A-

C P / MAS S E '" B L E R - Y E R 1. e ~ -to ch~ (A I ... L. 1)' t ro( )

. f(l~ -tv ~ ~\J'~ ~ r/l" fl C 8122 002H USE FACTOR END OF ASSEMBLY

16K II[IT YER 1. e NEXT PC 8121988e

..

-L116"

e 116 J"P 00ee cltt'~ ~ &&uVt O\cllS ~'tll At U~~ 9119 STAX B ellA HOP 011B IHR B - (y~)

-Glee. 116". Gt, ~ k;;~\~ Wl~ b.t..le~o;,,~ ~ IWi 4: e 11 6 IovlA~p't~ \"~~al - D 12 ~ ~~/)((,a lAliuI ~p.Jcl

. e 121 (iJ 88 22 21 8e 12 7E EB 77 13 23 EB as 18 81 o.·! ...... tal. I .. X . .,130 C2 27 91 C3 03 29 88 88 88 88 88 8e 08 81 88 18 0 ' ••• ) .. 0.· ... ..

e 1 49 B 9 0 e 9 e 9198 e 8 e 8 8 e 98 88 0 e 18 e e "8 8 8 8 e ............... .

- (yw.'l.Lt) ~ lOIl~ ~~

-£!_ 1i~P tcT; cl~ ~~ ~~

"