tpa equ 100h cr equ 0dh lf equ 0ah parity equ 0c1h ;Reset North Star partiy bank equ 0c0h ;North star bank select port org tpa jp start start: ld sp,prmflg xor a ld (l3563h),a ld a,parity ;Init North Star parity out (bank),a ld hl,mes ;Address of sign on message ld b,mese-mes ;Length outl: ld a,(hl) ;Get a character of sign on message call cout inc hl djnz outl ;Keep outputing til end of message ld iy,init ;Address of initilaztion driver call doall ;Figure memory configuration call blktst ;Do a block move test call pmap ld a,parity out (bank),a ld h,'A' ;Start series at 'AA' mainr: ld l,'A' ;Reset lower pass counter mainl: ld (series),hl ;Print out series ld a,h call cout ld a,l call cout ld a,(l3563h) or a ld a,' ' ;Space jr z,odd inc a ;Else '!' odd: call cout ld iy,stuck ld c,00 ;Check for bit stuck high ld a,'1' ;Phase 0 call dotest ld iy,stuck ld c,0ffh ;Check for bit stuck low ld a,'2' call dotest ld iy,phase3 ;Do fixed pattern test ld a,'3' call dotest ld a,(series) and 001h ;Check for odd series jr nz,l3072h ld iy,phased ld a,'-' ;Do a '-' phase on odd passes call dotest l3072h: ld iy,phase4 ld a,'4' call dotest ld iy,phase5 ld a,'5' call dotest lä a,'6§ calì cout lä c,000è call phas6a ld c,0ffh call phas6a ld iy,phas6b call crlf call doall call blktst call crlf ld hl,(series) ;Get series inc l ;Inc for new pass ld a,'Z'+1 ;Check if series overflowed cp l jp nz,mainl inc h ;Up lower counter if overflow jp mainr ;Main and reset lower counter blktst: ld iy,tldir doall: ld hl,0000 ;Start at address zero tl: push hl ;Save address ld e,h ;Swap bytes into (de) ld d,l ld ix,l3400h ;Load index pointer with mem table add ix,de ;Point to current page info ld a,(ix+01h) ;Get memory type or a call jumpiy ;Jump to selected routine in a,(003h) ;Check console status and 002h jr z,l30dah in a,(002h) ;Get character and 07fh ;Mask parity cp 003h ;Ctrl c ? jp z,le800h ;Yup, reboot ld (prmflg),a ;No, reprint map flag l30dah: pop hl ;Get address back inc h ;Inc a 1K's worth inc h inc h inc h jr nz,tl ;Still more ret jumpiy: jp (iy) init: ld a,h ;Get page into (a) ld c,'*' cp start/100h ;Check if testing test program area jr z,update cp (start+400h)/100h ;More test program area jr z,update ld b,(hl) ;Load memory address ld a,b cpl ;Invert all bits ld (hl),a ;Restore ld a,(hl) ;Load again cp b ;Check if memory jr z,notmem ld c,00 ;Start at zero ld b,c checkl: ld (hl),c ;Put in value ld a,(hl) ;Get it back xor c ;This will isolate bad bits or b ;Put together with old bad bits ld b,a ;Resave inc c ;Do a 0-255 pass jr nz,checkl update: ld (ix+01h),c ;Update memory type 0=good, else bad ld (ix+02h),b ;Update bad bits ret notmem: ld c,'-' ;Not memory inc b ;If it's an 0ffh then not memory jr z,update ld c,'P' ;Prom jr update badbit: or (ix+02h) ;Load old bad bits ld (ix+02h),a ;Enter new one in with old ones ld (prmflg),a ;Print at end of pass ld (l3563h),a ret dotest: call cout ;Print out pass number call doall ;Test a 1K chunk call blktst ;Do a block move test chkanp: ld a,(prmflg) ;Check print flag or a ret z ;Don't print new map call crlf pmap: ld c,001h ;Start with bit 0 ld iy,pent ;Print entry routine pml: call doall ;Enter general purpose routine call crlf ;Print A CRLF between bits sla c ;Move (C) around to next bit jr nz,pml ;Still more bits call crlf ;Finish up with a CRLF xor a ld (prmflg),a ;Clear print flag ret pent: jr nz,prin ;Not memory ld a,(ix+02h) ;Load bad bits and c ;Check if any l314eh: ld a,'M' ;'M' for memory jr z,prin ;Its still good ld a,'?' ;Found bad memory prin: call cout ld a,h ;Get memory page or 0e3h ;Check for end of 8K segment inc a ret nz ;Nop ld a,' ' ;Yup, seperate with spaces call cout ret tldir: ret nz ld d,h ;Point to same address ld e,l ld bc,0400h ;Do 1K's worth ldir ret stuck: ret nz ;Return, not memory push hl ;Save start address call storec ;Store value in memory pop hl call checkc ;Check ret kstore: ret nz storec: ld b,04 ;For a 1K's worth storl: ld (hl),c inc l ld (hl),c inc l ld (hl),c inc l ld (hl),c inc l jp nz,strol inc h djnz storl ret kcheck: ret nz checkc: ld b,004h chekl: ld a,(hl) ;Load memory address xor c ;Isolate bad bits call nz,badbit ;Error inc l jp nz,chekl inc h djnz chekl ret phas6b: jp nz,l3154h ld (hl),000h push hl l319dh: pop de push hl ld bc,03ffh inc de ldir ld (hl),0c9h pop hl ld b,0c8h l31aah: call l3205h djnz l31aah push hl ld bc,l002ah add hl,bc push hl pop de ld hl,l0000h ld (l355fh),hl ld hl,l3204h inc bc lddr push de pop hl ld c,006h add hl,bc call l3205h pop hl ld a,(l355fh) cp 0d6h jr nz,l31d7h ld a,(l3560h) cp 003h l31d7h: jp l314eh l31dah: lddr ld c,a lddr ld hl,(l355fh) inc hl ld (l355fh),hl inc de ld a,d or 003h ld h,a l31ebh: ld l,0ffh push hl sbc hl,de dec hl dec hl push hl ld a,(le918h) pop bc ld de,l0029h sbc hl,de pop hl push hl pop de dec hl ld a,002h jr nc,l31dah l3204h: ret l3205h: jp (hl) phas6a: ld iy,kstore call doall ld iy,l3222h call doall ld iy,kcheck call doall call blktst call chkanp ret l3222h: ret nz ld a,c cpl ld d,a ld a,(hl) xor c call nz,badbit l322bh: ld b,02bh l322dh: ld (hl),d ld a,(le918h) djnz l322dh dec l ld a,(hl) xor c call nz,badbit inc l inc l ld a,(hl) xor c call nz,badbit dec l ld a,(hl) xor d call nz,badbit ld (hl),c inc l jp nz,l322bh inc h dec e jp nz,l3222h ret phase4: ret nz ;Return if no memory ld c,h ;Put page of memory address into (c) ld b,08 ld a,(series) ;Load low series counter ld e,a ;Move into (e) p4loop: ld hl,01ffh ld a,c ;Get high byte of memory address add a,h ;add 1 ld h,a ;Resave in (h) push hl ;This make an address of memory + 1ffh p4wlop: call getnum ;Get a calculated number ld (hl),a ;Store value in memory call rand1 call getnum ld (hl),a ;Store another byte call rand2 jr nz,p4wlop ;Still more to do pop hl p4rlop: call getnum ;Check with random number pattern xor (hl) call nz,badbit ;Error call rand1 call getnum xor (hl) call nz,badbit call rand2 jr nz,p4rlop inc hl ld a,e add a,087h ld e,a djnz p4loop ret getnum: ld a,l ;Get low order memory address rlca ;Rotate left add a,a ;*2 add a,h ;Add high address add a,e ;add pass number ld d,a ;Back into (d) ret rand1: ld a,h ;Get page address xor 003h ;Invert lower 3 bits ld h,a ld a,l xor 0ffh ld l,a ret rand2: call rand1 dec hl ;Count down ret nz ;Done ld a,c dec a cp h ret phase3: ret nz ;Return if no memory ld d,h ;Load (de) with destination ld e,000h ld bc,pattrn ;Load address of pattern table ld h,b ;Get address of table to (hl) p3a: ld l,c p3l: ld a,(hl) ;get a byte from table ld (de),a ;Store in memory inc l ;Inc table pointer jr nz,more3 ld hl,pattrn more3: inc e ;Inc memory pointer jr nz,p3l inc d ld a,d and 003h ;Check if end of page jr nz,p3l ld a,d sub 004h ;Start at beginning again ld d,a ld l,c m3chl: ld a,(de) ;Get a byte from memory xor (hl) ;Check with table entry call nz,badbit ;Error inc l ;Up table address jr nz,m3chk ld hl,pattrn m3chk: inc e jr nz,m3chl inc d ld a,d and 003h ;Check if end of K jr nz,m3chl ld l,c m3ddwn: dec de ;Now do the same test counting down ld a,(hl) ;Gett an entry from table ld (de),a ;Store in memory inc l jr nz,m3ds ;Still more of table ld hl,pattrn m3ds: ld a,d and 003h ;Check if back to start of table or e jr nz,m3dwn ld a,d add a,004h ;start a top again ld d,a ld l,c p3down: dec de ;Do a loop through memory ld a,(de) ;Get a byte xor (hl) ;Check call nz,badbit ;Error inc l jr nz,m3c2 ld hl,pattrn m3c2: ld a,d and 003h or e jr nz,p3down inc c jr nz,p3a ;All done with check ret inc bc ld b,b adc a,027h mes: defb cr, lf,'RAMTEST VERSION DD1',cr, lf mese: equ $ phased: ret nz ;Return if no memory to test push iy ;Save memory table address ld a,e ;Load a with high byte of address sub 010h bit 02h,e jr z,l332ch add a,020h l332ch: ld iy,l3400h ;Get memory table address ld e,a ;Make an offset to proper address add iy,de ld a,(iy+01h) ;Load memory type or a ;Not memory to test jp nz,l3356h ld d,e ld e,01 ;Make an memory address push de pop iy ;Move memory address into (IY) push hl ;Save memory address push hl ld hl,dcode ;Load address of code to be executed pop de ;Get dstination address into (de) ld bc,dcend-dcode ;Length of code ldir ;Move it into memory to be tested pop hl ;Get address back jp (hl) ;Jump to routine dret: xor 0ffh ;Should get back to here call nz,badbit ;Did not get an ffh back xor b call nz,badbit ;(B) should have a zero l3356h: pop iy ret dcode: ld (iy+00h),0ffh ;Should be memory address + 1 ld a,(iy+00h) ;Get pattern back ld (iy+0ffh),0 ;Should be memory address ld b,(iy+0ffh) ;Get second pattern back into (b) jp dret ;Return to test dcend equ $ phase5: ret nz ;Return if not memory ld (l3561h),hl ld c,00 ;Store zero's in memory call storec push ix ;Save (IX) push iy ;Save (IY) ld iy,p5sub ld c,0ffh call doall ;Store ffh's in all of memory except pop iy ;current page pop ix ;Get old index registers back ld hl,(l3561h) ;Get current memory page back ld c,00 ;Make sure its still zero call checkc ret p5sub: cp '*' ;Return if testing program area ret z ld a,(l3562h) ;Get high byte of address cp h ;Check if current page ret z ;Yup jp storec ;Store new pattern in this area crlf: ld a,cr ;Print a CR, LF sequence call cout ld a,lf call cout ret cout: push af ;Print character in (A) push bc ld c,a call conout ;Call prom routine for I/O pop bc pop af ret ld (bc),a ret inc hl ld (l51a3h),hl ld (l48ech),hl call l319dh call l320fh ret c call l31ebh cp 020h jp c,l3f36h jp nz,l4072h jp l3f36h ld hl,(l51a1h) ld a,(hl) cp 020h ret z cp 03ah ret nz inc hl ld (l51a1h),hl ret call l320fh ld a,(de) cp 021h jp z,l3674h cp 01fh jp z,l365bh cp 020h jp z,l364ah cp 000h ld bc,0402h ex af,af' djnz 3414h ld b,b add a,b xor d ld a,a cp a rst 018h rst 028h rst 030h ei push iy rst 038h l3400h equ $ prmflg equ 0355eh l3563h equ 03563h series equ 03564h le800h equ 0e800h l002ah equ 0002ah l355fh equ 0355fh l3560h equ 03560h le918h equ 0e918h l0029h equ 00029h pattrn equ 033edh l0011h equ 00011h l3561h equ 03561h l3562h equ 03562h conout equ 0f806h l51a3h equ 051a3h l48ech equ 048ech l320fh equ 0320fh l3f36h equ 03f36h l4072h equ 04072h l51a1h equ 051a1h l3674h equ 03674h l365bh equ 0365bh l364ah equ 0364ah l3414h equ 03414h end