• Keine Ergebnisse gefunden

XRA A CALL BKLOC

Im Dokument Self-Study Course (Seite 173-186)

DATA FORMAT

XRA A CALL BKLOC

CNC BKENT EI

The address can be removed by:

DI

XRA A CALL BKLOC

cc

BKRMV

EI

Subroutine BKLOC finds the location in the breakpoint table of the given address, and returns Carry set if the address exists. Then it can be entered or removed. The conditional calls to BKENT and BKRMV prevent duplicating an existing breakpoint or removing a non-existing breakpoint. Since these subroutines lengthen or shorten the stack it is vital that they not be used improperly. The procedures shown above protect against stack errors. BKLOC must be entered with Carry clear.

DATA FORMAT

9.6.3 Subroutine BKMEM (01D5)

This is the subroutine used by the monitor breakpoint system to test for a change in the data stored at a memory location that has been entered as a breakpoint. SOTBT marks the end of transmission of the message by changing the data stored in the breakpoint memory table (rather than that in the main memory), which allows BKMEM to detect the end of transmission.

To be effective, BKMEM must be entered with Carry cleared.

If no breakpoint data has changed, BKMEM returns:

Not Carry, Not Zero

(A) = Data byte from oldest breakpoint (BC)= Address of oldest breakpoint (DE) Preserved

(HL) = Address of count byte of oldest breakpoint If breakpoint data has been changed, BKME.M returns:

Carry, Not Zero

(A) = Data byte that has changed

(BC) = Address of data byte that has changed (DE) Preserved

(HL) = Address of count byte for breakpoint whose data has changed

9.6.4 Subroutine SINWS (03CF)

This subroutine waits for a start bit and then for successive data bits. It includes calls to the delay subroutine. SINWS returns with the received data byte in (A), stop bit in Carry, and Not Zero if a character has been received. If a long delay expires without a start bit SINWS returns with Zero set.

The delay times must be loaded to Registers C and B before the call to SINWS.

(C) = Bit time delay count

Bit time= 106 + 148 (C) system clocks (B) = Delay to wait for start bit

Delay 9.375 milliseconds for each count in (B).

All registers except (A) are preserved.

START

Accept starting address CALL ENTWD

Store starting address (83E4, ES) ..,__ (HL)

Accept stopping address or command

CALL ENTWD

To Transmit

Zero

To Receive

DATA FORMAT

9.6.5 Transmit/Receive with Monitor Subroutines

This exercise uses the subroutine described above to record data on tape and read it back, comparing the received data with that recorded.

A starting Another call but if none

address must be entered via ENTWD. (See Figure 9-14.) to ENTWD accepts a stopping address for transmission, is entered the receive function is performed. ENTWD returns Zero set after a command.

9.6.5.1 Transmission

Monitor subroutine SOTBT is called by an interrupt service routine, activated by a programmed RST6 after the time delay subroutine DELYT.

At the end of the transmission the service routine stores FF as the high byte of the data pattern, indicating completion as a signal to the main loop. Interrupt service and the transmit loop. are shown in Figures 9-15 and 9-16.

Sa~e all registers Load Data Pattern CALL SOTBT

CY Set - Finished

Output to PORTOC

Store Data Pattern Restore Registers EI, Return

( H ) - (A}

DATA f.ORMAT

Enter if Stopping Location Entered

Enter stopping location as breakpoint

Load time delay to (C) CALL DELYT

RST 6

Test for end

(A) - (8301) Not End

(8301)

=

FF

DI

Display LRC (83E1) Display symbol Lr Display final address Remove breakpoint EI

START

Transmit Main Loop With Breakpoint Entry

DATA. FORMAT

The main transmit loop uses the procedures of Section 9.6.2 to enter the stopping address as a breakpoint and remove it when transmission is finished (Figure 9-16). It recognizes the end of the message by finding FF at address 8301, which otherwise contains stop bits or zeros. The final address and the LRC generated by SOTBT are displayed, along with a symbol, Lr. Since the display subroutines enable monitor interrupts, it is necessary here to disable interrupts until the breakpoint has been removed. Otherwise the monitor will detect a data change at the breakpoint, because SOTBT changes the data in the breakpoint table to indicate that the LRC has been sent.

9.6.5.2 Receiving

The receive loop calls SINWS in three different places (Figure 9-17).

The first call is repeated indefinitely until a data byte is received. Data bytes are compared with successive data locations in memory, and the address and data are displayed until one of two possible events terminates the operation.

a) SINWS returns Zero set, to indicate the end of the recording.

b) Received data is different from the memory data.

In the latter case, there may be an error, or the LRC recorded on tape may have been received. If an error has occurred, more data will be received, but if the LRC has been received SINWS should

Enter if No Stopping Location Entered

Not

Disable Interrupts Load memory address

(HL) - 83E4, ES

Load Timing Data

(BC) - 207D

Wait for first input CALL SINWS

Zero

Display Received Data Save Received Data Display Address

Recover Received Data Compare Memory

Increment Address Receive next input CALL SINWS

Zero

Not Equal

Zero

SINWS

A

Zero

Set symbol LR

Di-splay symbol left of received data EI

Data Entry

Test for end CALL SINWS

DATA FORMAT

End of Message

Data Not Equal to Memory

INSTRUCTION TIMING

HLT (if interrupted inunediately}

NOP

9.7 CALCULATING DELAY TIMES In

and

the previous exercises we have DELYC. When you design

DATA FORMAT

used the monitor subroutine DELYT delay loops with critical time requirements, it is necessary to calculate the timing. Figure 9-15 lists the number of clocks for each 8080 instruction. As an exercise design a delay subroutine to replace DELYT in the transmit program.

Calculate the timing and the necessary delay value.

MICROCOMPUTER TRAINING WORKBOOK

CHAPTER 10

Im Dokument Self-Study Course (Seite 173-186)