org 30h .z80 start: ld sp,30h ld hl,begin ld de,30h ld bc,ecode - begin ldir begin: ld a,1 out (41h),a ;turn DJ off call prstart ld c,0 ;segment counter ld iy,0ffh ;report map pointer ld a,'A' ;pass 1 = A ld (iy),a inc iy ;now point to map ld ix,mapram + 2 ld b,0 ;test pattern call initmap ;******************************************************** ;* Loop0 - updates the segment under test for 1 Mb * ;* of main memory (c = 0ffh). * ;* Loop1 - Checks memory 4 Kb with character in b * ;* and it's complement. * ;* Loop2 - goes back and checks again--checking for * ;* for refresh problems * ;* * ;******************************************************** loop0: ld hl,1000h ;memory counter ld (ix),c ;segment pointer ld a,b loop1: ld (hl),a cp (hl) jr nz,error cpl ld (hl),a cp (hl) jr nz,error inc hl bit 1,h jr z,loop1 ld hl,1000h ;check again for refresh ld a,b loop2: cp (hl) jr nz,error cpl inc hl bit 1,h jr z,loop2 ld a,'G' call message inc c jr z,prnmap ;print report if done jr loop0 ;next segment error: ld a,'X' call message inc c jr z,prnmap ;print report if done jr loop0 ;next segment message: push af ld a,(iy) ;get old segment result inc iy ;next map entry cp 'X' ;was it bad?? ret z ;leave alone if yes pop a ld (iy),a ;update the map ret initmap: ld d,0ffh ;byte count initlp: ld (iy),b ;null the message ram inc iy dec d jr nz,initlp ret prnmap: ld iy,0ffh ;begining report buffer ld d,0h ;byte count ld l,0fh ;16 bytes per line call passprn pmap0: ld a,(iy) ;get the results ld c,a ;print character in c call conout ;print it inc iy ;next segment report dec l call z,crlf ;16 bytes per line dec d jr nz,pmap0 ;255 entries newpas: ld a,b rrc ld b,a ld c,0 ;next pass ld iy,0ffh ld a,(iy) inc a ld (iy),a ;increment the pass jr loop0 ; routine prints the pass number passprn: call crlf call crlf ld a,(iy) ;get the pass number inc iy ld c,a call conout ; Print a carriage return/line feed crlf: ld c,ACR call conout ld c,ALF ; Console output routine for Mult I/O or WB I/O conout: ld a,grp1 out (grpctl),a wait: in a,(lsr) and thbe jr nz,wait ld a,c out (tbr),a ret ecode equ $ end