EET 211 - LAB #3 Introduction to the SDK-85 Micro-computer
EET 211 - LAB #1 RAM Memory
K. Dudeck
1) Connect a seven segment (common cathode) display to a 74LS48 decoder/driver. Use the pin information for the display as shown on the attached drawing (page 2).
2) Test the display by simulating a BCD input to the driver.
3) This RAM has the capacity to store 16 4-bit binary numbers. The pulser on the counter increments the address of the RAM and displays that address on the four LEDs. The seven segment display shows the value at that memory location.
__
4) When the negative pulser, connected to the WE (write enable), goes low, the value of the four DIP switches is written to the memory location. Try writing your 11 digit student number into the first 11 memory locations on the RAM.
5) Try reading back your lab partner's student number.
6) (Design)-- Using principles learned in this lab, design a memory system which will store and display 32 8-bit numbers. Draw a block diagram of your design and explain how it operates.
EET 211 - LAB #2 Analog / Digital Conversion
K. Dudeck
Microprocessors have the ability to interface to the external world via I/O ports. These I/O ports allow the microprocessor to read input bits (8 in the case of the 8085) from an external source (i.e. switches, sensor) into the microprocessor, or write the contents of a memory location out to an external destination (i.e. LEDs, control surfaces). In either case, the I/O information is DIGITAL, on/off.
Some applications require that the microprocessor deal with analog information. For example, reading the voltage off some circuit element which can range from 0 to 24V. In that case the voltage is not simply on or off, but rather a range of possibilities. An Analog to Digital Converter (ADC) is used to digitize the voltage level to an 8-bit binary
number that is proportional to the voltage. Another application may require the microprocessor to drive a voltage signal into a circuit ranging from 0 to 10V. A Digital to Analog Converter (DAC) is needed to accomplish this task.
In this lab you will use an ADC0809 to convert an analog signal from a function generator into an 8-bit binary number. You will also use a DAC08CP to convert an 8-bit binary number into an analog signal that will be displayed on the o-scope. Although in this lab you will not be interfacing the ADC and DAC directly to the microprocessor, future labs will illustrate how digital interfacing is accomplished, which when combined with the concepts learned here, make analog interfacing possible.
Equipment Needed Components Needed
(1) Function generator (1) ADC0809 ADC
(1) O-scope with probes (1) DAC08CP DAC
(1) TTL designer console (1) LM741 Op Amp
(1) +15 -15V power supply (1) 74LS163 4-bit Counter
PART I. Analog to Digital Conversion.
Study the circuit containing the ADC0809, Figure 1, which is found on the next page. Also review the data sheet for the ADC0809, found at the end of this lab write up on page 6. The ADC0809 has the potential of converting 8 different analog channels (pins IN 0 to IN 7) one at a time. The channel that is selected to be converted is determined by the three-bit address input (AD C, AD B, AD A -where AD A is least significant). Figure 1 shows the address selections all grounded and therefore IN 0 is selected.
The reference voltage establishes the lowest (VR-) and highest (VR+) voltages that the input voltage will be compared to. This voltage range is divided into 256 segments. The value that the input voltage nearest compares to will be placed on the data outputs, D7->D0 (or 2-1 -> 2-8).
Figure 1 shows the VR- connected to ground, and the VR+ connected to 5V. This means that 0V will be represented as $00 while 5V is represented as $FF on the data outputs. The resolution of this eight bit ADC is:
Resolution = (VR+ - VR-)/256 = (5-0)/256 = 19.5mV .
If the output is $2C, what's the input voltage?
solution: $2C = 2 x 16 +12 = 4410 (Convert to Decimal)
Vin = Output x Resolution = 44 x 0.0195 = 0.858 V
In order for the ADC to operate, the OE must be high, and the ALE and START must pulsed to start a conversion.
Figure 1 - Analog to Digital Conversion
Procedure:
1) Connect the circuit of figure 1. Connect the four most significant data outputs, D4 -> D7 to the four LEDs. Verify that grounding the IN 0 produces a $0 output, and connecting IN 0 to 5V produces a $F output. The pulser switch must be pulsed to take a new reading.
2) Using the o-scope, set the function generator to a 1Hz sine wave with 5V peak to peak output and a 2.5V DC offset. Connect this signal to the IN 0 pin. While observing the o-scope, sample the voltage at various times along the sine wave.
3) To achieve continuous sampling, disconnect the pulser switch and connect the EOC (End of Convert) output to the START and ALE inputs.
PART II. Digital to Analog Conversion.
Study the circuit shown in Figure 2. This circuit uses a DAC08CP Digital to Analog converter chip. The chip takes an 8-bit binary input (B8 -> B1) and converts it to an analog voltage that is in the range of VREF- to VREF+ (in this case, 0 -> +15V). The chip requires the standard power of 5V and GND and additionally a negative supply rail of approximately -15V. In order for the DAC to supply an external analog voltage, it is common practice to use an operational amplifier, such as a LM741 or equivalent, to buffer the DAC output. This is shown in Figure 2. The circuit in Figure 2 will convert any 8-bit binary number to an analog voltage ranging from 0 -> +15V.
Pin diagrams for the DAC08CP and the LM741 are found at the end of this lab, on page 6.
Figure 2 - Digital to Analog Conversion
Procedure
1) Connect the circuit shown in figure 2. Use a 74LS163 counter to drive the four most significant input bits of the DAC. Set the clock input to 10kHz square wave. Connect the output of the LM741 to the o-scope and observe a digitally generated saw-tooth wave. If you expand the time base of the o-scope you will notice that the saw-tooth wave is generated in 16 distinct steps that correspond to the 16 count states of the counter. The voltage steps (resolution) should be approximately 0.93V (15V/16) apart. Sketch carefully what you see taking note to the o-scope sensitivity settings.
2) Measure the frequency of the saw-tooth wave. It should be 1/16th of the clock frequency.
3) See if you can make the waveform smoother by designing an 8-bit counter to drive all 8 data inputs of the DAC, and thus generate 256 steps in the saw-tooth wave. An 8-bit counter can be designed by using the RCO (ripple carry output) of the least significant 4-bit counter into the clock input of the most significant 4-bit counter.
EET 211 - LAB #3 Introduction to the SDK-85 Micro-computer
K. Dudeck
This lab introduces the SDK-85 micro-computer. The SDK-85 is built around the 8085 microprocessor. The SDK-85 has 2k of ROM that resides at address locations (0000H ->07FFH) and contains the nonvolatile "MONITOR" program.
The monitor program is what allows the user to examine or change RAM memory locations, examine the 8085 internal registers, write machine language programs, or run the programs.
The SDK-85 has 256 available RAM locations the are addressable at locations 2000H -> 20FFH. In addition, the SDK-85 can accommodate an additional expansion RAM, which has been installed, that is addressable at 2800H -> 28FFH. These RAM locations are where the user can place data, or write machine programs.
Procedure:
1) Review Chapter 5 concerning the hardware. At this point in the course, you should be capable of understanding the information presented on the SDK-85 hardware configuration.
2) Review the Operating instructions found in Chapter 4.
Complete each of the boxed exercises shown on the next page.
• Substitute Memory Example 1
- This example illustrates how the contents of preprogrammed
ROM locations data can be examined.
• Substitute Memory Example 2
- This example illustrates how to place data into RAM
locations. This data is actually a machine code program
that places a hexadecimal value of 47 into the accumulator.
• Single Step Example
- This example shows how to execute a program one instruction
at a time.
• Examine Register Examples 1 and 2
- These examples show how to view the various 8085 register
contents.
• The Go Example
- This program will run the program entered in the Substitute
Memory Example 2.
3) Examine the contents of ROM locations 0200, 0201, and 0202H. You
will find values of 2A, F2, and 20H, respectively, in those memory
locations. These bytes are part of the "MONITOR" program. Try
changing any of these bytes. You will find that you can not. Why?
Cycle the power off and on again. Do these memory locations contain
the same values?
4) Enter the program for the Program Example - Decimal Counter, which
is found on the next page of this handout. This program will display
a decimal count. Once the program is running, the count can be
stopped by pressing any key on the keypad.
PROGRAM EXAMPLE - DECIMAL COUNTER
ADDR. DATA ASSEMBLY
2000: 31 80 20 LXI SP, 2080H
2003: 3E 08 30 MVI A, 08
2005: 30 SIM
2006: FB LOOP: EI
2007: 78 MOV A,B
2008: 3C INR A
2009: 27 DAA
200A: 47 MOV B,A
200B: C5 PUSH B
200C: CD 6E 03 CALL UPDDT
200F: 16 18 MVI D,18H
2011: CD F1 05 CALL DELAY
2014: C1 POP B
2015: C3 06 20 JMP LOOP
-
20CE: FB EI
20CF: 76 HLT
20D0: C9 RET
1) To execute this program, type 2000 .
2) Try to stop the count exactly at 00 using the key.
3) You can change the speed of the counter by varying the contents of memory location 2010.
EET 211 - LAB #4 I/0 and Data Transfer with the SDK-85
K. Dudeck
1) Enter the following program, labeled I/O CONFIG , into your SDK 8085, beginning at address location 2000H .
2000: 3E FF I/O CONFIG: MVI,A FFH
2002: D3 03 OUT 03H
2004: 2F CMA
2005: D3 02 OUT 02H
These instructions will ALWAYS be required to be at the beginning of all your programs which use the ROM I/O ports. Port 02H and port 03H are the data direction control registers for port 00H and port 01H respectively. Therefore, to be consistent with the "hard wired" switches and lights, 00H must always be loaded into port 02H, and a FFH into port 03H.
Now, write a program which continually reads the input port, called SWITCHES, into the SDK-85 micro-computer, which will continuously display the binary result to the output port, called LEDS. You will need to use the JMP instruction to continuously loop, see instruction set for details.
SWITCHES = 00H (input port address)
LEDS = 01H (output port address)
3) Run the program to see if it works.
4) Now write an another program which will continuously display the contents of a memory location called MEM, to the output port LEDS.
The address of MEM is defined as:
MEM = $03 (SWITCHES) ,
such that the low address byte is current setting of the eight switches on the input port.
5) The program you have written is a pseudo-monitor program that can be used to examine the contents of any ROM location, ranging from 0300 to 03FFH. Record the contents of addresses 0390 to 03BFH using your program. You can verify the results by using the SDK-85 command.
6) Alter the program so that it can examine any RAM location.
Can your program be used to examine itself?
EET 211 - LAB #5 8086 Tutor Monitor Program
K. Dudeck
Part I. 8086 Registers and Memory
a) Run the TUTOR monitor by typing tutor. Use the /R command to set the 8086 registers to the following hex values:
AX = 1234 BX = 5678 CX = 89AB DX = CDEF SI = 1111 DI = 2222
b) Go to offset address 1000 within the current segment by typing >O 1000. Enter eight bytes into memory by typing /MH followed by
11 22 33 44 55 66 77 88
c) Enter the ASCII codes for letters A - H in the next eight memory locations (offset addresses 1008 - 100F) by typing /MA followed by
A B C D E F G H
d) Go to a new segment (by typing >S ...) in which the data you have just typed in starting at offset address 1000 will be stored at offset address 0000. Print the TUTOR screen on the printer. Go to the segment in which you can find your data at offset 100.
e) Enter the bytes of the program shown below, starting at offset address 0000.
0000 B8 34 12 mov ax,1234H
0003 8B D8 mov bx,ax
0005 F7 D8 neg ax
0007 03 C3 add ax,bx
0009 F7 D3 not bx
000B CC int 3
Move the cursor to the beginning of the program (by pressing the Home key), disassemble the code by typing /UP, and then single step each instruction by pressing function key F1. Observe the registers after you execute each instruction.
f) Go to the segment address of the video RAM in your computer, (either B000 or B800) and write the inverse video letters abc in the upper right corner of the screen, by typing /MA followed by
a p b p c p
g) Type in the program shown below starting at offset address 0000.
0000 B4 00 KEYIN: MOV AH,0
0002 CD 16 INT 16H
0004 EB FA JMP KEYIN
Single step through the program using the function key F2. When you execute the instruction at offset address 0002 you will need to press any key to continue. The scan code and ASCII code for this key will be stored in AH and AL. Check several of the ASCII codes with an ASCII chart.
h) Modify the program shown below so as to display your first name on the bottom row of the screen starting in column 10.
0008 B7 00 mov bh,0 set the cursor
000A B2 00 mov dl,0 at column 0
000C B6 18 mov dh,18H row 24 = 18H
000E B4 02 mov ah,2
0010 CD 10 int 10H
0012 BA 00 00 mov dx,0 set string address to 0000H
0015 B4 09 mov ah,9 DOS string output function
0017 CD 21 int 21H
0019 CC int 3 stop program w/ breakpoint
Beginning at memory location 0000 you need to put the ASCII values of your first name into memory using the /MA command, and the last byte must be a $. If your first name is longer than seven characters, you will need to begin this program at a higher offset address.
Part II. - TUTOR Commands
a) Go to memory location 2000:0000 and enter the eight hex values
11. 22 33 44 55 66 77 88
Transfer these eight bytes to locations 2C00:0FF8-2C00:0FFF using the TUTOR command /T described in the attached TUTOR Appendix B. Transfer the same bytes to locations 2D00:1010-2D00:1017.
b) Go to memory location 2000:0003 and insert the three bytes AA BB CC between 33 and 44 using the TUTOR command /I (see Appendix B).
c) Delete the three bytes you inserted in step 2) using the TUTOR
command /D (see Appendix B).
d) Save the eight bytes from locations 2E00:0000-2E00:0007 on a disk using the TUTOR command /SS described in Appendix B. Type /QD to exit to DOS and list the directory (dir) to see the file you saved. Run TUTOR again and load the eight bytes you saved at memory location 2E00:0100 using the /SL command (see Appendix B).
e) When you first run TUTOR, observe the value stored in BX and CX. The value in BX is the segment address that contains the TUTOR program. The value in CX is the starting offset address of TUTOR. Go to this starting address and press /UP. The beginning of the tutor program will be disassembled on the right side of the screen. Now press /LP. This will disassemble a page of code on the entire screen.
EET 211 - LAB #6 DEBUG EXERCISE
K. Dudeck
Introduction
This exercise will introduce you to DEBUG, which is a piece of software that comes with DOS. DEBUG works very similar to the TUTOR monitor described in the text, but is not as easy to use and does not give as much information as TUTOR does. DEBUG does have one very powerful advantage however, it can "look up" opcodes from typed mnemonics. This is called "assembling". In this exercise you will learn to monitor and change register contents, enter bytes into memory, enter an assembly program into memory, unassemble to see the machine
code, save it to disk as a .COM file, and run it under DOS control.
Procedure:
1) Run DEBUG by typing debug from the dos prompt.
C:\> debug
2) Debug will respond with a dash: -
At this point you can enter a debug command.
If you type "?" and , a list of debug commands will be displayed on the screen.
In this exercise we will use the following DEBUG commands:
-r Displays all the Register values.
-r ax Displays the contents of ax and allows you to
change the contents. You can do this with any of
the registers.
-e Allows you to Enter hex values into memory
locations staring at .
-d Dumps a group of memory locations beginning
at .
-h Calculates the Hexadecimal sum and
difference between the two values.
-a Allows you to type Assembly (mnemonic)
instructions and then assembles them into
machine code in memory beginning at
.
-u Unassembles machine code into assembly
beginning at .
-n Assigns a filename to the current bytes
in memory.
-w Writes a block of bytes to the file named
with -n command. Note, the first byte
written is the value currently in the IP
register, and the total number of bytes is
the value in the bx:cx register pair.
-g Runs (Go) the program beginning at
.
-q Quits DEBUG and returns to DOS.
Type -r to see the current register values.
Notice that IP=0100. DEBUG automatically starts programs at this offset address. This is because if we wish to create a .COM file, which can be run directly from DOS, the 8086 needs the first 256 (100h) memory locations reserved for the stack upon program execution. THEREFORE ALL PROGRAMS SHOULD START AT 0100h.
Note: If we later wish to load a .COM into the TUTOR monitor, it should also be loaded beginning at offset address 0100h.
3) Enter the following data bytes into memory beginning at
address location 0120 by typing: -e 0120
then type:
45 45 54 20 32 31 31 20 69 73 20 66 75 6E 21 24
4) Verify what you entered by typing: -d 0120
Notice how the ASCII is also displayed!
5) Enter an assembly program at 0100h by typing: -a 0100
Now enter the following Assembly program:
mov bh,00
mov dl,00
mov ah,02
int 10
mov dx,0120
mov ah,09
int 21
int 20
This program will output a string stored at location 0120 to the screen and then return to DOS (int 20 returns to DOS).
6) Unassemble the program to see that the opcodes were inserted
for you by typing: -u 0100
7) We now are going to store this program on disk as an executable DOS
program, called . All of the following must be done to
achieve this.
a) Set the register IP to equal the address of the first byte to
store:
-r ip
:0100
b) Calculate the number of bytes to store, program plus data string.
The program starts at 0100, and the string ends at 012F. We need
the difference between 0100 and 0130 (one more than 012F).
type: -h 0130 0100
0230 0030 (sum and diff will be displayed)
We now know that 30h (48 decimal) is the total number of bytes that needs to be stored.
We need to set BX=0000 and CX=0030 to tell debug how many total bytes to store.
type: -r bx
:0000
-r cx
:0030
We will now name the file, type: -n
And finally store the file, type: -w
8) Run the program by typing: -g 0100
9) Exit DEBUG by typing: -q
10) In DOS, issue a directory listing by typing > dir
Notice that was created and is exactly 48 bytes long.
Run the program by typing : > etest
You have a dos executable program!
11) Bring the program into TUTOR by running TUTOR, then set the memory cursor to address 0100 by issuing the >o 0100 command, and then using the /sl (store load) command. Respond to the pathname prompt by answering .
12) We will need to change the int 20 instruction to int 3 so that TUTOR will not "lock up" when run, since TUTOR can not jump to DOS while running your program. All programs must end with int 3 if you wish to run them in TUTOR, or int 20 if you want them to be .COM files, to be run in DOS.
13) Also change the program to print out your name instead of the advertisement for this course! Run the program in TUTOR.
Conclusion: You can use DEBUG to assemble (look up opcodes) of all your programs, save them to disk, and then import them into TUTOR, to then use all the advantages that TUTOR has over DEBUG.
EET 211 - LAB #7 MICROSOFT'S ASSEMBLER "MASM"
K. Dudeck
In this lab you will use Microsoft's assembler "MASM," to assemble an assembly language program into a DOS executable machine code .exe file.
The steps to producing a *.exe program is as follows:
1) Install the "MASM" software (if not already done).
2) Boot the computer into the Real DOS mode and initialize
the MASM software.
3) Generate the intended assembly language program by writing a text file with a text editor and save the file with a *.ASM extension (i.e. myprog.ASM).
4) Compile the program using MASM (i.e. C:> MASM myprog.ASM).
-This step generates an object file : myprog.obj .
5) Link the file with any external subroutines and generate the DOS
executable code ( i.e. C:> LINK myprog mysubs ).
-This step generates a file : myprog.exe .
6) Run the program from DOS by typing the name ( i.e. C:> myprog ).
We will specifically write a program called, SHOWTIME, that uses the DOS interrupt function int 21 (when AH = 2Ch). This function reads the current time from the clock and returns the hours, minutes, seconds, and hundreds of seconds in the CH, CL, DH, and DL registers respectively.
Procedure:
1) Boot your computer into the DOS REAL MODE by shutting down windows
and selecting > Restart in MS_DOS mode. Then get into the
C:\EET\MASM directory and initialize the local MASM variables by
Typing: GO_MASM . If you have trouble doing this, please ask your
instructor for help.
2) Run the Microsoft text editor and begin generating the assembly file by typing: edit showtime.asm
3) Type the program shown on the next page into the text editor.
Note that a semicolon is used to denote comments in the program.
You do not have to type the comments shown on the next page for
the program to work properly.
Also note that a subroutine named DIGITS is attached at the end of the main program and called three times. DIGITS takes the decimal number stored in the AL register and converts it into two ASCII number codes, prints them to the display at the current cursor
position, and returns to the main program.
;Program SHOWTIME.ASM: Display system time (in military format).
;
.MODEL SMALL
STACK SEGMENT PARA STACK
DB 64 DUP(?)
STACK ENDS
.DATA
TMSG DB 'The time is $'
.CODE
.STARTUP
LEA DX,TMSG ;set up pointer to time message
MOV AH,9 ;display string
INT 21H ;DOS call
MOV AH,2CH ;read system time
INT 21H ;DOS call
MOV AL,CH ;load hours
CALL DIGITS ;and display them
MOV DL,':' ;load a colon
MOV AH,2 ;output character to screen
INT 21H ;DOS call
MOV AL,CL ;load minutes
CALL DIGITS ;and display them
MOV DL,':' ;output another colon
MOV AH,2
INT 21H
MOV AL,DH ;load seconds
CALL DIGITS ;and display them
.EXIT
DIGITS PROC NEAR
SUB AH,AH ;prepare for division by 10
MOV BL,10
DIV BL ;AL will contain 10's digit, AH the 1's
ADD AL,30H ;add ASCII bias
MOV DL,AL ;prepare for output
PUSH AX ;save the 1's digit
MOV AH,2 ;output character to display
INT 21H ;DOS call
POP AX ;get 1's digit back
ADD AH,30H ;add ASCII bias
MOV DL,AH ;and output character
MOV AH,2
INT 21H
RET
DIGITS ENDP
END
Save this program and exit back into DOS.
3) Compile the program by typing: masm /l/n showtime.asm
If there are no errors, check the directory and see that a file called showtime.obj was generated. The /l/n option tells the assembler to produce a file showtime.LST. Edit this file to find
the listing of the machine code generated by the assembler.
4) To generate a DOS executable file, showtime.exe, run the linker by
typing: link showtime . Check the directory to see that the showtime.exe is generated.
5) Run the program by typing: showtime .
The program should read the clock, and the current time should be
displayed on the monitor.
6) Make sure that you save the assembly text file showtime.asm on a floppy for the next lab, we will be editing the program to make it a subroutine that can be called from a main program.
EET 211 - LAB #8 STRUCTURED PROGRAMMING (SUBROUTINES)
K. Dudeck
In this lab we will learn how to write an assembly language procedure, or subroutine. A subroutine is a software module (procedure) which is written and assembled into an object (*.obj) file but not linked. Then a main program is written which drives the procedure (sometimes called a driver). The driver CALLs the external procedure which has been already assembled, then linked with the procedure.
We will modify the showtime.asm program so that it is written as a procedure, and place that procedure into a file, called eetsubs.asm . Later, the file eetsubs.asm will be used as a collection of useful subroutines that we develop throughout the course, any of which can be called from within a main program.
Procedure Part I.
1) Modify the program showtime.asm so that it is a procedure as show
below. The changes are shown in boldface.
;Subroutines for EET211
;
.MODEL SMALL
.DATA
TMSG DB 'The time is $'
.CODE ; NOTE NO .STARTUP DIRECTIVE
; Displays Time in Military Format
PUBLIC SHOWTIME
SHOWTIME PROC FAR
LEA DX,TMSG ;set up pointer to time message
MOV AH,9 ;display string
; < same as before >
; . . .
MOV AL,DH ;load seconds
CALL DIGITS ;and display them
RET
SHOWTIME ENDP
;Displays Contents of the AL register to Screen
PUBLIC DIGITS
DIGITS PROC FAR
SUB AH,AH ;prepare for division by 10
MOV BL,10
;
; . . .
MOV AH,2
INT 21H
RET
DIGITS ENDP
END
Notice that the changes begin at the beginning and ends only of the procedures. Save the file as eetsubs.asm .
2) Assemble the program by typing: masm eetsubs.asm .
Do not link the program, as it not a main program, just a object
procedure, eetsubs.obj .
3) Create a new main program by typing: edit stime.asm .
This program will drive the showtime procedure. Type into the editor the program below and save it:
;Program STIME.ASM: Drives Procedure to
;display system time (in military format).
.MODEL SMALL
STACK SEGMENT PARA STACK
DB 64 DUP(?)
STACK ENDS
.CODE
EXTRN SHOWTIME:FAR ; Must declare external procedure
.STARTUP
CALL SHOWTIME ; Calls external procedure
.EXIT
END
4) After saving the program to your disk, assemble the program
by typing: masm stime.asm . Notice the statement in the
source file EXTRN SHOWTIME:FAR. This statement tells the
assembler that the subroutine showtime, which is called, is not
attached at the end of the program, but exists in a separate
file which will be linked in order to make the stime.exe run
file.
5) To generate the stime.exe, link the two object files together
by typing: link stime eetsubs .
6) Run the program by typing: stime .
Procedure Part II.
1) Create a new program called password.asm by typing the following program into the editor.
;Program PASSWORD.ASM: Wait until a secret password is entered
; Note: Control-C exits immediately
;
.MODEL SMALL
.DATA
PMSG DB 0DH,0AH,'Password: $'
PWTXT DB 'secret',0DH
.CODE
.STARTUP
LEA DX,PMSG ;point to message string
MOV AH,9 ;display string function
INT 21H ;DOS call
GETPW: LEA SI,PWTXT ;point to password string
GETCH: MOV AH,8 ;read keyboard without echo
INT 21H ;DOS call
CMP AL,[SI] ;does character match?
JNZ GETPW ;jump if no match found
INC SI ;else, point to next password character
CMP AL,0DH ;was last character a carriage return?
JNZ GETCH ;continue reading password if not
.EXIT
END
This program waits until you type the secret password, "secret",
or press Ctrl-C and then ends. You can change the program
password from "secret" to any thing you want. How?
2) Assemble, link and run the program. Does it work? Note that the password is case sensitive.
3. 3) From what you learned in Part I, modify this program so that
after the correct password is entered the program prints out
a message like "Correct password!" and then prints out the
current time.
4) Assemble, link and run this program.
-----------------------
SUBSTITUTE MEMORY EXAMPLE 1
Using to list the first few Monitor locations:
KEY ADDR DATA
.
0 0000.
0000 3E.
0001 00.
0002 32.
0003 00.
-
SUBSTITUTE MEMORY EXAMPLE 2
Using to enter a small program:
KEY ADDR DATA
2 0002.
0. 0020.
0 0200.
0 2000.
2000 **.
3 2000 03.
E 2000 3E.
2001 **.
< 4 SPN> 2001 04.
< 7 PCL> 2001 47.
2002 **.
C 2002 0C.
F 2002 CF.
-
NOTE: **. represents unpredictable values
After loading the above program, use
again to go back and check locations 2000-2002 to see that they contain:
CORRESPONDING
8085 ASSEMBLY
LANGUAGE
ADDRESS DATA INSTRUCTIONS
2000 3E MVI A, 47H
2001. 47
2002 CF RST 1
This program will load the A register with the number 47 and jump back to the monitor.
SINGLE STEP EXAMPLE
Single stepping through the SDK-85 Monitor, this is what you should see on the display:
KEY ADDR DATA
****. **
8N 0008.
000b. E1
000C. 22
000F. F5
0010. E1
To resume full speed operation at this point, do the following:
-
0010. E1
-80 85
EXAMINE REGISTER EXAMPLE 2
Using to examine the contents of the 8085's Registers:
KEY ADDR DATA
A A **.
b **.
C **.
d **.
E **.
F **.
I **.
H **.
L **.
SPH **.
SPL **.
PCH **.
PCL **.
or -
NOTE: ** represents the contents of the register whose name is in the address field of the display.
EXAMINE REGISTER EXAMPLE 1
Using to initialize the 8085's stack pointer to 20C2:
KEY ADDR DATA
< 4 SPN> SPH **
2 SPH 02.
0 SPH 20.
SPL **.
C SPL 0C.
2 SPL C2.
-
GO COMMAND EXAMPLE
Now you can execute the program you entered Recall that this small program loads the A register
in example 2 of the command. with the number 47 and restarts the monitor. To
First, check to make sure the 3 location program To verify that the A register now holds 47, and to
is in memory, then the program will be executed. get more practice using the ,
try the following sequence:
KEY ADDR DATA COMMENTS KEY ADDR DATA COMMENT
2 0002. A A 47. (A reg now
0 0020. holds 47)
0 0200. 0 A 00.
0 2000. - (Now A holds
2000 3E. MVI A, 47 0)
2001 47. ( ****. **
2002 CF. RST 1 2 0002.
- 0 0020. (Run the small
( **** ** program again)
2 0002. 0 0200.
0 0020. 0 2000.
0 0200. -80 85
0 2000.
-80 85 A A 47 (Now A holds
47 again)
NOTE: **** denotes "don't care" values Now try lacing other values in location 2001 using
and use to execute the
program again, seeing how those values are
loaded into the A register after execution.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- introduction to computer systems pdf
- introduction to basic computer pdf
- introduction to computer studies pdf
- introduction to computer science
- introduction to computer packages pdf
- introduction to computer pdf notes
- introduction to computer science free
- introduction to computer network pdf
- basic introduction to computer programming
- introduction to computer skills pdf
- introduction to computer pdf
- 3 raised to the negative 6 power