80-Bus News

  

November-December 1983, Volume 2, Issue 6











Page 57 of 67











57

Memory Block Comparison Program M-80

E100 E000

0000"

DOOO DOO4

DOO7

DOOD DOOE DOOF D012 DOW DOI4 DOS DO16 D019 DO1B DOID DOE

Do20 DO24

ED 31

21 1 1A BE c4 23 13 ES

01 28

Et 18

cg

73 #100 E000

0100 6100

DO25

6100 03 ED

7B B100

19 Nov 1983 19:19 PAGE 1

+Z80 Title Memory Block Comparison Program

+Comment

COMPARE V1.1 15/06/83, A. M. Davies Written source supplied, transcribed DRH 19/11/83.

This program compares all the bytes in two blocks of memory and types out on the console the HEX values of the addresses in the lower block where the bytes are different from the corresponding bytes in the higher block. The start addresses of the two blocks are defined as blocki and block2, and the top address of block! to be checked is loaded into <BO>, at blokitop. The program runs from 0D000H.

The program was originally used to find a bad byte in an EPROM version of MBASIC-80, which did not run correctly although the tape version of the same did. It took about 500mS to find the one byte in 24K that was incorrect.

The program is not claimed to optimised in any way whatever."

0e100h 0e000h

stcksave equ newstack equ

aseg org 0d000h

ld (stcksave),sp ; Save the RP/M stack

ld sp, newstack ; Set up new stack blockt: id h1,100h 3; Start addr. of lo. block block2: 1d de ,6100h 3; Start addr. of hi. block getbyte: 1d a, (de) ; Get byte from hi. block

ep (nl) 3 Compare with lo. block

eall nzg,taddr } If not equal report error

ine hl ; Increment both pointers

ine de

push hl 3 Save <HL>

or a 3 Clear any carry flag blokitop: ld be ,6100h 3 Check against top addr..

sbe h1,be 3 «for end

jr zyexit 3; If top then quit

pop hi ; Restore <HL> and..

dr getbyte 3 --loop for next byte exit: ld sp,(stcksave) ; Get the stack back..

ret 3; and return

Memory Block Comparison Program M-80

D025 D026 D027 Bo28 D029 DO2B DOZE

DO30 D031 D032 D033 DO36 D037 DO3A DO3B DO3C DO3D DOZE

DO3F DO40 DO44

D042 DO43 D044 DO47 BO48 DO4B

Do4c DO4E D051 DO52 DO55

DOS6 DO58 DO5A DO5B DOSD

DOSE DOSF DOGO DO61 DdOo62 D064 D067 D068 DOES DO6A DO6B

Bi E5 7 cb 7D cD Ei Di Ci wi cg

F5 OT OT

OT cD oa

cD cg

E6 cD

cD cg

ce

ce cg

F5 C5 D5

OF cD EI D1 Ci Fi cg

oD DOSE

DO3F

DO3F

DO4c DO4c OF DO56 DOSE 30 3A OT

02 0005

taddr:

tbyte:

thex:

hexas:

conout:

19 Nov 1983 push af push be push de push hi id e,Odh call conout 1d e,Oah

3 Now put out the current address pop hl push hi ld a,h call thyte 1d a,l eall thyte pop hl pop de pop be pop af ret push af rlca rlea rlca rlca call thex pop af call thex ret and OFH eall hexas 14a e,a call conout ret add a,’O’ ep ‘g’ +1 ret c add a,7 ret push af push be push de push hl ld c,2 eall 0005h pop hl pop de pop be pop af ret

end

19:19 PAGE i-t

Save the registers

Type a CR and...

oo» an LF

Get <HL> back

Resave <HL> –

Type the hi. order byte Type the lo. order byte

Restore the registers...

«-and return

Save <AF> Rotate high nibble ... «ee into low nibble

Print the nibble Get <AP> back Print the nibble

Mask the high nibble

Print the nibble

Convert to ASCIT Check if > 9

Return if not Convert to character

Save the registers


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 57 of 67