TOS RAM test routine ?

News,announcements,programming,fixes,game patches & discussions.
User avatar
exxos
Site Admin
Site Admin
Posts: 28388
Joined: 16 Aug 2017 23:19
Location: UK

TOS RAM test routine ?

Post by exxos »

Looking through the TOS sources for the TTram tests..

Code: Select all

/* copy erase routine to low memory */
        move.w    #(coldbend-coldboor+3)/4-1,d0
        lea.l     coldboor(pc),a0
        movea.w   #$00c,a1
coldboo1:
        move.l    (a0)+,(a1)+
        dbf       d0,coldboo1
        jmp       ABSW($0000000C)
/* clear ST memory until buserror */
coldboor:
        lea.l     coldboo4(pc),a0
        move.l    a0,ABSW(_buserror)
        lea.l     coldboo6(pc),a0
        moveq.l   #0,d0
coldboo3:
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        bra.s     coldboo3
/* clear FASTRAM until buserror */
coldboo4:
        move.l    ABSW($00000004),ABSW(_buserror)
        lea.l     FASTRAMBASE,a0
coldboo5:
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        bra.s     coldboo5
coldboo6:
        nop
coldbend:  ds.b 0

        data
zero2:  dc.l 0
		text
I assume the relevant bit is this..

Code: Select all

coldboo5:
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        move.l    d0,(a0)+
        bra.s     coldboo5
So I assume d0 contains all zeros and is moved to address (a0) which is then incrementally each time presumably by one ?

I also further assume it is why that line is in there 4 times as it would have to increase 4 addresses for 32 bit ?

Further I don't really understand how it puts the dashes on the screen during test as it would be permanently stuck in that loop ?!

Sadly I know practically zero about assembly :(

I mention this because @stephen_usher Says PAK TOS does the TTram test about 4x faster than TOS. So I am not sure how it is clearing the entire address range that much faster unless it simply is not clearing every address or there is a much faster way of doing the loop :shrug:
User avatar
Badwolf
Site sponsor
Site sponsor
Posts: 3043
Joined: 19 Nov 2019 12:09

Re: TOS RAM test routine ?

Post by Badwolf »

exxos wrote: 05 Dec 2022 16:31 Looking through the TOS sources for the TTram tests..
That's not testing the RAM, just initialising it to zero on a cold boot.

If PAK TOS can test the ram faster then I'd guess it's either running fewer tests or skipping over addresses.

BW
DFB1 Open source 50MHz 030 and TT-RAM accelerator for the Falcon
Smalliermouse ST-optimised USB mouse adapter based on SmallyMouse2
FrontBench The Frontier: Elite 2 intro as a benchmark
User avatar
exxos
Site Admin
Site Admin
Posts: 28388
Joined: 16 Aug 2017 23:19
Location: UK

Re: TOS RAM test routine ?

Post by exxos »

Badwolf wrote: 05 Dec 2022 16:47 That's not testing the RAM, just initialising it to zero on a cold boot.

If PAK TOS can test the ram faster then I'd guess it's either running fewer tests or skipping over addresses.
ah, The code must be somewhere else then but it is being rather elusive so far :roll:

I understood it would check its own address for memory test but not yet located that code :(
User avatar
exxos
Site Admin
Site Admin
Posts: 28388
Joined: 16 Aug 2017 23:19
Location: UK

Re: TOS RAM test routine ?

Post by exxos »

ah Maybe $20000 is the block size it is testing then..

Code: Select all

#include "config.h"

ZONESIZE equ $20000

/* 306de: 00e05fa4 */
/* 206de: 00e05bb2 */
	xdef memtest
memtest:
        movea.l   memtnext,a0
        move.l    a0,d0
        beq.s     memtes1
        jmp       (a0)
memtes1:
        movea.l   #memthdr1,a0
        bsr       mempstr
        clr.l     memtaddr
        move.l    _phystop,memttop
        move.l    _membot,d0
        add.l     #ZONESIZE-1,d0
        move.l    #ZONESIZE-1,d1
        not.l     d1
        and.l     d1,d0
        move.l    d0,memtbot
        move.l    _memtop,d0
        and.l     d1,d0
        move.l    d0,memtend
        clr.w     memterr
        move.l    #memtes2,memtnext
        bra       memtes16
memtes2:
        bsr       testzone
        move.w    memterr,d1
        or.w      d0,d1
        move.w    d1,memterr
        move.l    memtsize,d0
        sub.l     #ZONESIZE,d0
        move.l    d0,memtsize
        bgt.s     memtes5
        move.l    memtzone,d0
        add.l     d0,memtsize
        tst.w     memterr
        beq.s     memtes3
        move.w    #$0058,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, 'X') */
        addq.w    #6,a7
        bra.s     memtes4
memtes3:
        move.w    #$002D,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '-') */
        addq.w    #6,a7
memtes4:
        clr.w     memterr
memtes5:
        move.l    memtaddr,d0
        cmp.l     memttop,d0
        bne.s     memtes8
        move.l    d7,-(a7)
#if TP_49
        moveq.l   #10,d7
#else
        moveq.l   #8,d7
#endif
memtes6:
        move.w    #$0008,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '\b') */
        addq.w    #6,a7
        dbf       d7,memtes6
        move.l    (a7)+,d7
        move.w    #$0020,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, ' ') */
        addq.w    #6,a7
        move.l    _phystop,d0
        asr.l     #8,d0
        asr.l     #2,d0
        bsr       prtdec
        movea.l   #memtkb,a0
        bsr       mempstr
        move.l    #memtes9,memtnext
memtes8:
        clr.l     d0
        rts
memtes9:
        clr.w     memterr
        move.l    _ramtop,d0
        beq       memtes15
        cmp.l     #$01000000,d0
        beq       memtes15
        move.l    d0,memttop
        move.l    #$01000000,memtaddr
        move.l    memtaddr,memtbot
        move.l    #ZONESIZE-1,d1
        not.l     d1
        and.l     d1,d0
        move.l    d0,memtend
        movea.l   #memthdr2,a0
        bsr       mempstr
        move.l    #memtes9a,memtnext
        bra       memtes16
memtes9a:
        bsr       testzone
        move.w    memterr,d1
        or.w      d0,d1
        move.w    d1,memterr
        move.l    memtsize,d0
        sub.l     #ZONESIZE,d0
        move.l    d0,memtsize
        bgt.s     memtes12
        move.l    memtzone,d0
        add.l     d0,memtsize
        tst.w     memterr
        beq.s     memtes10
        move.w    #$0058,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, 'X') */
        addq.w    #6,a7
        bra.s     memtes11
memtes10:
        move.w    #$002D,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '-') */
        addq.w    #6,a7
memtes11:
        clr.w     memterr
memtes12:
        move.l    memtaddr,d0
        cmp.l     memtend,d0
        bne.s     memtes14
        move.l    d7,-(a7)
#if TP_49
        moveq.l   #10,d7
#else
        moveq.l   #8,d7
#endif
memtes13:
        move.w    #$0008,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '\b') */
        addq.w    #6,a7
        dbf       d7,memtes13
        move.l    (a7)+,d7
        move.w    #$0020,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, ' ') */
        addq.w    #6,a7
        move.l    _ramtop,d0
        sub.l     #$01000000,d0
        asr.l     #8,d0
        asr.l     #2,d0
        bsr       prtdec
        movea.l   #memtkb,a0
        bsr       mempstr
        move.l    #memtes15,memtnext
memtes14:
        clr.l     d0
        rts
memtes15:
        movea.l   #memtcmsg,a0
        bsr       mempstr
        move.l    #memtesa1,memtnext
        clr.l     d0
        rts

/* 306de: 00e061f2 */
	xdef memtestabort
memtestabort:
        tst.l     memtnext
        beq.s     memtesa1
        cmpi.l    #memtesa1,memtnext
        beq.s     memtesa1
        movea.l   #memtamsg,a0
        bsr       mempstr
        move.l    #memtesa1,memtnext
memtesa1:
        moveq.l   #-1,d0
        rts

memtes16:
        move.l    memttop,d0
        sub.l     memtaddr,d0
        cmp.l     #$00100000,d0
        bhi.s     memtes17
#if TOSVERSION >= 0x300
        move.l    d0,-(a7)
        movea.l   #memtsp,a0
        bsr       mempstr
        move.l    (a7)+,d0
memtes17:
#else
        movea.l   #memtsp,a0
        bsr       mempstr
memtes17:
        movea.l   #memtams2,a0
        bsr       mempstr
        move.l    memttop,d0
        sub.l     memtaddr,d0
#endif
        cmp.l     #$00400000,d0
        ble.s     memtes18
        move.l    d0,d2
        lsr.l     #5,d2
        move.l    d2,memtzone
        moveq.l   #32,d2
        bra.s     memtes19
memtes18:
        move.l    #ZONESIZE,memtzone
        move.l    d0,d2
        clr.w     d2
        swap      d2
        lsr.l     #1,d2
memtes19:
        move.l    d7,-(a7)
        move.l    memtzone,memtsize
        move.l    d2,d7
        move.l    d2,-(a7)
memtes20:
        move.w    #$0020,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, ' ') */
        addq.w    #6,a7
        subq.l    #1,d7
        bne.s     memtes20
        move.l    (a7)+,d7
memtes21:
        move.w    #$0008,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '\b') */
        addq.w    #6,a7
        subq.l    #1,d7
        bne.s     memtes21
        move.l    (a7)+,d7
        clr.l     d0
        rts

#if (OS_COUNTRY == CTRY_PL) & (TOSVERSION >= 0x300)
memthdr1:
                                     dc.b 'Test pami',$d3,'ci',13,10
                                     dc.b 'ST RAM ',27,'p',0
memthdr2:                            dc.b 13,10,'TT RAM ',27,'p',0
memtcmsg:                            dc.b 13,10,'Koniec testu pami',$d3,'ci.',13,10,0
memtkb:                              dc.b ' KB',27,'q',27,'K',0
memtamsg:                            dc.b 13,10,'!TEST NIEDOKO',$c5,'CZONY.',27,'q',13,10,0
#else
#if TOSVERSION >= 0x300
memthdr1:
                                     dc.b 'Memory Test:',13,10
                                     dc.b 'ST RAM ',27,'p',0
memthdr2:                            dc.b 13,10,'TT RAM ',27,'p',0
memtcmsg:                            dc.b 13,10,'Memory Test Complete.',13,10,0
memtkb:                              dc.b ' KB',27,'q',27,'K',0
memtamsg:                            dc.b 13,10,'Memory Test Aborted.'
                                     dc.b 27,'q',13,10,0
#else
memthdr1:
                                     dc.b 'Memory Test:',13,10
                                     dc.b 'ST RAM ',0
memthdr2:                            dc.b 13,10,'TT RAM ',0
memtcmsg:                            dc.b 13,10,'Memory Test Complete.',13,10,0
memtkb:                              dc.b ' KB',27,'q',27,'K',0
memtamsg:                            dc.b 13,10,'Memory Test Aborted.'
                                     dc.b 27,'q',13,10,0
memtams2:                            dc.b 27,'p',0
#endif
#endif
#if TP_49
memtsp:                              dc.b '         ',0
#else
memtsp:                              dc.b '       ',0
#endif
		even

mempstr:
        move.l    a5,-(a7)
        movea.l   a0,a5
mempstr1:
        move.b    (a5)+,d0
        beq.s     mempstr2
        move.w    d0,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13
        addq.w    #6,a7
        bra.s     mempstr1
mempstr2:
        movea.l   (a7)+,a5
        rts

testzone:
        moveq.l   #0,d0
#if !TP_12 /* SKIP_RAM */
        move.l    memtaddr,d1
        cmp.l     memtbot,d1
        bcs.s     testzon8
        cmp.l     memtend,d1
        bcc.s     testzon8
        move.l    #ZONESIZE/4-1,d0
        move.l    d0,d1
        movea.l   memtaddr,a0
        moveq.l   #-1,d2
testzon1:
        move.l    d2,(a0)+
        dbf       d0,testzon1
        movea.l   memtaddr,a0
        move.l    d1,d0
testzon2:
        cmp.l     (a0)+,d2
        dbne      d0,testzon2
        bne.s     testzon7
        movea.l   memtaddr,a0
        move.l    d1,d0
        moveq.l   #1,d2
testzon3:
        rol.l     #1,d2
        move.l    d2,(a0)+
        dbf       d0,testzon3
        movea.l   memtaddr,a0
        move.l    d1,d0
        moveq.l   #1,d2
testzon4:
        rol.l     #1,d2
        cmp.l     (a0)+,d2
        dbne      d0,testzon4
        bne.s     testzon7
        movea.l   memtaddr,a0
        move.l    d1,d0
        moveq.l   #0,d2
testzon5:
        move.l    d2,(a0)+
        dbf       d0,testzon5
        movea.l   memtaddr,a0
        move.l    d1,d0
testzon6:
        cmp.l     (a0)+,d2
        dbne      d0,testzon6
        bne.s     testzon7
        moveq.l   #0,d0
        bra.s     testzon8
testzon7:
        moveq.l   #-1,d0
testzon8:
#endif /* TP_12 */
        movea.l   memtaddr,a0
        adda.l    #ZONESIZE,a0
        move.l    a0,memtaddr
        rts

prtdec0:
        movem.l   d3-d4,-(a7)
        moveq.l   #1,d4
        bra.s     prtdec1
prtdec:
        movem.l   d3-d4,-(a7)
        clr.l     d4
prtdec1:
#if TP_49
        move.l    #1000000,d2
        clr.w     d3
prtdec2:
        movem.l   d1-d2,-(a7)
		move.l    d2,-(a7)
		move.l    d0,-(a7)
#ifdef __GNUC__
		jsr       ___modsi3
		move.l    d0,_ldivr
		jsr       ___divsi3
#else
		jsr       bdosldiv
#endif
		addq.l    #8,a7
        tst.l     d0
        bne.s     prtdec3
        tst.w     d3
        bne.s     prtdec3
        cmpi.l    #1,d2
        beq.s     prtdec3
        tst.w     d4
        bne.s     prtdec5
        move.b    #$20,d0
        bra.s     prtdec4
prtdec3:
        addi.b    #$30,d0
        moveq.l   #1,d3
prtdec4:
        move.w    d0,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13
        addq.w    #6,a7
prtdec5:
        movem.l   (a7)+,d1-d2
        move.l    _ldivr,d0
        move.l    d0,-(a7)
        pea       10.w
        move.l    d2,-(a7)
#ifdef __GNUC__
		jsr       ___divsi3
#else
        jsr       bdosldiv
#endif
        addq.l    #8,a7
        move.l    d0,d2
        move.l    (a7)+,d0
        tst.l     d2
        bne.s     prtdec2
#else
        move.l    #10000,d2
        clr.w     d3
        cmp.l     #$00010000,d0
        bne.s     prtdec2
        move.w    #$0036,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '6') */
        addq.w    #6,a7
        move.w    #$0035,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '5') */
        addq.w    #6,a7
        move.w    #$0035,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '5') */
        addq.w    #6,a7
        move.w    #$0033,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '3') */
        addq.w    #6,a7
        move.w    #$0036,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13         /* Bconout(2, '6') */
        addq.w    #6,a7
        bra.s     prtdec6
prtdec2:
        divu.w    d2,d0
        swap      d0
        move.w    d0,d1
        swap      d0
        movem.l   d1-d2,-(a7)
        or.b      d0,d0
        bne.s     prtdec3
        tst.w     d3
        bne.s     prtdec3
        cmpi.l    #1,d2
        beq.s     prtdec3
        tst.w     d4
        bne.s     prtdec5
        move.b    #$20,d0
        bra.s     prtdec4
prtdec3:
        addi.b    #$30,d0
        moveq.l   #1,d3
prtdec4:
        move.w    d0,-(a7)
        move.l    #$00030002,-(a7)
        trap      #13
        addq.w    #6,a7
prtdec5:
        movem.l   (a7)+,d1-d2
        move.l    d1,d0
        moveq.l   #10,d1
        divu.w    d1,d2
        bne.s     prtdec2
#endif
prtdec6:
        movem.l   (a7)+,d3-d4
        rts

		bss
		
		xdef memterr
		comm memterr,2
		
		xdef memtbot
		comm memtbot,4
		
		xdef memtnext
		comm memtnext,4
		
		xdef memtzone
		comm memtzone,4
		
		xdef memtsize
		comm memtsize,4

		xdef memtend
		comm memtend,4
		
		xdef memtaddr
		comm memtaddr,4
		
		xdef memttop
		comm memttop,4

#ifdef __GNUC__
		xdef _ldivr
		comm _ldivr,4
#endif
User avatar
Badwolf
Site sponsor
Site sponsor
Posts: 3043
Joined: 19 Nov 2019 12:09

Re: TOS RAM test routine ?

Post by Badwolf »

Looks to me like:

testzon1 writes FFs to memory in blocks of ZONESIZE and testzon2 reads them back

testzon3 starts with 1 and rotates it left with each longword written in blocks of ZONESIZE. testzon4 reads them back.

testzon5 writes zeros and testzon6 reads them back.

ZONESIZE corresponds to one character (- or X) printed, I think.

So I can only see three separate write/read test cycles there. Could triple speed by only doing one of them, but not quadruple it.

Is it possible PAK TOS only tests up to 16MB?

BW
DFB1 Open source 50MHz 030 and TT-RAM accelerator for the Falcon
Smalliermouse ST-optimised USB mouse adapter based on SmallyMouse2
FrontBench The Frontier: Elite 2 intro as a benchmark
User avatar
frank.lukas
Posts: 812
Joined: 19 Jan 2018 11:52

Re: TOS RAM test routine ?

Post by frank.lukas »

My PAK has 64MB Fastram and the test runs smoothly up to the 64MB. So I think the whole Fastram is tested ...
User avatar
exxos
Site Admin
Site Admin
Posts: 28388
Joined: 16 Aug 2017 23:19
Location: UK

Re: TOS RAM test routine ?

Post by exxos »

Badwolf wrote: 05 Dec 2022 17:22 So I can only see three separate write/read test cycles there. Could triple speed by only doing one of them, but not quadruple it.

Is it possible PAK TOS only tests up to 16MB?

Not sure. I have not had a working PAK TOS setup. it was @stephen_usher who guesstimated it was about four times faster.
User avatar
exxos
Site Admin
Site Admin
Posts: 28388
Joined: 16 Aug 2017 23:19
Location: UK

Re: TOS RAM test routine ?

Post by exxos »

frank.lukas wrote: 05 Dec 2022 17:30 My PAK has 64MB Fastram and the test runs smoothly up to the 64MB. So I think the whole Fastram is tested ...
Maybe you and / or @stephen_usher Can test PAK and ST536 TOS and see how long it takes in seconds to do full 64MB TTram test ?
User avatar
frank.lukas
Posts: 812
Joined: 19 Jan 2018 11:52

Re: TOS RAM test routine ?

Post by frank.lukas »

Fastram bar only ...

PAK030/50Mhz 64MB = 24s
PAK020/40Mhz 64MB = 35s
TF536 /50Mhz 64MB = 4m40s

... the ST Ram test bar is faster on the PAK Atari ST than on the TF536 Atari ST.


Atari TT 32Mhz 256MB = 2m20s

... the PAK machines are already faster than the Atari TT.
User avatar
stephen_usher
Site sponsor
Site sponsor
Posts: 7386
Joined: 13 Nov 2017 19:19
Location: Oxford, UK.

Re: TOS RAM test routine ?

Post by stephen_usher »

exxos wrote: 05 Dec 2022 17:53
frank.lukas wrote: 05 Dec 2022 17:30 My PAK has 64MB Fastram and the test runs smoothly up to the 64MB. So I think the whole Fastram is tested ...
Maybe you and / or @stephen_usher Can test PAK and ST536 TOS and see how long it takes in seconds to do full 64MB TTram test ?
I'll have to bring the machine back down from the loft again. (I cleared the work area to start building the prototype Apricot HD emulator.)

I can then run both the ST536TOS and the PAK/3 TOS on the same hardware and time it.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.

Return to “SOFTWARE PROGRAMMING & DISCUSSION”

Who is online

Users browsing this forum: ClaudeBot and 8 guests