Professional Documents
Culture Documents
ONUCHUKWU ROSE-Mary 1987 3300
ONUCHUKWU ROSE-Mary 1987 3300
Research Publications
Author
ONUCHUKWU Rose-Mary O.
PG/M.ENG./85/3300
Title
Engineering
Department
Electronic Engineering
Date
September, 1987
September, 1987.
A VERSATILE MICROPROCESSOR DEVELOPMENT
SYSTEM USING APPLE I1 AND MAT 385
BY
CERTIFIED BY:
ACCEPTED BY: /
HEAD OF DEPAFTMENT
- ( i ) -
DEDICATION
ABSTRACT
The project is aimed at producing a versatile Microprocessor
Developnent Systan (MDS) £ran an existing MAT 385 Microcanputer trainer
kit and an Apple 11 Personal Ccmputer.
The cross assenbler was designed using topdown design approach and
implenented on Apple I1 using the DOS facilities of Apple 11. The cross
assembler resides on the Apple 11 disk and is called into the systen
whenever it is required. Results £ran the cross assembler were also
printed and analysed.
The interface facilities available on the Apple I1 and MAT 385 were
studied and based on the available facilities interface design was made
for the interconnection of Apple I1 and MAT 385. The interface design
involved hardware interconnection of Apple I1 and MAT 385 and interface
software in both the Apple I1 and MAT 385. The interface design was
implenented, tested and satisfactory results were got.
The newly produced MDS is such that the assanbler is loaded into
Apple 11, £ran the disk, where the assably language are keyed in and
assenbled. On canpletion of the translation, the machine codes produced
are down loaded into MAT 385 where the program is debugged and tested.
..
./iii
- ( iii ) -
DECLARATION
PAGE
DEDICATION 0 .*. i
ABSTR?CT *.* .me ii
DECLARATION ... ... iii
ACKNCWLEDGm ... ... iv
PAGE
A v e r s a t i l e Microprocessor Developent Systen Using
MAT 385 and Apple I1 ... ... ... 8
Typical Microcanputer ... ... ... 9
As the computer was being put to bigger use, there was the need to
store programns outside the canputer main menory. Manory products like
disk and druns were introduced.
To cut down on cost and make the target systen cheap, as to justify
its production, canpared to other methods of implanentation available, the
microprocessor cannot support developnent aids. Thus the target systan
.
cannot afford such costly junctions as systan so£tware (e.g translators
.
and editors) and peripherals (e.g VDU, TTY) that aid systen developnent.
Aids and facilities need to be providd to enable progran developnent,
testing and debugging of the target systen program. This developnent aid
is normally offered by the MDS.
.../4
Although it can be argued that it is possible to develop a
microprocessor application without an MDS, but in engineering, working
without appropriate and adequate tools is unacceptable since it leads to
waste of time and result may never be produced.
The requirenent and denand for better and more powrful developnent
tools have led to the evolution of MDS in different forms, The new
generation of MDS are sophisticated and powerful (e.g. Intel, Tektronix,
Hewlett-Packard etc).
Like any other canputing facility, different makers offer MDS tools
to aid in the developnent of microprocessor application. Fig. 1.3 shows
.
what is generally accepted as MDS (4)
F o r a m i c r o p r o c e s s o r t o be i n t e r f a c e d t o a p e r i p h e r a l . , t h e y have t o
be c a n p a t i b l e . C a n p a t i b i l i t y was one of t h e s e r i o u s problerns f a c i n g t h e
c a n p u t e r world because of few catununication s t a n d a r d s .
I n w e l l designed m i c r o p r o c e s s o r s y s t e n , t h e r e a r e always t r a d e o f f
c o n s i d e r a t i o n s where d e c i s i o n s a r e taken a s t o which p o r t i o n ~ l i ~h-e. ~ l ?
s o f tware and which hardware. In most a p p l i c a t i o n s , s o f t w a r e a c c o u n t s f o r
a b o u t 80% o f t o t a l c o s t s (10)
I n s u c h c a s e s where t h e MDS is n o t r e a d i l y a v a i l a b l e , p r o t o t y p e k i t s
(e.g. I n t e l SKD-80, S i g n n e t i c s 2650, M A T 305 etc) a r c 11.7r-ul in j t.,; pl.ace.
These have the disadvantage that all the MDS aids cannot be provided for
by the latter. This is the case with our university electronic laboratory
where the prototype kit used for developnent does not have most of the
above mentioned developnent aids.
k
3 t >
Pt lNPUT /
0 MEMORY
0 WTQIlT
8 , no
o D A T A BUS
CONTROL BUS
EMULATOR
FLOPPY
01811s
I
I MD3 PROCESSOR
UNIT
CON3OLL
TERMINAL
( VDU 1
READER AND PUNCH
CHAPTER 'IWO
Since the facilities in Apple I1 and MAT 385 are to be used in the
production of a versatile MDS, there is a need to look at the
facilities available on both systms to make for the most efficient
use of then for the production of a cheap MDS,
For ease of use, the Apple 11's circuitry has these input-output
locations menory mapped.
House-keeping Cmands:
These allow for disk initialization, program entry into the
systm from disk, deletion or addition of program and
program running. It also ensures safety of disk stored
program and prevents unauthorised progran access,
Access CaTmand:
These allow program access to the various peripheral
devices.
The input-output facilities include 8155 ports, 8755 ports, RST 6.5,
. RST 7.5, serial interface provided specially for interfacing of
.
teletypewriter (TTY), cassette recorder and video display unit (VDU)
2.3.1 8155, 8755 And RST:
-
8155: This is an input-output manory card that is interfaced
to the 8085 microprocessor of the MAT 385 microcanputer. It
has 256 byte RAM memory available for storage of user's
progran , two input-output ports and an input-output
port/t her.
These facilities are available for use during the testing of
appl ication program, through socket J5. The port addresses
are 29 , 24 and 2B. Available also is a timer, VrX and W.
RST 6.Sf 7.5: These are vectored interrupts which allow the
programmer to interrupt the processor when it needs to
comnunicate with the microprocessor, using its control 'ITL
high input.
Whenever any of the vector interrupt pins are high, the
microprocessor finishes the last instruction it is executing,
saves the content of program counter (PC) and branches to the
call address of the vectored interrupt. It executes the
subroutines stored in the address and returns to continue
whatsoever it was doing.
Although, the MAT 385 does not have any standard input-output for
linking to the outside world, the input-output facilities it has can
be configured such that the Apple I1 does not realise this.
This also involves software routine on MAT 385. The MAT 385 has
subroutines on its monitor which can be called in a progran to do the
house keeping job for characters to be sent to WY. This progran in
MAT 385 would be used to call on the monitor subroutines to send the
application program to 'ITY for the production of hard copy.
Considering that the major part of the work would involve software
developnent chapter three is devoted to "Overview of Software
Developnent Techniques". In chapter four, the cross assanbler design
is discussed while the cross assanbler implenentation is treated in
chapter five. Chapter six is devoted to cross assembler basic
program description and users guide while chapter seven treats the
interface design and implenentation.
INTRODUCTION
A good software design methodology should aim at producing a
consistent program structure independent of whosoever is
applying it. The key to easily modifiable software are clarity
and simplicity in both design and implementation. Clarity and
simplicity are enhanced by modularity, module independence and
topdown design implementation.
The software developnent aids are flow chart and topdown design
.
(data flow design, data structure design and functional design)
FLClWcHART
The flow chart is one of the comnon methods of expressing the
logic and structure of a progran. ~t is a schematic visual
description of the logic of a program.
.../21
In the second level, each of the first level instruction/cmand
is refined to get less powerful instructions. Thus each
sub-systen is broken down into program that canprise it.
I t h a s t h e d i s a d v a n t a g e t h a t t h e r e is s t i l l no c l e a r
methodology f o r l a r g e systen and deriving the c o r r e c t d a t a
s t r u c t u r e can be d i f f i c u l t .
.../23
3.3.3 Data Flow Desisn
Data flow design is functional deccanposi t i o n with r e s p e c t
t o d a t a flow. Each b l o c k o f t h e s t r u c t u r e c h a r t is
obtained by successive a p p l i c a t i o n of the engineering
d e f i n i t i o n of a black box t h a t transforms an input d a t a
s t r e a n i n t o an o u t p u t d a t a stream.
Compared t o t h e c o s t o f hardware, t h e c o s t o f s o f t w a r e is
c o n t i n u i n g t o e s c a l a t e (I2) .
The l a t t e s t s t a t e o f a r t i n
s o f t w a r e design is by t h e p r a c t i c a l a p p l i c a t i o n of s c i e n t i f i c
knowledge i n t h e d e s i g n and c o n s t r u c t i o n of canputer p r o g r m s 1
I
Based on the above, t h e data flow design approach was chosen and
it is used for a l l software design i n t h i s project.
EXEC
J 1.
OET z Z-cL PUT L
4.1 INTRODUCTION
A t a t i m e , t h e canputer programner had a t h i s d i s p o s a l a b a s i c
machine t h a t i n t e r p r e t e d through hardware c e r t a i n fundamental
i n s t r u c t i o n s . H e programs t h e canputer by writing a series of
o n e s and zeroes (machine language), p l a c e them i n t o t h e menory
of t h e machine and p r e s s a buttan where upon t h e canputer would
s t a r t t o i n t e r p r e t e them a s i n s t r u c t i o n s . Programners found it
d i f f i c u l t t o w r i t e o r read these machine language program. In
t h e i r q u e s t f o r more convenient language, they began t o u s e
mnemonics (symbol) f o r each machine i n s t r u c t ion, which they
would subsequently t r a n s l a t e i n t o machine code. Such mnenonics
are c a l l e d assenbly language. r?rograms c a l l e d a s s e n b l e r s were
w r i t t e n t o a u t a n a t e t h e t r a n s l a t i o n of assenbly language i n t o
machine language.
Resident Assenbler :
This is an assenbler w r i t t e n t o run on t h e same machine t h a t
w i l l execute t h e source code. Example, an 8085 assenbler
t h a t is t o run i n a canputer whose microprocessor is an 8085
microprocessor chip, is a r e s i d e n t assenbler.
./29 ..
b) Meta Assenbler :
his is an assenbler which supports many d i f f e r e n t micro-
processors. The programer merely s p e c i f i e s a t the s t a r t of
t h e source which microprocessor assanbly language w i l l be
used and t h e meta-assenbler t r a n s l a t e s the source code t o
t h e c o r r e c t machine d e .
c) Cross Assenbler :
They a r e assgnblers which r e s i d e i n machine which can not
e x e c u t e the o b j e c t code generated by t h e assenbler. They
a r e normally w r i t t e n i n high l e v e l language e.g. f o r t r a n ,
b a s i c , pascal, which make then machine independent.
d) me Pass Assenbler :
Here t h e source code is processed only once and during t h i s
p r o c e s s i n g , any l a b e l encountered is given an address and
stored i n a table. Therefore, when t h e l a b e l is encountered
a g a i n , t h e assanbler may look backward t o find t h e address
of t h e label. I f t h e l a b e l h a s n o t been d e f i n e d f o r
example, a junp i n s t r u c t i o n t h a t s k i p s forward, an e r r o r
message is generated.
f) T h i s is a t y p e o f two p a s s assembler t h a t a l l o w s t h e
programer t o write the source code i n macro-sequence of
i n s t r u c t i o n s t h a t t h e programner g i v e s a name. Whenever the
progrmner wishes t o d u p l i c a t e t h e sequence of i n s t r u c t i o n s ,
t h e macro m e is inserted i n t o the source code.
The programer can format the source code based on his own
style and on the appropriate length of fields for particular
progran.
4.4.3 Other A t t r i b u t e s
The symbol table should have symbols i n t h e order i n which
they appear i n t h e progran and not i n a l p h a b e t i c a l order.
4.5.2 m a t e (EQU)
This is used to assign the data value or address in the
operand field to the label field. This instruction is
valuable because it allows the programer to write the
source code in symbolic form and not be concerned with the
nuneric value needed. (Example PORTA EQU @01).
Requirement
The cross assembler under design is an assembler written
in high level language which is required to transform 8085
source code to object code for use in MAT 385
microcanputer.
T h e MAT 385 microcanplter does n o t have f a c i l i t y t o accept
assenbly codes. Only o b j e c t code i n hexadecimal form can
b e keyed in. his creates problen t o t h e programer who
it t o a form
a f t e r w r i t i n g h i s source code, hand-codes
acceptable t o MAT 385 before keying it i n t o t h e MAT 385
manory .
The c r o s s assenbler is t o be designed such t h a t it runs i n
a microcanputer which has the facility to run the
assenbler as w e l l as allow the keying i n of t h e source
code by t h e programer. The p r o g r a m e r instead of
t r a n s l a t i n g source code, keys i n t h e source code and goes
t o d o another job while t h e assembler assembles t h e
program.
GET FIELD
VALIDATE FIELD
END
GEX' FIELD
CASE 1: T h i s is a ccxrment
DO
RETURN
END
CASE 2:
DO
VALIDATE LABEL
END
ASSEMBLE SOURCE CODE
GET LABEL
MAKE LABEL TABLE
END
INITIALISE COUNTER
I F LABEL THEN
DO
CASE 4
ELSE
POINT TO OPCODE TYPE
INCREMENT COUNTER APPROPRIATELY
END
END
CASE 4 LABEL TABLE
DO
STORE COUNTER VALUE, LABEL
POINT TO OPCODE TYPE
INCREMENT COUNTER APPROPRIATELY
END
STORE OBJECTCODE
DO
STORE COUNTER, MACHINE CODE
STORE COUNTER, MACHINE CODE, SOURCECODE
END
CODE CODE
FI@.4.1. C R 0 8 8 A 9 8 E M B L E R D A T A F L O W DIAORAM
CODE \ CODE 1
- FLD
ERROR
ANALY 8 E R
I ERROR LINE
ERROR
CORRECT ION
F l 0 . 4. 12 M A K E L A B E L DATA F L O W DlAQRAM
INCREW-NT
ADDRESS
ADDRESS
I
n
.%
OET VALID MAKE
SOURCE LABEL
WOE TABLE
VAL1DATE
FIELD FIELD
t
30URCE CODE
PUT
VALIDATE
I SOURCE
I-- ERROR
t
SE PARAT t
SOURCE
FIELDS
CODE
LABEL NUMBER
FIELD LABEL OF BYTES
I I V L - COD
OET VALID
SOURCEC00
OET CONVERT
FIELD F E U 10 FILE
T YPE OBJECT
&
\
gl
COD
VALD- COD
1-1 FIELD TYPE
5.1 OVERVIEM
The c r o s s assgnbler program g e t s the source code £ran user,
s t o r e s it in a f i l e . I t then reads through the f i l e l i n e by
l i n e and validates each l i n e of code t o make sure i t is a valid
8085 code. On getting t o any invalid l i n e , it p r i n t s it on the
screen and pranpts user t o correct the l i n e by displaying the
possible source of e r r o r . After correction, the new 1ine input
b y u s e r is used t o r e p l a c e t h e old l i n e and t h e v a l i d a t i o n
routine continues. After validation, the label table is made.
This, the cross assenbler does by going through each l i n e of
s o u r c e code. On identifying a label in a l i n e , it s t o r e s the
l a b e l i n a label t a b l e with its matching address, t o serve a s
reference during decoding or object code generation.
I n t h i s a p p l i c a t i o n , t h e r e is need f o r t h i s f l e x i b i l i t y
and f a s t a c c e s s s i n c e t h e u s e r may feed i n an unacceptable
s o u r c e code which would need t o be changed. More-over ,
t h e r e may be need d u r i n g t h e program r u n t o c h a n g e
unacceptable code which was mistakenly keyed i n .
5.3 THE SOURCE CODE VALIDATION MOWLE
This module reads through t h e input f i l e , using t h e input source
code marker a s an indication of nunber of i n s t r u c t i o n s , takes
t h e source code l i n e by l i n e and checks i f each source code
conforms t o t h e 8085 standard assanbly code. On d e t e c t i o n of
a n y a b n o r m a l i t y , i t p r i n t s t h e code, a d v i s e s u s e r on t h e
possible cause of the error and pranpts him to make
modification.
5.3.1 Mode of e r a t i o n
I t starts by c a l l i n g the subroutine which g e t s t h e
appropriate opcode. ~t g e t s -the f i r s t word of t h e source
c o d e , checks i n t h e opcode a r r a y t o see i f it is a v a l i d
opcode. I f it is not a va1i.J opcode, i t assumes it is a
label. I t then goes t o the ].ribel. v a l i d a t ion subroutine t o
v a l i d a t e the label. I f it is not a v a l i d l a b e l , i.e.
s t a r t s with a number o r has more than s i x c h a r a c t e r s , an
e r r o r message is generated, source code p r i n t d and user
prmpted t o make t h e necessary changes.
5.3.1.1 -
MOV
If t h e opcode is a "MW", t h e program is indexed
to the MOV subroutine. Here, the first
character h c d i a t e 1 . y a f t e r r.IW is c o l l e c t e d and
compared with t h e r e g i s t e r array. I f it is a
v a l i d register, i.t goes ahead to c o l l e c t t h e
second character which is a l s o a v a l i d r e g j .,p ter.
5.3.1.2 MVI
---
Here, t h e next character is picked and validated
using t h e r e g i s t e r array. The data i t d i f ~ a t o ris
t h e n c o l l e c t e d , t h i s can be "@" o r "jP. When
t h e d a t a indicator is @ then i t m e m s the number
following imndiate1.y is a decimal. nmber while
"$" i n d i c a t e s a hexadecimal nmber .
The nunber is collected, the indicator tested.
If the indicator is "$", the nmber is converted
t o decimal using t h e hexadecimal t o decimal
converter subroutine. Otherwise, the nunber is
checked t o ensure it is not greater than two
hundred and fifty-f ive (255) (lbyte) . If nunber
is g r e a t e r than 1 byte, an e r r o r message ("no.
g ' r e a t e r than 1 byte") is d i s p l a y e d and u s e r
pranpted t o make changes, otherwise, the l i n e is
printed a s an acceptable valid source code.
On g e t t i n g a v a l i d r e g i s t e r p a i r , t h e d a t a /
operand indicator is collected. In t h i s case,
t h e r e a r e three a l t e r n a t i v e indicators. Apart
from "@" and "S" discussed above, the indicator
can be "L", indicating a label. In the case of
a label, the label is validated.
The nunber collected, if hexadecimal, is
converted t o decimal and t e s t e d t o make sure it
is not g r e a t e r than 65535 ( 2 b y t e s ) . I f ntpnber
is g r e a t e r than 65535, an e r r o r message
(Pddress > 2 bytes) is generated and user
prompted t o make changes. Otherwise, t h e code
is displayed a s being valid.
JPO, JPE, JP, --JM, CALL, CNZ, CZ, CNC. CC, CPO,
5.3.1.9 RST
-
The next character is collected and checked. If
it is a nunber between zero and seven (0 - 7),
the source code is displayed as being valid and
the validation continues. Otherwise, an error
message (%ST Nunber > 7") is displayed, source
code displayed and user pranpted to make the
necessary correction.
5.3.1.10 DB
-
Here, space separates the different bytes while
the last byte is immediately followed by a
mi-colon to show end of data.
5.3.1.12 Title
The first character is collected and validated
to make sure it is not a nmber. ~f it is a
number, an error message (~nvalid~itle) is
displayed and user prompted to give a valid
title. On the first character being valid, the
title is collected and it's length validated.
IF, it is longer than twenty characters, an
error message is generated otherwise it is
displayed as being valid.
5.5.1 -
MOV
On encountering this opcode, a subroutine is called which
collects the two registers hediately after it. These
two registers are concatenated with MOV example "MWABtt.
This new code is searched in the object code generation
array and its position is used to pick the appropriate
object code. The object code is stored in the appropriate
memory location. The menory location is then increnented
by one ready for another data.
5.5.2 -
MVI
This is a two-byte instruction. On the assenbler
detecting this opcode, it generates the appropriate object
code by using the WI subroutine. The subroutine picks
the character imediately after the opcode, which is a
register, concatenates it to MI1 and using the object code
generation array generates the appropriate object code,
stores it in the appropriate menory location and
increments menory location by one.
It then goes back to the source code and gets the data.
If the data information is a label, it goes to label table
to get the data equivalent. I£ it is in decimal (data),
it is converted to hexadecimal using decimal to
hexadecimal convertion subroutine. The data is then put
in the menory location and the manory location counter
increnented by one.
5.5.3 ADI, ACI, SUI, SBI, ANI, XRI, ORI, CPI, IN, OUT
These are two-byte instructions. Whenever any of these
opcodes are encountered, a subroutine call is made. his
subroutine uses these opcode to index into the objectcode
array thus picking the object code equivalent. The object
code is stored in the appropriate mmory location while
the menory location counter is increnented by one. The
second byte (data) is then collected and treated as in
5.5.2.
..
./65
5.5.4 -
MI
This is a three-byte instruction which has a register pair
before the address/data.
5.507 LDAX, STAX, INX, DCX, PUSH, POP, DAD, ADD, ACC, SUE, SBB,
ANA, XRA, ORA, CMP, INR, DCR, RST:
These opcodes cause a call to subroutine which picks the
next character and concatenates to the opcode. This is
used to get the index nmber in the objectcode array.
This index nunber is then used to pick the object code
which is stored in the appropriate menory location and the
menory location counter increnented by one.
5.5.8 XCHG, DAA, RLC, RRC, RAL, RAR, CMA, CMC, SlC, PCHL, XTHL,
SPHL, EI, DI, HLT, NOP, RIM, SIM:
These opcodes are one byte instructions which cause a call
to subroutine which indexes into the object code array to
collect the object code, stores it in the appropriate
menory location and increnents the counter by one.
5.5.9 -
LIST
This causes a subroutine call that causes a hard copy of
the assenbled progran to be printed.
5.5.10 -
DB
T h i s instruction causes a c a l l t o subroutine t h a t picks
o n e b y t e d a t a l i m i t e d by space and s t o r e s than s e r i a l l y
u n t i l it encounters a seni-colon. After 1-11 data
s t o r a g e , t h e memory l o c a t i o n is increnented by one.
5.5.11 -
DW
On encountering t h i s i n s t r u c t i o n , a subroutine c a l l is
made which p i c k s t h e two-byte d a t a limited by space and
s t o r e s them one-byte a t a time using t h e I n t e l s t y l e .
This data storage continues until a seni-colon is
encountered.
5.6 CONCLUSION
The c r o s s a s s e n b l e r h a s been f u l l y implanented and sane p r i n t e d
r e s u l t s £ran it a r e a t t a c h e d f o r reference.
RE'T
F'DF' I3
ADD P
21 21 C7 RST I(:
22 22 27 DAA
1)11 YOU WANT HARDCCIPY ?
-
?PllflG. 'TEST 1
F:. rz%~1 c-3 TEEST 1
INDEX MEM
NO. L-OC
1 (:,001
2 [I (11(32
-7
.._, o
(:I ( 1 : ~
4 (1)(1)(:I 4
e
J (:)(:I (:I 5 DH @34 8r88;
6 r:) ( j(1) 6 I)R (234 8638;
7 (1) (1) 7 MOV A D
l3 (11I:) (1)8 M V I D $478
9 O (:I i:, 7
1(:I (1) (:) (1)0
1. 1 c)(1) (:)H
12 (1)0 (1)c
1 :3 (:)(:I I:( 1)
14 0 0 0 E:
15 (3.1 c:)F I-DA 82%
I6 (:)o1(3
17 (:)r)1 1
18 0(): 13 RET
17 .i (:I 13
1 POP E
2 (1) w:] I 4 n m E(
a 1. (:)(:I 15 RST O
22 (:)(I1b 27 AA
I)
DQ YOU WANT TO TRRNSFER SOURCE CODE TO MAT 385 ?
KlJN
DE M E ; I S VALID
IL-LEGAL CIF'CODE
MCID A D
I N P U T SOURCECODE
?MOV A D
MOV A D I S VALID
JMP L T E S T I S VALID
END I S VRLID
1 255 EE DB W E ;
,.'>o i 296 7A MOV A D
3 257 CD TEST C A L L fk77
4 23R 77
C
.J 299 r:) (1
6 2 (:) DP I N LASD
7 2h 1 88
£3 262 C3 JMP L T E S T
9 263 01
10 264 01
DO YOU WnNT HARDCOPY ?
?
TYPE YOUR PROGRAM T I T T L E
?PROG. T E S T 2
F'RCJC3- TEST ZZ
INDEX MEM OBJECT SOURCE
NO. LOC CODE CODE
1 OOFF EE DE bEE;
2 0 1 (30 70 MOV A D
.3 (3 10 1 IZD T E S T C A L L $47'7
4 0102 77
5 (1) 1. (:, (1)(11
6 0 104. RE I N LASD
7 0 1. 5 (38
o o 1.3 0 r: J MF' L... 'rE::'IT
'3 I 1: '7 r:) 1
10 0108 01
Dn You WfiNT TO TRANSFER SOURCE CODE TO MRT 3 R 5 ?
?IV
?SYNTAX ERROR
IRUN
......................
***8085 CROSSASSENBLEFI,*.*.*.*
*,.* DEVEL..OPEI) EY*+f++-#+-#*+
***ONUCHUKWU R.M.D*****
.*+t.w I N PART I AL F U L L F ILMENT*+
+K.KOF M. ENG+*.**
.H * . * I N MAY 1'?87***
-w.* H*~*~**~********.**~*******
TO ANSWER ANY QUESTIDN PRESS
N FOR NO RND Y FOR YES
flND PRESS KETLJHN
S NF'LJT SOURCECODE
7LDA ZtEE
DO YOU WANT A CHANGE ?
3
S NF'LIT SCIURCECODE
'?RST h
DO YOU WANT A CHANGE ?
'7
S NF'LJT SOURCECODE
?MUV B fi
DO YOU WANT A CHANGE 7
?
S NPLlT SUUKCXXXJDE:
?CRL..L ASD
DO YULJ WANT A CHANEE ?
-?y
INPUT SCIURCECUDE
" X f i L I... L-ASD
DD YOU WRN'T A CHANGE 7
S NPUT SOURCECODE
7ENLl
Dl:] YOU WONT A CHANGE ?
RST 6 I S VALID
MOV B fi I S VALID
CAI... I.. I..I\TiD I S VISI..T I>
KST h I S VAL.. JD
MOV P A IS V A L I I )
LDA ttEE
ME:M
-',-__.
-rE-15's
CI E J E:1:: T
-7"
I::!!:)4::):x
,..*
._.. (1)
4 I ) F.' 7 Fi3 'I" 6,
C
rJ (:)0(:,5 47 MCIV B n
h f:.K)i-!b 131) CAI 1.. $ 4 '7 7
7 .7
0(::)(:.I 7 '7
RLJN
*.#.*.Ea;*..Ea..E+t.*..**s..n.n.*.r...n*
.n..*.N.f3 C:, 5 [I I:? 0 S !.j !3 :1, MB 1.. I..17 .*.% .M.
.%.it.#.I)EL'EL.(:JFy'E:I] EY.tc.++.tr..W-tc+!?1.,#.
~..K+(:]I\.II.JC:l..+I.Jt:::bJl.JR . M u0++%.*(.wK
*.E.U. I N PC.SRT'I: AL. F'I.JL.LF' I L-tIEN'T*.s.
*.WX-(:]F' H. EN(~.M..~.E+$
I N PlnY 19R7-W-W-R
.X..E.#.
n. n +w.,n.a .#. *.*.+.w.& #..)(.#..e.n,n.ws..#.a;.~
*.
"SC:) f7N!Wf:F? fWlY L!lJE:Sl'I ON PRESS
N FUFI 1\10 C\ND Y f'~IF'3 Y E S
flN1:) F::lRt"t';S F?E.'T'LJRpJ
II\IF'IJT SOU1:~'rC~ECClIIIif
71JRG & A
IIKI Y01.1 LrJRNT A CHnNGt= 7
3
I Nf"l.I'T SCII.IF7CECI~JI)E
';'I]W e477 c!23;
D13 YC:)CJ WANT A Ct-IRNGE ?
INFWT SO1JRI:E:COl:)E
'? I:! EI @ 3. 2 H(7' ;
%9
T NPLIT SO1JFICEC::OIIE~
'?MOV fl rl
DO Y1:)U WANT fl CF.IANGE 7
7
1IllFYI'T S 131JR S: E:C [.'I1.)F:
7P1VI (3254.
DKI YC:l(.J WONT A Ct-IC-INGE ?
'7
I N N J T SClI.JRCEZC:OI)EE
'?OD1 C5h
IIC:) YCllJ LrJANT A C::HRNGE '7
'7
I NPI.JT' SC:ILJF~C:~~.CC)I:)E:
'?RE')'
DC) YC)LJ WANT' A CFMNGE ?
'7
T NF'UT' SOLIRCECCJDE
' p[ IR
DU YClU WANT A C:tiANGE ?
'Y.)
I hIF::'I.JT' SOUFICEC:UI:)EZ
MOV A D I S VALID
M V I D (3254 I S V A L I D
AD1 (2% IS V A L - I D
FIE'T I S VALID
nnn IS VALID
ADI @5h
WAIT I N $401
JZ L W A I T W A I T FOR STROBE
MOV M n s r n w ~ A T A
I N X H I N C R MEM
IJMF' I-.WFIIT
(1)ii)(1) 6)
ii)c)o '7
(1)(1)(1)E)
i:)(::I(1) c?
(1)(1)(1)A
(I i:)(::I R
0i:)0c:
(1)(::) (): D
(1)(1)(3E
0 ij 1::) F:'
0 (1) 1 (1)
i:)(:)I 1
(I(:) 12
(1) 1 73
(3(1)14
(:)O 15
0 ( :! 1. 6
(:)(::I 17
(1)0 1$3
(1) 0 19
(.)O 1A
00 1H
0(::' 1 c
(1) 1T.)
DCI Y(3U WANT T'CI
7N
CHAPTER SIX
The progran was started by storing all the data required for the
program in different arrays as specified in the remark statements.
This array storage goes £ran line 10 - 350.
The main program is about twenty lines, 550 - 600. The main prclgram
involves mainly calls to major subroutines that do the actual job.
These subroutines are :
a1 Input source code
b) Validate source code
c1 Make label table
d1 Generate object code
e) Make hard copy
The input source code is a mall subroutine with very few lines (2500
- 2505) .
The validate source code is the core of the progran a d has many
subroutines which it calls to enable it to do its house keeping job.
It is this subroutine which detects any programmer error ard calls
for correction. Any error which goes undetected at this point,
propagates and later causes a break in progran.
The main program of this subroutine goes f r m 6000 - 6420 while the
subroutine it calls spans 1000 - 3940 and 6500 - 6540. What each
subroutine does has been discussed in the previous chapter.
The make label table routine, which occupies lines 7000 - 751.0, is
not a very big routine though it makes use of s m e of the validate
source code routines.
The subroutine prepares the label table ready for use by the object
code generation subroutine.
The generate object code routine translates the assanbly codes using
the valid source code produced by validate source code routine and
the label table produced by the make label table routine.
Its main program which spans f r m 8000 - 8270 though short, call on
many subroutines which aid it in performance of its task. These
subroutines span 8275 - 9920. It also shares sane subroutines with
the validates source code subroutine.
The make h a r d copy r o u t i n e which can o n l y b e a c t i v a t e d on u s e r
request occupies l i n e s 9930 - 9991. I t p r i n t s t h e output in standard
form having four colunns, index nmber, menory l o c a t i o n , o b j e c t code
and source code.
7.1 INTRODUCTION
For the object code produced f r m the c r o s s assanbler t o be
loaded into the MAT 385, there is a need t o interface MAT 385 t o
Apple 11. A s i n d i c a t e d i n t h e d e s i g n i n c h a p t e r 2, this
i n v o l v e s the connection of MAT 385 and Apple 11 and control of
the data transfer by programns i n both Apple I1 and MAT 385.
his data transfer can also be done in basic using POKE (-16256
+ N16), DATA instruction. Where N is the slot nunber of the
printer card and DATA is the data to be transmitted.
Due to this inability to know when MAT 385 has finished its data
acquisition, data transfer can be time controlled, by
implementing a delay routine, in Apple I1 after each data
transfer.
Since the strobe signal lasts for only one clock cycle, it
is latched by a menory device with clear facility.
After the object code transfer, then MAT 385 manory was
checked using the "display memory" facility . The
transferred data were seen t o be stored a t the appropriate
menory locations.
APPLE: I1 INTERFACE SUBROUTIME
INDEX OBJECT SOURCE
NO. CODE CODE
1 3E I N I T M V I A &0Q
2 0Q
3 D3 OUT &U2 MAKE PORT 00 I N P U T
4 02
S 3E M V I A &OE
6 0E
7 D3 OUT &03
8 03
9 f E MU1 A $402
10 02
11 D3 OUT &O1 RESET COUNTER
12 01
13 3E M V I A &OC
14 0C
15 D3 OUT & 0 1 PREPARE COUNTER TO COUNT U P
16 (11
17 DR W A I T I N tcOl
1B 01
19 €6 A N 1 8401
20 01
21 CA J Z L W A I T W A I T FOR STROBE
22 11
cl-
L *> 00
24 gE M V I A &02
25 02
26 D3 OUT 8 4 0 1 RESET COUNTER
27 01
2R D3 OlJT fd31 RESET COUNTER
29 (:I1 ,
30 7
E
31 t:c
32 D.3
77
C' .-I
01
34 DR GDATA I N t&0 GET *DATA
35 (30
36 77 PlflV M A STORE DATA
57 23 I N X H I N C R MEM
38
99
c3 . JMP L W A I T
11
40 ):t ts
DO YOU WANT TO TRANSFER SOURCE CODE TO MAT 385 ?
\.
BTROBE
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
10 ACK
II BUbY
It- I 8 N / A
19- 27 ON0
28-SU N/A
5 - r
CPu -12
4 - CP. -13 01
MR i% CPu MODE
H X X -me 9( Assynchronous 1
L L X Preset
L H H No chonge
L H 1 Count up
L H H Count down
8.0 CONCLUSION
Apart from the problan of having t o record the assanbler in IBM basic
and l a t e r Apple I1 basic, having the cross assanbler in B
IM basic
makes it more v e r s a t i l e a s the trend in microcomputer production,
t h i s day is the production IBM canpartibles. Recent report fran a
computer firm in ~ a i w a n (which represents U.S.A. computer i n t e r e s t
because of low c o s t of labour) , canputrex, shows t h a t a l l
microcanputer on display were IBM compatible and were being sold a t a
p r i c e very low when canpared t o IBM PC (23) .
Even the l a t e s t brand of
Apple I1 microcanputer i n the market (Markintosh) is IBM canpatible.
T h i s i s not surprising because IEM has done a l o t of work in the
production of very good systen softwares.
The software for data transmission to and fran the microcanputer can
be implmented by using the subroutine already developed in MAT 385.
Before the subroutine call, data should be got fran the appropriate
menory locations and put in appropriate registers. These subroutines
are used to input or output data £ran or to the W .
For the work to be conclusively done, there is a need for the MAT 385
interface routines, both the down loader interface program and the
TTY program, to be on R(3M so that they can always be in canputer
menory. This calls for the ROM burning of the programs.
f-' -
- - ,->
.../lo3
- 103 -
APPENDIX
I, IST
5 j, REM *.K-,.*.k.lt+**.******.k***~~**.It
'70 D I M H:S(lb)
'71 F::OR 1 :: (1) 1.0 15
' 7 2 HE:(?D Id$ ( I )
7X NEXT :[
, I),qTfi " O H , " I " , "2" , 1 1 "-.a " , " 4. "
,-,
11 c II , llbll, 1 1 7 0 ,I I H I I , U 9 M , II
r ; :12
1(1
~ I F XLS: .- ;-??;& (1)
; 11 'l't.i~b1..3511.5
::;:? 1 4 LJ';?
.:;:y;?( ..
1;.)
.. :, .-,,.,.:-, . . : 1::
2
7: C:2 -1.. j
C Z .4.. 1,
, ,
PI I I>$ ( $:C ?: I[ 1)
-.
...,....,,, ,., :IF-' L.JI~ :-
.. .w~ .-: . , 1F I.J:f
..* ., .-,
P
.,
- 'rI..iE:rq 3:~.1.(::)
" ; I' 'Tt.IEN :iJI.c:)
.:, ,,:,,:,q. ~q:)' 7 : M:0: ,+ I1 .ir : (::;I: I 'r~3,:9:52r::)
3 ' 3 ) IF:' X $ r: " $ < I 1 Tt.IE::N 337c)
.. ..+
.,:,,,:. 1 2 1: I-' X :$: := " (ii." I'k.1E:N :3:38(:)
:,J::-qq, 1 y .? :!: 1 1 ,,,, 1 11 " l ' ~....- ~ ~ t,~
-:r"qC?[;)
.... ._.
,..r ...
\ - ' I
, ; 1 <E"[I.jRN
.T r l'- .
: : REM *#..#.*.+**%.,W.R.#..#.*.E.tc..8..&.*.*
; :1 :3 (.) 2 :: r"; 2 .+. 1
'?..*
.-,.:. 6 2 13[J "I'[I 53 0 0
..*. "-..
: : 71) G CIS1.1E h 5 (30
:5:.5'72 TjC3"rn ;???;sc)
..., .
.rj.:.S!() 1) -: Vf.>I_. ( M B ) : GO'l-(l 333:)
,.* ..,.
,. ".I
a , .. [I: 2 :!. c 2 -- w 2
. C-7
;53C'7G(3SIJH ll:)i:l(.:):(3(31'(3 :33:-?1:)
I
. ..
, ,.rL. .. c:-
. J . . .
REPI ~ M ~ * ? ~ % ~ * ~ E . X ~ * ~ ~ ~ ~ * . * ~ ~ . . W ~ * . # . . F ~ *
f::'RXNT "C3I="EFZfll\lD EXI"EZI::l"l.:D1': GCI'Tl3
. h ? 1, F:'t ( T I?I'I" C:::$: : G!lS LJR 263 4 5): GfJ-I(3 570
I
5 7. i:)
., <..
(-*? C 2 -I.. 1,
7-
-.
I F X:$ :- " " "rHEN H>57[:)
M.$: 4- Y,:$
G[:')SLJB 90(::1(3
GC)!jLJKl YC')c?0
IXI'T'U 8260
f3t:)!!jl J Ef (9(:I i j (11
f3C)SI.JR 70'-?(): GC)TfJ 9 2 b 0
[iyyl ~.E***.E*.*.*,*,E,~~~*,*+
K'Ell SE:ARC:H C:)F':'f3C:)I:)E 'I'RBI.,..E
F:'UR I :- 1, 247 'r(:]
I F : M l : ::= f359:(T) THEW Yr:)1H
r ' I
t-I:$ e:: Ah$. ( I ) :F.:C
' :; -: PC: + 1 :% 1 2:::
1
1. NWACHUKU, M. A. Basic ~rinciples of Microprocessors fran the
Digital System Design viewpoint, May 1985.
34. The Apple I1 DOS Manual, 1981 by Apple Canputer INC., U.S.A.