home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
384.lha
/
RAMSpeed
/
RAMSpeed.asm
< prev
next >
Wrap
Assembly Source File
|
1990-06-04
|
36KB
|
1,396 lines
***********************************
* Assembly Program: RAMSpeed.asm *
* Al Aburto *
* Original: 10 Oct 1988 *
* Revised : 09 Feb 1990 *
* Revised : 17 Feb 1990 *
* Revised : 08 May 1990 *
* Revised : 03 Jun 1990 *
* Must Link with TWStartup.o *
***********************************
INCLUDE "exec/types.i"
INCLUDE "exec/execbase.i"
INCLUDE "exec/nodes.i"
INCLUDE "exec/memory.i"
INCLUDE "libraries/dos.i"
INCLUDE "libraries/dosextens.i"
XREF _LVOAllocAbs
XREF _LVOFreeMem
XREF _LVORawDoFmt
XREF _LVOOpenLibrary
XREF _LVOCloseLibrary
XREF _LVOForbid
XREF _LVOPermit
XREF _LVODisable
XREF _LVOEnable
XREF _LVOSupervisor
XREF _LVODelay
XREF _LVOOpen
XREF _LVOClose
XREF _LVODateStamp
XREF _LVOWrite
XREF _DOSBase
XREF _SysBase
XREF _stdin
XREF _stdout
XREF _stderr
XREF _LVOIEEEDPDiv
XREF _LVOIEEEDPMul
XREF _LVOIEEEDPSub
XREF _LVOIEEEDPAdd
XREF _LVOIEEEDPNeg
XREF _LVOIEEEDPAbs
XREF _LVOIEEEDPTst
XREF _LVOIEEEDPCmp
XREF _LVOIEEEDPFlt
XREF _LVOIEEEDPFix
XDEF _main
XDEF _TWspec
XDEF _MathIeeeDoubBasBase
*************************************************************************
_main:
MOVE.L A7,SaveA7
MOVE.L A4,MyTaskPointer
MOVE.L #MyTaskName,LN_NAME(A4)
MOVEA.L _SysBase,A6
LEA.L MathLiba,A1
MOVEQ.L #$21,D0
JSR _LVOOpenLibrary(A6)
MOVE.L D0,_MathIeeeDoubBasBase
BNE M101
PEA.L NoMath ;Could not find mathieeedoubbas.library
JSR _printf
LEA.L $04(A7),A7
BRA Quit
M101:
BSR CPUFPU_Type ;CPU and FPU Type.
BSR PrtCPUFPU ;Set CPU / FPU Print String.
BSR Read_CACR ;Read CACR (Result in D0 and SaveCACR).
MOVE.L _stdout,crtFile
PEA.L Title01 ;Print RAMSpeed Title.
JSR _printf
LEA.L $04(A7),A7
PEA.L PrtFmt04
PEA.L Title02
JSR _printf
LEA.L $08(A7),A7
JSR CPUSpeed ;Print CPU Speed.
JSR FPUSpeed ;Print FPU Speed.
BSR PrtCache ;Print Cache Status.
PEA.L Title03
JSR _printf
LEA.L $04(A7),A7
PEA.L PrtFmt01 ;Memory Region Headers.
JSR _printf
LEA.L $04(A7),A7
PEA.L PrtFmt02
JSR _printf
LEA.L $04(A7),A7
BSR MTForbid
MOVEA.L _SysBase,A6 ;Search Memory Region List.
MOVEA.L MemList(A6),A0 ;First Region.
BSR MTPermit
LOOP:
BSR MTForbid
MOVE.L A0,SaveA0 ;Save Memory Region Pointer.
MOVE.L MH_UPPER(A0),RAMUpper ;Upper Limit.
MOVE.L MH_LOWER(A0),RAMLower ;Lower Limit.
MOVE.L LN_NAME(A0),RAMName ;Region Name.
MOVEA.L MH_FIRST(A0),A1 ;First Free Chunk.
L101:
CMPI.L #$00002400,$04(A1) ;Need Chunk >= $2400 Bytes in Size.
BGE.S L102 ;Got it.
TST.L (A1) ;Last Chunk?
BEQ.S L102 ;Yes
MOVEA.L (A1),A1 ;Keep Searching
BRA.S L101
L102:
MOVE.L $04(A1),D0 ;Chunk Size.
BSR MTPermit
MOVE.L D0,SaveD0 ;Save Chunk Size.
MOVE.L A1,SaveA1 ;Save Chunk Start Address.
MOVE.L A1,D0
ANDI.L #$FFFFFFF0,D0
MOVE.L D0,A1
ADDA.L #$00000010,A1
MOVE.L A1,SaveA1 ;Start Address of Memory To Request.
MOVE.L #$00002200,D0 ;Byte Size Of Memory To Request (8704).
MOVE.L D0,RAMSize
MOVEA.L _SysBase,A6
JSR _LVOAllocAbs(A6)
TST.L D0
BEQ L106 ;Exit On _LVOAllocAbs Error
MOVE.L SaveA1,RAMLoad ;Load Address for Test Program.
MOVEA.L SaveA1,A0
BSR CopyToRAM ;Move Test Program To RAM.
BSR Get_Time ;Calculate NullTime.
BSR MTForbid
BSR MTPermit
BSR Get_Time
BSR Elapsed_Time
LEA.L DPTime,A0
LEA.L NullTime,A1
MOVE.L $00(A0),$00(A1) ;NullTime
MOVE.L $04(A0),$04(A1)
;Calculate Test Program RunTime.
BSR Get_Time ;Start Timer.
BSR MTForbid
MOVEA.L SaveA1,A1
JSR (A1) ;Go execute the Test Program.
BSR MTPermit
BSR Get_Time ;Stop Timer.
BSR Elapsed_Time
LEA.L DPTime,A0
LEA.L RunTime,A2
MOVE.L $00(A0),$00(A2) ;RunTime
MOVE.L $04(A0),$04(A2)
MOVE.L $00(A2),D0 ;RunTime
MOVE.L $04(A2),D1
LEA.L NullTime,A1
MOVE.L $00(A1),D2 ;NullTime
MOVE.L $04(A1),D3
;Subtract NullTime.
MOVEA.L _MathIeeeDoubBasBase,A6
JSR _LVOIEEEDPSub(A6) ;(RunTime-NullTime)
LEA.L RunTime,A1
MOVE.L D0,$00(A1)
MOVE.L D1,$04(A1)
L105:
MOVE.L CCycles,D0
MOVEA.L _MathIeeeDoubBasBase,A6
JSR _LVOIEEEDPFlt(A6)
MOVE.L $00(A2),D2 ;RunTime
MOVE.L $04(A2),D3
JSR _LVOIEEEDPDiv(A6) ;CCycles / RunTime
MOVE.L D0,D2
MOVE.L D1,D3
MOVE.L #$000F4240,D0 ;1,000,000 (To Scale To MHz)
JSR _LVOIEEEDPFlt(A6)
EXG.L D0,D2
EXG.L D1,D3
JSR _LVOIEEEDPDiv(A6)
LEA.L DPNumber,A2
MOVE.L D0,$00(A2)
MOVE.L D1,$04(A2)
LEA.L DPNumber,A0
LEA.L DPStrb,A1
MOVE.L #$00000001,DPFlag
MOVE.L #$00000003,DPMaxWidth
BSR DPftoa
LEA.L RunTime,A0 ;DPNumber Pointer for DPftoa.
LEA.L DPStra,A1 ;DPString Pointer for DPftoa.
BSR DPftoa
PEA.L DPStrb ;DPString Holds RAM ClockSpeed.
PEA.L DPStra ;DPString Holds Runtime.
MOVE.L RAMLoad,-(A7)
MOVE.L RAMUpper,-(A7)
MOVE.L RAMLower,-(A7)
MOVE.L RAMName,-(A7)
PEA.L PrtFmt03
JSR _printf
LEA.L $1C(A7),A7
MOVE.L RAMSize,D0
MOVE.L RAMLoad,A1
MOVEA.L _SysBase,A6
JSR _LVOFreeMem(A6)
BRA L107
L106:
PEA.L PrtFmt07
MOVE.L SaveA1,-(A7)
MOVE.L RAMUpper,-(A7)
MOVE.L RAMLower,-(A7)
MOVE.L RAMName,-(A7)
PEA.L PrtFmt08
JSR _printf
LEA.L $18(A7),A7
L107:
MOVEA.L SaveA0,A0
MOVEA.L (A0),A0
TST.L (A0)
BNE LOOP
L108:
PEA.L LF
JSR _printf
LEA.L $04(A7),A7
PEA.L LF
JSR _printf
LEA.L $04(A7),A7
MOVEA.L _MathIeeeDoubBasBase,A1
MOVEA.L _SysBase,A6
JSR _LVOCloseLibrary(A6)
Wait_A_Bit:
MOVE.L #$0008,Sec_Delay ;Delay For 8 Seconds.
BSR Hold_It
Quit:
MOVEQ.L #$00,D0
MOVEA.L SaveA7,A7
RTS
*<<<<<<<<<<<<<<<<<<<<<<<< Subroutines >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*
************************* Copy Program to RAM ***************************
CopyToRAM:
MOVE.L #$203C0000,(A0)+ ;This is our NOP Test Program
MOVE.L #$13874E71,(A0)+
MOVE.L #$4E714E71,(A0)+
MOVE.L #$4E714E71,D1
MOVE.L #$00000800,D0
CPR01:
MOVE.L D1,(A0)+
SUBQ.L #$01,D0
BNE.S CPR01
MOVE.L #$53804E71,(A0)+
MOVE.L #$6600DFFE,(A0)+
MOVE.L #$4E750000,(A0)+
RTS
************************* Read Caches ***********************************
Read_CACR:
MOVEM.L A5/A6,-(A7)
MOVE.L CPU_Type,D1
CMPI.B #$03,D1
BLT RC01
MOVEA.L _SysBase,A6
JSR _LVODisable(A6)
LEA.L RCode,A5
JSR _LVOSupervisor(A6)
MOVE.L D0,SaveCACR
JSR _LVOEnable(A6)
RC01:
MOVEM.L (A7)+,A5/A6
RTS
CNOP 0,4
DC.L $00000000
RCode:
DC.L $4E7A0002 ;MOVEC.L CACR,D0
DC.W $4E73 ;RTE
DC.W $0000
************************* Print Cache Status ****************************
PrtCache:
MOVEM.L D2/A0-A4,-(A7)
MOVE.L SaveCACR,D2
LEA.L ITS_OFF,A3
LEA.L ITS_ON,A4
MOVE.L CPU_Type,D0
CMPI.B #$01,D0
BLE PC050
CMPI.B #$07,D0
BNE PC010
MOVEQ.L #$00,D1
LEA.L ICacheC,A2
BSR PC060
MOVEQ.L #$04,D1
LEA.L ICacheB,A2
BSR PC060
MOVEQ.L #$08,D1
LEA.L DCacheC,A2
BSR PC060
MOVEQ.L #$0C,D1
LEA.L DCacheB,A2
BSR PC060
BRA.S PC050
PC010:
CMPI.B #$03,D0
BNE.S PC050
MOVEQ.L #$00,D1
LEA.L ICacheA,A2
BSR PC060
PC050:
MOVEM.L (A7)+,D2/A0-A4
RTS
PC060:
MOVEA.L A3,A1
BTST.L D1,D2
BEQ.S PC062
MOVEA.L A4,A1
PC062:
MOVE.L A1,-(A7)
MOVE.L A2,-(A7)
JSR _printf
ADDQ.L #$08,A7
RTS
************************* CPU Speed *************************************
CPUSpeed:
BSR Get_Time
BSR MTForbid
BSR TestCPU
BSR MTPermit
BSR Get_Time
BSR Elapsed_Time
LEA.L DPTime,A0
MOVE.L $00(A0),D2
MOVE.L $04(A0),D3
LEA.L TestCPUCC,A1
MOVE.L $00(A1),D0
MOVE.L $04(A1),D1
MOVEA.L _MathIeeeDoubBasBase,A6
JSR _LVOIEEEDPDiv(A6)
LEA.L RunTime,A2
MOVE.L D0,$00(A2)
MOVE.L D1,$04(A2)
MOVE.L #$00000001,DPFlag
MOVE.L #$00000003,DPMaxWidth
LEA.L RunTime,A0
LEA.L DPStra,A1
BSR DPftoa
PEA.L DPStra
PEA.L PrtFmt06
JSR _printf
ADDQ.L #$08,A7
RTS
************************** TestCPU **************************************
TestCPU:
MOVE.W #$C34F,D4 ;Number of Loops - 1
MOVE.L #$0000FFFF,D2
MOVE.L D2,D3
BRA C001
CNOP 0,4
DC.L $00000000
C001:
MOVE.L D2,D0
MOVE.L D3,D1
DIVS D0,D1
MOVE.L D2,D0
MOVE.L D3,D1
DIVS D0,D1
MOVE.L D2,D0
MOVE.L D3,D1
DIVS D0,D1
MOVE.L D2,D0
MOVE.L D3,D1
DIVS D0,D1
MOVE.L D2,D0
MOVE.L D3,D1
DIVS D0,D1
DBRA D4,C001
RTS
************************* FPU Speed *************************************
FPUSpeed:
MOVE.L FPU_Type,D1
TST.L D1
BEQ FPU01
BSR Get_Time
BSR MTForbid
BSR TestFPU
BSR MTPermit
BSR Get_Time
BSR Elapsed_Time
LEA.L DPTime,A0
MOVE.L $00(A0),D2
MOVE.L $04(A0),D3
LEA.L TestFPUCC,A1
MOVE.L $00(A1),D0
MOVE.L $04(A1),D1
MOVEA.L _MathIeeeDoubBasBase,A6
JSR _LVOIEEEDPDiv(A6)
LEA.L RunTime,A2
MOVE.L D0,$00(A2)
MOVE.L D1,$04(A2)
MOVE.L #$00000001,DPFlag
MOVE.L #$00000003,DPMaxWidth
LEA.L RunTime,A0
LEA.L DPStra,A1
BSR DPftoa
PEA.L DPStra
PEA.L PrtFmt09
JSR _printf
ADDQ.L #$08,A7
RTS
FPU01:
PEA.L PrtFmt10
JSR _printf
ADDQ.L #$04,A7
RTS
************************** TestFPU **************************************
TestFPU:
DC.L $F2005C00 ;FMOVECR.X #PI,FP0
DC.L $F2005C8C ;FMOVECR.X #e,FP1
MOVE.L #$0000C34F,D4 ;50000 Loops - 1
BRA F001
CNOP 0,4
DC.L $00000000
F001:
DC.L $F2000420 ;FDIV.X FP1,FP0
DC.L $F2000423 ;FMUL.X FP1,FP0
DC.L $F2000420 ;FDIV.X FP1,FP0
DC.L $F2000423 ;FMUL.X FP1,FP0
DC.L $F2000420 ;FDIV.X FP1,FP0
DC.L $F2000423 ;FMUL.X FP1,FP0
DBRA D4,F001
RTS
************************* Get Time *************************************
Get_Time:
MOVEM.L D0-D7/A0-A6,-(A7)
LEA.L Strt_Time,A0 ;Start Time.
LEA.L Stop_Time,A1 ;Stop Time.
MOVE.L $00(A1),$00(A0) ;Update Start Time With Previous
MOVE.L $04(A1),$04(A0) ;Stop Time.
MOVE.L $08(A1),$08(A0)
MOVE.L A1,D1 ;Get New Stop Time.
MOVEA.L _DOSBase,A6
JSR _LVODateStamp(A6)
MOVEM.L (A7)+,D0-D7/A0-A6
RTS
************************* Elapsed Time **********************************
*** Remember D0-D1 AND A0-A1 NOT preserved in the _LVO Routines!!!!
***
Elapsed_Time:
MOVEM.L D0-D7/A0-A6,-(A7)
LEA.L FPAccum,A3
MOVEA.L _MathIeeeDoubBasBase,A6
MOVE.L #$00000BB8,D0 ;3000 Ticks/Minute.
JSR _LVOIEEEDPFlt(A6)
MOVE.L D0,D2
MOVE.L D1,D3
MOVE.L D2,$00(A3) ;Save Ticks/Minute DP Number
MOVE.L D3,$04(A3)
LEA.L Stop_Time,A1
MOVE.L $04(A1),D0 ;Stop_Time Minutes --> Ticks.
ANDI.L #$0000FFFF,D0
JSR _LVOIEEEDPFlt(A6)
JSR _LVOIEEEDPMul(A6)
MOVE.L D0,D2
MOVE.L D1,D3
LEA.L Stop_Time,A1
MOVE.L $08(A1),D0 ;Stop_Time Ticks.
ANDI.L #$0000FFFF,D0
JSR _LVOIEEEDPFlt(A6)
JSR _LVOIEEEDPAdd(A6) ;Elapsed Stop_Time Ticks (DP).
MOVE.L D0,$08(A3) ;Save it.
MOVE.L D1,$0C(A3)
LEA.L Strt_Time,A0
MOVE.L $04(A0),D0 ;Strt_Time Minutes (Hex)
ANDI.L #$0000FFFF,D0
JSR _LVOIEEEDPFlt(A6)
MOVE.L $00(A3),D2
MOVE.L $04(A3),D3
JSR _LVOIEEEDPMul(A6)
MOVE.L D0,D2
MOVE.L D1,D3
LEA.L Strt_Time,A0
MOVE.L $08(A0),D0
ANDI.L #$0000FFFF,D0
JSR _LVOIEEEDPFlt(A6)
JSR _LVOIEEEDPAdd(A6)
MOVE.L D0,D2
MOVE.L D1,D3
MOVE.L $08(A3),D0
MOVE.L $0C(A3),D1
JSR _LVOIEEEDPSub(A6)
MOVE.L D0,$10(A3) ;Elapsed Time in Ticks (DP).
MOVE.L D1,$14(A3)
JSR _LVOIEEEDPFix(A6)
MOVE.L D0,TimeTicks ;Elapsed Time in Ticks (Long).
MOVEQ.L #$32,D0 ;Number of Ticks per Second (50).
JSR _LVOIEEEDPFlt(A6)
MOVE.L D0,D2
MOVE.L D1,D3
MOVE.L $10(A3),D0
MOVE.L $14(A3),D1
JSR _LVOIEEEDPDiv(A6)
LEA.L DPTime,A2 ;Elapsed Time in Seconds (DP).
MOVE.L D0,$00(A2)
MOVE.L D1,$04(A2)
MOVEM.L (A7)+,D0-D7/A0-A6
RTS
************************* DOS Routine To Wait ***************************
Hold_It:
MOVE.L Sec_Delay,D1
MULU.W #$0032,D1
MOVEA.L _DOSBase,A6
JSR _LVODelay(A6)
RTS
************************* Forbid New Multi-Tasking **********************
MTForbid:
MOVEM.L D0-D7/A0-A6,-(A7)
MOVEA.L _SysBase,A6
JSR _LVOForbid(A6)
MOVEM.L (A7)+,D0-D7/A0-A6
RTS
************************* Permit New Multi-Tasking **********************
MTPermit:
MOVEM.L D0-D7/A0-A6,-(A7)
MOVEA.L _SysBase,A6
JSR _LVOPermit(A6)
MOVEM.L (A7)+,D0-D7/A0-A6
RTS
************************* De-Bugging Printout ***************************
Debug:
MOVEM.L D0-D7/A0-A6,-(A7)
MOVE.L D0,-(A7)
PEA.L PrtDebug
JSR _printf
LEA.L $08(A7),A7
MOVEM.L (A7)+,D0-D7/A0-A6
RTS
************************* CPU and FPU Types *****************************
CPUFPU_Type:
MOVEM.L D0/D1/A0/A6,-(A7) ; CPU / FPU
MOVEA.L _SysBase,A6 ;00 = 68000/-----
LEA.L AttnFlags(A6),A0 ;01 = 68010/-----
;03 = 68020/-----
LEA.L $01(A0),A0 ;07 = 68030/-----
MOVEQ.L #$00,D0 ;10 = 68000/68881
MOVE.B (A0),D0 ;11 = 68010/68881
MOVE.L D0,SYS_Type ;13 = 68020/68881
MOVE.L D0,D1 ;17 = 68030/68881
ANDI.B #$0F,D1 ;30 = 68000/68882
MOVE.L D1,CPU_Type ;31 = 68010/68882
;33 = 68020/68882
MOVE.L D0,D1 ;37 = 68030/68882
ANDI.B #$F0,D1
MOVE.L D1,FPU_Type
MOVEM.L (A7)+,D0/D1/A0/A6
RTS
************************* Print CPU and FPU Types **********************
PrtCPUFPU:
MOVEM.L D0/A0/A1,-(A7)
LEA.L PrtFmt04,A0
LEA.L $04(A0),A0
LEA.L TestFPUCC,A1
MOVE.L #$403F8000,$00(A1) ;Clock Cycles For FPUSpeed.
MOVE.L #$00000000,$04(A1) ;31.5 (Million CC's).
MOVE.L #$04E29C40,CCycles ;Clock Cycles For RAMSpeed.
LEA.L TestCPUCC,A1
MOVE.L #$404151EB,$00(A1) ;Clock Cycles For CPUSpeed.
MOVE.L #$80000000,$04(A1)
MOVE.L CPU_Type,D0
TST.B D0
BEQ S604 ;CPU is 68000
CMPI.B #$01,D0
BNE S601
MOVE.L #$31302F2D,(A0) ;CPU is 68010
MOVE.L #$404151EB,$00(A1)
MOVE.L #$80000000,$04(A1)
MOVE.L #$04E29C40,CCycles
BRA S604
S601: CMPI.B #$03,D0
BNE S602
MOVE.L #$32302F2D,(A0) ;CPU is 68020
MOVE.L #$402F0000,$00(A1)
MOVE.L #$00000000,$04(A1)
MOVE.L #$03A9F530,CCycles
BRA S604
S602: CMPI.B #$07,D0
BNE S603
MOVE.L #$33302F2D,(A0) ;CPU is 68030
MOVE.L #$402F0000,$00(A1)
MOVE.L #$00000000,$04(A1)
MOVE.L #$03A9F530,CCycles
BRA S604
S603: MOVE.L #$203F3F3F,-$04(A0) ;CPU is UnKnown
MOVE.L #$3F3F2F2D,(A0)
MOVE.L #$3FF00000,$00(A1)
MOVE.L #$00000000,$04(A1)
MOVE.L #$03A9F530,CCycles
S604: MOVE.L FPU_Type,D0
TST.B D0
BEQ S607
MOVE.L #$2F363838,$02(A0)
CMPI.B #$10,D0
BNE S605
MOVE.W #$3831,$06(A0)
BRA S607
S605: CMPI.B #$30,D0
BNE S606
MOVE.W #$3832,$06(A0)
BRA S607
S606: MOVE.L #$2F3F3F3F,$02(A0)
MOVE.W #$3F3F,$06(A0)
S607: MOVEM.L (A7)+,D0/A0/A1
RTS
************************* _printf **************************************
_printf:
MOVEM.L D1-D3/A0-A3/A6,-(A7)
MOVEA.L $24(A7),A0
LEA.L $28(A7),A1
LEA.L PutChProc,A2
LEA.L -$100(A7),A7
MOVEA.L A7,A3
MOVEA.L _SysBase,A6
JSR _LVORawDoFmt(A6)
MOVEQ.L #-$01,D0
prt01: TST.B (A3)+
DBEQ D0,prt01
NOT.L D0
BEQ prt02
MOVE.L _stdout,D1
MOVE.L A7,D2
MOVE.L D0,D3
MOVEA.L _DOSBase,A6
JSR _LVOWrite(A6)
prt02: LEA.L $100(A7),A7
MOVEM.L (A7)+,D1-D3/A0-A3/A6
RTS
PutChProc:
MOVE.B D0,(A3)+
RTS
****************** Convert DP Floating-Point To ASCII *********************
***** A0 --> Double Precision Number (DPNumber) to convert to ASCII String.
***** A1 --> ASCII String (DPString) Representing DPNumber.
***** Other Variables are defined in the program, but should be input.
DPftoa:
MOVEM.L D0-D7/A0-A6,-(A7)
MOVEA.L _MathIeeeDoubBasBase,A6
MOVEA.L A1,A2 ;A2 --> DPString.
MOVEA.L A0,A3 ;A3 --> DPNumber.
LEA.L Round,A4
CLR.L Exp ;Clear Exponent.
MOVE.L DPMaxWidth,D0
ADDQ.L #$01,D0
MOVE.L D0,Ndig
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPTst(A6) ;Is DPNumber Negative?
BGE S501 ;No
MOVE.L $00(A3),D0 ;Yes, Change sign then.
MOVE.L $04(A3),D1
JSR _LVOIEEEDPNeg(A6)
MOVE.L D0,$00(A3)
MOVE.L D1,$04(A3)
MOVE.B #$2D,(A2)+ ;'-'
S501:
JSR _LVOIEEEDPTst(A6) ;Is DPNumber Positive?
BLE S506 ;No (Shouldn't Happen!)
S502: ;Yes.
MOVE.L $08(A4),D2 ;1.0
MOVE.L $0C(A4),D3
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPCmp(A6) ;Is DPNumber < 1.0 ?
BGE S503 ;No.
;Yes.
MOVE.L $00(A4),D2 ;10.0
MOVE.L $04(A4),D3
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPMul(A6)
MOVE.L D0,$00(A3)
MOVE.L D1,$04(A3)
SUBQ.L #$01,Exp
BRA S502
S503:
S504:
MOVE.L $00(A4),D2 ;10.0
MOVE.L $04(A4),D3
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPCmp(A6) ;DPNumber >= 10.0 ?
BLT S505 ;No.
;Yes.
MOVE.L $00(A4),D2
MOVE.L $04(A4),D3
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPDiv(A6)
MOVE.L D0,$00(A3)
MOVE.L D1,$04(A3)
ADDQ.L #$01,Exp
BRA S504
S505:
S506:
CMP.L #$00000002,DPFlag ;DPFlag = 2?
BNE S509 ;No.
;Yes. DPFlag = 2 ==> 'g' Format.
MOVE.L DPMaxWidth,Ndig
CMP.L #-$00000004,Exp ;Exp < -4 ?
BLT S507 ;Yes.
;No.
MOVE.L Exp,D0
CMP.L DPMaxWidth,D0 ;Exp > DPMaxWidth ?
BLE S508 ;No.
;Yes.
S507:
CLR.L DPFlag
S508:
BRA S511
S509:
CMP.L #$00000001,DPFlag ;DPFlag = 1 ?
BNE S510 ;No.
;Yes. DPFlag = 1 ==> 'f' format.
MOVE.L Exp,D0
ADD.L D0,Ndig
S510:
S511:
TST.L Ndig ;Ndig >= 0 ?
BLT S516 ;No.
;Yes.
CMP.L #$00000010,Ndig ;Ndig > 16 ?
BLE S512 ;No.
;Yes.
MOVEQ.L #$10,D0
BRA S513
S512:
MOVE.L Ndig,D0
S513:
ADDQ.L #$01,D0
ASL.L #$03,D0
MOVE.L $00(A4,D0.L),D2 ;Rounding Values.
MOVE.L $04(A4,D0.L),D3
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPAdd(A6)
MOVE.L D0,$00(A3)
MOVE.L D1,$04(A3)
MOVE.L $00(A4),D2
MOVE.L $04(A4),D3
JSR _LVOIEEEDPCmp(A6)
BLT S515
MOVE.L $08(A4),$00(A3) ;10.0 --> DPNumber.
MOVE.L $0C(A4),$04(A3)
ADDQ.L #$01,Exp
TST.L DPFlag ;DPFlag = 0 ?
BEQ S514
ADDQ.L #$01,Ndig
S514:
S515:
S516:
TST.L DPFlag ;DPFlag = 0 ?
BEQ S522 ;Yes.
;No.
TST.L Exp ;Exp < 0 ?
BGE S520 ;No.
;Yes.
MOVE.B #$30,(A2)+ ;'0'
MOVE.B #$2E,(A2)+ ;'.'
MOVE.L Exp,D0
NEG.L D0
SUBQ.L #$01,D0 ;-Exp-1
MOVE.L D0,D4 ;i = -Exp - 1
TST.L Ndig ;Ndig <= 0 ?
BGT S517 ;No.
;Yes.
MOVE.L DPMaxWidth,D4 ;i = DPMaxWidth
S517:
S518:
MOVE.L D4,D0
SUBQ.L #$01,D4
TST.L D0
BEQ S519
MOVE.B #$30,(A2)+ ;'0'
BRA S518
S519:
CLR.L DecPos
BRA S521
S520:
MOVE.L Exp,D0
ADDQ.L #$01,D0
MOVE.L D0,DecPos
S521:
BRA S523
S522:
MOVEQ.L #$01,D0
MOVE.L D0,DecPos
S523:
TST.L Ndig ;Ndig > 0 ?
BLE S530 ;No.
;Yes.
MOVEQ.L #$00,D4 ;i = 0
S524:
MOVEQ.L #$10,D0
CMP.L D0,D4 ;i < 16 ?
BGE S525 ;No.
;Yes.
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPFix(A6)
MOVE.L D0,Digit
ADD.L #$00000030,D0 ;'0'
MOVE.B D0,(A2)+
MOVE.L Digit,D0
JSR _LVOIEEEDPFlt(A6)
MOVE.L D0,D2
MOVE.L D1,D3
MOVE.L $00(A3),D0
MOVE.L $04(A3),D1
JSR _LVOIEEEDPSub(A6)
MOVE.L $00(A4),D2 ;10.0
MOVE.L $04(A4),D3
JSR _LVOIEEEDPMul(A6)
MOVE.L D0,$00(A3)
MOVE.L D1,$04(A3)
BRA S526
S525:
MOVE.B #$30,(A2)+ ;'0'
S526:
SUBQ.L #$01,Ndig
BEQ S529
TST.L DecPos
BEQ S527
SUBQ.L #$01,DecPos
BNE S527
MOVE.B #$2E,(A2)+ ;'.'
S527:
S528:
ADDQ.L #$01,D4 ;i = i + 1
BRA S524 ;Do It Again.
S529:
S530:
TST.L DPFlag ;DPFlag = 0 ?
BNE S534 ;No.
;Yes. Process Exponent Then.
MOVE.B #$45,(A2)+ ;'E'
TST.L Exp ;Exp < 0 ?
BGE S531 ;No.
;Yes.
NEG.L Exp ;Exp --> -Exp
MOVE.B #$2D,(A2)+ ;'-'
BRA S532
S531:
MOVE.B #$2B,(A2)+ ;'+'
S532:
CMP.L #$00000064,Exp ;Exp >= 100 ?
BLT S533
MOVEQ.L #$64,D1 ;100
MOVE.L Exp,D0 ;Exp
JSR _Divs ;D0 = D0 / D1
ADD.L #$00000030,D0 ;D0 = D0 + '0'
MOVE.B D0,(A2)+
MOVEQ.L #$64,D1 ;100
MOVE.L Exp,D0 ;Exp
JSR _Mods ;D0 = D0 % D1
MOVE.L D0,Exp
S533:
MOVEQ.L #$0A,D1 ;10
MOVE.L Exp,D0 ;Exp
JSR _Divs ;D0 = Exp / 10
ADD.L #$00000030,D0 ;D0 = D0 + '0'
MOVE.B D0,(A2)+
MOVEQ.L #$0A,D1 ;D1 = 10
MOVE.L Exp,D0 ;D0 = Exp
JSR _Mods ;D0 = D0 % D1
ADD.L #$00000030,D0 ;D0 = D0 + '0'
MOVE.B D0,(A2)+
S534:
CLR.B (A2)
MOVEM.L (A7)+,D0-D7/A0-A6
RTS
************************* Long Signed Divide ****************************
***** Long Signed Divide ( D0 = D0 / D1 )
_Divs:
MOVEM.L D1/D4,-(A7)
MOVEQ.L #$00,D4 ;Mark Result As Positive.
TST.L D0
BPL D0_Positive
NEG.L D0
MOVEQ.L #$01,D4 ;Mark Result As Negative.
D0_Positive:
TST.L D1
BPL D1_Positive
NEG.L D1
EORI.W #$0001,D4 ;Flip Sign Of Result.
D1_Positive:
BSR Divide
Check_Sign:
TST.W D4
BEQ Result_Positive
NEG.L D0
Result_Positive:
MOVEM.L (A7)+,D1/D4
TST.L D0
RTS
************************* Long Signed Remainder *************************
***** Long Signed Remainder ( D0 = D0 % D1 )
_Mods:
MOVEM.L D1/D4,-(A7)
MOVEQ.L #$00,D4 ;Mark Result Positive.
TST.L D0
BPL RD0_Positive
NEG.L D0
MOVEQ.L #$01,D4 ;Mark Result Negative.
RD0_Positive:
TST.L D1
BPL RD1_Positive
NEG.L D1
RD1_Positive:
BSR Divide
MOVE.L D1,D0
BRA Check_Sign
************************* Divide Routine *******************************
*******
Divide:
MOVEM.L D2/D3,-(A7)
SWAP D1
TST.W D1
BNE Divisor32
Divisor16:
;16-Bit Divisor Routine
SWAP D1
MOVE.W D1,D3 ;Divisor
MOVE.W D0,D2 ;Lower half of Dividend
CLR.W D0
SWAP D0 ;Upper half of Dividend
DIVU.W D3,D0 ;D0 = D0 / D3
MOVE.L D0,D1 ;First Remainder
SWAP D0 ;First Quotient.
MOVE.W D2,D1 ;Lower half of Dividend
DIVU.W D3,D1 ;D1 = D1 / D3
MOVE.W D1,D0 ;Second Quotient
CLR.W D1
SWAP D1 ;Second Remainder
MOVEM.L (A7)+,D2/D3
RTS
************************* Divide Routine *******************************
*******
Divisor32:
SWAP D1
MOVE.L D1,D3 ;Save Divisor
MOVE.L D0,D1 ;Copy Dividend
CLR.W D1
SWAP D1
SWAP D0
CLR.W D0
MOVEQ.L #$0F,D2 ;Loop 16 Times.
D3201:
ADD.L D0,D0
ADDX.L D1,D1
CMP.L D1,D3
BHI D3202
SUB.L D3,D1
ADD.W #$0001,D0
D3202:
DBF D2,D3201
MOVEM.L (A7)+,D2/D3
RTS
************************* Data ******************************************
CNOP 0,4
DC.L $00000000
MyTaskPointer: DS.L 1
SaveD0: DS.L 1
SaveA0: DS.L 1
SaveA1: DS.L 1
SaveA7: DS.L 1
RAMLower: DS.L 1
RAMUpper: DS.L 1
RAMName: DS.L 1
RAMLoad: DS.L 1
RAMSize: DS.L 1
TimeTicks: DS.L 1
crtFile: DS.L 1
Sec_Delay: DS.L 1
SYS_Type: DS.L 1
FPU_Type: DS.L 1
CPU_Type: DS.L 1
SaveCACR: DS.L 1
CCycles: DS.L 1
DPMaxWidth: DS.L 1
DPFlag: DS.L 1
Exp: DS.L 1
Digit: DS.L 1
DecPos: DS.L 1
Ndig: DS.L 1
_MathIeeeDoubBasBase: DS.L 1
CNOP 0,2
MyTaskName DC.B 'RAMSpeed',0
CNOP 0,2
MathLiba DC.B 'mathieeedoubbas.library',0
CNOP 0,2
Strt_Time DC.L $00000000,$00000000,$00000000
Stop_Time DC.L $00000000,$00000000,$00000000
CNOP 0,2
FPAccum: DC.L $00000000,$00000000
DC.L $00000000,$00000000
DC.L $00000000,$00000000
DC.L $00000000,$00000000
CNOP 0,2
TestCPUCC: DC.L $00000000,$00000000
CNOP 0,2
TestFPUCC: DC.L $00000000,$00000000
CNOP 0,2
DPTime: DC.L $00000000,$00000000
CNOP 0,2
NullTime: DC.L $00000000,$00000000
CNOP 0,2
RunTime: DC.L $00000000,$00000000
CNOP 0,2
DPNumber: DC.L $00000000,$00000000
CNOP 0,2
DPStra: DC.B $00,$00,$00,$00,$00,$00,$00,$00
DC.B $00,$00,$00,$00,$00,$00,$00,$00
DC.B $00,$00,$00,$00,$00,$00,$00,$00
DC.B $00,$00,$00,$00,$00,$00,$00,$00
CNOP 0,2
DPStrb: DC.B $00,$00,$00,$00,$00,$00,$00,$00
DC.B $00,$00,$00,$00,$00,$00,$00,$00
DC.B $00,$00,$00,$00,$00,$00,$00,$00
DC.B $00,$00,$00,$00,$00,$00,$00,$00
CNOP 0,2
Round: DC.B $40,$24,$00,$00,$00,$00,$00,$00
DC.B $3F,$F0,$00,$00,$00,$00,$00,$00
DC.B $3F,$E0,$00,$00,$00,$00,$00,$00
DC.B $3F,$A9,$99,$99,$99,$99,$99,$99
DC.B $3F,$74,$7A,$E1,$47,$AE,$14,$7A
DC.B $3F,$40,$62,$4D,$D2,$F1,$A9,$FB
DC.B $3E,$D4,$F8,$B5,$88,$E3,$68,$EF
DC.B $3E,$A0,$C6,$F7,$A0,$B5,$ED,$8C
DC.B $3E,$6A,$D7,$F2,$9A,$BC,$AF,$46
DC.B $3E,$35,$79,$8E,$E2,$30,$8C,$38
DC.B $3E,$01,$2E,$0B,$E8,$26,$D6,$93
DC.B $3D,$CB,$7C,$DF,$D9,$D7,$BD,$B8
DC.B $3D,$95,$FD,$7F,$E1,$79,$64,$93
DC.B $3D,$61,$97,$99,$81,$2D,$EA,$0F
DC.B $3D,$2C,$25,$C2,$68,$49,$76,$7E
DC.B $3C,$F6,$84,$9B,$86,$A1,$2B,$98
DC.B $3C,$C2,$03,$AF,$9E,$E7,$56,$13
CNOP 0,2
_TWspec DC.B 'CON:0/0/640/200/RAMSpeed',0
CNOP 0,2
Title01 DC.B $0C
DC.B ' <<<<<<<******** RAMSpeed, Version of 03 Jun 1990, By'
DC.B ' ALA ********>>>>>>>',$0A
DC.B $00
CNOP 0,2
Title02 DC.B $0A
DC.B ' Amiga RAM Speed Tests ( CPU/FPU:%s )'
DC.B $0A,$00
CNOP 0,2
Title03: DC.B ' RunTime based on timing an 8000 Byte NOP loop in each'
DC.B ' memory region.',$0A
DC.B $0A,$00
CNOP 0,2
PrtFmt01 DC.B ' Memory Regions:',$0A,$00
CNOP 0,2
PrtFmt02 DC.B ' Node Name Lower Upper Program RunTime'
DC.B ' RAM Speed',$0A
DC.B ' (Hex) (Hex) Address (Sec) '
DC.B ' (MHz)',$0A
DC.B $00
CNOP 0,2
PrtFmt03 DC.B ' %-20s %08lx %08lx %08lx %7s %7s',$0A,$00
CNOP 0,2
PrtFmt04 DC.B ' 68000/-----',$00
CNOP 0,2
PrtFmt05 DC.B ' DPNumber = %s',$0A,$00
CNOP 0,2
PrtFmt06 DC.B $0A
DC.B ' CPU Speed = %7s MHz',$0A,$00
CNOP 0,2
PrtFmt07 DC.B 'No Room! No Test!',$00
CNOP 0,2
PrtFmt08 DC.B ' %-20s %08lx %08lx %08lx %s',$0A,$00
CNOP 0,2
PrtFmt09 DC.B $0A
DC.B ' FPU Speed = %7s MHz',$0A
DC.B $0A,$00
CNOP 0,2
PrtFmt10 DC.B $0A
DC.B ' FPU Speed = N/A',$0A
DC.B $0A,$00
CNOP 0,2
NoMath DC.B $0A
DC.B ' Could Not Find mathieeedoubbas.library!',$0A,$00
CNOP 0,2
LF DC.B $0A,$00
CNOP 0,2
PrtDebug DC.B ' D0 = %08lx',$0A,$00
CNOP 0,2
ITS_ON: DC.B 'ON',$00
CNOP 0,2
ITS_OFF: DC.B 'OFF',$00
CNOP 0,2
ICacheA: DC.B ' ICache %s',$0A
DC.B $0A,$00
CNOP 0,2
ICacheC: DC.B ' ICache %s, ',$00
CNOP 0,2
ICacheB: DC.B 'IBurst %s, ',$00
CNOP 0,2
DCacheC: DC.B 'DCache %s, ',$00
CNOP 0,2
DCacheB: DC.B 'DBurst %s',$0A
DC.B $0A,$00
************************* Thats All Folks! *******************************
END