From 5f9b5a63c3efeeb9340554fba177254f748adfaf Mon Sep 17 00:00:00 2001 From: ROOL <code@riscosopen.org> Date: Tue, 5 Nov 1996 09:41:50 +0000 Subject: [PATCH] This commit was manufactured by cvs2git to create branch 'StrongARM'. Sprout from Black 1996-11-05 09:41:48 UTC Neil Turton <nturton@gitlab.riscosopen.org> 'Import from cleaned 360 CD' Cherrypick from master 1996-11-05 09:40:48 UTC Neil Turton <nturton@gitlab.riscosopen.org> 'Clean reimport of hdr.RISCOS (real commit date 2008-03-28 by bavison), without any of the 3rd party allocations.': hdr/RISCOS Delete: Doc/!ReadMe Doc/0197276.02 Doc/5thColumn/Manual Doc/A540Extend Doc/Kernel Doc/KernlSplit Doc/MMUControl Doc/MemMaps/130 Doc/MemMaps/258 Doc/Mode22 Doc/Modes Doc/MonLead Doc/PaletteV Doc/PrivDoc/5thColumn/Concept Doc/PrivDoc/MMPM Doc/PrivDoc/ScreenMode Doc/ReadSysInf Doc/TVmodesMed,dde OldTestSrc/A600tlb OldTestSrc/Arm3 OldTestSrc/Begin OldTestSrc/Cmos OldTestSrc/ExtCmd OldTestSrc/ExtIO OldTestSrc/Ioc OldTestSrc/MEMC1 OldTestSrc/Mem1IOMD OldTestSrc/Mem1MEMC1 OldTestSrc/Mem2 OldTestSrc/Mem3 OldTestSrc/Mem4 OldTestSrc/Mem5 OldTestSrc/TestMain OldTestSrc/Vidc --- Doc/!ReadMe | 57 -- Doc/0197276.02 | 1400 -------------------------------- Doc/5thColumn/Manual | 323 -------- Doc/A540Extend | 118 --- Doc/Kernel | 162 ---- Doc/KernlSplit | 45 -- Doc/MMUControl | 35 - Doc/MemMaps/130 | 38 - Doc/MemMaps/258 | 24 - Doc/Mode22 | 64 -- Doc/Modes | 40 - Doc/MonLead | 108 --- Doc/PaletteV | 120 --- Doc/PrivDoc/5thColumn/Concept | 59 -- Doc/PrivDoc/MMPM | 54 -- Doc/PrivDoc/ScreenMode | 92 --- Doc/ReadSysInf | 129 --- Doc/TVmodesMed,dde | 1337 ------------------------------ OldTestSrc/A600tlb | 61 -- OldTestSrc/Arm3 | 71 -- OldTestSrc/Begin | 1428 --------------------------------- OldTestSrc/Cmos | 321 -------- OldTestSrc/ExtCmd | 1019 ----------------------- OldTestSrc/ExtIO | 1089 ------------------------- OldTestSrc/Ioc | 92 --- OldTestSrc/MEMC1 | 552 ------------- OldTestSrc/Mem1IOMD | 481 ----------- OldTestSrc/Mem1MEMC1 | 390 --------- OldTestSrc/Mem2 | 278 ------- OldTestSrc/Mem3 | 119 --- OldTestSrc/Mem4 | 630 --------------- OldTestSrc/Mem5 | 316 -------- OldTestSrc/TestMain | 78 -- OldTestSrc/Vidc | 530 ------------ 34 files changed, 11660 deletions(-) delete mode 100644 Doc/!ReadMe delete mode 100644 Doc/0197276.02 delete mode 100644 Doc/5thColumn/Manual delete mode 100644 Doc/A540Extend delete mode 100644 Doc/Kernel delete mode 100644 Doc/KernlSplit delete mode 100644 Doc/MMUControl delete mode 100644 Doc/MemMaps/130 delete mode 100644 Doc/MemMaps/258 delete mode 100644 Doc/Mode22 delete mode 100644 Doc/Modes delete mode 100644 Doc/MonLead delete mode 100644 Doc/PaletteV delete mode 100644 Doc/PrivDoc/5thColumn/Concept delete mode 100644 Doc/PrivDoc/MMPM delete mode 100644 Doc/PrivDoc/ScreenMode delete mode 100644 Doc/ReadSysInf delete mode 100644 Doc/TVmodesMed,dde delete mode 100644 OldTestSrc/A600tlb delete mode 100644 OldTestSrc/Arm3 delete mode 100644 OldTestSrc/Begin delete mode 100644 OldTestSrc/Cmos delete mode 100644 OldTestSrc/ExtCmd delete mode 100644 OldTestSrc/ExtIO delete mode 100644 OldTestSrc/Ioc delete mode 100644 OldTestSrc/MEMC1 delete mode 100644 OldTestSrc/Mem1IOMD delete mode 100644 OldTestSrc/Mem1MEMC1 delete mode 100644 OldTestSrc/Mem2 delete mode 100644 OldTestSrc/Mem3 delete mode 100644 OldTestSrc/Mem4 delete mode 100644 OldTestSrc/Mem5 delete mode 100644 OldTestSrc/TestMain delete mode 100644 OldTestSrc/Vidc diff --git a/Doc/!ReadMe b/Doc/!ReadMe deleted file mode 100644 index 522352e..0000000 --- a/Doc/!ReadMe +++ /dev/null @@ -1,57 +0,0 @@ -> !ReadMe - -Instructions on how to make/modify Arthur. - -Directory Asm contains the Exec files. - -Asm.A500 assembles the A500 kernel and then does *Asm.BuildA500 -Asm.BuildA500 glues modules to the kernel to make an image for 27512's. -Asm.BigA500 glues modules to the kernel to make an image for 1Mbit devices. - -Asm.Test assembles the Archimedes kernel, for 300 and 400 series machines. - NB. This uses Hdr.Archie, not Hdr.Test !!! -Asm.Test2 glues modules to the kernel to make an image for 1Mbit devices. - -Asm.MoveFS takes a new copy of FileSwitch (and headers) from the net. -Asm.TransTim takes a new copy of Tim's stuff from the net. - - -Directory Hdr has the header files for the various assemblies. - - -Directory Text has various files, only one of which is important: -Text.Changes should be updated whenever changes are made to Arthur. -Text.Still has my list of things still to do. - - -Quick guide to the source files: - -Kernel is the first, and has the SWI dispatcher, plus the initialized variables -to copy into RAM, plus some Brazil swi handlers. - -Middle contains the rest of the Brazil swi stuff, plus supervisor routines. - -NewReset is the reset code - if you need to change this, you will need to use -the AddTubeBashers flag, which lives in Kernel. The TubeChar macro should then -function. - -Super1 is the supervisor loop, plus more Brazil oddsnsods. - -ArthurSWIs is ReadUnsigned, vectors, services, ValidateAddress. Note that -the version of ChangeDynamic in here is NOT the one that's assembled. - -Arthur2 is variables, GSTRANs - -Arthur3 is command code, including Status/Configure. - -Other files are hopefully obvious from their names. - - -Backing Up. -=========== - -You need to copy the whole tree from $.Kernel to the backup medium. -You also need to take a copy of all the current header files from $.Hdr. -A copy of all the tools in $.Library and $.Utils would also be handy. - - Have fun! diff --git a/Doc/0197276.02 b/Doc/0197276.02 deleted file mode 100644 index 8ec4977..0000000 --- a/Doc/0197276.02 +++ /dev/null @@ -1,1400 +0,0 @@ - -Copyright (C) Acorn Computers Ltd. 1993 0197,276/FS Issue 2 **Live** - - Medusa Memory Management Software Functional Specification - ========================================================== - - ----------------------------------------- - | Drawing No : 0197,276/FS | - | Issue : 2 **Live** | - | Date : 15th April 1993 | - | Author : Tim Dobson | - | Sheets : n | - | Last Issue: ? | - ----------------------------------------- - - Contents - ======== - - 1 History - - 2 Outstanding Issues - - 3 Overview - - 4 Technical Background - - 5 User Interface - 5.1 TaskManager and large RAM sizes - - 6 Programmer Interface - 6.1 Logical memory map - 6.2 Free pool - 6.3 New SWI: OS_DynamicArea - 6.3.1 Reason codes - 6.3.1.1 Create dynamic area - 6.3.1.2 Remove dynamic area - 6.3.1.3 Return information on dynamic area - 6.3.1.4 Enumerate dynamic areas - 6.3.1.5 Renumber dynamic area - 6.3.2 Dynamic area handler routine - 6.3.2.1 PreGrow - 6.3.2.2 PostGrow - 6.3.2.3 PreShrink - 6.3.2.4 PostShrink - 6.3.3 Sequence Of Actions When OS_ChangeDynamicArea Is Called - 6.3.3.1 Service_PagesUnsafe - 6.3.3.2 Service_PagesSafe - 6.3.4 Implementation Notes for OS_ChangeDynamicArea - 6.3.5 OS_DynamicArea Service Calls - 6.3.5.1 Service_DynamicAreaCreate (&90) - 6.3.5.2 Service_DynamicAreaRemove (&91) - 6.3.5.2 Service_DynamicAreaRenumber (&92) - 6.4 New SWI: OS_Memory - 6.4.1 OS_Memory Reasons 0-5: Convert Memory Address - 6.4.2 OS_Memory Reasons 6-8: Physical Memory - 6.4.2.1 Read Physical Memory Arrangement Table Size - 6.4.2.2 Read Physical Memory Arrangement Table - 6.4.2.3 Read Amounts Of Various Sorts Of Memory - 6.4.3 I/O Space Information - 6.4.3.1 Read Controller Presence - 6.5 Old SWI OS_SetMemMapEntries (&53) - 6.6 Old SWI OS_ReadDynamicArea (&5C) - 6.7 New SWI OS_ClaimProcessorVector - - 7 External Dependancies - - 8 Development Test Strategy - - 9 Organisation - - 10 Future Enhancements - 10.1 Abort trappping - 10.1.1 Technical background - 10.1.2 New SWI: OS_AbortTrap - 10.1.2.1 Add abort trap - 10.1.2.2 Remove abort trap - - - 1. History - ========== - - TMD 05-Nov-92 Started initial draft - TMD 08-Mar-93 More detail added - Issue A TMD 21-Apr-93 Released for initial review - JSR 11-May-93 Input from review entered - JSR 24-May-93 Adjustments to area grow and deletion - behaviour. - Add 2 controllers to list: VIDC1 and VIDC20 to - allow ScreenTricks module to operate. - JSR 02-Jun-93 Added section to development test strategy for - Wimp and Switcher testing. - JSR 04-Jun-93 Comments on Issue 1 spec from DLowdell. - - 2. Outstanding Issues - ===================== - - What if anything should be done to the task manager's task display to cope - with large memory sizes? - - The handling of Wimp_ClaimFreeMemory. This SWI claims the free pool making - it available for data transfers. The Wimp used to implement this by putting - the free memory on the end of the current task. This is no longer - necessarily going to work as there may not be any free space beyond the end - of the current task's memory. Also, it is quite likely that there won't be - enough space for all the free memory. - - - 3. Overview - =========== - - This specification covers changes to the memory management system in RISC - OS for Medusa platforms. - - The main features of Medusa platforms which require changes to RISC OS's - memory management are as follows:- - - 1) Ability to cope with RAM sizes up to 256+2Mbytes, rather than the - current maximum of 16Mbytes; - - 2) Ability to control DMA; - - 3) Requirements for second processor card drivers to claim memory; - - 4) Physical RAM no longer contiguous; - - 5) ARM600 MMU requires page table allocation; - - 6) Logical memory map expansion due to 32-bit address space. - - 7*) Changes to support emulation of VIDC1; - - 8*) Changes to support line-doubling; - - Note: The implementation of the starred items above (VIDC1 emulation, - line-doubling) are not part of the Medusa project; however it is an aim of - the memory management work that it should be possible to implement these in - a soft-loaded module at a later date. - - 4. Technical Background - ======================= - -In RISC OS 2 and 3 (version 3.10) the memory management task was divided -between the kernel and the wimp. The kernel ordered the memory into dynamic -areas and an application space, and the wimp then bludgeoned the kernel into -not getting in the way of the wimp's model of having a free pool and -multiple application spaces, rather than just the one application space -which had all spare memory in it. For Medusa the free pool management will -be moved into the kernel so that there isn't such a wrestling match between -the kernel and the wimp. The wimp will still manage the multiple application -spaces - it being the module responsible for constructing and managing tasks -in the desktop. The main kernel interface for memory management was -OS_ChangeDynamicArea which simply allowed the resizing of dynamic areas. -This has been added to for Medusa with the OS_DynamicArea SWI for the -control, creation and deletion of dynamic areas. - -The dynamic area management in RISC OS 2 and 3 (version 3.10) was somewhat -tied together with the dynamic area clients. The change dynamic area SWI -specifically called other modules depending on which dynamic area was being -resized. The result was that there was no flexibility with how dynamic areas -were used. - -Other memory related services were not available. For example it was not -possible to find out what memory or hardware was available on the system -without knowing a great deal about the platform. - -Memory is referred to in three ways: physcial address, logical address and -physical page number. The first two refer to the address of the memory in -the physical address space (what IOMD presents to ARM) and logical address -space (what the ARM memory manager presents to the ARM core) respectively. -The physical page number is an arbitrary number assigned to RAM pages. It is -necessary to have this last abstraction to save space. If it weren't there -then the storage and management overheads would be prohibitive on a small -memory machine, which, as Medusa is targetted at under 1000 pounds, is -likely to be a majority of users. The way physical page numbers are -allocated is that all the contiguous RAM section in physical address space -are bunched together and the page numbers allocated from 0 upwards. - -There are several interfaces described here which use Page blocks. These are -tables of 3-word records: - word use - 0 Physical page number - 1 logical address - 2 physical address -That is, a block of memory 12*N bytes big where N is the number of records -in the block. They are used to pass round lists of addresses or pages. - - - 5. User Interface - ================= - - 5.1 TaskManager and large RAM sizes - ----------------------------------- - - The TaskManager module's 'Task display' window does not cope well in this -area at present. The combination of a 16-fold increase in maximum RAM size -and an 8-fold decrease in page size means that the existing linear 1 -pixel-per-page model will not be practical on large memory machines. A -number of options are possible:- - - a) Do nothing. It is rare that anyone will want to manually drag an area's -size to anything particularly big. Most big programs will set their own -Wimp slot size; - - b) Allow the user to click in the number fields and enter a number -(presumably still in K); - - c) Make the scale exponential (ie at the small sizes it goes in units of -4K, but when the area gets bigger go in larger and larger steps). - - d) Make the scale a modified exponential (1+log(x)/c). - - - 5.2 *-Command *Cache On/Off - --------------------------- - - A module will be provided to give this functionality. It will switch both -caching and write-buffering on and off. The corresponding SWIs will not be -supplied as they are inapplicable to an ARM600/700 based system. - - - 6. Programmer Interface - ======================= - - 6.1 Logical Memory Map - ---------------------- - - Address Size Use Public? - - 00000000 16k System workspace Private - 00004000 16k Scratch space Public(1) - 00008000 28M-32k Application space Public - 01C00000 8k SVC stack Public(2) - 01C02000 2M-8k System heap Private - 01E00000 8k Undefined stack Public(2) - 01E02000 1M-8k Soft CAM map Private - 01F00000 32k Cursor/sound etc Private - 01F08000 32k "nowhere" Private - 01F10000 1M-64k Reserved for fake screen (480k) Private - 02000000 12M RMA Public(3) - 02C00000 4M Level 2 page tables Private - 03000000 4M I/O space Private(4) - 03400000 1M Reserved for VIDC1 emulation Private - 03500000 1M VIDC20 Private - 03600000 1M Reserved for Vinit &c emulation Private - 03700000 1M Reserved for 2nd Proc ctrl regs Private - 03800000 8M ROM Private - 04000000 2G-64M Dynamic areas Public(5) - 80000000 512M Copy of physical space Private - A0000000 1 1/2 G More dynamic areas Public(5) - -Notes: -1) This may be used by any module. The rules for its use are: - Not in an IRQ routine - Not if you're going to call something which might use it while you - are -Example clients are: FileCore to hold structures whilst working out how to -allocate some free space; Filer to hold structures for OS_HeapSort. -2) It may be assumed that these end on a 1M boundary and will exception if -accessed beyond that end. However, the exact location of these stacks should -not be assumed. -3) The location of RMA and its maximum size may not be assumed. However, it -is guaranteed that it will be in low 64MBytes (ie can execute 26 bit code). -4) Except where particular device drivers export hardware addresses. -5) Only in so far as a client may make its own dynamic area. - - - 6.2 Free pool - ------------- - - Large RAM sizes pose a problem for RISC OS, because the existing metaphor - that all spare memory lives in application space breaks down. The current - limit on application space size is 16MB, whereas the maximum RAM size on - Medusa platforms is 258MB. Although this limit can be moved up a little by - moving other areas out of the way, it is not possible to extend it enough - (eg I/O still has to live at &03000000 onwards). - - To cope with this a new dynamic area is created, known as the "free pool" - (area number 6). The operation of SWI OS_ChangeDynamicArea is modified as - follows:- - - a) When an area (other than the free pool) is grown, memory is taken from - the free pool, if any exists (the current application is not notified - of this). - - If having shrunk the free pool to zero size, there is still not enough - memory for the growth, the kernel attempts to remove pages from the - application space as it does under existing versions of RISC OS. - - b) When an area (other than the free pool) is shrunk, the pages recovered - are added to the free pool. The current application is not consulted. - - c) If the free pool itself is grown, pages are taken from application - space to put in it (and the application consulted beforehand). - - d) If the free pool is shrunk, the recovered pages are added to - application space (the application is consulted beforehand). - - The WindowManager module also changes, to take this into account. In some - ways its operation is simplified, as it no longer needs to maintain its own - free pool. However the implementation of the following SWIs needs to - change:- - - Wimp_TransferBlock at present puts all used task memory into application - space, and then copies the relevant bits over. It cannot do this any more, - as the total used task memory may not fit into application space. Instead - it must do the following:- - - Split the transfer into chunks of no more than half of the maximum - application memory size. For each chunk, put the appropriate pages of the - source block in at the start of application space, and the appropriate - pages of the destination block above these, then perform the transfer. - After all chunks have been done, restore the current task's pages in - application space. - - Wimp_ClaimFreeMemory needs to be modified, because the Wimp no longer - maintains control of the free pool. - - - 6.3 New SWI: OS_DynamicArea (&66) - --------------------------------- - - This SWI performs miscellaneous operations on dynamic areas. - - On entry, r0 provides a reason code which determines which operation is - performed. - - Note that as all operations on dynamic areas work in physical page numbers - it is not possible to map anything other than RAM pages (DRAM and VRAM) - into a dynamic area. In particular EASI space cannot be mapped in. - - 6.3.1 Reason codes - ------------------ - - 6.3.1.1 Create dynamic area - --------------------------- - - This call creates a new dynamic area. - - On entry: r0 = 0 (reason code) - r1 = new area number (-1 => RISC OS should allocate number) - (must not be 128-255 - see section 6.6) - r2 = initial size of area (in bytes) - r3 = base logical address of area (-1 => OS should allocate - base address) - r4 = area flags - bits 0..3 = access privileges to be given to each page - in the area (same format as for - OS_Read/SetMemMapEntries) - - bit 4 = 0 => area is singly mapped - = 1 => area is doubly mapped - - bits 5..31 must be zero - - r5 = maximum size of area, or -1 if the area should be - capable of growing to the total RAM size of the - machine - r6 -> area handler routine, or 0 for no routine - r7 = workspace pointer to be passed in r12 on entry to - area handler (should be 0 if r6=0) - r8 -> area description string (null terminated), eg - "Font cache". This string will be displayed in the - TaskManager window. - - On exit: r1 = allocated area number - r3 = specified or allocated base address of area - r5 = specified or allocated maximum size of area - r0,r2,r4,r6-r8 preserved - - An error will be returned if: - - * the given area number clashes with an existing area, or - - * the logical address space occupied by the area at maximum size would - intersect with any other area at maximum size, or - - * there is not enough contiguous logical address space to create the - area, or - - * there is not enough memory in the free pool to allocate level 2 page - tables to cover the area at maximum size. - - If r1 is -1 on entry the RISC OS will allocate an area number itself. - This will be greater than or equal to 256. This means (see section 6.6) - that OS_ReadDynamicArea on these areas will always return with r2 - being the maximum area size. - - For singly mapped areas the base logical address is the lowest logical - address used by that area. The area grows by adding pages at the high - address end. - - For doubly mapped areas the base logical address is the (fixed) boundary - between the two mappings: the first mapping ends at r3-1, and the second - starts at r3. When one of these areas grows the pages in the first copy - move down to accommodate the new pages at the end, and the second copy - simply grows at the end. - - On entry, r6 points to the area handler routine which gets called with - various reason codes when an an area is grown or shrunk. If zero is - passed in, then no routine will be called, and any shrink or growth will - be allowed. - - Details of the entry and exit conditions for this routine are given - in section 6.3.2 below. - - The area is created initially with size zero (ie no pages assigned to - it), and is then grown to the size specified in size r2, which involves - the area handler being called in the same way as if - OS_ChangeDynamicArea was called to grow the area. - - The area is created with a maximum size equal to either the amount given - in r5 on entry, or the total RAM size of the machine, if this is - smaller. If r5 is -1 on entry, then the maximum size will be set to the - total RAM size of the machine. - - If r3 on entry is -1, then RISC OS allocates a free area of logical - address space which is big enough for the maximum size of the area. - - Once the area has been created Service_DynamicAreaCreate will be issued - to inform the rest of the system about this change. - - Notes for application writers - ----------------------------- - - The following facilities: - - * the ability to create areas with specific area numbers - * the ability to create areas at specific logical addresses - * the ability to create doubly-mapped areas - - are intended for internal system use only. - - Applications should in general create only singly-mapped areas, and - request that RISC OS allocate area numbers and logical addresses. - - This will prevent clashes of area numbers or addresses. - - 6.3.1.2 Remove dynamic area - --------------------------- - - This call removes a previously created dynamic area. - - On entry: r0 = 1 (reason code) - r1 = area number - - On exit: All registers preserved - - An error is returned if the area was not removed for any reason. - - Before the area is removed, RISC OS attempts to shrink it to zero size. - This is done using ChangeDynamicArea. If the ChangeDynamicArea returns - an error then the area will be grown back to its original size using - ChangeDynamicArea and the remove dynamic area call will return with an - error. If the ChangeDynamicArea to reduce the area to 0 size worked then - the area will be removed. - - Once the area has been removed Service_DynamicAreaRemove will be issued - to inform the rest of the system about this change. - - - 6.3.1.3 Return information on dynamic area - ------------------------------------------ - - This call returns various information on a dynamic area. - - On entry: r0 = 2 (reason code) - r1 = area number - - On exit: r2 = current size of area (in bytes) - r3 = base logical address of area - r4 = area flags - r5 = maximum size of area - r6 -> area handler routine - r7 = workspace pointer for area handler - r8 -> area description string (null terminated) - - Note that for doubly-mapped areas, r3 on exit from this call returns the - address of the boundary between the first and second copies of the area, - whereas OS_ReadDynamicArea returns the start address of the first copy - (for backwards compatibility). - - 6.3.1.4 Enumerate dynamic areas - ------------------------------- - - On entry: r0 = 3 (reason code) - r1 = area number or -1 - - On exit: r1 = next area number or -1 - - This allows an application to find out what dynamic areas are defined. - -1 is used to start the enumeration and -1 indicates that the - enumeration has finished. - - - 6.3.1.5 Renumber dynamic area - ----------------------------- - - This call renumbers a dynamic area. - - On entry: r0 = 4 (reason code) - r1 = old area number - r2 = new area number - - On exit: All registers preserved - - An error is returned if the area specified by the old area number does - not exist or if the new number clashes with an existing area. - - This call is intended for system use only. - - Once the dynamic area has been renumbered Service_DynamicAreaRenumber - will be issued to inform the rest of the system about this change. - - - 6.3.1.6 Read size of application space - -------------------------------------- - - This call returns the maximum size of application space - - On entry: r0 = 5 (reason code) - - On exit: r5 = maximum size of application space - - This call is intended for system use only. - - - - 6.3.2 Dynamic area handler routine - ---------------------------------- - - This section describes the reason codes passed to the dynamic area handler - routine, with their entry and exit conditions. - - This routine is called when the size of an area is being changed. - - On entry, r0 contains a reason code, which describes what is happening. - - It should be noted that when called, OS_ChangeDynamicArea is currently at - work and will reject requests to resize dynamic areas. As a consequence - any SWIs which might resize a dynamic area should be avoided. Such things - as OS_Module to claim some workspace are an example, and hence most file - operations should be avoided (although I/O on an existing file is more - safe than other operations). - - The reason codes are as follows:- - - 6.3.2.1 PreGrow (0) - ------------------- - - This reason code is issued when a call to OS_ChangeDynamicArea results - in an area growing. It is called before any pages are actually moved. It - allows the handler to specify particular physical pages if it needs them - (eg for the screen area), or to object to the size change. - - On entry: r0 = 0 (reason code) - r1 -> Page block - The physical page number entries will be set to -1 - r2 = number of entries in Page block (= number of pages - area is growing by) - r3 = number of bytes area is growing by (= r2 * pagesize) - r4 = current size of area (bytes) - r5 = page size - r12 -> workspace - - On exit: If the growth is OK, then - r0 is preserved - If particular physical page numbers are required then all - the physical page number entries must be filled in with - the required pages. The other entries must be left alone. - V = 0 - else - r0 -> error to return, or zero to return generic error - V = 1 - endif - All other registers preseved - - This call permits the dynamic area handler to request that specific - pages be used for growing the area. If this is the case then all pages - must be specified. The correspondence between the Page block and memory - is that the first entry in the page block corresponds to the lowest - memory address of the extension, and the last entry in the Page block - the highest memory address. - - If an error is returned, then the area will not change size. - - 6.3.2.2 PostGrow (1) - -------------------- - - This reason code is issued when a call to OS_ChangeDynamicArea results - in an area growing. It is called after the PreGrow reason code has been - issued successfully and the memory pages have been moved. It provides - the handler with a list of which physical pages have been moved into the - area. - - On entry: r0 = 1 (reason code) - r1 -> Page block - Only the physical page number entries are defined - r2 = number of entries in Page block (= number of pages - area grew by) - r3 = number of bytes area grew by - r4 = new size of area (bytes) - r5 = page size - r12 -> workspace - - On exit: All registers preserved - - 6.3.2.3 PreShrink (2) - --------------------- - - This reason code is issued when a call to OS_ChangeDynamicArea results - in an area shrinking. It is called before any pages are moved. It allows - the handler to limit the amount of memory moved out of the area, or to - object to the size change altogether. The shrink amount alowed as - returned by this reason code is permitted to be a non-page multiple. The - ChangeDynamicArea code will ensure the shrink permitted is rounded down - to a page multiple before it is actioned. - - On entry: r0 = 2 (reason code) - r3 = number of bytes area is shrinking by - r4 = current size of area (bytes) - r5 = page size - r12 -> workspace - - On exit: If shrink (even by reduced amount) is OK, then - r0 preserved - r3 = number of bytes area can shrink by. This must be less - than or equal to r3 on entry. - V = 0 - else - r0 -> error block, or zero to return generic error - r3 = 0 - V = 1 - endif - All other registers preserved - - 6.3.2.4 PostShrink (3) - ---------------------- - - This reason code is issued when a call to OS_ChangeDynamicArea results - in an area shrinking. It is always called after the PreShrink reason - code has been issued successfully even if the memory pages can't be - moved. - - On entry: r0 = 3 (reason code) - r3 = number of bytes area shrunk by - r4 = new size of area (bytes) - r5 = page size - r12 -> workspace - - On exit: All registers preserved - - - 6.3.3 Sequence Of Actions When OS_ChangeDynamicArea Is Called - ------------------------------------------------------------- - - This section has been provided to give an overview of what happens when a - dynamic area's size is changed. This is presented as pseudo-code for - clarity. - - Check IRQSemaphore - reject CDA if set - - Growing free pool: - (no check for page availability - do as much as possible!) - Application space being shrunk - confirm it's OK: - If CAO in application space then - UpCall_MovingMemory (asks application if it consents to - memory move) - If UpCall *not* claimed Then reject CDA - Else - Service_Memory (asks modules for objectors to the memory - move) - If Service *is* claimed then reject CDA - EndIf - Move pages from application space end to free pool - - Growing other dynamic area: - Check for page availability - if not enough available bounce CDA with - error - Table of pages prepared: - Allocates memory - Fills in -1s for 'any page' - PreGrow is called: - replaces -1s if it wants - objects about resize amount perhaps - Check for unavailable pages: - If there is a non -1 which can't be grabbed then reject CDA - Check for application space resizing: - If free pool < amount needed then - If CAO in application space then - UpCall_MovingMemory (asks application if it consents to - memory move) - If UpCall *not* claimed Then reject CDA - Else - Service_Memory (asks modules for objectors to the memory - move) - If Service *is* claimed then reject CDA - EndIf - EndIf - Page replacements determined: - Work out swap sequences on all non -1s - Replace all -1s with actual pages - Pages get grabbed first from the free pool, then underflowing into - the application space - Issue Service_PagesUnsafe (only if PreGrow specified pages) - Pages get moved around: - Do the page moving/swapping (don't swap if pages requested are in - free pool) - Issue Service_PagesSafe (only if PreGrow specified pages) - PostGrow is called: - Sorts out structures for the new size - - Shrinking free pool: - Check if application space OK to grow: - If application space < maximum then - If CAO in application space then - UpCall_MovingMemory (asks application if it consents to - memory move) - If UpCall *not* claimed Then reject CDA - Else - Service_Memory (asks modules for objectors to the memory - move) - If Service *is* claimed then reject CDA - EndIf - EndIf - Move pages from free pool to application space - - Shrinking other dynamic area: - PreShrink is called: - objects about resize amount perhaps, or gives larger allowed size - Sorts out structures for the new smaller size as the shrink - will definitely go ahead. - Pages get moved around: - Move pages from dynamic area to free pool - PostShrink is called: - Keep subsystem informed. - - - - It should be noted that the system stack is used for the page structure - passed to the PreGrow routine. As a consequence there is a limit to the - amount that an area can be grown by at one time. To get round this problem - an area grow request of a large amount will be performed in several - steps. If one of these steps fails then the grow will terminate early with - the area grown by however much was achieved, but not by the full amount - requested. - - You will notice two new service calls were used here: - Service_PagesUnsafe - Service_PagesSafe - which are issued around page swapping to inform any DMA subsystems (eg - IOMD DMA or second processor) that some pages are being swapped around. - Here is the detailed description of these service calls: - - 6.3.3.1 Service_PagesUnsafe - --------------------------- - - On entry: r1 = Service_PagesUnsafe - r2 = Page block filled in by the PreGrow routine with the - two address fields filled in too. - r3 = number of entries in Page block - - On exit: All registers preserved - - The recipient of this service call is being told that the pages - specified are about to be swapped around. Direct memory access - activities involving the specified pages should be suspended until - Service_PagesSafe has been received indicating the pages are safe. - - - 6.3.3.2 Service_PagesSafe - ------------------------- - - On entry: r1 = Service_PagesSafe (&8F) - r2 = Number of entries in each Page block - r3 -> Page block before move - r4 -> Page block after move - - On exit: All registers preserved - - The recipient of this service call is being told that the pages - specified have been swapped for different pages and what those different - pages are. Note that the logical addresses in both Page blocks will - match. The 'before' Page block will contain the physical page numbers - and physical addresses of the pages which were replaced, and the 'after' - block the page numbers and physical addresses of the pages which - replaced them. - - 6.3.4 Implementation Notes for OS_ChangeDynamicArea - --------------------------------------------------- - -There is an issue with OS_ChangeDynamicArea when a particular page is -requested by the growing dynamic area which is currently in use by the page -tables. The problem is that moving pages that themselves control where the -pages are is a tricky operation. This is exacerbated on level 1 page tables -even more because these are 16k (4 pages) big and must be 16k aligned. This -means that if a level 1 page table needs moving then another 4 page block -needs to be found - potentially resulting in more page swapping to make such -a gap. Level 2 page tables don't have this problem as they're 4k (1 page) -big. - -Having said this, unless some mobility is permitted the minimum -configuration which would permit a '486 second processor to work would be -4MBytes. In a 2MByte machine 1M is left free of page tables to allow the -screen to grow, and the 2nd MByte would, as a consequence, be 'contaminated' -with page tables and so would be unavailable for the 2nd processor. If the -page tables could be moved they could reside in the 'screen' MByte as they -could be moved freely about if the screen needed to grow. - - 6.3.5 OS_DynamicArea Service Calls - ---------------------------------- - - These service calls are designed to keep the rest of the system informed - about changes to the dynamic areas. Their primary customer is the task - manager, although other modules could make use of them. - - 6.3.5.1 Service_DynamicAreaCreate (&90) - --------------------------------------- - - On entry: r1 = Service_DynamicAreaCreate (&90) - r2 = area number of area just created - - On exit: All registers preserved - This service must not be claimed - - This service is issued just after the successful creation of a dynamic - area. - - - 6.3.5.2 Service_DynamicAreaRemove (&91) - --------------------------------------- - - On entry: r1 = Service_DynamicAreaRemove (&91) - r2 = area number of area about to be removed - - On exit: All registers preserved - This service must not be claimed - - This service is issued just before the removal of a dynamic - area. It is issued during a call to OS_DynamicArea(1), after the area has - been successfully reduced to zero size, but before it has been removed - completely. - - - 6.3.5.2 Service_DynamicAreaRenumber (&92) - ----------------------------------------- - - On entry: r1 = Service_DynamicAreaRenumber (&92) - r2 = old area number - r3 = new area number - - On exit: All registers preserved - This service must not be claimed - - This service is issued during a call to OS_DynamicArea(2), ie when an area - is being renumbered. - - - 6.4 New SWI: OS_Memory - ---------------------- - -This SWI performs miscellaneous operations for memory management. - -On entry: r0 = reason code and flags. Bits o-7 are the reason code, bits - 8-31 are the flags which may be specific to the reason code. - The other registers are specific to the reason code. - -On exit: The returned values are specific to the reason codes. - -Here are the defined reason codes: - -0-5: Page block Operations -0 - General Page block Operation -1-5 - reserved - -6-8 - physical memory: -6 - read physical memory arrangement table size -7 - read physical memory arrangement table -8 - read amounts of various sorts of memory - -9-? - I/O space information: -9 - read controller presence - -The details of these are given below. - - 6.4.1 OS_Memory Reason 0: General Page block Operation - ------------------------------------------------------ - - This reason code is used to convert between representations of memory - addresses. The different memory spaces are logical memory, physical - memory and physical pages. - - On entry: r0 = flags: - bit meaning - 0-7 reason code (0-5) - 8-9 which entry is defined in the Page block: - 0 - Physical page number - 1 - Logcial address - 2 - Physical address - 10 Physical page number will be filled in when set - 11 Logical address will be filled in when set - 12 Physical address will be filled in when set - 13-14 Cachability control: - 0 - no change - 1 - no change - 2 - disable caching on these pages - 3 - enable caching on these pages - 15-31 reserved - set to 0 - r1 -> Page block - r2 = number of entries in page block - - On exit: Page block updated as necessary - - The Page block will be scanned and the specified operations applied to - it. It is possible to do address conversions and control the cachability - on a per-page basis. If any page is found to be unconvertable or - non-existent then an error will be returned and the cachability will be - unaffected. Cachability is accumulated for each page. So, for example, if - there are 5 clients which need caching turned off on a page then each of - them must turn caching back on individually for that page actually to - become cached again. - - Where an ambiguity may occur, for example in doubly-mapped areas such as - the screen, one of the possible results will be chosen and filled in. - - This will only handle RAM addresses. The address fields may be non-page - aligned. - - 6.4.2 OS_Memory Reasons 6-8: Physical Memory - -------------------------------------------- - - These are provided to enable a program to find out what physical - memory there is and its arrangement. The first two calls provide - complete information on the available memory. The information is provided - in the form of a table, with each page of physical memory space having - one entry in the table. Due to the large number of pages the table is - packed down to only 4 bits per page. In each byte of the table the low - order 4 bits correspond to the page before the high order 4 bits, ie it - is little-endian. This is the meaning of a nibble in the table: - - bit meaning - 0-2 type of memory: - 0 not present - 1 DRAM - 2 VRAM - 3 ROM - 4 I/O - 5-7 Undefined - 3 0 - Page available for allocation - 1 - Page not available for allocation - - The page availability is based on whether it is RAM, and whether it has - already been allocated in such a way that it can't be replaced with a - different RAM page eg the OS's page tables or screen memory. - - The third call gives a summary of available memory. - - - 6.4.2.1 Read Physical Memory Arrangement Table Size - --------------------------------------------------- - - On entry: r0 = 6 (bits 8-31 clear) - - On exit: r1 = table size (bytes) - r2 = page size (bytes) - - This returns information about the memory arrangement table. - - - 6.4.2.2 Read Physical Memory Arrangement Table - ----------------------------------------------- - - On entry: r0 = 7 (bits 8-31 clear) - r1 = pointer to table to be filled in - - On exit: registers preserved - - This returns the physical memory arrangement table in the block of memory - pointed at by r1. Note the information about page availability may well - change between this being called before a OS_ChangeDynamicArea and the - PreGrow routine being called, in particular it may have been necessary - for OS_ChangeDynamicArea to allocate level 2 page tables for the grown - area, and these are not available for allocation. Hence, for - applications which require, say, all pages from physical address 0 - onwards their PreGrow handler must make this call, rather than the - information being extracted and held before OS_ChangeDynamicArea being - called. - - - 6.4.2.3 Read Amounts Of Various Sorts Of Memory - ----------------------------------------------- - - On entry: r0 = bits meaning - 0-7 must be 8 - its the reason code - 8-11 the type of memory: - 1 - DRAM - 2 - VRAM - 3 - ROM - 4 - I/O - 12-31 reserved - set to 0 - - On exit: r1 = number of pages of that sort of memory - r2 = page size (in bytes) - - - 6.4.3 I/O Space Information - --------------------------- - - These give information about the I/O space. Controllers are identified by - type and sequence number so that a machine could be constructed with, - say, more than one IDE controller in it. - - 6.4.3.1 Read Controller Presence - -------------------------------- - - On entry: r0 = 9 (bits 8-31 clear) - r1 = controller ID - bit meaning - 0-7 controller sequence number - 8-31 controller type: - 0 - EASI card access speed control - 1 - EASI space - 2 - VIDC1 - 3 - VIDC20 - - On exit: r1 = controller base address or 0 if not present. - - This returns the location of a controller on the given machine. For - example the EASI space gives the base address of podule N where N is - the sequence number given. This reason code is provided for internal - use only and is documented here for completeness' sake. In particular - you must use the Podule manager to get at this information and to - control your podule's EASI space access speed. - - 6.5 Old SWI OS_SetMemMapEntries (&53) - ------------------------------------- - - As noted in the RISC OS 3 PRMs -1 should be used to indicate that a page - should become inaccessible, for future compatibility. In the Medusa kernel - the future has arrived - only -1 will work! - - 6.6 Old SWI OS_ReadDynamicArea (&5C) - ------------------------------------ - - As noted in the RISC OS 3 PRMs if bit 7 of the dynamic area number is set - then r2 will be returned with the maximum area size. This is being changed - slightly to be that if the dynamic area number passed in is greater than or - equal to 128 then r2 will be returned as the dynamic area size. Also, if - the dynamic area number passed in is between 128 and 255 inclusive then the - information will be returned for the area whose number is 128 less than the - passed-in value. The net result is that for old dynamic area numbers (0-5) - the functionality is unchanged, but the number-space impact of the - interface is minimised - it was prety horrible to have to force bit 7 of - all dynamic area numbers to be clear just for this SWI, so we just prohibit - a small patch of low numbers instead. - - 6.7 New SWI OS_ClaimProcessorVector - ----------------------------------- - - - In - r0=Vector and flags - bit meaning - 0-7 Vector number: - 0 - 'Branch through 0' vector - 1 - Undefined instruction - 2 - SWI - 3 - Prefetch abort - 4 - data abort - 5 - address exception (only on ARM 2 & 3) - 6 - IRQ - 7+ - reserved for future use - 8 0=release, 1=claim - 9-31 reserved, must be 0 - r1=replacement value - r2=value which should currently be on vector (only needed for release) - Out - r1=value which has been replaced (only returned on claim) - - This SWI provides a means whereby a module can attach itself to one of the - processor's vectors. This is a direct attachment - you get no environment - except what the processor provides. As such, claiming and releasing the - vectors is somewhat primitive - the claims and releases must occur in the - right order (the release order being the reverse of claim order). - - On release if the value in r2 doesn't match what is currently on the vector - then an error will be returned. This ensures correct chaining of claims and - releases. - - [ Implementation note: - On break the 1st ROM instruction gets copied to location 0 and branched to - (MOV pc, #0). This used to be a branch direct (B thing) instruction, but - will be changed to a branch indirect (LDR pc, [pc, #thing]). This means the - indirection vector must be filled in with the correct reset address. Hence, - the reset vector must be a different indirection vector to the 'Branch - through 0' one. - ] - - - - 7. External Dependencies - ========================= - -The development of the new memory management system relies upon the -availability of ARM600 (or 610) processor boards for A540s. - -The Window Manager will need modification to cope with the changed memory -management system. In particular it will need to: - Cope with the free pool being external to the wimp - Change how it does TransferBlock operations - Change how it gets the pages for new tasks - - - 8. Development Test Strategy - ============================= - -PHTester scripts will be writen to exercise the following SWIs: -OS_Memory - All reasons (0-9) -In range, edge of range, just outside range and wildly out of range values -will be tried. Where buffer contents are returned the buffer will be output. - -OS_AbortTrap -Where this implemented then the test strategy would be as follows. Due to the -nature of this SWI unsupported PHTester scripts will not be able to do the -job properly. A piece of support code will be written which can be loaded -into RMA and will monitor calls to the abort trapper. A PHTester script will -be written which will load this trapper, add it, exercise it and monitor the -results. The trapper will then be removed twice to make sure the correct -behaviour results. - -OS_ChangeDynamicArea -Again, this is hard to test with straight PHTester scripts. Under normal -circumstance the presence of PHTester running will prohibit dynamic areas -growing, however, this can be got around by growing a dynamic area before -PHTester starts, starting the script then shrink the dynamic area thus -giving the system a free pool (PHTester will refuse to allow the application -space to resize and thus the memory will be pushed into the free pool). -Support code will be writen which will monitor service calls and upcalls and -will exercise the various cases. This act of exercising must be done without -PHTester running. - -OS_DynamicArea -Again, support code will be needed for PHTester to be usable. With this -support code PHTester scripts will be writen to add (twice) and remove -(twice) a dynamic area. This area will then be resized testing success and -failure of both grow and shrink, failing because of either not enough memory -or unavilable specific pages being requeested. A straight PHTester script -will be used to exercise enumeration, readinfo and renumber operations. - - - -Testing the Wimp and Switcher - -Wimp: - -SWI Wimp_SlotSize - -The behaviour of this SWI depends on a number of external (To the task and calling parameters) factors: - - Environment, particularly MemoryLimit and ApplicationSpace - - Machine state, eg. remaining amount of memory - - Page size, to compare with ARM 3 systems units of 32K should be used - -Shrinking a slot: - Needs to be tested when MemLimit <> AppSpace, when MemLimit=AppSpace < RealSpace - where RealSpace is actual memory mapped in- This feature is used extensively by flex. - When a shrink succeedes, the free pool should grow by the shrinkage and the RMA by a roughly - proportional ammount (for slot being reduced) - -Growing a slot: - Again Different environments need testing, but also effects near total memory usage: - Eg. A large increase is requested, but only a smaller amount is available. Also when the - area has been grown, there may not be enough RMA to extend the Memory Map slot and so the - slot shrinks by a page. - -In both cases the SWI should return with the environment set to the real size and a message sent -to the switcher. - -Application testing. - As mentioned above, flex makes good use of the features of this SWI. Loading a file into !Draw -or !Paint should make the slot grow by a comparable amount to the file size (taking into account the -internal storage methods). When the document is discarded the slot should reduce to the value it was -before (unless flex/malloc usage makes this impossible) and total RMA/system memory should be roughly -what it was, though of course for a first document load the application may claim additional memory. - A small application could be written to do similar things repeatedly and could this give a -measure to memory leaks etc. Medusa is bound to be slower because of smaller page size, more pages (which -need to be scanned when growing a slot) and Log-Phys map (Level 2 table) being in RAM rather than on -chip. - -SWI Wimp_TransferBlock - -Many possible cases: - Should always be possible even if no free memory. - For tasks a,b,c (c is current task) - a <-> b a <-> c c <-> c - For small and large lengths (eg. 1K or 8Meg) - For when c takes up all/most of app space - For when transfers occur to/from non application space (eg. RMA) - For non word aligned/ size transfers - For transfers involving over-the-page memory, eg. 34k-38k (32-36,36-40 pages) - -Application testing. - RAM transfer from !Paint to !Draw (this is c->a,small, prob aligned) - Use of !SqlFiler and !Faults (this c(RMA)->a,small, prob aligned) - Some combinations can only be tested on real Medusa's with 32Meg memory. - -SWI Wimp_ClaimFreeMemory - Only claimable once at a time, memory should be accessible and remain intact until free'd - (incidentally can be freed by any task). - -System testing - *copy, *compact ? - -Mode changing: - -SWI Wimp_SetMode, *wimpmode - numbers 0-255 as before (testable by script which then checks screen memory usage and VDU -variables) and new style configuration (again script can work out from config the mem usage and VDU -vars). Wimp should shrink screen memory as much as possible and send mode changed message to all tasks - -Switcher: - Dynamic areas used to be scanned (finding addresses for all the system pages) now RDA is used. -Dynamic areas (all, including app-created areas) should update when window is open and a task calls -CDA successfully. Areas which are non-fixed should be draggable, should reflect/update area as seen -by a task. Dragging bars should update memory text as appropriate, on medusa platforms with more than -4Meg this should be logarithmic for large values. Switcher should behave as before on non medusa platforms. - - - - 9. Organisation - ================ - - The software described herein resides in the RISC OS ROM. - - 10. Future Enhancements - ======================= - -Some sort of system to request memory to be freed in cases of memory -shortage might be nice. - -OS_Heap to be extended to allow allocation of anchored moveable blocks. This -would be used to prevent heap fragmentation. - - 10.1 New SWI: OS_AbortTrap (&67) - -------------------------------- - - This has been moved to the future enhancements section as this is not - required by the project specification, there is insufficient time to do it - and it can be added later if needed. Also, there are some unresolved issues - regarding handling aborts of writes to &00-&1f and handling of coprocessor - data transfer operations. - - 10.1.1 Technical background - --------------------------- - - The extra processor modes in the ARM6 and ARM7 processor cores allow for - complete recovery from data aborts, even if the abort happens while in - privileged modes, such as supervisor mode. This was not possible on - earlier processors, because when the abort was taken, the return address - (and condition codes) was placed in r14_svc, thereby corrupting it. - - This allows for (amongst other things) complete software emulation of - hardware devices (apart from devices which cause interrupts, or which are - very time-critical). In particular, it becomes possible to write a module - which emulates VIDC1 on systems which are VIDC20 based (provided that the - address map is set up so that the address where VIDC1 is accessed - (&03400000) causes a data abort when written to). - - In order to facilitate this kind of activity, RISC OS allows a module to - provide a trap routine for accesses within specified address ranges. This - is an additional feature over and above the usual abort handlers which are - owned by the current application. - - When a data abort happens, the OS works out the range of addresses - accessed by the instruction. - - It then looks through its MMU page tables, and splits the range into - sub-ranges which correspond to accesses within one page or section, as - appropriate. - - For each sub-range, it then checks the access privileges to see if the - access was valid. If so, it performs the access itself. (For a load, it - transfers the data into a temporary stack frame from which the register(s) - will be subsequently loaded. For a store, the stack frame is already set - up with the register(s) to be stored.) - - If the sub-range corresponds to a page or section which would have caused - an abort, the sub-range is then checked against its list of abort traps. - Starting with the lowest address in the sub-range, if the address is - contained within any of the address ranges specified in the list, then - the corresponding routine is called. The registers on entry and on exit - are as follows:- - - On entry: r0 = flags - bits 1,0 = 00 undefined - 01 store - 10 load - 11 SWP - - bit 2 = 0 => user mode access - 1 => privileged mode access - - bits 3..31 undefined - - r1 -> block of registers to be transferred to/from - r2 = lowest address which faulted in the specifed address range - r3 = number of transferred bytes which fall within the specified address range - r4 -> instruction which aborted - r12 = workspace ptr specified in node - SVC26 (at the moment - I might change this to SVC32 at some stage) - - On exit: VC => instruction processed, please complete writeback - VS => instruction shouldn't be allowed - generate exception - All registers preserved (apart from PSR) - - If the routine wishes to accept the transfer as valid, it must perform the - transfer itself by transferring the data (of length r3 bytes) in or out of - the block pointed to by r1. (In the case of the SWP instruction it must - transfer data out of, then into the block). It should then exit with V=0. - - The OS will then advance its address pointer by the number of bytes - processed by this routine, and continue with the next sub-range (if there - are any more to do). - - If the routine wishes to fault the transfer after all, it should exit with - V=1. This will cause the OS to call the normal data abort handler. (This - also happens if an address in a sub-range which faulted does not lie in - any address range on the list). - - Note: this behaviour currently precludes having two or more abort traps on - the list which have overlapping address ranges, where each trap actually - is interested in a subset of accesses within that range. At the moment, - the OS faults if any trap routine exits VS, whereas it could carry on down - the list looking for further trap ranges containing the address. But then - you would have to have some way of returning saying you had done part of - the transfer. - - In addition to trapping page and section faults, the OS has special code - to deal with writes to addresses in the range &00 to &1F inclusive, which - cause aborts on ARM6/7 when the processor is executing in a 26-bit PC mode - (assuming we are in the 32-bit PC configuration, which we are). - - If the address range for the transfer includes an address in the range - 0-&1F, and the aborting instruction is within the RISC OS "ROM" image, - then RISC OS executes the transfer itself (in 32-bit PC mode), as ROM code - is considered kosher. This is mainly to allow FIQ claimants such as ADFS - floppy drivers or Econet to set up their FIQ code while executing in - 26-bit PC mode. It also allows the FPE to set up the undefined instruction - vector (although of course the FPE still has to know that it will get - called in undef_32 mode). - - If the aborting instruction is not in the ROM image, then the usual abort - list is checked. If however the address is not in the list, or the routine - exits with V set, then instead of calling the current data abort handler, - the OS calls its default data abort handler (this was so I could then do a - *ShowRegs and find out where the program went bang, rather than have the C - exception handler swallow it up). - - Note that if you set up a node to respond to vector poking, and you want - to accept the transfer, you'll have to switch to SVC32 to execute it (this - is why I may change the entry to be called in SVC32. - - 10.1.2 New SWI: OS_AbortTrap (&66) - ---------------------------------- - - SWI OS_AbortTrap provides calls to add or remove abort trap routines. - - On entry, r0 provides a reason code which determines which operation is - performed. - - 10.1.2.1 Add abort trap (0) - --------------------------- - - This reason code adds a trap routine to RISC OS's list. - - On entry: r0 = 0 (reason code) - r1 = lowest trapped address - r2 = highest trapped address +1 - r3 = address of trap routine - r4 = workspace pointer for trap routine - - On exit: All registers preserved - - The entry and exit conditions for the trap routine are described in - section x.y.z. - - 10.1.2.2 Remove abort trap (1) - ------------------------------ - - This reason code removes a trap routine from RISC OS's list. - - On entry: r0 = 1 (reason code) - r1 = lowest trapped address - r2 = highest trapped address +1 - r3 = address of trap routine - r4 = workspace pointer for trap routine - - On exit: All registers preserved - - Registers r1 to r4 on entry should be identical to those previously - passed to reason code 0. diff --git a/Doc/5thColumn/Manual b/Doc/5thColumn/Manual deleted file mode 100644 index 49e9e68..0000000 --- a/Doc/5thColumn/Manual +++ /dev/null @@ -1,323 +0,0 @@ -; > 5thColumn - - RISC OS Support for extension ROMs - ================================== - - Author: Tim Dobson - Status: Draft - Issue: 0.03 - History: - - Date Revision Changes - - 11-Oct-90 0.00 Started - 16-Oct-90 0.01 Completed first draft - 08-Feb-91 0.02 Updated to reflect reality - 23-Apr-91 0.03 Added note about directly executable - extension ROMS - -This document describes the enhancements to RISC OS to support extension (or -"5th column") ROMs. - -Extension ROMs are ROMs fitted in addition to the main ROM set, which -provide software modules which are automatically loaded by RISC OS on -power-on. - -The availability, size and number of extension ROM sockets depends on which -type of RISC OS computer you are using. - -In general, however, RISC OS recognises extension ROMs or ROM sets which are -8, 16 or 32 bits wide, provided the ROM adheres to the specification below. - -32 bit wide extension ROM sets are directly executable in place, saving on -user RAM. 8 or 16 bit wide sets have to be copied into RAM to execute. - - Creating an extension ROM - ========================= - -Extension ROMs appear in the ROM area of the memory map, ie between -&03400000 and &03FFFFFF. An extension ROM set must end on a 64K boundary or -at the start of another extension ROM. This is normally not a problem as it -is unlikely you would want to use a ROM smaller than a 27128 (16K), and the -normal way of addressing this would mean that the ROM would be visible in 1 -byte out of each word, ie within a 64K addressable area. - -Extension ROMs have a header at the end of the ROM image which indicates the -presence of a valid extension ROM. The header is at the end because RISC OS -scans the ROM area downwards from the top. - -At the end of each ROM set of size 'n' bytes must be a 16-byte header as -follows:- - - Byte address Contents - - n-16 1-word size field containing n - n-12 1-word checksum (bottom 32 bits of the sum of all - words from addresses 0 to n-16 inclusive) - n-8 2-word id "ExtnROM0" indicating a valid extension - ROM, ie - - n-8 &45 ; "E" - n-7 &78 ; "x" - n-6 &74 ; "t" - n-5 &6E ; "n" - n-4 &52 ; "R" - n-3 &4F ; "O" - n-2 &4D ; "M" - n-1 &30 ; "0" - -Note that the ROM header will not necessarily appear in the memory map in -the last 16 bytes if the ROM set is 8 or 16 bits wide. In the 8-bit case, -the header will appear in one of the four byte positions of the last 16 -words, and in the 16-bit case, in one of the two half-word positions of the -last 8 words. However, RISC OS copes with this. - -Extension ROMs also have a header at the *start* of the ROM set, which is -identical to the format of an expansion card's identity space. This is -because the Podule manager module handles much of the extension ROM -processing. - -The format of the header at the start is as follows:- - - Byte address Contents Meaning - - 0 &00 Extended expansion card identity, - not requesting IRQ or FIQ - 1 &03 bit 0 set => there is a chunk - directory - bit 1 set => interrupt status - pointers defined (necessary because - bit 0 is set) - bits 2,3 = 0 => 8-bits wide (NB this - should be set to 0 irrespective of - the actual width of the ROM set) - 2 &00 Reserved, must be zero - 3 &87 Product type (lo-byte) - 4 &00 Product type (hi-byte) - See below - 5 Manuf(lo) Manufacturer code (lo-byte) - 6 Manuf(hi) Manufacturer code (hi-byte) - See below - 7 Country Country code - see below - - 8 to 15 &00 Interrupt status pointers (extension - ROMs do not generate interrupts!) - 16 onwards Chunk directory - see below - -Product type code: Note that &0087 has been allocated as a product type code -for all extension ROMs. - -Manufacturer code: All manufacturers of expansion cards and/or extension -ROMs should have a code for manufacturer. If you have not already been -allocated one, you should consult Acorn. - -Country code: Every extension ROM should have a code for the country of -origin. These match those used by the International module, except that the -UK has a country code of 0 for expansion cards and extension ROMs. If you do -not already know the correct country code for your country, you should -consult Acorn. - -The chunk directory in an extension ROM is identical to that in an expansion -card - see the chapter "Expansion Cards: Technical Details" in the RISC OS -Programmer's Reference Manual. - - Note - ==== - -In extension ROMs which are directly executable (ie which are 32 bits wide), -the word immediately preceding the start of each module must contain (size -of module +4), ie an offset from itself to the first word after the module. -It is recommended that all extension ROMs be created like this, irrespective -of whether they are directly executable. - - Additional interfaces to support extension ROMs - =============================================== - - Changes to Podule manager - ========================= - -The Podule manager module is responsible for recognising extension ROMs, -although it is the kernel which is responsible for loading modules contained -in them. - -The numbering scheme for expansion card slots has been extended to include -extension ROMs. The numbers for extension ROMs are -2, -3, -4... (-1 is -reserved for the main ROM, although the Podule manager itself does not -accept -1 for any of its SWI calls). - -All Podule manager SWIs which take an expansion card slot number as a -parameter allow an extension ROM specifier instead. - -The SWIs Podule_ReadID, Podule_ReadHeader, Podule_EnumerateChunks, -Podule_ReadChunk operate as one would expect when presented with an -extension ROM specifier. - -The SWIs Podule_ReadBytes, Podule_WriteBytes, Podule_CallLoader will -normally fail because extension ROMs have no code space or loader. - -SWI Podule_RawRead will read successive bytes out of the extension ROM, -taking the ROM width into account. - -SWI Podule_RawWrite must not be used with an extension ROM specifier, as -writing to the ROM area can reprogram the memory and video controllers. - -SWI Podule_HardwareAddress returns the base address of the specified -extension ROM, although this is not in general useful as the ROM width can -vary. - - New SWIs - -------- - -SWI Podule_EnumerateChunksWithInfo - - in: R0 = chunk number (zero to start) - R3 = expansion card slot number or extension ROM number - - out: R0 = next chunk number (zero if final chunk enumerated) - R1 = size (in bytes) if R0<>0 on exit - R2 = operating system identity byte if R0<>0 on exit - R4 = pointer to a copy of the module name if the chunk is a relocatable module, else preserved - R5 = pointer to a copy of the module's help string if the chunk is a relocatable module, else preserved - R6 = address of module if the chunk is a directly executable relocatable module - or 0 if the chunk is a non-directly-executable relocatable module - else preserved - -SWI Podule_HardwareAddresses - - in: R3 = expansion card slot number or extension ROM number - - out: R0 = raw hardware address - R1 = combined hardware address - -For an expansion card, the "raw hardware address" is the base address of the -expansion card, and the "combined hardware address" is the raw hardware -address (in bits 12-25) combined with the base address of the expansion -card's private CMOS RAM (in bits 0-11) (as returned by SWI -Podule_HardwareAddress). - -For an extension ROM, the two addresses are the same, and are the start -address of the extension ROM (ie the address of the first byte of the ROM). - - Star commands - ------------- - -*Podules now displays the extension ROMs in the system as well as expansion cards. - - Changes to kernel - ================= - - SWI OS_Module - ------------- - -OS_Module 17 (Add expansion card module) - This call now allows R3 to be -either an expansion card slot number or an extension ROM number. - -OS_Module 19 (Enumerate ROM modules) - This call now enumerates -over all ROM sections, ie extension ROM modules as well as main ROM and -expansion card modules. R2 on entry now specifies the ROM section number to -start scanning from, with the order of enumeration as follows:- - --1 (main ROM), 0, 1, 2, 3 (expansion cards), -2, -3, -4,... (extension ROMs) - -Edition 1 of the PRM is incorrect when it states that on exit R1 (the -module number to scan from) is incremented and R2 (the expansion card number -to scan from) is preserved. - -In fact R1 returns the module number of the found module plus one, where -modules are numbered from zero within each ROM section, and R2 returns the -ROM section number of the found module, which may be in a different ROM -section from the value passed in R2 on entry, if there are insufficient -modules in the specified section. - -The values returned in R1 and R2 are therefore set up for the next call to -OS_Module 19. - -The call returns the error "No more modules" (error number &107) if there -are no more modules from the point specified in the ordering. - - New call - -------- - -OS_Module 20 (Enumerate ROM modules with version) - -This call is identical to OS_Module 19, except that on exit R6 holds a BCD -(binary coded decimal) form of the module's version number, as derived from -the module's help string. The top 16 bits of this value hold the integer -part of the version number, and the bottom 16 bits hold the fractional part, -eg if the version number of the module is "3.14" then the value returned -would be &00031400. - - Module initialisation - --------------------- - -The way in which the kernel initialises modules has been changed. If there -is more than one version of the same module present in the ROM (which -includes all ROM sections) then only the newest version of the module is -initialised, where newest means the version with the highest version number. -(If there are two copies of the same version, then directly executable -versions (ie in main ROM or in a 32-bit wide extension ROM) are considered -"newer". If they are equal in this respect, then the later one in scanning -order is considered to be newer.) - -The kernel first scans down the list of modules in the main ROM. For each -module in this list, the kernel initialises the newest version of that -module. - -For each module in the main ROM, the newest version of that module - If an extension ROM contains a newer version of a module in the -main ROM, then the newer version will be initialised at the point in the -initialisation sequence where the main ROM version would have been -initialised. This allows main ROM modules to be replaced without the -problems associated with initialisation order. - -The kernel then applies the same rule to all of the expansion cards in turn. -In each case the newest version of the module is initialised, but with the -hardware address (in R11) corresponding to that of the expansion card. - -The kernel finally initialises any extension ROM modules that are the newest -versions, but which have not already been initialised in lieu of a module in the -main ROM or on an expansion card. - - Star commands - ------------- - -*ROMModules now displays the version number of each module, as well as the -other information. Extension ROM modules are now included in the list. Note -that extension ROMs are numbered 1, 2, 3... in this command - these -correspond to ROM section numbers -2, -3, -4... respectively. - -*Unplug can now unplug extension ROM modules, as well as modules in the main -ROM or in expansion cards. The syntax is now - - *Unplug [<moduletitle> [<ROM section number>]] - -*Unplug with no parameters does the same as it used to, ie display any -unplugged modules. - -*Unplug with a module name but no ROM section number specified unplugs all -versions of that module in the system, and kills off any active module of -that name. - -If a ROM section number is specified then only versions of that module -in that ROM section are unplugged. - -The action of *RMReInit has changed slightly. If the specified module is -active, then the effect is as before, ie the module is killed and then -re-initialised. - -If the specified module is not active, but is in the ROM, then the unplug -bit in CMOS RAM is cleared for all versions of the specified module, and -then the newest version of the module is initialised. - - New star command - ---------------- - -*RMInsert <moduletitle> [<ROM section number>] - -If no ROM section number is specified, then this command clears the unplug -bit for all versions of the specified module, without reinitialising any of -them. - -If a ROM section number is specified, then this command clears the unplug -bit for all versions of the specified module present in the given section, -without reinitialising any of them. diff --git a/Doc/A540Extend b/Doc/A540Extend deleted file mode 100644 index a342ca6..0000000 --- a/Doc/A540Extend +++ /dev/null @@ -1,118 +0,0 @@ -; A540Extend - - Title: A540Extend - Author: Tim Dobson - Version: 1.01 - Started: 01-Nov-90 - Last updated: 25-Nov-91 - Status: Release - History: - 01-Nov-90 TMD Created - 25-Nov-91 TMD Updated for RISC OS 3.03 - -Additions to the mode extension system for A540 and similar machines -==================================================================== - -This document describes extensions to the RISC OS mode extension system for -machines which have programmable VIDC clock speeds and sync polarities, such -as the A540. Familiarity with the RISC OS 2.00 mode extension system is -assumed (this is described in the existing Programmer's Reference Manual). - -The A540 has extra hardware to allow the selection of different VIDC clocks -and to determine the polarity of the sync lines. VIDC uses its clock -together with a set of internal dividers to provide a range of pixel rates. - -The format of the "VIDC list" returned from Service_ModeExtension (&50) has -been extended to allow the pixel rate and sync polarities to be specified. - -On original Archimedes machines, the VIDC clock is fixed at 24MHz, and the -pixel rate is only determined by VIDC's internal dividers, as specified in -bits 0 and 1 of the Control Register (VIDC address &E0). This would be -stored in the VIDC list as a word of the form &E00000xx. - -RISC OS now supports two different format VIDC lists. - -The original (type 0) VIDC list format is as follows:- - - Offset Value - - 0 0 - 4 VIDC base mode - 8 VIDC parameter - 12 VIDC parameter - .. .. - n -1 - -The new (type 1) VIDC list format is as follows:- - - Offset Value - - 0 1 - 4 VIDC base mode - 8 VIDC parameter - 12 VIDC parameter - .. .. - n -1 - n+4 Extended parameter - n+8 Extended parameter - .. .. - m -1 - -where extended parameters are of the form - - (0 << 24) + (pixel rate in kHz) - -or - - (1 << 24) + (sync polarity) - -or - - (2 << 24) + (true VIDC clock rate in kHz) - ** This option available only from RISC OS 3.03 onwards ** - -The sync polarity is defined as follows:- - - bit 0 = 0 => HSync +ve (as on a standard Archimedes) - = 1 => HSync -ve - - bit 1 = 0 => VSync +ve (as on a standard Archimedes) - = 1 => Vsync -ve - - bits 2..23 must be zero - -A pixel rate specifier in a type 1 VIDC list will override the settings of -bits 0 and 1 of a Control Register specifier in the main body of the list. -If no pixel rate is specified, then the VIDC clock is set to 24MHz, and the -settings of the divider in the Control Register are used as normal. - -The A540 hardware provides the following pixel rates:- - - 24000 kHz, 25175 kHz, 36000 kHz with a multiplier of 2/2 - 16000 kHz, 16783 kHz, 24000 kHz with a multiplier of 2/3 - 12000 kHz, 12587 kHz, 18000 kHz with a multiplier of 1/2 - 8000 kHz, 8392 kHz, 12000 kHz with a multiplier of 1/3 - -If the pixel rate specified is not achievable with the hardware on the -machine, the nearest available pixel rate is used. - -Note: when specifying a pixel rate for a hi-res-mono display, the pixel rate -specified should be the actual pixel rate divided by 4, ie 24000 not 96000. - -If no sync polarity is specified, a default of 0 is used (ie the same as a -normal Archimedes). - -The true VIDC clock rate specifier (only on RISC OS 3.03 or later) is -intended to be used in systems where the clock rate fed to VIDC is under the -control of some external device, rather than being selected by the clock -select latch. (For example, on the portable machine, the LCD ASIC feeds -either 8MHz or 16MHz into VIDC when LCD modes are selected). - -The values programmed into the clock select latch and the VIDC divider are -still determined either from the control register specifier or a pixel rate -specifier assuming the same range of clock speeds as on the A540, but the -VIDC clock rate specifier is used to determine the video memory rate, -which in turn determines the VIDC FIFO Request Pointer values (bits 4 and 5 -of the VIDC control register). The VIDC clock rate specifier is also stored -in VDU variable VIDCClockSpeed (&AC), which is used by the SoundDMA module -to determine the VIDC Sound Frequency Register value. diff --git a/Doc/Kernel b/Doc/Kernel deleted file mode 100644 index 562f477..0000000 --- a/Doc/Kernel +++ /dev/null @@ -1,162 +0,0 @@ -> net#arf:$.a500.RiscOS+.doc.Kernel - - Description: Documentation of changes to kernel for PRM - Author: Tim Dobson - Status: Preliminary - History: - 06-Oct-89 TMD Created - 13-Oct-89 TMD Added documentation of OS_RemoveCallBack - 27-Oct-89 TMD Added documentation of VDU variable VIDCClockSpeed - 01-Dec-89 NRaine Added documentation of OS_FindMemMapEntries - 04-Dec-89 TMD Documentation of OS_FindMemMapEntries updated slightly - -The description of bug fixes below is in a very rough state at the moment - -it will need to be tidied up before publication. Not all of the information -below is relevant to the average user. - - Documentation updates since RISC OS 2.00 release - ------------------------------------------------ - - Changes applying to RISC OS 2.01 - -------------------------------- - -A new SWI, OS_ChangeRedirection, has been added, to allow the reading and -writing of the handles associated with OS_CLI input/output redirection. This -call was provided for future versions of the task window module, so that -these handles can be made local to the task running in a task window. - - SWI OS_ChangeRedirection - - Read or write OS_CLI input/output redirection handles - -in: R0 = new input handle (0 => not redirected, -1 => leave alone) - R1 = new output handle (0 => not redirected, -1 => leave alone) - -out: R0 = old input handle (0 => not redirected) - R1 = old output handle (0 => not redirected) - -**************************************************************************** - -In RISC OS 2.00, the SWI OS_AddCallBack allowed interrupt routines to -request a callback, which was granted later when RISC OS was about to -exit to a user mode routine with IRQs enabled. However there was no way to -cancel a callback request before it was granted. This could cause problems, -for example if a module is being killed, and it has outstanding callback -requests, it must refuse to die, otherwise the callback may be granted after -that memory has been reused for something else. For this reason a new SWI, -OS_RemoveCallBack, has been added. - - SWI OS_RemoveCallBack - - Remove a transient callback from the list - -in: R0 = address that was to be called - R1 = value of R12 that the routine was to be called with - -out: R0 = preserved - R1 = preserved - -**************************************************************************** - -A new VDU variable, VIDCClockSpeed (variable number 172), has been added. -The value of this variable is the current VIDC clock rate, in kHz. This -value changes when a screen mode is selected which requires a different -clock rate. The value is read in the same way as other VDU variables, by -issuing the SWI OS_ReadVduVariables. - -Typical values are 24000 (ie 24MHz) for TV standard modes, 25175 (ie -25.175MHz) for VGA modes, and 36000 (ie 36MHz) for super-VGA modes. - -**************************************************************************** - -A number of routines were changed to improve IRQ latency:- - -a) New version of ChangeDynamicArea which reenables interrupts. - -b) Heap manager extend block has improved IRQ latency. - -c) Made OS_Byte &87 restore caller's IRQ state during call. - -d) Made OS_Word &0E,0 enable IRQs during call. - -e) Made OS_Word &15,0 enable IRQs during call. - -The heap manager has been optimised in a few places. - -The routine that converts a date and time value (in hours, minutes, seconds -etc) into a 5-byte centisecond value has been made smaller and much faster. - - Bug fixes - --------- - -Fixed bug in extend heap call (stack imbalance when returning 'No RAM for -extending heap' error) - -Fixed "*%" (LDREQB not LDREQ). - -Fixed OS_ReadArgs with a /E argument that evaluates to a string (always used -to give 'Buffer full' - also fixed 2 other bugs lurking in the background, -viz. did STRB of buffer addr assuming it was non-zero to indicate a string, -and didn't allow for length and type bytes in amount free value. - -Fixed OS_Word &15 reason code 4 (Read unbuffered mouse position) - it used -to generate undefined instruction trap due to stack mismatch. - -Fixed OS_SWINumberToString with negative numbers. - -Fixed ROMModules never saying 'Running'. - -Made OS_SpriteOp reentrant by pushing register dump area on stack. - -Fixed sideways scroll by one 'byte' in MODEs 3 and 6. - -Fixed incarnation names being terminated by 1st character. - -Fixed *Unplug using address as extra terminator for module name. - -Fixed podule IRQ despatcher corrupting R0 (prevented it from correctly -disabling the podule IRQ (or podule FIQ-as-IRQ) interrupt if no handler) - -RR-2047: Fixed bug in GSRead with quoted termination. - -RR-2060: Fixed bug in AddCallBack which freed the wrong heap node. - -RR-2066: Fixed bug which occasionally left soft cursors on the screen. - -RR-2067: Fixed bug in keyboard driver (pressing Break (as escape) key when -keyboard buffer full did nothing) - -RR-2079: Fixed bug in CallAfter/Every which returned duff error pointers. -Changed error message from null string to 'Invalid time interval'. - -RR-2080: Fixed rename incarnation bug. - -RR-2099: Fixed bug in monadic plus/minus in EvaluateExpression (eg *Eval -50*-3) - -RR-2105: Added help on LEN in *Help Eval. - -RR-2108: Fixed bug in prefer incarnation which returned duff error pointers. - - - Changes applying to RISC OS 2.04 - -------------------------------- - -A new SWI OS_FindMemMapEntries has been added to allow fast scanning of the -soft CAM map to find the correct page numbers for a given range of addresses. -For efficiency, the caller supplies the probable page numbers as well as the -addresses, so that the routine can take a quick look to check if the page -number is already correct before scanning the rest of the CAM map. - - SWI OS_FindMemMapEntries - In: R0 -> table of 12-byte page entries - +0 4 probable page number (0..npages-1) (use 0 if no idea) - +4 4 logical address to match with - +8 4 undefined - terminated by a single word containing -1 - Out: table of 12-byte entries updated: - +0 4 actual page number (-1 => not found) - +4 4 address (preserved) - +8 4 page protection level - terminator preserved - diff --git a/Doc/KernlSplit b/Doc/KernlSplit deleted file mode 100644 index 8859fa7..0000000 --- a/Doc/KernlSplit +++ /dev/null @@ -1,45 +0,0 @@ -; > KernlSplit - -Feasibility of splitting the RISC OS kernel -=========================================== - -Author: Tim Dobson -Name: KernlSplit -Document version: 0.01 -Last modified: 19-Apr-90 - -Cbange record: - - Date Name Description of change - ---- ---- --------------------- - 19-Apr-90 TDobson Started - -This document discusses the feasibility of splitting the RISC OS kernel into -separate modules/code segments for each device driver. - -Suggested device drivers to be split off:- - - VDU - Screen hardware drivers - VIDC - Pointer - Palette - Hardware scroll/multiple display banks - Allocation of screen memory - Bitmap manipulation - Wrch - Sprites - Draw - Fonts - ColourTrans - - Keyboard/mouse - - IIC - Real time clock - CMOS RAM - Serial - - Centronics - - Memory control diff --git a/Doc/MMUControl b/Doc/MMUControl deleted file mode 100644 index 277832f..0000000 --- a/Doc/MMUControl +++ /dev/null @@ -1,35 +0,0 @@ -; Available from RISC OS 3.30 onwards - - SWI OS_MMUControl (&6B) - - On entry: - R0 = reason code/flags (must be zero) - R1 = XOR mask - R2 = AND mask - - On exit: - R1 = old value of control register - R2 = new value of control register - - Interrupts: - Interrupt status is undefined - Fast interrupts are enabled - - Processor mode: - Processor is in SVC mode - - Re-entrancy: - Not defined - - Use: - This call performs a read-modify-write operation on the ARM MMU - control register. The new value of the register is - - ((old value AND R2) XOR R1) - - The old value of the register is returned in R1, and the new value - in R2. If the call results in the C (Cache enable) bit being - changed, the cache is flushed. - - This call is intended for internal system use only. Users wishing to - enable or disable the cache should use the *Cache command instead. diff --git a/Doc/MemMaps/130 b/Doc/MemMaps/130 deleted file mode 100644 index 8d44fc2..0000000 --- a/Doc/MemMaps/130 +++ /dev/null @@ -1,38 +0,0 @@ - 000 App space - 01C System heap/svc stack - 01E Soft CAM copy/und stack - 01F Sound/pointer/random - 020 RMA - 02C L2PT and L1PT - 030 I/O - 038 ROM - 040 Screen - 060 Free pool - 0E2 Sprites - 164 Font cache - 1E6 RAM disc - 268 Another area 1 - 2EA Another area 2 - 36C Another area 3 - 3EE Another area 4 - 470 Another area 5 - 4F2 Another area 6 - 574 Another area 7 - 5F6 Another area 8 - 678 Another area 9 - 6FA Another area 10 - 77C Another area 11 - 7FE Nothing - 800 Phys space copy - A00 Another area 12 - A82 Another area 13 - B04 Another area 14 - B86 Another area 15 - C08 Another area 16 - C8A Another area 17 - D0C Another area 18 - D8E Another area 19 - E10 Another area 20 - E92 Another area 21 - F14 Another area 22 - F96 Nothing diff --git a/Doc/MemMaps/258 b/Doc/MemMaps/258 deleted file mode 100644 index 86cfa15..0000000 --- a/Doc/MemMaps/258 +++ /dev/null @@ -1,24 +0,0 @@ - 000 App space - 01C System heap/svc stack - 01E Soft CAM copy/und stack - 01F Sound/pointer/random - 020 RMA - 02C L2PT and L1PT - 030 I/O - 038 ROM - 040 Screen - 060 Free pool - 162 Sprites - 264 Font cache - 366 RAM disc - 468 Another area 1 - 56A Another area 2 - 66C Another area 3 - 76E Nothing - 800 Phys space copy - A00 Another area 4 - B02 Another area 5 - C03 Another area 6 - D04 Another area 7 - E05 Another area 8 - F06 Nothing diff --git a/Doc/Mode22 b/Doc/Mode22 deleted file mode 100644 index be09035..0000000 --- a/Doc/Mode22 +++ /dev/null @@ -1,64 +0,0 @@ - - Title: Mode22 - Author: Tim Dobson - History: - 05-Dec-91 TMD Created - -From RISC OS 3.03 onwards a new screen mode (22) is available, on monitor -types 0 and 1 only, which is suitable for use by visually impaired people. - -In terms of pixels and colours the mode is equivalent to mode 35 (an -overscan mode), ie 16 colours, 768 pixels by 288 rows. - -However, the ratio of OS coordinates to pixels is changed so that instead of -the screen being 1536 by 1152 coordinates like mode 35, it is only 768 by -576 coordinates. This results in most text and graphics in the desktop being -drawn twice as large in both X and Y directions, thus making them easier to -see. - -There are currently a number of problems associated with this mode:- - - a) The desktop tool sprites (ie the sprites used in window borders and the -like) are inappropriate for this mode, causing some horizontal lines to -become double thickness, and some vertical lines to disappear entirely. - - b) Some applications (including those in the ROM) create windows of a -certain size without scroll bars, and assume that the screen will be big -enough in one or both directions to accommodate the whole of the window. -Some parts of these windows may then be inaccessible. - - Examples of this are:- - - Filer windows with 'Full info' selected - !Alarm 'Setup','Set clock', 'Set alarm' (particularly repeating alarms) - windows - !Chars window - !Draw toolbox (goes partly off bottom) - !Edit 'Find text' window (particularly with 'Magic characters' or - 'Wildcarded expressions' turned on - - - c) Some applications may create windows and then assume that the -window has been created that size, and then create icons in that -window assuming that size. The icons will then appear in the wrong -place, eg overlapping other icons. - - Examples of this are:- - - !Paint tool window with various tools selected (eg use sprite as brush) - - d) Some applications may create windows aligned with the bottom of the -screen, such that the title bar goes completely off the top of the screen. -The window therefore cannot be moved. - - Examples of this are:- - - Some !Impression windows. - - e) Some applications which use sprites to update their windows, always use -a fixed number of pixels for their windows. The inside of the window -therefore does not appear double size. - - Examples of this are:- - - PC emulator (in a window). diff --git a/Doc/Modes b/Doc/Modes deleted file mode 100644 index 7834714..0000000 --- a/Doc/Modes +++ /dev/null @@ -1,40 +0,0 @@ -Modes we can do: - -DRAM-only system: Peak bandwidth used (x 1E6 bytes/sec) -Total bandwidth available - = 46.5E6 bytes/sec - - 640 x 480 (72Hz) at 8bpp 31.5 - - 800 x 600 (56Hz) at 8bpp 36 - 800 x 600 (60Hz) at 8bpp 40 - 800 x 600 (72Hz) at 4bpp 25 - - 1024 x 768 (60Hz) at 4bpp 32.5 - 1024 x 768 (70Hz) at 4bpp 37.5 - -1M VRAM system: -Total bandwidth available -= 80E6 bytes/sec - - 640 x 480 (72Hz) at 16bpp 63 - - 800 x 600 (56Hz) at 16bpp 72 - 800 x 600 (60Hz) at 16bpp 80 - 800 x 600 (72Hz) at 8bpp 50 - - 1024 x 768 (60Hz) at 8bpp 65 - 1024 x 768 (70Hz) at 8bpp 75 - -2M VRAM system: -Total bandwidth available -= 160E6 bytes/sec - - 640 x 480 (72Hz) at 32bpp 126 - - 800 x 600 (56Hz) at 32bpp 144 - 800 x 600 (60Hz) at 32bpp 160 - 800 x 600 (72Hz) at 16bpp 100 - - 1024 x 768 (60Hz) at 16bpp 130 - 1024 x 768 (70Hz) at 16bpp 150 diff --git a/Doc/MonLead b/Doc/MonLead deleted file mode 100644 index 4acaf4a..0000000 --- a/Doc/MonLead +++ /dev/null @@ -1,108 +0,0 @@ -; > Doc.MonLead - - Title: MonLead - Author: Tim Dobson - Version: 0.04 - Started: 19-Mar-91 - Last updated: 24-Apr-92 - Status: Incomplete - History: - 19-Mar-91 TMD Created - 19-Mar-91 TMD Updated - 10-Apr-91 TMD Added documentation of Service_MonitorLeadTranslation - 24-Apr-92 TMD Corrected information to match bodge for LiteOn monitor - - Automatic detection of monitor type from monitor lead ID pins - ============================================================= - -Some RISC OS computers have circuitry which allows the detection of the -state of ID pins on the monitor connector. This allows the computer to -distinguish between most types of monitor, and adjust its video output -accordingly. - -To support this, a number of changes have been made to RISC OS:- - -a) To simplify the interface, the commands *Configure Mode and -*Configure WimpMode have been merged. Both commands control the same CMOS -location. Therefore the same screen mode will be selected on startup -irrespective of whether the desktop is being used. - -b) The commands *Configure Mode/WimpMode, *Configure MonitorType, and -*Configure Sync now take the keyword Auto as an alternative to a numeric -parameter. If this option is configured, then RISC OS will determine a -reasonable default for the particular parameter, based on the type of -monitor plugged in. - -As the default is for all three to be set to Auto, the user should only have -to change the settings if he has a type of monitor which is not recognised -properly, or if he wishes to use a different screen mode from the chosen -default. - -c) The effect of holding certain keys down on power-on is slightly changed:- - -Key held down on power-on Settings of CMOS RAM - -R or Delete MonitorType Auto, Mode/WimpMode Auto, Sync Auto, and all the rest it used to -T or Copy MonitorType Auto, Mode/WimpMode Auto, Sync 0 (separate syncs), and all the rest -Keypad 0 to 9 MonitorType 0 to 9 -Keypad dot MonitorType Auto, Mode/WimpMode Auto, Sync Auto - -d) A new service has been added which allows unknown values of the monitor -ID to be recognised by modules and converted into the appropriate monitor -type number, sync type and default mode, as follows:- - -Service_MonitorLeadTranslation (&76) - - in: R1 = service code (&76) - R2 = monitor lead ID (see below) - - out: If monitor lead ID is recognised, then the module should set - R1 = 0 (claim service) - R3 = default screen mode number to use on this type of monitor - R4 = monitor type number to use (as used in *Configure MonitorType) - R5 = sync type to use on this type of monitor - (0 => separate syncs, 1 => composite sync) - All other registers must be preserved. - - If the monitor lead ID is not recognised, the module should preserve - all registers. - -The monitor connector provides 4 ID pins, ID0-ID3. Each of these may be -connected to 0v, +5v or to the Hsync pin. The monitor lead ID therefore -represents the state of the 4 ID pins by 8 bits as follows:- - - Bit 0 Bit 1 State of ID0 - Bit 2 Bit 3 State of ID1 - Bit 4 Bit 5 State of ID2 - Bit 6 Bit 7 State of ID3 - - 0 0 Tied to 0v - 1 0 Tied to +5v - 0 1 Tied to Hsync - 1 1 Inderminate - either the state is fluctuating - or machine is not capable of reading the ID - -The service is issued when SWI OS_ReadSysInfo is called with R0=1 (see -document 'ReadSysInf') if any of the configured Mode/MonitorType/Sync are -set to Auto. - -If the service is not claimed, then RISC OS checks the monitor lead ID -against the following list of recognised IDs:- - -Monitor ID pins Monitor type Sync type Default mode -0=0v,1=+5v,H=Hsync, -X=don't care - Pin 0 1 2 3 - - 1 1 H X 1 (Multisync) 1 (composite) 27 - 1 0 1 X 3 (Mono VGA) 0 (separate) 27 - 0 1 1 X 3 (Colour VGA) 0 (separate) 27 - 0 1 0 X 1 (Multisync) * 0 (separate) 27 - H 1 1 X 0 (TV standard) 1 (composite) 12 - -For all other ID values RISC OS uses the TV standard monitor settings. - -* This entry should really be monitor type 4 (Super VGA). However the LiteOn -monitor returns this monitor ID, even though it can do the TV standard -modes. RISC OS therefore selects monitor type 1 instead, so the TV standard -and VGA standard modes can be selected on this monitor. diff --git a/Doc/PaletteV b/Doc/PaletteV deleted file mode 100644 index ca729cd..0000000 --- a/Doc/PaletteV +++ /dev/null @@ -1,120 +0,0 @@ - - Title: PaletteV - Author: Tim Dobson - History: - 11-Nov-91 TMD Adapted from ColourTrans.Doc.PaletteV - 25-Nov-91 TMD Changed a bit about setting flashing colours - -From RISC OS 3.03 onwards, the kernel has a default entry on PaletteV. Also, -a number of additional reason codes have been added, to facilitate the -implementation of the LCD drivers for Perth. - -The new specification for PaletteV is as follows:- - -R4 holds a reason code on entry to the vector. Any owner of the vector which -has carried out the operation requested should set R4 to zero and claim the -vector. - - Reason codes - ============ - - 1 - Read palette - - in: R0 = logical colour - R1 = type of colour (16,17,18,24,25) - R4 = 1 (reason code) - - out: R2 = 1st flash colour (&BBGGRRSS) - device colour - R3 = 2nd flash colour (&BBGGRRSS) - device colour - R4 = 0 => operation complete - - 2 - Set palette - - in: R0 = logical colour - R1 = type of colour (16,17,18,24,25) - R2 = &BBGGRRSS - device colour - R4 = 2 (reason code) - - out: R4 = 0 => operation complete - - 3 - Set first flash state - - in: R4 = 3 (reason code) - - out: R4 = 0 => operation complete - - 4 - Set second flash state - - in: R4 = 4 (reason code) - - out: R4 = 0 => operation complete - - 5 - Set default palette - - in: R4 = 5 (reason code) - - out: R4 = 0 => operation complete - - 6 - Blank/unblank screen (only available from RISC OS 3.08 onwards) - - in: R0 = -1 (read blank state) - or 0 (unblank screen) - or 1 (blank screen) - R4 = 6 (reason code) - - out: R0 = old state (0=unblanked, 1=blanked) - R4 = 0 => operation complete - - This call blanks or unblanks the screen, independently of the current - palette settings. - -In the SS bits mentioned in calls 1 and 2 above, bit 7 is the current -supremacy bit, other bits are reserved. - - How old OS calls map onto PaletteV - ---------------------------------- - -Initial suggestions were that VDU 19 and OS_Word(12) should ignore the -bottom 4 bits of RGB values passed to them, and duplicate the top 4 bits in -the bottom 4 bits before calling PaletteV. This was so that old style -programs which set the low nybbles to zero would work correctly on machines -with 8-bit per gun palette hardware. - -However, I believe that this damages the usefulness of the above calls -unnecessarily. As long as the default palettes read back true 8-bit values, -and the PaletteUtil module duplicates the nybbles when setting the colours, -it should not be necessary to alter the parameters to VDU 19 and -OS_Word(12). - -So the OS will pass the values through to PaletteV, and, assuming there is -no-one else on the vector, will get the values itself. At this point it will -just store the top 4 bits of each value in its soft copy, and in the -hardware if appropriate (when setting the 1st and 2nd flashing colours it -only updates the hardware if that flash state is current). - -The calls to read the palette on earlier versions of the OS return a value -which corresponds to how the palette entry was programmed, ie 0..15 if a BBC -style colour was selected, 16 if steady RGB colours were used, 17 or 18 for -flashing colours, 24 for border colours and 25 for pointer colours. - -Since PaletteV does not return this information, the OS will try to make up -this information itself. It can easily cope with the 24,25 cases. If the two -colours returned are different, it will substitute 17 or 18 as appropriate, -otherwise it will use 16. It will no longer return values in the range 0 to -15. - -Also, when setting the palette, PaletteV does not understand BBC colours -0..15. In order to provide the necessary functionality, the OS calls to set -the palette will trap these values and convert them to type 16 calls (for -0..7) or pairs of type 17 and type 18 calls. - -This requires a slight change to the specification of what type 17 and 18 -calls do. At the moment, these calls NEVER update the VIDC palette, instead -they only update the relevant soft copy, and when/if the flash state -changes, the colours are updated. But programming a BBC flashing colour -takes effect immediately even if the flash state is 'frozen'. - -I therefore propose to make the 17 and 18 calls also update the VIDC palette -if the current state is 1st or 2nd respectively. It's still not quite ideal -because you really want to update both flash colours atomically, in case the -state changed in between the two calls. diff --git a/Doc/PrivDoc/5thColumn/Concept b/Doc/PrivDoc/5thColumn/Concept deleted file mode 100644 index 50565e9..0000000 --- a/Doc/PrivDoc/5thColumn/Concept +++ /dev/null @@ -1,59 +0,0 @@ -; > 5thColumn.Concept - - RISC OS Support for extension ROMs - ================================== - - Author: Tim Dobson - Status: Draft - Issue: 0.02 - History: - - Date Revision Changes - - 11-Oct-90 0.00 Started - 16-Oct-90 0.01 Completed first draft - 04-Feb-91 0.02 Updated to reflect reality - -This document describes the purpose of the extension ROM system and -discusses various design issues. For the full technical documentation, refer -to the document "5thColumn.Manual". - -The extension ROM system allows the development of hardware platforms fitted -with a normal 32 bit wide RISC OS ROM set plus one or more 8, 16 or 32 bit -ROMs or EPROMs containing software modules which add to or replace modules -in the main ROM set. This allows the same main ROM set to be used in a wider -variety of hardware platforms, removing the extra cost and lead times of -re-romming, and possibly reducing costs by allowing bulk purchase of the -main ROM set. - -The extension ROM(s) appear in the memory map in unused parts of the low -(&03400000 to &037FFFFF) or high (&03800000 to &03FFFFFF) ROM areas. A 32 -bit wide extension ROM set is directly executable in place, saving on user -RAM. 8 or 16 bit wide sets have to be copied into RAM to execute. By using -the low ROM area (whose access time is programmable independently from the -high area containing the main ROM set) slow EPROMs can be used. - -A particularly attractive configuration might be to have 8 ROM sockets on -the board, 4 for the main ROM set, and the other 4 capable of taking either -one 32 bit wide set (eg a large set of applications eg Internet) or up to 4 -individual 8 bit wide ROMs containing smaller applications or utilities. - -The scheme also allows a machine to have limited protection against -unauthorised access, if the extension ROM contains a module which requires a -password to be entered before continuing. - -In order to allow different sizes of EPROMs to be used without having to -have links on the board, the software will look for extension ROMs at higher -addresses first, and work backwards. This means that the high order address -lines (which should be tied to +5v on smaller sizes of EPROM) will be pulled -high initially, although they will be pulled low later on when looking for -further extension ROMs. - -The way in which the kernel initialises modules has been changed. If there -is more than one version of the same module present in the ROM (which -includes the main ROM, expansion card ROMs and extension ROMs) then only the -newest version of the module is initialised. If an extension ROM contains a -newer version of a module in the main ROM, then the newer version will be -initialised at the point in the initialisation sequence where the main ROM -version would have been initialised. This allows main ROM modules to be -replaced without the problems associated with initialisation order. diff --git a/Doc/PrivDoc/MMPM b/Doc/PrivDoc/MMPM deleted file mode 100644 index 57ea4e0..0000000 --- a/Doc/PrivDoc/MMPM +++ /dev/null @@ -1,54 +0,0 @@ -; > PrivDoc.MMPM - -Still to do on memory management, as of 26-May-93: - -; Must be TMD - - + Make SoftCAMMap variable size - + Finish routine to allocate backing L2 for an area - + Write routine to allocate logical addresses for areas - + Write routine to check for overlapping areas - + Complete Create dynamic area routine - (done apart from final OS_ChangeDynamicArea to get required size) - + Write Remove dynamic area routine - (done apart from initial OS_ChangeDynamicArea to shrink to zero size) - + Write Return info on dynamic area routine - + Write Enumerate dynamic areas routine - + Write Renumber dynamic areas routine - + Change OS_ReadDynamicArea to use new list - + Change OS_ValidateAddress to use new list - + Put in new error messages properly - * If CreateArea fails to grow area to required size, it should kill area and return error - * Change ChangeDynamicArea code to use lists: - + Check enough is working for Wimp_ClaimFreeMemory to use OS_DynamicArea(create) - * Check PreShrink and PostShrink work completely OK - * Check PreGrow and PostGrow work (apart from passing in page blocks) - * Migrate existing areas to new world: - * Update InitDynamicAreas initially to fake up a node for the RMA, and check it works - * Use DynamicArea_Create to create RMA from scratch (if feasible) - * Update InitDynamicAreas to fake up a node for the system heap + check it (no way of using create routine) - * Change OS_ReadRAMFsLimits to use OS_ReadDynamicArea - * Write RAMFS area handlers - * Create RAMFS dynamic area using DynamicArea_Create, + check it works - * Do similar for font cache, sprite area - - * Put in code to split grow block into chunks, and create page blocks (without checking for updates from PreGrow) - * Put in checks for PreGrow requesting particular pages, and call alternative code: - * Do the double shuffle - * Issue Service_PagesUnsafe/Safe - * Stop it getting the static pages (esp. cursor/sound page, L1 and maybe L2) - * Put in extra code to cope with doubly-mapped areas - * Write area handlers for screen, and move it to new world - * Change size of application space to 24M (check all refs to 16M in whole image) - * Put in indirections for hardware vector poking - * Change FPE to use indirections (KWelton) - * Move RMA to &02100000, and change size of app space to 28M - * Conversion to do late aborts - -; Could be done by ANOther - - * OS_Memory: - a) conversion bits - b) read phys.memory arrangement - c) read amounts of various sorts of memory - d) read controller addresses \ No newline at end of file diff --git a/Doc/PrivDoc/ScreenMode b/Doc/PrivDoc/ScreenMode deleted file mode 100644 index 410e776..0000000 --- a/Doc/PrivDoc/ScreenMode +++ /dev/null @@ -1,92 +0,0 @@ -; > PrivDoc.ScreenMode - -Still to do on screen mode selection, as of 21-Jul-93: - -Key: + Done and tested - - Done but not tested - * Still to do - x Not done for a good reason - - + Make OS_ReadModeVariable work with mode selectors - + OS_ScreenMode(ReturnMode) - + OS_ScreenMode(EnumerateModes) - + Create variable holding video bandwidth - + Add this reason code to just load up video bandwidth, VideoSize and issue service - + Service_ModeExtension additions - + Load up r4 and r5 with video bandwidth, VideoSize respectively - + Change vdugrafg:SetUpSprModeData:04 to check for mode selector, and goto 10 if so - + Check other occurrences of BranchIfKnownMode to look for similar bits - + Put code to handle new sprite mode word into PushModeInfo (any monitor only?) - + Remove new sprite mode word fudging in vdugrafg:SetupSprModeData and - vdugrafl:SwitchOutputToSprite - + Make SwitchOutputToSprite(new format) set up ECFIndex (it doesn't at the moment!) - + Make sure tests for equal mode numbers don't assume equal ptrs to mode selectors are equivalent - + Modify NewModes module to respond to Service_EnumerateScreenModes, to test enumeration. - + OS_ScreenMode(SetMonitorType) - + Allocate soft copy for monitortype - + Write routine to update soft copy from CMOS - + Call this routine in initialisation - + Make *Configure MonitorType update soft copy - + Change ReadMonitorType to read from soft copy - + Add this reason code to either store given value or update from CMOS - + Make sprites which have mode selectors as their mode word illegal - + Move conversion of mode selectors to new format sprite mode words - into PreCreateHeader, rather than PostCreateHeader, so that it - doesn't call SetupSprModeData with a (now illegal) mode selector - -> MT ScreenModes module - - -> AG Make switch output to sprite for a new format sprite make mode selector for current mode? - - -> AG *ScreenSave in mode 50 seems to produce a sprite with a palette. - - -> NK Trying to set a WimpMode with XEigFactor=27 caused data abort. - Investigate and/or range-limit values. - - -> AG Put in support for returning errors from PushModeInfo (for bad mode - selectors and new format sprite mode words): - + Make mode change routine check for error from PushModeInfo and FindOKMode - + Make FindSubstitute check errors from PushModeInfo - + Make FindOKMode check errors from FindSubstitute - + Make CheckModeValid check errors from FindOKMode - + Make SetupSprModeData capable of returning errors: - + Ditto SpriteV handler (already OK) - + Ditto PreCreateHeader - + Ditto CreateHeader - + Ditto GetSprite - -> AG Make SwitchOutputToSprite/Mask check errors from PushModeInfo - - - Design and code algorithm for working out FIFO reload position for VIDC20 - (Still need explanation from ARM of why 7 quad-words doesn't always work) - - * OS_ScreenMode(SelectMode) - + Make normal mode selection routine into a subroutine - + Write veneers to put round call to this in OS_ScreenMode(SelectMode) - * Change actual mode change code to cope with mode selectors - + Prevent main routine looking at shadow bit in mode selector - + Modify FindOKMode to cope with mode selector - + Modify OS_CheckModeValid to cope with mode selector - + Make all pushed mode variables into words (not bytes) - + Modify PushModeInfo to cope with mode selector - + Make YEigFactor default to 2 if yres < xres/2 (and change spec. to reflect that) - + Make numbered modes work after loading mode file - + Allocate space for OS copy of mode selector - x Make OS mode selector part of saved VDU context - (not needed since sprites can't have mode selectors as their mode) - x Sort out internal mode variables PalIndex, ECFIndex wrt - converting existing mode numbers into mode selectors (no need, still use old workspace-getting code) - x Make mode selector blocks for all existing numbered modes - (no need, constructed on fly since only needed during svc call) - * Check that copying mode selector has no adverse effects - * Sort out why issuing a mode change with invalid mode selector doesn't give error - * Modify FindOKMode to cope with 16 and 32 bpp modes somehow - - * Prevent pointer position from going into the sync pulse (causes screen picture disruption) - - * Adjust borders on all modes, to cope with VIDC20 problem - (Needs algorithm from ARM that works!) - - * Mode change happily passes round any old rubbish to Service_ModeExtension - it should:- - * First check that value is word-aligned - if not it may be a new sprite mode word - * Do a Validate_Address on fixed bit of block? - - * What should *ScreenLoad do with a new format sprite? diff --git a/Doc/ReadSysInf b/Doc/ReadSysInf deleted file mode 100644 index ee05c1a..0000000 --- a/Doc/ReadSysInf +++ /dev/null @@ -1,129 +0,0 @@ -; > Doc.ReadSysInf - - Title: ReadSysInf - Author: Tim Dobson - Version: 0.03 - Started: 19-Mar-91 - Last updated: 21-Oct-91 - Status: Preliminary - History: - 19-Mar-91 TMD Created - 04-Apr-91 TMD Updated OS_ReadSysInfo(2) - - Extensions to SWI OS_ReadSysInfo in RISC OS 2.11 and later versions - =================================================================== - -SWI OS_ReadSysInfo has been extended since RISC OS 2.00 - the full -specification is as follows:- - -***************************************************************************** - - SWI OS_ReadSysInfo - Read various system information - - in: R0 = reason code - - out: Depends on reason code - - Reason codes:- - -------------------------------------------------------------------------- - - in: R0 = 0 - out: R0 = amount of configured screen memory, in bytes - -This sub-call is the same as on RISC OS 2.00, with the exception that two -bugs in the call have been fixed:- - - a) It no longer goes wrong if less than 20K configured on 8K or 16K page -size machine; - - b) It now properly ignores the top bit of the CMOS location holding the -configured value. - -------------------------------------------------------------------------- - - in: R0 = 1 - out: R0 = Configured Mode/WimpMode - R1 = Configured MonitorType - R2 = Configured Sync - -Note that from RISC OS 2.09 onwards, the configured Mode and WimpMode have -been merged. Both *Configure Mode and *Configure WimpMode control the same -CMOS RAM location. - -Note also that if any of Mode/WimpMode, MonitorType or Sync have been -configured to Auto (see "Doc.MonLead"), then the appropriate value for the -attached monitor will be returned. - -------------------------------------------------------------------------- - - in: R0 = 2 - out: R0 = IOEB ASIC presence flag - 0 => absent - 1 => present (type 1) - Other values are reserved for future versions of IOEB which are - not backwards compatible. - - R1 = 82C710 (or similar) presence flag - 0 => absent - 1 => present - - R2 = LCD ASIC presence flag - 0 => absent - 1 => present (type 1) - Other values are reserved for future versions of LCD ASIC which - are not backwards compatible. - - R3 = word 0 of unique machine ID - R4 = word 1 of unique machine ID - -Some RISC OS computers are fitted with a chip providing a machine ID number -which is unique to each computer. Machines not fitted with an ID will return -zero in both R3 and R4. - -------------------------------------------------------------------------- - - in: R0 = 3 (*** Only available from RISC OS 3.01 onwards ***) - out: R0 = 82C710/82C711 basic features mask 82C710 82C711 - Bits 0..3 Basic IDE type 1 1 - Bits 4..7 Basic FDC type 1 1 - Bits 8..11 Basic parallel port type 1 1 - Bits 12..15 Basic 1st serial port type 1 1 - Bits 16..19 Basic 2nd serial port type 0 1 - Bits 20..23 Basic Configuration type 1 2 - Bits 24..31 Reserved - - R1 = 82C710/82C711 extra features mask - Reserved for upwards compatible additional functionality - - R2-R4 Undefined (reserved for future expansion) - -The 82C710 family of chips are composed of several sub-units, each of which -might change under future revisions of the chip. Current sub-units are as -follows: - - IDE hard disc interface - Floppy disc interface - Parallel port - Serial port 1 - Serial port 2 (only present in 82C711) - Chip configuration (different on 82C710 and 82C711) - -New versions of the chip may have some sub-units which are incompatible with -earlier versions, while leaving the functionality of other sub-units -unchanged. - -This call allows drivers which are only interested in particular sub-units -to tell whether they can work on the particular hardware running in the -machine. - -Different values of each sub-field correspond to incompatible versions of -the corresponding sub-unit. A sub-field of zero indicates that the sub-unit -is not present. - -If a sub-unit gains additional backwards-compatible functionality in future -versions of the chip, this will be indicated by having bits set in the value -returned in R1. - -Information on extra sub-units will be accomodated in the remaining bits of -R0, or in R2-R4. diff --git a/Doc/TVmodesMed,dde b/Doc/TVmodesMed,dde deleted file mode 100644 index 8ab0e28..0000000 --- a/Doc/TVmodesMed,dde +++ /dev/null @@ -1,1337 +0,0 @@ -%OP%VS4.13 (28-Apr-92), Tim Dobson, R4001 0202 1006 4799 -%OP%FGTrinity.Medium -%OP%FS12000 -%OP%WC162,1898,210,1494,1,22,0,0 -%CO:A,2,0%%CO:B,17,72%Medusa screen modes - -This spreadsheet gives the horizontal and vertical timings for the Medusa screen modes. -For the numbered screen modes, these timings are almost identical to the RISC OS 3 timings. - -However, on VIDC1 the horizontal front and back porch timings are forced to be an odd -number of pixel times, whereas on VIDC20 they have to be even, therefore all horizontal back -porch timings have been reduced by one pixel, and front porch timings increased by one pixel. - -The figures below show that our timings for the 800 x 600 modes differ from the VESA -manufacturing guidelines in that we have hsync=100, hbpch=100, whereas they have -hsync=72, hbpch=128; ie the total times are the same, and the time from the start of the hsync -pulse to the start of the display area is the same, but our sync is wider. It is likely that I will -change RISC OS to match the VESA standard - I don't believe this will have an effect on the -horizontal position of the display (this is something I will have to check out). - -It is likely that as well as adding the VESA modes described below, RISC OS will also -provide several modes obtained by doubling the dot frequency of standard modes, eg 1280 x -480, 1600 x 600, 2048 x 768. - -It may also be possible to provide 1280 x 1024 at some pixel depths, although this may -involve running VIDC20 and/or the VCO out of specification. I don't have any timing -diagrams for 1280 x 1024; if you can get hold of these (is there a VESA standard for this?) it -would help establish the feasibility of this (the Taxan 875 Plus LR monitor spec. gives the line -frequency for this at 60 and 70Hz frame rates, but not the detailed timings (eg the dot -frequency)). - -Tim (22-Mar-93). - -Horizontal parameters for Monitortype 1 modes - - - -0,3,4,8,11,12,14,15 - - -1,2,5,6,7,9,10,13 - - -16,17,24 - - -33,34,35,36 -(overscan) - -18,19,20,21 - - -25,26,27,28 -(VGA) - -29,30,31 -(SVGA) - -37,38,39,40 -(DTP - ega) - -41,42,43 -(EGA - pcemu) - -44,45,46 -(CGA - pcemu) - -800 x 600 (56 Hz) -VESA guideline - -800 x 600 (60 Hz) -VESA guideline - -800 x 600 (72 Hz) -VESA standard - -1024 x 768 (60 Hz) -VESA guideline - -1024 x 768 (70 Hz) -VESA standard - - - -Vertical parameters - -0,1,2,4,5,8,9,10 -12,13,15,16,24 - -3,6,7,11,14,17 - - 33,34,35,36 - -18,19,20,21 - -25,26,27,28 - -29,30,31 - -37,38,39,40 - -41,42,43 - -44,45,46 - -800 x 600 (56 Hz) -VESA guideline - -800 x 600 (60 Hz) -VESA guideline - -800 x 600 (72 Hz) -VESA standard - -1024 x 768 (60 Hz) -VESA guideline - -1024 x 768 (70 Hz) -VESA standard -%CO:C,6,60% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sync - -%V%%R%%D0%72 -%V%%R%C34/M34*1000 - -%V%%R%%D0%36 -%V%%R%C37/M37*1000 - -%V%%R%%D0%108 -%V%%R%C40/M40*1000 - -%V%%R%%D0%76 -%V%%R%C43/M43*1000 - -%V%%R%%D0%56 -%V%%R%C46/M46*1000 - -%V%%R%%D0%96 -%V%%R%C49/M49*1000 - -%V%%R%%D0%100 -%V%%R%C52/M52*1000 - -%V%%R%%D0%118 -%V%%R%C55/M55*1000 - -%V%%R%%D0%76 -%V%%R%C58/M58*1000 - -%V%%R%%D0%72 -%V%%R%C61/M61*1000 - -%V%%R%%D0%72 -%V%%R%C64/M64*1000 - -%V%%R%%D0%128 -%V%%R%C67/M67*1000 - -%V%%R%%D0%120 -%V%%R%C70/M70*1000 - -%V%%R%%D0%136 -%V%%R%C73/M73*1000 - -%V%%R%%D0%136 -%V%%R%C76/M76*1000 - - - -(rasters) - -%V%%R%%D0%3 - - -%V%%R%%D0%3 - -%V%%R%%D0%3 - -%V%%R%%D0%3 - -%V%%R%%D0%2 - -%V%%R%%D0%2 - -%V%%R%%D0%3 - -%V%%R%%D0%3 - -%V%%R%%D0%3 - -%V%%R%%D0%2 - - -%V%%R%%D0%4 - - -%V%%R%%D0%6 - - -%V%%R%%D0%6 - - -%V%%R%%D0%6 -%CO:D,6,48% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - porch - -%V%%R%%D0%62 -%V%%R%D34/M34*1000 - -%V%%R%%D0%30 -%V%%R%D37/M37*1000 - -%V%%R%%D0%72 -%V%%R%D40/M40*1000 - -%V%%R%%D0%82 -%V%%R%D43/M43*1000 - -%V%%R%%D0%112 -%V%%R%D46/M46*1000 - -%V%%R%%D0%46 -%V%%R%D49/M49*1000 - -%V%%R%%D0%100 -%V%%R%D52/M52*1000 - -%V%%R%%D0%58 -%V%%R%D55/M55*1000 - -%V%%R%%D0%36 -%V%%R%D58/M58*1000 - -%V%%R%%D0%162 -%V%%R%D61/M61*1000 - -%V%%R%%D0%128 -%V%%R%D64/M64*1000 - -%V%%R%%D0%88 -%V%%R%D67/M67*1000 - -%V%%R%%D0%64 -%V%%R%D70/M70*1000 - -%V%%R%%D0%160 -%V%%R%D73/M73*1000 - -%V%%R%%D0%144 -%V%%R%D76/M76*1000 - - - - - -%V%%R%%D0%16 - - -%V%%R%%D0%16 - -%V%%R%%D0%19 - -%V%%R%%D0%18 - -%V%%R%%D0%32 - -%V%%R%%D0%22 - -%V%%R%%D0%9 - -%V%%R%%D0%9 - -%V%%R%%D0%34 - -%V%%R%%D0%22 - - -%V%%R%%D0%23 - - -%V%%R%%D0%23 - - -%V%%R%%D0%29 - - -%V%%R%%D0%29 -%CO:E,6,36% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - border - -%V%%R%%D0%88 -%V%%R%E34/M34*1000 - -%V%%R%%D0%44 -%V%%R%E37/M37*1000 - -%V%%R%%D0%106 -%V%%R%E40/M40*1000 - -%V%%R%%D0%0 -%V%%R%E43/M43*1000 - -%V%%R%%D0%0 -%V%%R%E46/M46*1000 - -%V%%R%%D0%0 -%V%%R%E49/M49*1000 - -%V%%R%%D0%0 -%V%%R%E52/M52*1000 - -%V%%R%%D0%0 -%V%%R%E55/M55*1000 - -%V%%R%%D0%0 -%V%%R%E58/M58*1000 - -%V%%R%%D0%0 -%V%%R%E61/M61*1000 - -%V%%R%%D0%0 -%V%%R%E64/M64*1000 - -%V%%R%%D0%0 -%V%%R%E67/M67*1000 - -%V%%R%%D0%0 -%V%%R%E70/M70*1000 - -%V%%R%%D0%0 -%V%%R%E73/M73*1000 - -%V%%R%%D0%0 -%V%%R%E76/M76*1000 - - - - - -%V%%R%%D0%17 - - -%V%%R%%D0%20 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - - -%V%%R%%D0%0 - - -%V%%R%%D0%0 - - -%V%%R%%D0%0 - - -%V%%R%%D0%0 -%CO:F,6,24% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -display - -%V%%R%%D0%640 -%V%%R%F34/M34*1000 - -%V%%R%%D0%320 -%V%%R%F37/M37*1000 - -%V%%R%%D0%1056 -%V%%R%F40/M40*1000 - -%V%%R%%D0%768 -%V%%R%F43/M43*1000 - -%V%%R%%D0%640 -%V%%R%F46/M46*1000 - -%V%%R%%D0%640 -%V%%R%F49/M49*1000 - -%V%%R%%D0%800 -%V%%R%F52/M52*1000 - -%V%%R%%D0%896 -%V%%R%F55/M55*1000 - -%V%%R%%D0%640 -%V%%R%F58/M58*1000 - -%V%%R%%D0%640 -%V%%R%F61/M61*1000 - -%V%%R%%D0%800 -%V%%R%F64/M64*1000 - -%V%%R%%D0%800 -%V%%R%F67/M67*1000 - -%V%%R%%D0%800 -%V%%R%F70/M70*1000 - -%V%%R%%D0%1024 -%V%%R%F73/M73*1000 - -%V%%R%%D0%1024 -%V%%R%F76/M76*1000 - - - - - -%V%%R%%D0%256 - - -%V%%R%%D0%250 - -%V%%R%%D0%288 - -%V%%R%%D0%512 - -%V%%R%%D0%480 - -%V%%R%%D0%600 - -%V%%R%%D0%352 - -%V%%R%%D0%352 - -%V%%R%%D0%200 - -%V%%R%%D0%600 - - -%V%%R%%D0%600 - - -%V%%R%%D0%600 - - -%V%%R%%D0%768 - - -%V%%R%%D0%768 -%CO:G,6,30% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - border - -%V%%R%%D0%88 -%V%%R%G34/M34*1000 - -%V%%R%%D0%44 -%V%%R%G37/M37*1000 - -%V%%R%%D0%106 -%V%%R%G40/M40*1000 - -%V%%R%%D0%0 -%V%%R%G43/M43*1000 - -%V%%R%%D0%0 -%V%%R%G46/M46*1000 - -%V%%R%%D0%0 -%V%%R%G49/M49*1000 - -%V%%R%%D0%0 -%V%%R%G52/M52*1000 - -%V%%R%%D0%0 -%V%%R%G55/M55*1000 - -%V%%R%%D0%0 -%V%%R%G58/M58*1000 - -%V%%R%%D0%0 -%V%%R%G61/M61*1000 - -%V%%R%%D0%0 -%V%%R%G64/M64*1000 - -%V%%R%%D0%0 -%V%%R%G67/M67*1000 - -%V%%R%%D0%0 -%V%%R%G70/M70*1000 - -%V%%R%%D0%0 -%V%%R%G73/M73*1000 - -%V%%R%%D0%0 -%V%%R%G76/M76*1000 - - - - - -%V%%R%%D0%17 - - -%V%%R%%D0%20 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - - -%V%%R%%D0%0 - - -%V%%R%%D0%0 - - -%V%%R%%D0%0 - - -%V%%R%%D0%0 -%CO:H,6,20% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - porch - -%V%%R%%D0%74 -%V%%R%H34/M34*1000 - -%V%%R%%D0%38 -%V%%R%H37/M37*1000 - -%V%%R%%D0%88 -%V%%R%H40/M40*1000 - -%V%%R%%D0%98 -%V%%R%H43/M43*1000 - -%V%%R%%D0%88 -%V%%R%H46/M46*1000 - -%V%%R%%D0%18 -%V%%R%H49/M49*1000 - -%V%%R%%D0%24 -%V%%R%H52/M52*1000 - -%V%%R%%D0%28 -%V%%R%H55/M55*1000 - -%V%%R%%D0%16 -%V%%R%H58/M58*1000 - -%V%%R%%D0%146 -%V%%R%H61/M61*1000 - -%V%%R%%D0%24 -%V%%R%H64/M64*1000 - -%V%%R%%D0%40 -%V%%R%H67/M67*1000 - -%V%%R%%D0%56 -%V%%R%H70/M70*1000 - -%V%%R%%D0%24 -%V%%R%H73/M73*1000 - -%V%%R%%D0%24 -%V%%R%H76/M76*1000 - - - - - -%V%%R%%D0%3 - - -%V%%R%%D0%3 - -%V%%R%%D0%2 - -%V%%R%%D0%1 - -%V%%R%%D0%11 - -%V%%R%%D0%1 - -%V%%R%%D0%0 - -%V%%R%%D0%0 - -%V%%R%%D0%25 - -%V%%R%%D0%1 - - -%V%%R%%D0%1 - - -%V%%R%%D0%37 - - -%V%%R%%D0%3 - - -%V%%R%%D0%3 -%CO:I,6,10% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Total - -%V%%R%%D0%sum(C34H34) -%V%%R%I34/M34*1000 - -%V%%R%%D0%sum(C37H37) -%V%%R%I37/M37*1000 - -%V%%R%%D0%sum(C40H40) -%V%%R%I40/M40*1000 - -%V%%R%%D0%sum(C43H43) -%V%%R%I43/M43*1000 - -%V%%R%%D0%sum(C46H46) -%V%%R%I46/M46*1000 - -%V%%R%%D0%sum(C49H49) -%V%%R%I49/M49*1000 - -%V%%R%%D0%sum(C52H52) -%V%%R%I52/M52*1000 - -%V%%R%%D0%sum(C55H55) -%V%%R%I55/M55*1000 - -%V%%R%%D0%sum(C58H58) -%V%%R%I58/M58*1000 - -%V%%R%%D0%sum(C61H61) -%V%%R%I61/M61*1000 - -%V%%R%%D0%sum(C64H64) -%V%%R%I64/M64*1000 - -%V%%R%%D0%sum(C67H67) -%V%%R%I67/M67*1000 - -%V%%R%%D0%sum(C70H70) -%V%%R%I70/M70*1000 - -%V%%R%%D0%sum(C73H73) -%V%%R%I73/M73*1000 - -%V%%R%%D0%sum(C76H76) -%V%%R%I76/M76*1000 - - - - - -%V%%R%%D0%sum(C83H83) - - -%V%%R%%D0%sum(C86H86) - -%V%%R%%D0%sum(C88H88) - -%V%%R%%D0%sum(C90H90) - -%V%%R%%D0%sum(C92H92) - -%V%%R%%D0%sum(C94H94) - -%V%%R%%D0%sum(C96H96) - -%V%%R%%D0%sum(C98H98) - -%V%%R%%D0%sum(C100H100) - -%V%%R%%D0%sum(C102H102) - - -%V%%R%%D0%sum(C105H105) - - -%V%%R%%D0%sum(C108H108) - - -%V%%R%%D0%sum(C111H111) - - -%V%%R%%D0%sum(C114H114) -%CO:J,4,0% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec - -pix -usec -%CO:K,6,42% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - H Freq - KHz -%V%%R%%D3%1000/I35 - - -%V%%R%%D3%1000/I38 - - -%V%%R%%D3%1000/I41 - - -%V%%R%%D3%1000/I44 - - -%V%%R%%D3%1000/I47 - - -%V%%R%%D3%1000/I50 - - -%V%%R%%D3%1000/I53 - - -%V%%R%%D3%1000/I56 - - -%V%%R%%D3%1000/I59 - - -%V%%R%%D3%1000/I62 - - -%V%%R%%D3%1000/I65 - - -%V%%R%%D3%1000/I68 - - -%V%%R%%D3%1000/I71 - - -%V%%R%%D3%1000/I74 - - -%V%%R%%D3%1000/I77 - - - - - - -%V%%R%1000000/I35/I83 - - -%V%%R%1000000/I38/I86 - -%V%%R%1000000/I44/I88 - -%V%%R%1000000/I47/I90 - -%V%%R%1000000/I50/I92 - -%V%%R%1000000/I53/I94 - -%V%%R%1000000/I56/I96 - -%V%%R%1000000/I59/I98 - -%V%%R%1000000/I62/I100 - -%V%%R%1000000/I65/I102 - - -%V%%R%1000000/I68/I105 - - -%V%%R%1000000/I71/I108 - - -%V%%R%1000000/I74/I111 - - -%V%%R%1000000/I77/I114 -%CO:L,6,32% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - disp - cntr - usec -%V%%R%(C34+D34+E34+F34/2)/M34*1000 - - -%V%%R%(C37+D37+E37+F37/2)/M37*1000 - - -%V%%R%(C40+D40+E40+F40/2)/M40*1000 - - -%V%%R%(C43+D43+E43+F43/2)/M43*1000 - - -%V%%R%(C46+D46+E46+F46/2)/M46*1000 - - -%V%%R%(C49+D49+E49+F49/2)/M49*1000 - - -%V%%R%(C52+D52+E52+F52/2)/M52*1000 - - -%V%%R%(C55+D55+E55+F55/2)/M55*1000 - - -%V%%R%(C58+D58+E58+F58/2)/M58*1000 - - -%V%%R%(C61+D61+E61+F61/2)/M61*1000 - - -%V%%R%(C64+D64+E64+F64/2)/M64*1000 - - -%V%%R%(C67+D67+E67+F67/2)/M67*1000 - - -%V%%R%(C70+D70+E70+F70/2)/M70*1000 - - -%V%%R%(C73+D73+E73+F73/2)/M73*1000 - - -%V%%R%(C76+D76+E76+F76/2)/M76*1000 - - - - - - -Hz - - -Hz - -Hz - -Hz - -Hz - -Hz - -Hz - -Hz - -Hz - -Hz - - -Hz - - -Hz - - -Hz - - -Hz -%CO:M,6,22% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pix - clock - KHz -%V%%R%%D0%16000 - - -%V%%R%%D0%8000 - - -%V%%R%%D0%24000 - - -%V%%R%%D0%16000 - - -%V%%R%%D0%24000 - - -%V%%R%%D0%25175 - - -%V%%R%%D0%36000 - - -%V%%R%%D0%24000 - - -%V%%R%%D0%2*25175/3 - - -%V%%R%%D0%16000 - - -%V%%R%%D0%36000 - - -%V%%R%%D0%40000 - - -%V%%R%%D0%50000 - - -%V%%R%%D0%65000 - - -%V%%R%%D0%75000 - - - - - vert - center -%V%%R%%D0%(C83+D83+E83+F83/2) - - -%V%%R%%D0%(C86+D86+E86+F86/2) - -%V%%R%%D0%(C88+D88+E88+F88/2) - -%V%%R%%D0%(C90+D90+E90+F90/2) - -%V%%R%%D0%(C92+D92+E92+F92/2) - -%V%%R%%D0%(C94+D94+E94+F94/2) - -%V%%R%%D0%(C96+D96+E96+F96/2) - -%V%%R%%D0%(C98+D98+E98+F98/2) - -%V%%R%%D0%(C100+D100+E100+F100/2) - -%V%%R%%D0%(C102+D102+E102+F102/2) - - -%V%%R%%D0%(C105+D105+E105+F105/2) - - -%V%%R%%D0%(C108+D108+E108+F108/2) - - -%V%%R%%D0%(C111+D111+E111+F111/2) - - -%V%%R%%D0%(C114+D114+E114+F114/2) -%CO:N,8,0% \ No newline at end of file diff --git a/OldTestSrc/A600tlb b/OldTestSrc/A600tlb deleted file mode 100644 index 6481c8b..0000000 --- a/OldTestSrc/A600tlb +++ /dev/null @@ -1,61 +0,0 @@ -; -; A600tlb -; -; POST procedure for checking the TLB in A600 MMU. -; -; for each of level 1, level 2 small-page, level 2 large-page -; construct page table -; flush cache -; start timer -; for 32 addresses (with different mappings) -; check address mapping -; save timer -; for same 32 addresses -; check address mapping -; compare test times (did 2nd test require table walk ?) - - - - - -Use a list of addresses that cover a good mixture of virtual addresses -Build a page table that maps these to physical RAM addresses in various ways -Access the addresses in such an order that the cache rotates, scrapping -one entry each time through the list, and loading another. So each cache -entry gets used 31 times, then is lost. -Choice of physical mapping should ensure that the cache entries contain -lots of different values of page and section base addresses. -Choice of virtual test address should ensure that cache tag varies as -widely as posible, too. PRBS ? -Very widely varying values of cache tag require that a large number -of mappings exist .. if these are 2-level mappings, that requires -a lot of RAM. Page tables should be multiply-mapped. -RISC OS puts lots of stuff below the 4M mark. Limits App space to 16M -for backwards compatibility. Probably worth testing outside these -limits to ensure Gold doesn't fall over, but failure rates would be -very low. - - - - -; -; POST procedure for checking access faults (was PPL test) -; -; for each of level 1, level 2 small-page, level 2 large-page -; construct page table -; for user, supervisor mode -; check address alignment fault -; check section translation fault -; check -; check page translation fault -; for 3 domain types -; for 16 domains -; check access permissions -; - - - -; -; POST procedure for checking IDC -; -; diff --git a/OldTestSrc/Arm3 b/OldTestSrc/Arm3 deleted file mode 100644 index a385f75..0000000 --- a/OldTestSrc/Arm3 +++ /dev/null @@ -1,71 +0,0 @@ -; > TestSrc.ARM3 - - TTL RISC OS 2+ POST ARM version determination -; -; Reads ARM3 version register, returns 0 if ARM 2 fitted. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 20-Apr-89 ArtG Initial version -; -; -;------------------------------------------------------------------------ - -A3Cid CN 0 -A3Cfls CN 1 -A3Cmod CN 2 -A3Ccac CN 3 -A3Cupd CN 4 -A3Cdis CN 5 - -A3CON CP 15 - - - -ts_ARM_type - MOV r13,lr -; -; First, set up an undefined instruction vector to catch an ARM 2 -; (or a faulty ARM 3 ??) when the copro instruction is run. -; Only applies on systems where ROM isn't mapped at zero. - - [ CPU_Type = "ARM2" :LOR: CPU_Type = "ARM3" - MOV r0,#0 ; set a page at logical 0 - MOV r1,r0 - BL ts_set_cam - ADR r0,ts_ARM_undefined - LDMIA r0,{r2,r3} - MOV r1,#4 - STMIA r1,{r2,r3} ; set the undefined instruction trap - ] -; -; Read ARM3C0 version I.D. -; - MOV r0, #(-1) ; should always be altered - MRC A3CON,0,r0,A3Cid,A3Cid ; Read control register 0 - MOV r12, r0 - [ CPU_Type = "ARM2" :LOR: CPU_Type = "ARM3" - MOV r1,#0 - BL ts_set_cam_idle ; remove the vector page again - ] - MOVS r0, r12 ; return the ID (0 for ARM 2) - MOV pc,r13 - -; -; Trap to be taken when ARM 2 is fitted -; - -ts_ARM_undefined - MOV r0,#0 - MOVS pc,r14_svc -10 - ASSERT ((%10 - ts_ARM_undefined) / 4 = 2) - - - - - END - diff --git a/OldTestSrc/Begin b/OldTestSrc/Begin deleted file mode 100644 index b4b65b2..0000000 --- a/OldTestSrc/Begin +++ /dev/null @@ -1,1428 +0,0 @@ -; > TestSrc.Begin - - TTL RISC OS 2+ Power-On Self-Test -; -; Startup code for RISC OS ROM Self-Test. -; -; Performs ROM test patterns, determines test strategy and enters -; external or internal test code. -; -; A minimal set of opcodes should be used (ideally, only B, LDR and ADDS) -; so that a processor test may be validly included in the internal test -; sequence. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Rel Comment -; ---- ---- --- ------- -; 23-Feb-93 ArtG 2.00 Experimental ARM 600 / Jordan mods -; 20-Oct-93 ARTG 2.02 Changed to new conditional assembly scheme -; -;------------------------------------------------------------------------ - -; TS_STATUS should be one of : -; -; 'R' RISC OS POST -; 'S' Standalone version (with a2 memory test instead of RISCOS) -; 'T' Test build - development only -; - -TS_STATUS * "R" ; Medusa POST version 2.0x -; -TS_RELEASE * 20 -TS_CHANGES * 4 - - - GBLL POSTenabled -POSTenabled SETL {TRUE} ; don't permit POST for ordinary startup - -ts_Rom_bits * 21 ; Widest ROM address -ts_Rom_length * 1 :SHL: ts_Rom_bits ; Longest ROM -ts_highaddr_bit * 1 :SHL: 25 ; ARM address width -ts_Alias_bits * (1 :SHL: 23) ; I/F output bits -ts_recover_time * (1 :SHL: 8) ; inter-twiddle delay -ts_pause_time * 200 ; Display pause time -ts_S5_base * &3350000 ; IO register base address -ts_IOEB_ID * (ts_S5_base + &50) ; IOE_B ASIC identification -ts_IOEB_ident * &5 ; the value found there -ts_PCaddress * &3010000 ; PC IO world base address -ts_ReadyByte_00 * &90 ; signal 'Here I am' to ExtIO -ts_BBRAM * &A0 ; IIC address of clock/ram chip -ts_RamChunk * &2000 ; gap between data line tests -ts_MaxRamTest * 4*1024*1024 ; Max. DRAM tested on normal reset -ts_VIDCPhys * &3400000 ; Real location of VIDC - -; -; Border colours used for self-test indicators -; - [ VIDC_Type = "VIDC1a" -C_ARMOK * &40000000+&70C ; testing ROM -C_RAMTEST * &40000000+&C70 ; testing RAM -C_FAULT * &40000000+&00F ; failed tests -C_PASSED * &40000000+&7C0 ; all passed -C_WARMSTART * &40000000+&777 ; not tested - ] - - [ VIDC_Type = "VIDC20" -C_ARMOK * &40000000+&7000C0 ; testing ROM -C_RAMTEST * &40000000+&C07000 ; testing RAM -C_FAULT * &40000000+&0000F0 ; failed tests -C_PASSED * &40000000+&70C000 ; all passed -C_WARMSTART * &40000000+&707070 ; not tested - ] - -; -; Responses to external commands -; - -ErrorCmd * &00FF - - -; -; Control bitmasks used to indicate results of test to RISCOS -; - -R_SOFT * 0 ; not a power-on reset -R_HARD * 1 ; Self-test run due to POR -R_EXTERN * 2 ; external tests performed -R_TESTED * 4 ; Self-test run due to test link -R_MEMORY * 8 ; Memory has been tested -R_ARM3 * &10 ; ARM 3 fitted -R_MEMSKIP * &20 ; long memory test disabled -R_IOEB * &40 ; PC-style IO controller -R_VRAM * &80 ; VRAM present - -R_STATUS * &1ff ; bits that aren't a fault - -R_CHKFAILBIT * &100 ; CMOS contents failed checksum -R_ROMFAILBIT * &200 ; ROM failed checksum -R_CAMFAILBIT * &400 ; CAM failed -R_PROFAILBIT * &800 ; MEMC protection failed -R_IOCFAILBIT * &1000 ; IOC register test failed -R_INTFAILBIT * &2000 ; Cannot clear interrupts -R_VIDFAILBIT * &4000 ; VIDC flyback failure -R_SNDFAILBIT * &8000 ; Sound DMA failure -R_CMSFAILBIT * &10000 ; CMOS unreadable -R_LINFAILBIT * &20000 ; Page zero RAM failure -R_MEMFAILBIT * &40000 ; Main RAM test failure -R_CACFAILBIT * &80000 ; ARM 3 Cache test failure -; - [ MorrisSupport -Kludge * 96 - | -Kludge * 0 - ] - SUBT Exception vectors -; -; These vectors are available for use while the Rom is mapped into -; low memory addresses. The Reset vector will be copied to low RAM -; as part of a software reset sequence : therefore it must perform -; a fixed operation to ensure compatibility with future versions -; of RISC-OS. -; - -Reset -ts_start - $DoMorrisROMHeader - - [ :LNOT: MorrisSupport - [ ResetIndirected - LDR pc,.+ResetIndirection ; load pc from vector at &118 - | - B ts_RomPatt + PhysROM ; Jump to normal ROM space - ] - ] -01 - & ts_Rom_length ; gets patched by ROM builder -02 - & (ts_ROM_cvectors - ROM) ; pointer to code vector table -03 - & (ts_ROM_dvectors - ROM) ; pointer to data vector table -04 - & (ts_ROM_bvectors - ROM) ; pointer to branch table - B Reset ; not currently used - B Reset - B Reset - - -ts_ROMSIZE * %BT01 - ts_start -ts_CVECTORS * %BT02 - ts_start -ts_DVECTORS * %BT03 - ts_start -ts_BVECTORS * %BT04 - ts_start - -; -; Selftest version ID -; - -00 - ASSERT %B00 <= (ts_start + &2c + Kludge) - % ((ts_start + &2c + Kludge) - %B00) - -ts_ID & ((TS_STATUS :SHL: 24) + (TS_RELEASE :SHL: 16) + TS_CHANGES) - -ts_ID_text -ts_himsg - = "SELFTEST" ; **DISPLAY_TEXT** - = &89 ; Cursor position - = TS_STATUS - = ("0" + (TS_RELEASE / 10)) - = "." - = ("0" + (TS_RELEASE :MOD: 10)) - = ("0" + (TS_CHANGES :MOD: 10)) - = 0 - - -; -; These vector tables permit access by the external (or downloaded) test -; software to data and code in the POST modules. -; Find the start of these tables through the 2nd and 3rd vectors at -; the start of the ROM. -; - -ts_ROM_dvectors -01 - & ts_ID ; Selftest identification number -02 - & (ts_ID_text - ROM) ; Selftest identification text - - -; -; vectors ORd with these flags to assure proper mode when -; executed by host thro' vector table. -; - -ts_runflags * (I_bit :OR: F_bit :OR: SVC_mode) - -ts_ROM_cvectors - & ts_RomPatt :OR: ts_runflags - & ts_User_startup :OR: ts_runflags - & ts_Self_test_startup :OR: ts_runflags - & ts_Dealer_startup :OR: ts_runflags - & ts_Forced_startup :OR: ts_runflags - & ts_GetCommand :OR: ts_runflags - & ts_Softstart :OR: ts_runflags - & ts_Hardstart :OR: ts_runflags - - -; -; ROM branch vectors - intended primarily so downloaded programs -; may use standard subroutines. This table should be in a fixed place. -; - -00 - ASSERT %B00 <= (ts_start + 128 + Kludge) - % ((ts_start + 128 + Kludge) - %B00) - -ts_ROM_bvectors - B ts_RomPatt - B ts_GetCommand - B ts_SendByte - B ts_SendWord - B ts_GetByte - B ts_GetWord - B ts_SendText - B ts_MoreText - B ts_SendLCDCmd - - -; -; Pad out until the location of the ResetIndirection vector -; - - ASSERT .-ROM <= ResetIndirection - % ResetIndirection-(.-ROM) - & ts_RomPatt-ROM+PhysROM - -; -; ROM test code -; -; Note : the register order in ADDS ...pc.. is often critical. -; If we want to adjust pc, use ADDS pc,rn,pc so that the PSR is -; rewritten with it's original value. -; If we want to do some pc-relative arithmetic, use ADDS rn,pc,rn -; so that the bits from PSR are NOT used in the address calculation. -; - - SUBT Macros - - MACRO - MODE $mode_bits - TEQP psr,#($mode_bits :OR: I_bit :OR: F_bit) - NOP - MEND - - MACRO - MOV_fiq $dest,$src - MODE FIQ_mode - MOV $dest,$src - MODE SVC_mode - MEND - - MACRO - FAULT $code - MODE FIQ_mode - ORR r12_fiq,r12_fiq,$code - MODE SVC_mode - MEND - - MACRO - M32_fiq $dest,$src,$tmp1,$tmp2 - SetMode FIQ32_mode,$tmp1,$tmp2 - MOV $dest,$src - msr AL,CPSR_all,$tmp2 - MEND - - MACRO - FAULT32 $code,$tmp - SetMode FIQ32_mode,$tmp - ORR r12_fiq,r12_fiq,$code - SetMode SVC32_mode,$tmp - MEND - -; -; Define an area of storage with the required set of data bus patterns -; These are used both for testing the complete width of the data bus -; during ROM pattern testing, and will provide a tidy set of patterns -; if the reset is held, while the ARM increments addresses. -; - - SUBT ROM Address and Data Patterns - -DataPatterns - - GBLA dmask -dmask SETA &80000000 - - DCD &FFFFFFFF ; first two : all set - DCD &0 ; all clear - - GBLA OldOpt ; don't list all the walking -OldOpt SETA {OPT} ; patterns - OPT OptNoList - - WHILE dmask > 0 ; then for each bit - DCD &$dmask ; set it - DCD :NOT: &$dmask ; and clear it -dmask SETA dmask :SHR: 1 - WEND - OPT OldOpt -DEnd - - - OPT OptList -; -; -; Read the ROM at a series of addresses -; such that : a) all the address lines are exercised individually -; b) all the data lines are exercised individually -; -; Data and address lines are exercised as walking-0 and walking-1. -; The test is performed as a series of LDR operations to avoid using -; a larger instruction set. -; - -ts_RomPatt ROUT - - ; Patterns which will exercise most of the data bus. - ; All are arbitrary instructions with NV execution - - DCD &F0000000 ; walking 1 - -OldOpt SETA {OPT} ; patterns - OPT OptNoList - -dmask SETA &08000000 - WHILE dmask > 0 - DCD dmask :OR: &F0000000 -dmask SETA dmask :SHR: 1 - WEND - - DCD &FFFFFFFF ; walking 0 - -dmask SETA &08000000 - WHILE dmask > 0 - DCD (:NOT: dmask) :OR: &F0000000 -dmask SETA dmask :SHR: 1 - WEND - - OPT OldOpt - - ; Now some proper code : - ; Initialise address pointer and make MemC safe - - LDR r0,%01 - ADD pc,r0,pc -01 - & 0 ; useful constant - - [ IO_Type = "IOC-A1" ;;!! unsafe if we execute ROM at zero - LDR r1,%02 - ADD pc,r0,pc -02 ;;!! This remaps MEMC's ROM - & &E000C :OR: MEMCADR ;;!! addressing if it hasn't - STR r1,[r1] ;;!! already happened. - ] - - LDR r5,%03 ; Load r5 with a constant which - ADD pc,r0,pc ; may be added to ROM plus a -03 ; walking-zero bitmask to create - & ts_Rom_length - 3 ; a valid word address in ROM. - LDR r2,%04 ; Offset from ROM start to here - ADD pc,r0,pc -04 - & ROM - pcfromstart - - ADD r2,pc,r2 ; pointer to start of ROM - ADD r3,r2,r0 ; pointer to start of ROM -pcfromstart - ADD r4,r2,r0 ; pointer to start of ROM - - ; assembly-time loop - only 32 iterations required - -OldOpt SETA {OPT} - - GBLA doffset -doffset SETA DataPatterns - WHILE doffset < DEnd - - LDR r0,doffset ; walking 1 data pattern - LDR r1,doffset+4 ; walking 0 data pattern - LDR r6,[r2] ; walking 1 address pattern - LDR r6,[r3] ; walking 0 address pattern - - [ (doffset - DataPatterns) > ((32 - ts_Rom_bits) * 8) - [ (doffset - DataPatterns) < (31 * 8) - ADD r2,r4,r0 ; r2 = ROM + walking 1 pattern - ADD r3,r4,r1 ; r3 = ROM + walking 0 pattern - ADD r3,r3,r5 ; adjust to a valid address - ] - ] - - OPT OptNoList - -doffset SETA doffset + 8 - WEND - - ASSERT (. - doffset < 4095) ; in range without barrel shift ? - - OPT OldOpt - -; -; External interface drivers - -; provides entry points to send byte- and word- and string-sized objects -; and to receive byte- and word-sized objects -; -; Continue into GetCommand, which determines adapter type (or no adapter) -; and jumps to an ExtCmd handler, ts_User_startup, ts_Forced_startup or -; ts_Dealer_startup as appropriate. -; - B ts_GetCommand - - GET TestSrc.ExtIO - -; -; External command handlers - respond to commands given through the -; external test interface. -; - - GET TestSrc.ExtCmd - - - SUBT Selftest -; -; There is no attached test interface. Is this a power-on reset ? -; Addressing IOC will make MEMC1a remap the ROM to high memory if -; it hasn't already done it, so be careful to ensure that the -; ARM is addressing normally-addressed ROM when this code runs. -; - -ts_User_startup ROUT - LDR r0,%01 - ADD pc,r0,pc -01 - & 0 -; -; IOMD will only access the ROM until a write to IOMD has been made - -; make this write also switch on refresh so the DRAM has a chance to -; get running before the memory test starts. -; - [ MEMC_Type = "IOMD" - LDR r1,%02 - ADD pc,r0,pc -02 - & (IOMD_Base+IOMD_VREFCR) - LDR r2,%03 - ADD pc,r0,pc -03 - & IOMD_VREFCR_REF_16 - STR r2, [r1,#0] - ] - - [ POSTenabled - LDR r1,%12 ; load address of IOC IRQ register - ADD pc,r0,pc -12 - & IOC+IOCIRQSTAA - - LDR r1, [r1,#0] ; Get IRQSTAA register (hence POR bit) - LDR r2, %13 - ADD pc,r0,pc ; Constant to shift por to bit 31 -13 - & por_bit :SHL: 1 -14 ADD r1,r1,r1 - ADDS r2,r2,r2 - BCC %14 ; loop until por_bit is at bit 31 - ADDS r1,r1,r1 ; then shift it into carry - BCC ts_Self_test_end ; POR bit clear - do soft reset. - -; it's a power-on reset, so assume we can't be in 32-bit mode - - MOV_fiq r12_fiq, #R_HARD - B ts_Self_test_startup - | - B CONT ; if user POST disabled - ] -; -; Perform self - tests -; -; Any distinction between test operation for Power-up, Display-only -; and Forced tests needs to be made between these three entry points. -; - - -; This is where tests start if a dumb test link is fitted -; (a diode from A21 to *ROMCS, disabling the ROMs when A21 is high) - -ts_Forced_startup ROUT - - MOV_fiq r12_fiq, #R_TESTED - B ts_Self_test_startup - -; This is where the tests start if an external display adapter is fitted - -ts_Dealer_startup ROUT - - MOV_fiq r12_fiq, #R_EXTERN - - LDR r4,%FT02 ; make a pointer to signon string -01 ADD r4,pc,r4 - ADD pc,r0,pc -02 - & (ts_himsg - %BT01 - 8) - - ADD r14,pc,r0 ; make a return address for this 'call' - ASSERT (.+4 = ts_Self_test_startup) ; PC must point there already ! - B ts_SendText - -ts_Self_test_startup ROUT - -; This is where the power-on test starts (every user gets this) - - -; -; Processor test would go here .... if there was one. -; - -; -; From this point on we assume we can safely use all the processor -; -; Initialise VIDC : Sync mode 0, border covers screen -; - -ts_InitVIDC - [ IO_Type = "IOMD" ; If POSTbox fitted, ROM may still be mapped everywhere - MOV r2,#IOMD_Base - MOV r0, #IOMD_VREFCR_REF_16 ; switch on DRAM refresh - STR r0, [r2, #IOMD_VREFCR] - - ; choose monitor settings from ID bit 0 - MOV r1,#ts_VIDCPhys - ADRL r2,TestVIDCTAB - LDR r0,=IOMD_MonitorType - LDR r0,[r0] - ANDS r0,r0,#IOMD_MonitorIDMask - ADDEQ r2,r2,#(TestVVIDCTAB-TestVIDCTAB) - - | ; not IOMD - MOV r1,#ts_VIDCPhys - ADRL r2,TestVIDCTAB - ] - -10 LDR r0, [r2],#4 - CMP r0, #-1 - STRNE r0, [r1] - BNE %BT10 - - LDR r0,=C_ARMOK ; set initial screen colour - STR r0, [r1] - - B ts_RomTest - - - LTORG - ROUT - -; -; Calculate ROM checksum : display status and calculated checksum. -; - -1 - = "ROM :",0 -2 - = "ROM bad",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = "ROM size",&8A,&ff,&ff,&ff,&ff,&ff,&ff,0 - ALIGN - -ts_RomTest - ADR r4,%BT1 - BL ts_SendText - - BL ts_ROM_checksum - BEQ %20 - ADR r4,%BT2 ; Failed message - FAULT #R_ROMFAILBIT ; set ROM bit in r12_fiq - MOV r8,r0 ; calculated checksum - BL ts_SendText - - BL ts_ROM_alias ; Checksum failed :- - ADR r4,%BT3 ; hunt for first alias - MOV r8,r0, LSL #8 - BL ts_SendText ; and report it. -20 - - [ IO_Type = "IOC-A1" ; Don't use RISC OS MemSize - ; until much later - it sets up - ; the ARM600 MMU as well. - B ts_MEMCset - -; -; Do MEMC setup and memory size determination (the first time). -; - LTORG - ROUT - -1 - = "M Size :",0 -2 - = "M Size",&89,&ff,&ff,&ff,&ff,".",&ff,&ff,0 - ALIGN - -ts_MEMCset - MOV r12,#0 - ADR r4,%BT1 - BL ts_SendText - LDR r1,=(&E000C :OR: MEMCADR) ; MemSize expects 32k page - STR r1,[r1] - BL MemSize - -; -; MemSize returns with r0 = page size (now in bytes, *NOT* in MEMC control patterns), -; r1 = memory size (in bytes) -; r2 = MEMC control value -; -; Translate these into a number that looks like : -; -; mmmm.pp -; -; where mmmm is memory size in hex Kbytes, pp is page size in hex Kbytes. -; - MODE FIQ_mode ; Save memory size and - MOV r11_fiq,r2 ; MEMC setup value for - MOV r10_fiq,r1 ; later use - MODE SVC_mode - - MOV r8, r0, LSR #2 ; MemSize now returns actual page size in r0 - ADD r8,r8,r1,LSL #6 - ADR r4,%BT2 - BL ts_SendText - - ] - -; -; Test data, address and byte strobe lines. -; On MEMC systems, this calls MemSize and tests the memory that finds. -; On IOMD systems, memory sizing is performed along with the data line -; tests, and that result is used for address line testing. -; - - B ts_LineTest - - GBLS tsGetMem1 -tsGetMem1 SETS "GET TestSrc.Mem1" :CC: MEMC_Type - $tsGetMem1 - -; -; Test IOC. -; This shuld require vector space to work (for testing interrupts), -; but the current version just reports the status register contents. -; -; Display is ccaabbff -; -; where cc is the control register -; aa is IRQ status register A -; bb is IRQ status register B -; ff is FIQ status register -; - - B ts_IOCTest - - LTORG - ROUT - - [ IO_Type = "IOMD" -1 - = "IOMD :",0 -2 - = "IOMD-F",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = "IOMD-V" -4 - = &88,&ff,&ff,&ff,&ff," V.",&ff,0 - | -1 - = "IOC :",0 -2 - = "IOC-F",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = "IOC" -4 - = &88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - ] - ALIGN - -ts_IOCTest - ADR r4,%BT1 - BL ts_SendText - BL ts_IOCreg ; check register integrity - BEQ %FT8 - ADR r4,%BT2 - BL ts_SendText ; report if failure - - FAULT #R_IOCFAILBIT -8 - ADR r4,%BT1 - BL ts_SendText - BL ts_IOCstat - BEQ %FT10 ; fail message only printed if - ADR r4,%BT3 ; ID code unrecognised - BL ts_SendText - FAULT #R_IOCFAILBIT ; .. and set error bit if IOMD code is wrong - B %FT11 -10 - ADR r4,%BT4 ; print the status value - BL ts_MoreText -11 - - [ IO_Type = "IOMD" - B ts_CMOStest - | - B ts_IOEBtest - ] - - LTORG - ROUT - -; -; Check for presence of IOEB ASIC -; - - [ IO_Type = "IOEB" - -1 - = "IOEB :",0 -2 - = "IOEB",&88,"exists",0 - - - ALIGN - -ts_IOEBtest - ADR r4,%BT1 - BL ts_SendText - - LDR r0,=ts_IOEB_ID ; read an ID register in the IOEB ASIC - LDRB r0, [r0] - AND r0, r0, #&f - CMPS r0, #ts_IOEB_ident ; if it looks right ( == 5) .. - BNE %10 - - FAULT #R_IOEB ; set that bit in the result word - ADR r4, %BT2 - BL ts_SendText -10 B ts_CMOStest - ] ; IOEB IO world -; -; Read CMOS -; Check the checksum, read the memory test flag. -; - -1 - = "SRAM :",0 -2 - = "SRAM-F",0 -3 - = "SRAM-C",&8e,&ff,&ff,0 - ALIGN - -ts_CMOStest - ADR r4,%BT1 - BL ts_SendText - - [ ChecksumCMOS - - LDR r0,=(ts_BBRAM + &4000) - MOV r1,#&C0 ; Get first RAM area - MOV r2,#CMOSxseed - BL ts_CMOSread - BNE %20 - MOV r2, r0 - LDR r0,=(ts_BBRAM + &1000) ; Accumulate the second RAM area - MOV r1,#&2F - BL ts_CMOSread - BNE %20 - RSB r2, r0, #0 ; Subtract from the checksum byte - LDR r0,=(ts_BBRAM + &3F00) - MOV r1,#1 - BL ts_CMOSread - BNE %20 - MOV r8, r0, LSL #24 - ANDS r0, r0, #&FF ; A zero result ? - MOV r1, #R_CHKFAILBIT - ADR r4,%BT3 ; Report checksum failure - BNE %21 ; failed .. report error - ] ; end ChecksumCMOS - - LDR r0,=(ts_BBRAM + &FC00) ; Read Misc1CMOS byte - MOV r1,#1 - MOV r2,#0 - BL ts_CMOSread - BNE %20 - ANDS r0,r0,#&80 ; Test the memory-test-disable bit - BEQ %25 - FAULT #R_MEMSKIP ; If set, skip the memory test - B %25 - -20 - MOV r1,#R_CMSFAILBIT ; Real fault - set the fault bit - ADR r4,%BT2 ; Report fault accessing IIC - ; (Bitmap & POST display) -21 - FAULT r1 - BL ts_SendText ; Report one fault or another -25 - B ts_IOinit - - LTORG - ROUT -; -; Initialize various machine registers - e.g, turn off the floppy -; drive, etc, etc. -; - -1 - = "IOinit:",0 - ALIGN - -ts_IOinit - ADR r4,%BT1 - BL ts_SendText - ADRL r2,ts_IOinitab -10 - LDR r0,[r2],#4 ; Get address - LDR r1,[r2],#4 ; Get initialization data - CMPS r0,#(-1) - STRNE r1,[r0] ; write to IO port - BNE %10 - B Speedset -; -; Use the RISC OS MEMC setup code to guess the proper processor / memory -; configuration. The memory speed can then be set up correctly for -; fastest possible working, and the memory array tested in the -; configuration RISC OS expects. -; -; Display the results of the TimeCPU test as : -; -; ssss.m.r -; -; where ssss is the processor speed in hex kHz, -; m is 0 for MEMC, 1 for MEMC1a -; r is the MEMC rom speed switch setting. -; - ROUT - -1 - = "Speed :",0 -2 - = "Speed",&88,&ff,&ff,&ff,&ff,".",&ff,".",&ff,0 - - ALIGN - -Speedset - ADR r4,%BT1 - BL ts_SendText - - [ MEMC_Type = "IOMD" - MOV r9,#0 - | - MOV_fiq r0, r11_fiq ; get MEMC setup - MOV r9,r0 ; compare IOC and CPU clocks - ] - - BL TimeCPU - MOV r0,r9 - MOV_fiq r11_fiq,r0 - - MOV r8,r7,LSL #16 - TST r7, #1 :SHL: 16 ; test bit 16 of r7 : - ADDNE r8,r8,#&1000 ; MEMC1 / MEMC1a detected - AND r9,r9,#&C0 ; get High ROM access bits - ADD r8,r8,r9, LSL #2 - ADR r4,%BT2 - BL ts_SendText - B RAMtest - - -; -; Long RAM test, ideally exercising all memory. -; In order to keep boot time short, the following scheme is used : -; -; Normal power-on boot - test VRAM and up to 4M of first DRAM entry -; CMOS disable set - test nothing -; Test hardware fitted - test entire memory -; - - ROUT - - -1 - = "RAM :",0 -2 - = "RAM bad",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = &89,"skipped",0 -4 - = "RAM :",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - - - ALIGN - -RAMtest - ADR r4,%BT1 - BL ts_SendText -; -; if (R_MEMSKIP && R_HARD) -; skip all the remaining tests -; if (!R_LINFAILBIT) -; perform the long memory test -; - MOV_fiq r0,r12_fiq ; skip this test if data line fault - AND r1,r0,#(R_MEMSKIP :OR: R_HARD) ; or the user didn't want it - TEQS r1,#(R_MEMSKIP :OR: R_HARD) - ANDNE r1,r1,#R_LINFAILBIT - TEQNE r1,#R_LINFAILBIT - BNE %12 - ADR r4,%BT3 ; skipping memory test .... - BL ts_MoreText - B ts_Report -12 - LDR r1,=C_RAMTEST ; doing at least part of the long memory test - LDR r0,=ts_VIDCPhys ; write the border colour - STR r1,[r0] - - BL MemSize ; Set MMU up, mapping (some) RAM at logical address 0 - ; Note that this returns with the MMU enabled, - ; the ROM remapped to it's ORGed address, - RSB r4,r4,#PhysROM ; and r4 the offset from physical to ORGed ROM addresses - ADD r4,r4,#PhysSpace - SetMode SVC32_mode,r0 ; Must do this, as PhysSpace is outside 26 bit addressing - ADD pc,pc,r4 ; Jump into the ROM at its image in PhysSpace - NOP ; this instruction skipped by pc adjustment - -; -; Modify the PhysRamTable so only VRAM and the first ts_MaxRamTest of DRAM gets tested -; - M32_fiq r0,r12_fiq,r1,r2 ; get the test condition flags - - ANDS r0,r0,#(R_EXTERN :OR: R_TESTED) - BNE %FT16 ; do full test if test adapter is present - MOV r9,#PhysRamTable - ADD r10,r9,#(PhysRamTableEnd-PhysRamTable) -14 - LDR r1,[r9, #4] - ADD r0,r0,r1 ; r0 = running sum of memory sizes - SUBS r2,r0,#ts_MaxRamTest ; r2 = excess over ts_MaxRamTest - SUBHI r1,r1,r2 ; r1 = current size truncated - STRHI r1,[r9, #4] - MOVHI r0,#ts_MaxRamTest ; truncate running sum to MaxRamTest - - ADD r9,r9,#(DRAMPhysAddrB-DRAMPhysAddrA) - CMPS r9,r10 - BNE %BT14 -16 - FAULT32 #R_MEMORY,r0 ; memory tests were attempted - - MOV r9,#VideoPhysAddr - LDR r8,[r9] ; report the test address - ADRL r4,%BT4 - BL ts_SendText - LDR r0,[r9] ; get VRAM start address and size - LDR r1,[r9,#4] - ADD r0,r0,#PhysSpace - BL ts_RamTest - BNE %FT20 ; failed - abort ram testing - -; -; VRAM (or 1st MB of DRAM, if no VRAM fitted) looks OK - move the translation -; table there so memory tests can proceed without smashing it. -; - MOV r9,#PhysRamTable - LDR r0,[r9,#VideoPhysAddr-PhysRamTable] ; get address of video RAM - LDR r1,[r9,#DRAMPhysAddrA-PhysRamTable] ; get address of 1st DRAM bank - LDR r3, =DRAMOffset_L2PT - ADD r1, r1, r3 ; make r1 -> L2PT - ADD r0, r0, r3 ; make r0 -> temporary L2PT - BL ts_remap_ttab ; copy ttab at r1 to r0 and change table base - -; -; Now run the RAM test at each DRAMPhysAddr until the end of the table or a zero entry -; is reached. Mark tested entries by setting the PhysSpace address, so a pointer to the -; next entry need not be kept. -; -18 - MOV r9,#DRAMPhysAddrA - ADD r10,r9,#(PhysRamTableEnd-DRAMPhysAddrA) -19 - CMPS r9,r10 ; reached end of table ? - LDRNE r0,[r9] - TSTNE r0,r0 ; reached unused entries ? - LDRNE r1,[r9,#4] ; or blanked-out entries ? - TSTNE r1,r1 - BEQ %FT21 ; .. all passed OK - TSTS r0,#PhysSpace - ADDNE r9,r9,#(DRAMPhysAddrB-DRAMPhysAddrA) - BNE %BT19 ; this entry done .. find the next - - MOV r8,r0 ; report address of this block - ADRL r4,%BT4 - BL ts_SendText - - LDR r0,[r9] ; start testing it - ADD r0,r0,#PhysSpace - LDR r1,[r9, #4] - STR r0,[r9] ; mark block so it isn't retested - MOV r2,#PhysRamTable - LDMIA r2,{r3-r14} ; save the PhysRamTable - STMIA r0,{r3-r14} - BL ts_RamTest - LDMIA r13,{r1-r11,r14} ; restore the PhysRamTable - MOV r13,#PhysRamTable - STMIA r13,{r1-r11,r14} - BEQ %BT18 ; if it passed, go look for another block - -20 - FAULT32 #R_MEMFAILBIT,r2 ; failed - report fault address - ADRL r4,%BT2 - MOV r11,r1 ; Save failed data - MOV r8,r0 ; first failing address - BL ts_SendText - MOV r4,r12 ; get fault message - MOV r8,r11 ; and fault data - BL ts_SendText -21 - - [ MEMM_Type = "MEMC1" - -; -; Test the CAMs - for each fitted MEMC, go through all the CAM entries -; remapping logical memory and testing against physical correspondence. -; Then try out the protection bits in each CAM entry and various -; processor modes. -; These tests return pointers to their own fault report strings. -; - B ts_CAMtest - ROUT -1 - = "CAMs :",0 -2 - = "PPLs :",0 -3 - = &89,"skipped",0 - ALIGN - -ts_CAMtest - LDR r4,=%BT1 - BL ts_SendText - - MOV_fiq r0,r12_fiq ; skip this test if memory fault - MOV r1,#(R_LINFAILBIT :OR: R_MEMFAILBIT) - ANDS r0,r0,r1 - BEQ %08 - LDR r4,=%BT3 - BL ts_MoreText - B %20 - -08 - BL ts_CAM - BEQ %10 - BL ts_SendText - FAULT #R_CAMFAILBIT -10 - LDR r4,=%BT2 - BL ts_SendText - - MOV_fiq r0,r12_fiq ; skip this test if memory fault - MOV r1,#(R_LINFAILBIT :OR: R_MEMFAILBIT) - ANDS r0,r0,r1 - BEQ %18 - LDR r4,=%BT3 - BL ts_MoreText - B %20 -18 - BL ts_memc_prot - BEQ %20 - BL ts_SendText - FAULT #R_PROFAILBIT -20 - - ] - -; -; After testing memory and translation, turn MMU off again before running remainder -; of tests. This simplifies finishing up (where system must be put back into 26-bit -; mode before initialising RISCOS) if memory tests were deselected. -; Take care to poke the real translation table - it's been relocated to video -; RAM during the memory tests. -; - -ts_restore_physical - MOV r5, pc ; obtain current address - SUB r5, r5,#PhysSpace ; adjust to point to unmapped version - MOV r5, r5, LSR #20 ; divide by 1MB - MOV r7, r5, LSL #20 ; r7 = physical address of base of section - ORR r7, r7, #(AP_None * L1_APMult) - ORR r7, r7, #L1_Section - MOV r3, #VideoPhysAddr ; find the copied translation table - LDR r3, [r3] - ADD r3, r3, #PhysSpace - ADD r3, r3, #DRAMOffset_L1PT - STR r7, [r3, r5, LSL #2] ; store replacement entry in L1 (not U,C or B) - - SetCop r7, CR_IDCFlush ; flush cache + TLB just in case - SetCop r7, CR_TLBFlush ; (data written is irrelevant) - -; The ROM should now be mapped at the present address less PhysSpace, which is where it -; would be if the MMU were turned off. - - MOV r4,#PhysSpace - SUB pc,pc,r4 - NOP ; this instruction is skipped - - MOV r7, #MMUC_D ; Now turn the MMU off - SetCop r7, CR_Control - - B ts_VIDCtest - - -; -; The VIDC tests check vertical blanking frequency in a fixed video -; mode and measure the time taken for sound DMA. -; - - ROUT - -1 - = "VIDC :",0 -2 - = "Virq bad",&88,' ',&ff,'.',&ff,&ff,&ff,&ff,&ff,0 -3 - = "Sirq bad",&8B,&ff,&ff,&ff,&ff,&ff,0 -4 - = &8A,"Mid0 ",&ff,0 - - ALIGN - -ts_VIDCtest - ADR r4,%BT1 - BL ts_SendText - [ IO_Type = "IOMD" - LDR r0,=IOMD_MonitorType ; Indicate monitor ID bit's value - LDR r0,[r0] - AND r0,r0,#IOMD_MonitorIDMask - MOV r8,r0,LSL #28 - ADR r4,%BT4 - BL ts_MoreText - ] - - BL ts_VIDC_period - BEQ %10 - ADR r4,%B2 - MOV r8, r0, LSL #8 - BL ts_SendText ; Display Virq fail msg - FAULT #R_VIDFAILBIT -10 - [ IO_Type = "IOMD" - MOV r3,#IOMD_Base ; skip Sirq test on version 1 IOMD - LDRB r0,[r3,#IOMD_VERSION] - CMPS r0,#1 - BEQ %FT20 - ] - BL ts_SIRQ_period - BEQ %20 - ADR r4,%B3 - MOV r8, r0, LSL #12 - BL ts_SendText ; Display Sirq fail msg - FAULT #R_SNDFAILBIT -20 - MOV r1,#ts_VIDCPhys ; Restore full-screen - ADRL r2,TestVIDCTAB ; border colour. - [ IO_Type = "IOMD" - LDR r0,=IOMD_MonitorType - LDR r0,[r0] - ANDS r0,r0,#IOMD_MonitorIDMask - ADDEQ r2,r2,#(TestVVIDCTAB-TestVIDCTAB) - ] -30 LDR r0, [r2],#4 - CMP r0, #-1 - STRNE r0, [r1] - BNE %BT30 - LDR r0,=C_ARMOK ; set initial screen colour - STR r0, [r1] - - B ts_ARMtype_test - -; -; Read the ARM3 identification register. -; If memory tests failed, this won't be performed since the vector -; page must exist for error recovery on ARM2 systems. -; - - ROUT -1 - = "ARM ID:",0 -2 - = "ARM ID",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = &89,"skipped",0 - - ALIGN - -ts_ARMtype_test - - ADR r4,%BT1 - BL ts_SendText - - MOV_fiq r0,r12_fiq ; skip this test if memory fault - LDR r1,=((R_LINFAILBIT :OR: R_MEMFAILBIT) :OR: (R_CAMFAILBIT :OR: R_PROFAILBIT)) - ANDS r0,r0,r1 - BEQ %05 - ADR r4,%BT3 - BL ts_MoreText - B %08 ; and quit - -05 - BL ts_ARM_type - MOVS r8, r0 ; ready to display ID code - ADR r4,%BT2 - - BEQ %FT07 ; ARM 2 : skip cache test - FAULT #R_ARM3 ; not really a fault, just status -07 - BL ts_SendText - -08 - B ts_Report - - - -; -; Report the test results to the user -; -; If this was a forced test (test adapter fitted) then pause even when -; test passed : otherwise, pause only on error. -; - -ts_passmsg - = "PASS :",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -ts_failmsg - = "FAIL :",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - -ts_R00 & 00 - -ts_Report ROUT - MOV_fiq r7,r12_fiq ; check for fault bits set - LDR r0,=R_STATUS - BICS r0,r7,r0 - - ADREQ r4, ts_passmsg ; tests passed - LDREQ r9,=C_PASSED - - ADRNE r4, ts_failmsg ; tests failed - LDRNE r9,=C_FAULT - - LDR r0,=ts_VIDCPhys ; write the border colour - STR r9,[r0] - - MOV r8,r7 - BL ts_SendText ; write the message and fault code - - ; if the test adapter is present, leave green screen awhile - ; otherwise, wait only if there's a fault. - - LDR r3,=ts_recover_time -00 ADDS r3,r3,r3 ; 16-loop delay - BCC %B00 ; - let the adapter recover - ; from previous bus activity - ADR r2,ts_R00 - ORR r2,r2,#ts_Alias_bits - LDR r3,[r2] - MOV r2,#-1 - ADDS r3,r3,r2 - BCS ts_Report_wait - - MOV_fiq r0,r12_fiq - LDR r2,=R_STATUS - BICS r0,r0,r2 - BEQ ts_Hardstart - -ts_Report_wait ROUT - -; -; Indicate fault found : Set the border to the fault colour and flash -; the disk LED, using the fault bitmap in r12_fiq to modulate the flashing. - -ts_oldLED_on * &be0000 ; assert SEL0 and INUSE -ts_oldLED_off * &ff0000 ; on machines with 1772 controller -ts_oldLEDaddr * (ts_S5_base :OR: &40) - -ts_710LED_on * &100000 ; assert SEL0 and MotorEN0 -ts_710LED_off * &110000 ; on machines with 82C710 controller -ts_710LEDaddr * (ts_PCaddress :OR: (&3f2 :SHL: 2)) - -ts_665LED_on * &10 ; assert SEL0 and MotorEN0 -ts_665LED_off * &11 ; on machines with 37665 controller - ; and Medusa low-byte I/O world -ts_665LEDaddr * (ts_PCaddress :OR: (&3f2 :SHL: 2)) - - -01 MOV_fiq r6,r12_fiq - LDR r2,=&11111111 - LDR r7,=(35000 * 8) ; 1/4 second pause loop count - - [ IO_Type = "IOMD" - LDRNE r1,=ts_665LEDaddr ; set up for Medusa disc address - MOVNE r8,#ts_665LED_on - MOVNE r9,#ts_665LED_off - | - TST r6, #R_IOEB ; determine original / 710 disc controller - LDREQ r1,=ts_oldLEDaddr ; set up for Archimedes disc address - MOVEQ r8,#ts_oldLED_on - MOVEQ r9,#ts_oldLED_off - LDRNE r1,=ts_710LEDaddr ; set up for Brisbane disc address - MOVNE r8,#ts_710LED_on - MOVNE r9,#ts_710LED_off - ] - -02 MOV r0,r7 -03 SUBS r0,r0,#1 ; pause for a 1/4 second - BNE %03 - - MOV r0,r8 ; turn the LED on - STR r0,[r1] - - MOV r0,r7 -04 SUBS r0,r0,#1 ; pause for a 1/4 second - BNE %04 - ADDS r6,r6,r6 ; if a '1' is to be written, - BCC %06 - MOV r0,r7,LSL #1 ; then pause another 1/2 second -05 SUBS r0,r0,#1 - BNE %05 - -06 - MOV r0, r9 ; turn the LED off - STR r0,[r1] - -; -; Count down 32 bits. Every 4 bits, insert an extra pause to simplify -; reading the flashes. -; - ADDS r2,r2,r2 - BCC %08 - MOV r0,r7,LSL #2 ; then pause another second -05 SUBS r0,r0,#1 - BNE %05 -08 - ANDS r2,r2,r2 ; all the bits displayed now ? - BNE %02 - MOV_fiq r0,r12_fiq ; restore the faultcode bits - - ANDS r0,r0,#(R_EXTERN :OR: R_TESTED) ; If test adapter present, - BNE Reset ; repeat test forever - - B CONT ; otherwise, run RISC OS - -ts_Hardstart - MOVS r0,#R_HARD ; and report a hard start - B CONT ; to RISC OS - -; -; Tests skipped : fall into RISC-OS -; - -ts_Self_test_end - - LDR r1,=C_WARMSTART - LDR r0,=ts_VIDCPhys ; write the border colour - STR r1,[r0] - -ts_Softstart - MOVS r0,#R_SOFT ; soft reset indicator - B CONT - - - ROUT - -; -; This table consists of a series of address/data pairs for IO -; initialization. -; Note that these addresses are likely to be in the IO world, -; and hence the data written is that from the MOST significant -; 16 bits of the data bus. -; An 'address' of -1 terminates the table. -; - -ts_IOinitab - [ IO_Type = "IOMD" - | - & ts_S5_base :OR: &10, &000000 ; Printer port data - & ts_S5_base :OR: &18, &000000 ; FDC control & printer strobes - & ts_S5_base :OR: &40, &ff0000 ; FDD select lines - & ts_S5_base :OR: &48, &000000 ; VIDC clock control - ] - & (-1) - - - - - -; -; -;--------------------------------------------------------------------------- - - LTORG - - -; Include test modules executed by call, rather than inline - - GET TestSrc.Mem2 - GET TestSrc.Mem3 - GET TestSrc.Mem4 - GET TestSrc.Mem5 - GET TestSrc.Vidc - GET TestSrc.Ioc - GET TestSrc.Cmos - GET TestSrc.Arm3 - - END diff --git a/OldTestSrc/Cmos b/OldTestSrc/Cmos deleted file mode 100644 index 610193c..0000000 --- a/OldTestSrc/Cmos +++ /dev/null @@ -1,321 +0,0 @@ -; > TestSrc.Cmos - - TTL RISC OS 2+ POST battery-backed RAM access -; -; A function to read bytes from CMOS, for use in verifying the checksum -; and reading memory test flag & video modes. -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 05-Apr-91 ArtG Initial version, based on IICMod. -; -; -;------------------------------------------------------------------------ -; -; in: -; R0 = device address (bit 8 - 15 register address ) -; R1 = length of block to read -; R2 = initial sum value -; -; out: R0 = sum of all bytes in block -; R1 - R13 trashed -; - -ts_CMOSread ROUT - - MOV R13,R14 - MOV R8,R2 ; initialise accumulator - MOV R7,R1 ; initialise byte counter - MOV R6,R0 ; stash register address - MOV R2, #IOC - MOV R0, #-1 ; ensure timer is ticking - STRB R0, [R2, #Timer0LL] ; (nonzero in input latch) - STRB R0, [R2, #Timer0LH] - STRB R0, [R2, #Timer0GO] ; load the count registers - BL ts_Start - BEQ %FT30 ; check clock line toggles OK - AND R0, R6, #&FE - BL ts_TXCheckAck ; transmit device address (write) - BVS %FT30 - MOV R0, R6, LSR #8 - BL ts_TXCheckAck ; write register address - BVS %FT30 - BL ts_Start ; Extra START bit to switch modes - AND R0, R6, #&FE - ORR R0, R0, #1 - BL ts_TXCheckAck ; transmit device address (read) - BVS %FT30 -20 - BL ts_RXByte ; read byte from bus - ADD R8, R8, R0 ; accumulate total - SUBS R7, R7, #1 ; is it last byte ? - MOVNE R0, #0 ; no, then acknowledge with 0 bit - MOVEQ R0, #1 ; yes, then don't acknowledge - BL ts_ClockData ; but always send ack clock pulse - TEQ R7, #0 ; loop, until last byte - BNE %BT20 -30 - MOVVS R7, #-1 ; pass error indicator to caller - BL ts_Stop - MOV R0, R8 - TEQ R7, #0 ; return zero flag if read OK - MOV PC,R13 - -; ***************************************************************************** -; -; TXCheckACK - transmit a byte and wait for slave to ACK -; -; out: Trashes r0,r1,r2,r3,r4,r5,r9,r10,r11,r12 -; V bit set on error. -; - -ts_TXCheckAck ROUT - MOV R12,R14 - BL ts_TXByte - BL ts_Acknowledge - MOVVC PC, R12 ; acknowledged ok, so return - ORRS PC, R12, #V_bit - -; ***************************************************************************** -; -; SetC1C0 - Set clock and data lines to values in R1 and R0 respectively -; -; out: Trashes r0,r1,r2,r11 -; - -ts_SetC1C0 ROUT - MOV R11, R14 - BIC R14, R14, #Z_bit ; indicate not checking clock -ts_SetOrCheck - ORR R14, R14, #I_bit ; disable interrupts - TEQP R14, #0 - - ADD R0, R0, R1, LSL #1 ; R0 := C0 + C1*2 - - ORR R0, R0, #&C0 ; make sure two test bits are - ; always set to 1 ! - MOV R2, #IOC - STRB R0, [R2, #IOCControl] -10 - LDREQB R1, [R2, #IOCControl] ; wait for clock - TSTEQ R1, #i2c_clock_bit ; to read high - BEQ %BT10 - - MOV R0, #10 ; delay for >= 10/2 microsecs -; -; in-line do-micro-delay to save a stack level -; - STRB R0, [R2, #Timer0LR] ; copy counter into output latch - LDRB R1, [R2, #Timer0CL] ; R1 := low output latch -20 - STRB R0, [R2, #Timer0LR] ; copy counter into output latch - LDRB R14, [R2, #Timer0CL] ; R14 := low output latch - TEQ R14, R1 ; unchanged ? - MOVNE R1, R14 ; copy anyway - BEQ %BT20 ; then loop - SUBS R0, R0, #1 ; decrement count - BNE %BT20 ; loop if not finished -; -; end do-micro-delay -; - MOV PC, R11 - -; Set clock and data lines to R1 and R0 and then wait for clock to be high - -ts_SetC1C0CheckClock ROUT - MOV R11, R14 - ORR R14, R14, #Z_bit ; indicate checking clock - B ts_SetOrCheck - - -; ***************************************************************************** -; -; ClockData - Clock a bit of data down the IIC bus -; -; in: R0 = data bit -; -; out: Trashes r0,r1,r2,r3,r10,r11 -; - -ts_ClockData ROUT - MOV R10,R14 - - MOV R3, R0 ; save data - MOV R1, #0 ; clock LO - BL ts_SetC1C0 - - MOV R1, #1 ; clock HI - MOV R0, R3 - BL ts_SetC1C0CheckClock - -; Delay here must be >= 4.0 microsecs - - MOV R1, #0 ; clock LO - MOV R0, R3 - BL ts_SetC1C0 - - MOV PC,R10 - -; ***************************************************************************** -; -; Start - Send the Start signal -; -; out: Trashes r0,r1,r2,r9,r11 -; R0 (and Z flag) indicates state of clock .. should be NZ. -; - -ts_Start ROUT - MOV R9,R14 - - MOV R0, #1 ; clock HI, data HI - MOV R1, #1 - BL ts_SetC1C0 - -; Delay here must be >= 4.0 microsecs - - MOV R0, #0 ; clock HI, data LO - MOV R1, #1 - BL ts_SetC1C0 - -; Make sure clock really is high (and not shorted to gnd) - - LDRB R3, [R2, #IOCControl] - -; Delay here must be >= 4.7 microsecs - - MOV R0, #0 ; clock LO, data LO - MOV R1, #0 - BL ts_SetC1C0 - - ANDS R0, R3, #i2c_clock_bit - MOV PC,R9 - -; ***************************************************************************** -; -; Acknowledge - Check acknowledge after transmitting a byte -; -; out: Trashes r0,r1,r2,r3,r9,r11 -; V=0 => acknowledge received -; V=1 => no acknowledge received -; - -ts_Acknowledge ROUT - MOV R9,R14 - - MOV R0, #1 ; clock LO, data HI - MOV R1, #0 - BL ts_SetC1C0 - - MOV R0, #1 ; clock HI, data HI - MOV R1, #1 - BL ts_SetC1C0CheckClock - -; Delay here must be >= 4.0 microsecs - - MOV R2, #IOC - LDRB R3, [R2, #IOCControl] ; get the data from IOC - - MOV R0, #1 ; clock LO, data HI - MOV R1, #0 - BL ts_SetC1C0 - - TST R3, #1 ; should be LO for correct acknowledge - MOV R3, PC - BICEQ R3, R3, #V_bit ; clear V if correct acknowledge - ORRNE R3, R3, #V_bit ; set V if no acknowledge - TEQP R3, #0 - - MOV PC,R9 - -; ***************************************************************************** -; -; Stop - Send the Stop signal -; -; out: Trashes r0,r1,r2,r9,r11 -; - -ts_Stop ROUT - MOV R9,R14 - - MOV R0, #0 ; clock HI, data LO - MOV R1, #1 - BL ts_SetC1C0 - -; Delay here must be >= 4.0 microsecs - - MOV R0, #1 ; clock HI, data HI - MOV R1, #1 - BL ts_SetC1C0 - - MOV PC,R9 - -; ***************************************************************************** -; -; TXByte - Transmit a byte -; -; in: R0 = byte to be transmitted -; -; out: Trashes r0,r1,r2,r3,r4,r5,r9,r10,r11 -; - -ts_TXByte ROUT - MOV R9, R14 - MOV R4, R0 ; byte goes into R4 - MOV R5, #&80 ; 2^7 the bit mask -10 - ANDS R0, R4, R5 ; zero if bit is zero - MOVNE R0, #1 - BL ts_ClockData ; send the bit - MOVS R5, R5, LSR #1 - BNE %BT10 - MOV PC, R9 - -; ***************************************************************************** -; -; RXByte - Receive a byte -; -; out: R0 = byte received -; Trashes r1,r2,r3,r4,r9,r11 -; - -ts_RXByte ROUT - MOV R9, R14 - MOV R3, #0 ; byte:=0 - MOV R2, #IOC - MOV R4, #7 - - MOV R0, #1 ; clock LO, data HI - MOV R1, #0 - BL ts_SetC1C0 -10 - MOV R0, #1 ; pulse clock HI - MOV R1, #1 - BL ts_SetC1C0CheckClock - - LDRB R1, [R2, #IOCControl] ; get the data from IOC - AND R1, R1, #1 - ADD R3, R1, R3, LSL #1 ; byte:=byte*2+(IOC?0)AND1 - - MOV R0, #1 ; return clock LO - MOV R1, #0 - BL ts_SetC1C0 - - SUBS R4, R4, #1 - BCS %BT10 - - MOV R0, R3 ; return the result in R0 - MOV PC, R9 - - LTORG - - END - - - - - - - - diff --git a/OldTestSrc/ExtCmd b/OldTestSrc/ExtCmd deleted file mode 100644 index 963d266..0000000 --- a/OldTestSrc/ExtCmd +++ /dev/null @@ -1,1019 +0,0 @@ -; > TestSrc.ExtCmd - - TTL RISC OS 2+ POST external commands -; -; External test commands for RISC OS ROM. -; -; Provides functions to read data, write data and execute code using -; parameters from an external controlling host. -; -; A minimal set of opcodes should be used (ideally, only B, LDR and ADDS) -; so that a processor test may be validly included in the internal test -; sequence. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 27-Nov-89 ArtG Initial version -; 06-Dec-89 ArtG Release 0.2 for integration -; 30-Mar-90 ArtG Added NOPs (ADDS r0,r0,r0) after ADDS pc,.. -; 19-Apr-90 ArtG Speedups for read/write commands. -; 15-May-90 ArtG Fixed multiple %13 label in ts_W_FIW -; 22-May-90 ArtG Fixed bugs in ts_B_MWW, ts_W_RIB -; 18-Jun-93 ArtG Added Arm600 control instructions -; 1-Jul-93 ArtG Replaced ADDS pc.. instructions with ADD pc.. -; for compatibility with SVC32_mode. -; -;------------------------------------------------------------------------ - - - -; -; All these routines use registers as follows : -; -; r0 - always zero -; r1 -; r2 -; r3 - undisturbed : used as constant by I/O routine -; r4 - return value from I/O routine, parameter to I/O routines -; r5 -; r6 -; r7 - saved value of command byte on entry -; r8 - operation counter -; r9 - pointer to data transfer operation -; r10 - increment value (0, 1 or 4) to add to pointer in r9 -; r11 - decrement constant (-1) to add to counter in r8 -; r12 - checksum accumulator -; r13 - pointer to operation code -; r14 - return address for calls to I/O routines -; - - SUBT External command handlers -; -; Called by vectoring through command_table. -; R4 contains command byte (including 3 option bits) -; Get operation count -; Get address -; If single-word data -; Get data -; Get checksum -; Reply with command byte or FF -; Do operation -; Else -; For each word -; Get data -; Do operation -; Get checksum -; Reply with command byte or FF -; Return by branching to GetCommand. - -ts_write_memory ROUT - - ADDS r13,r0,r4 ; save the control byte - ADDS r7,r0,r4 - ADDS r14, r0, pc ; setup return address for .. - B ts_GetWord ; .. get operation count word - ADDS r8, r0, r4 ; r8 is operation count - ADDS r12,r0,r4 ; initialise checksum - ADDS r14, r0, pc - B ts_GetWord ; r9 is initial target address - ADDS r9, r0, r4 - ADDS r12,r12,r4 ; accumulate checksum - ADDS r10,r0,r0 ; set initial constants - LDR r11,%01 - ADD pc,pc,r0 -01 - DCD (0 - 1) - -; -; Check for operations which don't involve reading a block of data. -; These are acknowledged BEFORE performing the operation. -; - ADDS r0,r0,r0 - ADDS r13,r13,r13 ; convert operation code to vector - ADDS r13,r13,r13 - LDR r4, %02 - ADD pc,pc,r0 -02 - & (ts_write_cmd_table - %03) - ADDS r4,pc,r4 - ADDS r13,r4,r13 -03 - LDR r13,[r13] ; fetch pointer to code - LDR r4,%04 - ADD pc,pc,r0 -04 - & (ts_write_cmd_table - ts_W_fetch_operations) - ADDS r0,r0,r0 - ADDS r4,r4,r13 - BCS ts_Write_getdata ; defer acknowledgement till later - - ; check the above test was valid, given code layout - ; Note - this is also required by code near ts_Write_cmd_done - - ASSERT (ts_W_RSW < ts_W_fetch_operations) - ASSERT (ts_W_RSB < ts_W_fetch_operations) - ASSERT (ts_W_RIW < ts_W_fetch_operations) - ASSERT (ts_W_RIB < ts_W_fetch_operations) - ASSERT (ts_W_FSW >= ts_W_fetch_operations) - ASSERT (ts_W_FSB >= ts_W_fetch_operations) - ASSERT (ts_W_FIW >= ts_W_fetch_operations) - ASSERT (ts_W_FIB >= ts_W_fetch_operations) - -; -; Fetch the first data word and checksum, and acknowledge -; - - ADDS r14,r0,pc ;get next data word - B ts_GetWord - ADDS r12,r12,r4 ;accumulate checksum - ADDS r10,r0,r4 - ADDS r14,r0,pc - B ts_GetWord ;read transmitted checksum - ADDS r4,r4,r12 ;tx + total should be zero - LDR r5,%05 - ADD pc,pc,r0 -05 - & (0 - 1) - ADDS r5,r5,r4 ;carry set on checksum failure - BCS ts_cmd_error - -; -; Checksum looks OK. Send the command and the checksum back. -; - LDR r4,%06 - ADD pc,pc,r0 -06 - & ts_WriteCmdByte - ADDS r4,r4,r7 ;restore the original - - ADDS r14,r0,pc - B ts_SendByte - ADDS r4,r0,r12 ;then send the calculated checksum - ADDS r14,r0,pc - B ts_SendWord - - ADDS r4,r0,r10 ;restore the data word - ADDS r10,r0,r0 ;and the zero in r10 - B ts_Write_usedata ;dive off to do the work - -; -; Enter the main loop, repeating the operation labelled in r13. -; - -ts_Write_getdata - ADDS r9,r9,r10 ;perform increment operation - ADDS r8,r8,r11 ;countdown repeat counter - BCC ts_Write_cmd_ack - ADDS r14,r0,pc ;get next data word - B ts_GetWord - ADDS r12,r12,r4 ;accumulate checksum - B %07 - -ts_Write_usedata - ADDS r9,r9,r10 ;perform increment operation -ts_Write_count - ADDS r8,r8,r11 ;countdown repeat counter - BCC ts_Write_cmd_done -07 - ADD pc,pc,r13 ;jump back to operations - & 0 - -; -; In this table, the operation after any word fetch is vectored by -; the 3 least significant bits of the command byte to perform some -; combination of writing with : -; -; bit 2 -> 0 R : repeat with same data -; 1 F : fetch more data for next operation -; -; bit 1 -> 0 S : leave address static -; 1 I : increment address after operation -; -; bit 0 -> 0 W : word operation -; 1 B : byte operation -; - - ASSERT ((ts_write_cmd_table - %07) = 8) - -ts_write_cmd_table - - DCD (ts_W_RSW - ts_write_cmd_table) - DCD (ts_W_RSB - ts_write_cmd_table) - DCD (ts_W_RIW - ts_write_cmd_table) - DCD (ts_W_RIB - ts_write_cmd_table) - DCD (ts_W_FSW - ts_write_cmd_table) - DCD (ts_W_FSB - ts_write_cmd_table) - DCD (ts_W_FIW - ts_write_cmd_table) - DCD (ts_W_FIB - ts_write_cmd_table) - -; -; And here are the trailers that perform these operations. -; Each is started with the data in r4, address in r9 and completes -; by returning to Write_getdata (to read another word) or Write_usedata -; (to repeat with the same data) with r10 = increment value (initially 0) -; - -ts_W_RSW - STR r4,[r9] ;store word, repeat address - ADDS r8,r8,r11 ;countdown repeat counter - BCS ts_W_RSW - B ts_Write_cmd_done - -ts_W_RSB - STRB r4,[r9] ;store byte, repeat address - ADDS r8,r8,r11 - BCS ts_W_RSB - B ts_Write_cmd_done - -ts_W_RIW - LDR r10,%11 - ADD pc,pc,r0 -11 - DCD 4 -12 - STR r4,[r9] ;store word, increment word address - ADDS r9,r9,r10 ;perform increment operation - ADDS r8,r8,r11 ;countdown repeat counter - BCS %B12 - B ts_Write_cmd_done - - -ts_W_RIB - LDR r10,%13 - ADD pc,pc,r0 -13 - DCD 1 -14 - STRB r4,[r9] ;store byte, increment byte address - ADDS r9,r9,r10 - ADDS r8,r8,r11 - BCS %B14 - B ts_Write_cmd_done - - - -ts_W_fetch_operations ;all past here fetch new data - ;on each loop - -ts_W_FSW - STR r4,[r9] ;store word, repeat address - B ts_Write_getdata - -ts_W_FSB - STRB r4,[r9] ;store byte, repeat address - B ts_Write_getdata - -ts_W_FIW - STR r4,[r9] ;store word, increment word address - LDR r10,%15 - B ts_Write_getdata -15 - DCD 4 - -ts_W_FIB - STRB r4,[r9] ;store byte, increment byte address - LDR r10,%16 - B ts_Write_getdata -16 - DCD 1 - - -; -; Operations completed. Operations that read multiple data words from -; the host must now checksum and acknowledge the block (even though -; it's a bit late to do anything about it) -; - -ts_Write_cmd_ack -; -; Operation involved multiple fetches - only now ready to ACK. -; - ADDS r14,r0,pc - B ts_GetWord ;read transmitted checksum - ADDS r4,r4,r12 ;tx + total should be zero - LDR r5,%25 - ADD pc,pc,r0 -25 - & (0 - 1) - ADDS r5,r5,r4 ;carry set on checksum failure - BCS ts_cmd_error - -; -; Checksum looks OK. Send the command and the checksum back. -; - LDR r4,%26 - ADD pc,pc,r0 -26 - & ts_WriteCmdByte - ADDS r4,r4,r7 ;restore the original - ADDS r14,r0,pc - B ts_SendByte - ADDS r4,r0,r12 ;then send the calculated checksum - ADDS r14,r0,pc - B ts_SendWord - -ts_Write_cmd_done - B ts_GetCommand - - - -; Called by vectoring through command_table. -; R4 contains command byte (including 3 option bits) -; Get operation count -; Get address -; Reply with command byte or FF -; Reply with checksum -; For each word -; Read data -; If Verbose option -; Send data -; If Quiet option -; Send result of read operation -; Send checksum of result packet -; Return by branching to GetCommand. - -ts_read_memory ROUT - - ADDS r13,r0,r4 ; save the control byte - ADDS r7,r0,r4 - - ADDS r14, r0, pc ; setup return address for .. - B ts_GetWord ; .. get operation count word - ADDS r8, r0, r4 ; r8 is operation count - ADDS r12,r0,r4 ; initialise checksum - - ADDS r14, r0, pc - B ts_GetWord ; r9 is initial target address - ADDS r9, r0, r4 - ADDS r12,r12,r4 ; accumulate checksum - ADDS r10,r0,r0 ; set initial constants - LDR r11,%01 - ADD pc,pc,r0 -01 - DCD (0 - 1) -; -; Convert the operation options into a code pointer -; - ADDS r0,r0,r0 - ADDS r13,r13,r13 ; convert operation code to vector - ADDS r13,r13,r13 - LDR r4, %02 - ADD pc,pc,r0 -02 - & (ts_read_cmd_table - %03) - ADDS r4,pc,r4 - ADDS r13,r4,r13 -03 - LDR r13,[r13] ; fetch pointer to code - -; -; Fetch the checksum, and acknowledge -; - - ADDS r14,r0,pc - B ts_GetWord ;read transmitted checksum - ADDS r4,r4,r12 ;tx + total should be zero - LDR r5,%05 - ADD pc,pc,r0 -05 - & (0 - 1) - ADDS r5,r5,r4 ;carry set on checksum failure - BCS ts_cmd_error - -; -; Checksum looks OK. Send the command and the checksum back. -; - LDR r4,%06 - ADD pc,pc,r0 -06 - & ts_ReadCmdByte - ADDS r4,r4,r7 ;restore the original - ADDS r14,r0,pc - B ts_SendByte - ADDS r4,r0,r12 ;then send the calculated checksum - ADDS r14,r0,pc - B ts_SendWord - - ADDS r12,r0,r0 ;initialise the upload checksum - B ts_Read_count ;enter the loop - -; -; Enter the main loop, repeating the operation labelled in r13. -; This loop is for operations that finish with all data sent - -ts_Read_Txdata ;send data to host - ADDS r12,r12,r4 ;accumulate the checksum - ADDS r14,r0,pc - B ts_SendWord ;send this word - ADDS r9,r9,r10 ;perform increment operation - ADDS r8,r8,r11 ;countdown repeat counter - BCC ts_Read_cmd_done - B %07 ;go off to the jump handler - -ts_Read_count - ADDS r8,r8,r11 ;countdown repeat counter - BCC ts_Read_cmd_read ;send data at finish -07 - ADD pc,pc,r13 ;jump back to operations - & 0 - -; -; In this table, the operation after any word fetch is vectored by -; the 2 least significant bits of the command byte to perform some -; combination of reading with : -; -; bit 2 -> 0 Q : read data without reporting it -; 1 V : Transmit the result of every read operation -; -; bit 1 -> 0 S : leave address static -; 1 I : increment address after operation -; -; bit 0 -> 0 W : word operation -; 1 B : byte operation -; - - ASSERT ((ts_read_cmd_table - %07) = 8) - -ts_read_cmd_table - - DCD (ts_R_QSW - ts_read_cmd_table) - DCD (ts_R_QSB - ts_read_cmd_table) - DCD (ts_R_QIW - ts_read_cmd_table) - DCD (ts_R_QIB - ts_read_cmd_table) - DCD (ts_R_VSW - ts_read_cmd_table) - DCD (ts_R_VSB - ts_read_cmd_table) - DCD (ts_R_VIW - ts_read_cmd_table) - DCD (ts_R_VIB - ts_read_cmd_table) - -; -; And here are the trailers that perform these operations. -; Each is started with the data in r4, address in r9 and completes -; by returning to Write_getdata (to read another word) or Write_usedata -; (to repeat with the same data) with r10 = increment value (initially 0) -; - -ts_R_QSW - LDR r4,[r9] ;read word, repeat address - ADDS r8,r8,r11 ;countdown repeat counter - BCS ts_R_QSW - B ts_Read_cmd_read ;send data at finish - - -ts_R_QSB - LDRB r4,[r9] ;read byte, repeat address - ADDS r8,r8,r11 - BCS ts_R_QSB - B ts_Read_cmd_read - -ts_R_QIW - LDR r10,%11 - ADD pc,pc,r0 -11 - DCD 4 -12 - LDR r4,[r9] ;read word, increment word address - ADDS r9,r9,r10 ;perform increment operation - ADDS r8,r8,r11 ;countdown repeat counter - BCS %B12 - B ts_Read_cmd_read ;send data at finish - - -ts_R_QIB - LDR r10,%13 - ADD pc,pc,r0 -13 - DCD 1 -14 - LDRB r4,[r9] ;read byte, increment byte address - ADDS r9,r9,r10 ;perform increment operation - ADDS r8,r8,r11 ;countdown repeat counter - BCS %B14 - B ts_Read_cmd_read ;send data at finish - - -ts_R_VSW - LDR r4,[r9] ;read and tx word, repeat address - B ts_Read_Txdata - -ts_R_VSB - LDRB r4,[r9] ;read and tx byte, repeat address - B ts_Read_Txdata - -ts_R_VIW - LDR r4,[r9] ;read and tx word, next word address - LDR r10,%15 - B ts_Read_Txdata -15 - DCD 4 - -ts_R_VIB - ADDS r0,r0,r0 - LDRB r4,[r9] ;read and tx byte, next byte address - LDR r10,%16 - B ts_Read_Txdata -16 - DCD 1 - - -; -; Operations completed. Report final result and checksum back to host. -; Quiet option only transmits read data here (this is pretty useless -; except where only one value was read) -; - -ts_Read_cmd_read - ADDS r12,r12,r4 - ADDS r14,r0,pc ;send result of 'quiet' read - B ts_SendWord -ts_Read_cmd_done - SUBS r4,r0,r12 ;get overall checksum - can't think - ADDS r14,r0,pc ;how to do this using only ADDS ! - B ts_SendWord - - B ts_GetCommand - - -; Called by vectoring through command table. -; if option 1 set, read processor mode -; Read address -; Read and check checksum -; Reply with command byte or FF -; Reply with checksum -; if option 1 set, load SPSR -; Jump to code - - -ts_execute ROUT - ADDS r12,r0,r0 ; initialise checksum adder - LDR r8,%00 ; initialise msr-jumper - ADD pc,pc,r0 -00 - & 4 - ADDS r7,r4,r4 ; get operation type - ADDS r7,r7,r7 - ADD pc,pc,r7 ; jump to pc + (r4 * 4) - & 0 - - B %FT10 - B %FT08 - B %FT10 - B %FT10 - B %FT10 - B %FT10 - B %FT10 - B %FT10 - - -08 ADDS r14,r0,pc ; get new processor mode - B ts_GetWord - ADDS r12,r0,r4 - ADDS r8,r0,r0 ; kill msr-jumper -10 - ADDS r14,r0,pc - B ts_GetWord ; get jump address - ADDS r9,r12,r4 - ADDS r14,r0,pc - B ts_GetWord ; get checksum - ADDS r4,r4,r9 - LDR r5,%11 - ADD pc,pc,r0 -11 - & (0 - 1) - ADDS r4,r5,r4 ; compare total chex with zero - BCS ts_cmd_error ; carry set on error - - LDR r4,%12 - ADD pc,pc,r0 -12 - & ts_ExecuteCmdByte - ADDS r0,r0,r0 - ADDS r14,r0,pc ; echo command byte - B ts_SendByte - ADDS r4,r0,r9 ;return checksum (actually, the - ADDS r14,r0,pc ; entire message ..) - B ts_SendWord - - -; Now jump to the location given in the message, using the given status bits - - ADD pc,pc,r8 ; jump over the msr instruction - NOP - & 2_11100001011010011111000000001100 ; - - ADDS r14,pc,r0 ; Load the address of %13 into r14 - ; to provide a return address - ADD pc,r0,r9 ; Do the jump -13 - B ts_GetCommand - - - -; Called by vectoring through command table -; Read operation count -; Read target addresses -; Read data -; Send command byte or FF -; Send checksum -; For all operation count -; write data -; if read-back option -; read data -; Return by branching to GetCommand - - -ts_bus_exercise ROUT - ADDS r7,r0,r4 ; save the control byte - - ADDS r14, r0, pc ; setup return address for .. - B ts_GetWord ; .. get operation count word - ADDS r8, r0, r4 ; r8 is operation count - ADDS r12,r0,r4 ; initialise checksum - - ADDS r14, r0, pc - B ts_GetWord ; r9 is first target address - ADDS r9, r0, r4 - ADDS r12,r12,r4 ; accumulate checksum - ADDS r14, r0, pc - B ts_GetWord ; r10 is second target address - ADDS r10, r0, r4 - ADDS r12,r12,r4 ; accumulate checksum - - ADDS r14, r0, pc - B ts_GetWord ; r11 is first data word - ADDS r11, r0, r4 - ADDS r12,r12,r4 ; accumulate checksum - ADDS r14, r0, pc - B ts_GetWord ; r13 is second data word - ADDS r13, r0, r4 - ADDS r12,r12,r4 ; accumulate checksum - -; -; Fetch the checksum, and acknowledge -; - - ADDS r14,r0,pc - B ts_GetWord ;read transmitted checksum - ADDS r4,r4,r12 ;tx + total should be zero - LDR r5,%05 - ADD pc,pc,r0 -05 - & (0 - 1) - ADDS r5,r5,r4 ;carry set on checksum failure - BCS ts_cmd_error - -; -; Checksum looks OK. Send the command and the checksum back. -; - LDR r4,%06 - ADD pc,pc,r0 -06 - & ts_BusExCmdByte - ADDS r4,r4,r7 ;restore the original - ADDS r14,r0,pc - B ts_SendByte - ADDS r4,r0,r12 ;then send the calculated checksum - ADDS r14,r0,pc - B ts_SendWord - - ADDS r12,r0,r13 ; Now addresses are in r9, r10 - ; and data in r11, r12. -; -; Convert the operation options into a code pointer -; - ADDS r13,r7,r7 ; convert operation code to vector - ADDS r13,r13,r13 - LDR r4, %02 - ADD pc,pc,r0 -02 - & (ts_busex_cmd_table - %03) - ADDS r4,pc,r4 - ADDS r13,r4,r13 -03 - LDR r13,[r13] ; fetch pointer to code - LDR r7, %04 ; set up decrementer in r8 - ADD pc,pc,r0 -04 - DCD (0 - 1) -07 - ADD pc,pc,r13 ; jump to operation - & 0 - -; -; In this table, the operation after any word fetch is vectored by -; the 3 least significant bits of the command byte to perform some -; combination of writing with : -; -; bit 2 -> 0 S : Perform separate data write ops -; 1 M : Use STM / LDM instructions -; -; bit 1 -> 0 R : Perform only read operations -; 1 W : Write before reading -; -; bit 0 -> 0 W : word operation -; 1 B : byte operation -; -; Note that byte and multiple operations are mutually -; exclusive. -; - - ASSERT ((ts_busex_cmd_table - %07) = 8) - -ts_busex_cmd_table - - DCD (ts_B_SRW - ts_busex_cmd_table) - DCD (ts_B_SRB - ts_busex_cmd_table) - DCD (ts_B_SWW - ts_busex_cmd_table) - DCD (ts_B_SWB - ts_busex_cmd_table) - DCD (ts_B_MRW - ts_busex_cmd_table) - DCD (ts_B_MRB - ts_busex_cmd_table) - DCD (ts_B_MWW - ts_busex_cmd_table) - DCD (ts_B_MWB - ts_busex_cmd_table) - -ts_B_SRW - LDR r11,[r9] ; read-only separate words - LDR r12,[r10] - ADDS r8, r8, r7 - BCS ts_B_SRW - B ts_B_done - -ts_B_SRB - LDRB r11,[r9] ; read-only separate bytes - LDRB r12,[r10] - ADDS r8, r8, r7 - BCS ts_B_SRB - B ts_B_done - -ts_B_SWW - STR r11,[r9] ; write and read separate words - STR r12,[r10] - LDR r1,[r9] - LDR r2,[r10] - ADDS r8, r8, r7 - BCS ts_B_SWW - B ts_B_done - -ts_B_SWB - STRB r11,[r9] ; write and read separate bytes - STRB r12,[r10] - LDRB r1,[r9] - LDRB r2,[r10] - ADDS r8, r8, r7 - BCS ts_B_SWB - B ts_B_done - - -ts_B_MRW - LDMIA r9,{r1,r2} ; read-only multiple words - LDMIA r10,{r1,r2} - ADDS r8, r8, r7 - BCS ts_B_MRW - B ts_B_done - -ts_B_MWW - STMIA r9,{r11,r12} ; write and read multiple words - LDMIA r9,{r1,r2} - STMIA r10,{r11,r12} - LDMIA r10,{r1,r2} - ADDS r8, r8, r7 - BCS ts_B_MWW - B ts_B_done - -; -; Orthogonally, these should be multiple byte operations - we can't do that, -; so they actually do a single/multiple mixture. -; The first address argument is used for word-aligned operations and the -; second for byte-aligned operations - so set only the second address -; to a non-word-aligned address. - -ts_B_MRB - LDMIA r9,{r1,r2} ; read-only multiple words - LDRB r1,[r10] ; then single bytes - LDR r1,[r9] ; and single words - ADDS r8, r8, r7 - BCS ts_B_MRB - B ts_B_done - -ts_B_MWB - STMIA r9,{r11,r12} ; store multiple words - STRB r11,[r10] ; write byte - STR r12,[r9] ; write words - LDMIA r9,{r1,r2} - LDRB r1,[r10] - LDR r1,[r9] ; read single and multiple words - ADDS r8, r8, r7 - BCS ts_B_MWB -; B ts_B_done - -ts_B_done - B ts_GetCommand - - - -; -; All commands fall through here to respond with FF if the received -; message block checksums fail. -; - -ts_cmd_error ROUT ; error in command - LDR r4, %01 ; return error response - ADD pc,pc,r0 -01 - DCD ErrorCmd - ADDS r0,r0,r0 - ADDS r14, r0, pc ; send response byte to host - B ts_SendByte - - B ts_GetCommand - - -; generic coprocessor register names - -cpr0 CN 0 -cpr1 CN 1 -cpr2 CN 2 -cpr3 CN 3 -cpr4 CN 4 -cpr5 CN 5 -cpr6 CN 6 -cpr7 CN 7 -cpr8 CN 8 -cpr9 CN 9 -cpr10 CN 10 -cpr11 CN 11 -cpr12 CN 12 -cpr13 CN 13 -cpr14 CN 14 -cpr15 CN 15 - - -; Called by vectoring through command table. -; Read transfer value -; Read and check checksum -; Extract copro register number -; Index suitable MRC instruction -; Perform copro write -; Reply with command byte or FF -; Reply with checksum - -ts_write_cpr15h ROUT - ADDS r4,r4,#8 ; adjust opcode for high registers -ts_write_cpr15l - ADDS r7,r0,r4 ; save opcode to r7 - ADDS r14,r0,pc - B ts_GetWord ; get value for copro - ADDS r9,r0,r4 - ADDS r14,r0,pc - B ts_GetWord ; get checksum - ADDS r4,r4,r9 - LDR r5,%01 - ADD pc,pc,r0 -01 - & (0 - 1) - ADDS r4,r5,r4 ; compare total chex with zero - BCS ts_cmd_error ; carry set on error - - ADDS r13,r7,r7 ; point into instruction table - ADDS r13,r13,r13 - ADDS r13,r13,r13 - ADD pc,pc,r13 ; jump to pc + (r7 * 8) - & 0 - - SetCop r9,cpr0 ; transfer instructions - B %02 - SetCop r9,cpr1 - B %02 - SetCop r9,cpr2 - B %02 - SetCop r9,cpr3 - B %02 - SetCop r9,cpr4 - B %02 - SetCop r9,cpr5 - B %02 - SetCop r9,cpr6 - B %02 - SetCop r9,cpr7 - B %02 - SetCop r9,cpr8 - B %02 - SetCop r9,cpr9 - B %02 - SetCop r9,cpr10 - B %02 - SetCop r9,cpr11 - B %02 - SetCop r9,cpr12 - B %02 - SetCop r9,cpr13 - B %02 - SetCop r9,cpr14 - B %02 - SetCop r9,cpr15 - -02 - LDR r4,%03 - ADD pc,pc,r0 -03 - & ts_CPWCmdByte ; build command byte + option - ADDS r4,r4,r7 - ADDS r14,r0,pc ; echo command byte - B ts_SendByte - ADDS r4,r0,r9 ; return checksum - ADDS r14,r0,pc ; - B ts_SendWord - - B ts_GetCommand - - - - -; Called by vectoring through command table. -; Read and check checksum -; Extract copro register number -; Index suitable MCR instruction -; Perform copro read -; Reply with command byte or FF -; Reply with checksum -; Send transfer results -; Send checksum - -ts_read_cpr15h ROUT - ADDS r4,r4,#8 ; adjust opcode for high registers -ts_read_cpr15l - ADDS r7,r0,r4 ; save opcode in r7 - ADDS r14,r0,pc - B ts_GetWord ; get checksum to r4 - ADDS r9,r0,r4 ; copy to r9 - LDR r5,%01 - ADD pc,pc,r0 -01 - & (0 - 1) - ADDS r4,r5,r4 ; compare total chex with zero - BCS ts_cmd_error ; carry set on error - - LDR r4,%02 - ADD pc,pc,r0 -02 - & ts_CPRCmdByte ; build command byte + option - ADDS r4,r4,r7 - ADDS r14,r0,pc ; echo command byte - B ts_SendByte - ADDS r4,r0,r9 ; return checksum - ADDS r14,r0,pc - B ts_SendWord - - ADDS r13,r7,r7 ; point into instruction table - ADDS r13,r13,r13 - ADDS r13,r13,r13 - ADD pc,pc,r13 ; jump to pc + (r7 * 8) - & 0 - - ReadCop r12,cpr0 ; transfer instructions - B %03 - ReadCop r12,cpr1 - B %03 - ReadCop r12,cpr2 - B %03 - ReadCop r12,cpr3 - B %03 - ReadCop r12,cpr4 - B %03 - ReadCop r12,cpr5 - B %03 - ReadCop r12,cpr6 - B %03 - ReadCop r12,cpr7 - B %03 - ReadCop r12,cpr8 - B %03 - ReadCop r12,cpr9 - B %03 - ReadCop r12,cpr10 - B %03 - ReadCop r12,cpr11 - B %03 - ReadCop r12,cpr12 - B %03 - ReadCop r12,cpr13 - B %03 - ReadCop r12,cpr14 - B %03 - ReadCop r12,cpr15 - -03 - ADDS r4,r0,r12 ; return result - ADDS r14,r0,pc - B ts_SendWord - SUBS r4,r0,r12 ; return checksum - ADDS r14,r0,pc - B ts_SendWord - - B ts_GetCommand - - - END - - diff --git a/OldTestSrc/ExtIO b/OldTestSrc/ExtIO deleted file mode 100644 index 8ef956a..0000000 --- a/OldTestSrc/ExtIO +++ /dev/null @@ -1,1089 +0,0 @@ -; > TestSrc.ExtIO - - TTL RISC OS 2+ POST external commands -; -; External interface for RISC OS ROM. -; provides entry points to send byte- and word- and string-sized objects -; and to receive byte- and word-sized objects -; -; A minimal set of opcodes should be used (ideally, only B, LDR and ADDS) -; so that a processor test may be validly included in the internal test -; sequence. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 06-Dec-89 ArtG Initial version - split from `Begin` -; Release 0.2 for integration -; 31-Mar-90 ArtG Added ts_MoreText, cursor position, hex. -; 19-Apr-90 ArtG Added bus exercise commands -; 09-May-90 ArtG Changed LCD strobe to 12 pulses -; 15-May-90 ArtG Added ReadyByte : improves synchronization -; when ExtCmd execution toggles A21/A22. -; 18-Jun-90 ArtG Added CPR15 read/write functions -; -; -;------------------------------------------------------------------------ - - - SUBT Test adapter interface - -; -; The test adapter senses an access to the ROM with address line A21 high. -; Current (2M addressing space) ROMs only use address lines A2 to A20, -; so if A21 to A22 are asserted they will be ignored (the ROMS are aliased -; into 8M of space). With no test adapter, the aliased ROM location will -; be read and may be recognised. The test adapter may selectively disable -; ROMs when A21 is high, causing arbitrary data to be read. This data -; should be dependent on the previous ROM read operation, and will -; therefore be predictably not equal to the data read when the ROMs are -; aliased. -; The assumption that A21 is unused may be invalidated by a later issue -; of the PCB. A22 is therefore asserted at the same time : this will then -; be used on a PCB where A22 is tracked to a test connector and 8Mbit ROMS -; are used. Machines using larger ROMs than 8 Mbit (4M addressing space) -; will require explicit decoding or a new communication scheme. -; - - -; -; This section determines whether the test interface adapter exists, and -; what variety is fitted (dumb, display or external) -; 3 read operations are performed (a WS operation): if all of these -; find a ROM alias then no adapter is fitted. -; -; If an adapter responds, then a RD operation is performed - 4 strobes then -; clocking 8 bits into r4. These bits may be all zeros (a dumb adapter) -; or all ones (a display adapter) or some other value (an external -; adapter) -; - -ts_GetCommand ROUT - - LDR r0,%01 - ADD pc,pc,r0 -01 - & 0 - - ; delay to make a gap before reading - - LDR r3,%02 - ADD pc,pc,r0 -02 - & ts_recover_time -03 - ADDS r3,r3,r3 ; 16-loop delay - BCC %03 - - ROUT - -; -; Load up the registers for the test interface communication - -; - - LDR r0,%01 ; set zero in r0 - ADD pc,pc,r0 ;(generally useful constant - especially for skip) -01 - & 0 - LDR r1,%02 ; set FFFFFFFF in r1 - ADD pc,pc,r0 ;(test value : sets carry when added to non-zero) -02 - & (-1) - LDR r2,%03 ; set pointer to test address - ADD pc,pc,r0 ;(points to aliased copy of a zero word) -03 - & (ts_Alias_bits + (%01 - %04)) - ADDS r2,pc,r2 ; adjust r2 for ROM-relative address - ADDS r4,r0,r0 ; clear output accumulator -04 ; where pc is when added to r2 - - ; do an RD operation (four strobes) to ensure interface cleared - - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - - ; write a byte (initially, &90) to indicate readiness - - LDR r4,%20 - ADD pc,pc,r0 -20 - & ts_ReadyByte_00 - ADDS r14,r0,pc - B ts_SendByte - - ; delay to make a gap between WRS and RD operations - - LDR r3,%05 - ADD pc,pc,r0 -05 - & ts_recover_time -06 - ADDS r3,r3,r3 ; 16-loop delay - BCC %06 - - LDR r5,%07 ; counter for first 5 bits - ADD pc,pc,r0 -07 - & 1 :SHL: (32 - 5) - LDR r6,%08 ; counter for last 3 bits - ADD pc,pc,r0 -08 - & 1 :SHL: (32 - 3) - ADDS r4,r0,r0 ; input accumulator initialisation - -; put the test interface into input mode - - LDR r3,[r2] ; 3 bit lead-in - ADDS r3,r3,r1 ; (adapter detects WS operation) - BCC ts_User_startup ; abort if no adapter present - - LDR r3,[r2] ; two more strobes, then waitloop - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - -; started input operation : wait for interface to be ready - -09 - LDR r3,[r2] ; read start bit repeatedly - ADDS r3,r3,r1 ; (adapter detects RD operation) - BCC %09 ; loop until interface is ready - -; read the first 5 bits into r5 and the second 3 bits into r4 - -10 LDR r3,[r2] ; read a bit of the byte - ADDS r3,r3,r1 ; .. if the test adapter is present, carry bit set - ADCS r4,r4,r4 ; .. shift left and add in carry - - ADDS r5,r5,r5 ; loop until 5 bits are read - BCC %10 - - ADDS r5,r4,r4 ; copy bits 7..3 to r5, bits 5..1 - - ADDS r4,r0,r0 ; and read the last 3 bits to r4 -11 LDR r3,[r2] ; read a bit of the byte - ADDS r3,r3,r1 - ADCS r4,r4,r4 - - ADDS r6,r6,r6 ; loop until last 3 bits are read - BCC %11 - -; -; Command byte read in (split between r4 and r5) -; Pass the option bits (r4) to the function identified by r5. -; - - ADDS r5,r5,r5 ; index * 2 -> index * 4 - LDR r3,%12 ; pc-relative ptr to command_table - ADD pc,pc,r0 -12 - & ts_command_table - %13 - ADDS r3,pc,r3 ; absolute pointer to command table - ADDS r3,r3,r5 - -13 LDR r3,[r3] ; get table entry -14 ADD pc,pc,r3 ; (offset from command_table) - - & 0 ; necessary padding : pc must point - ; to command table when r3 is added. - -; -; This is the table of offsets to all the built-in functions. -; The top 5 bits of the command are used to index, so there are -; 32 possible entries, mostly illegal. -; Decoding of the function modifier bits is performed by multiple -; entries in this table. -; - -; pc must point here when ADDS pc,r3,pc is executed - - ASSERT ((ts_command_table - %14) = 8) - -ts_command_table - - DCD (ts_Dealer_startup - ts_command_table) ; display interface -ts_Windex - DCD (ts_write_memory - ts_command_table) ; external tests -ts_Rindex - DCD (ts_read_memory - ts_command_table) -ts_Eindex - DCD (ts_execute - ts_command_table) -ts_Bindex - DCD (ts_bus_exercise - ts_command_table) - - DCD (ts_GetCommand - ts_command_table) ; dummy entry aligns CPR instructions - ; to allow 4-bit option field -ts_CWindex - DCD (ts_write_cpr15l - ts_command_table) - DCD (ts_write_cpr15h - ts_command_table) -ts_CRindex - DCD (ts_read_cpr15l - ts_command_table) - DCD (ts_read_cpr15h - ts_command_table) - - ; pad the table out to 31 entries - ; (leave space for display vector) - -OldOpt SETA {OPT} - OPT OptNoList -doffset SETA . - WHILE doffset < (ts_command_table + (31 * 4)) ; illegal entries - DCD (ts_GetCommand - ts_command_table) -doffset SETA doffset + 4 - WEND - OPT OldOpt - - DCD (ts_Forced_startup - ts_command_table) ; dumb interface - -; -; The indexes into the above table are needed in ExtCmd ... -; -ts_WriteCmdByte * ((ts_Windex - ts_command_table) :SHL: 1) -ts_ReadCmdByte * ((ts_Rindex - ts_command_table) :SHL: 1) -ts_ExecuteCmdByte * ((ts_Eindex - ts_command_table) :SHL: 1) -ts_BusExCmdByte * ((ts_Bindex - ts_command_table) :SHL: 1) -ts_CPWCmdByte * ((ts_CWindex - ts_command_table) :SHL: 1) -ts_CPRCmdByte * ((ts_CRindex - ts_command_table) :SHL: 1) - - -; -; Primitives for reading data from the external interface -; -; - Get a byte from the interface (into r4) -; - Get a (4 byte) word from the interface (into r4) -; -; Required register setup is presumed done by a recent ts_GetCommand. -; r0, r1 and r2 have critical values -; r14 is the link address -; - -ts_GetWord ROUT - - LDR r6,%01 ; counter for 4 bytes per word - ADD pc,pc,r0 ; (bit set 4 left shifts from Carry) -01 - & 1 :SHL: (32 - 4) - B ts_Getdata - -ts_GetByte ROUT - LDR r6,%01 ; counter for single byte - ADD pc,pc,r0 -01 - & 1 :SHL: (32 - 1) - -ts_Getdata ROUT - ADDS r4,r0,r0 ; input accumulator initialisation - - LDR r3,[r2] ; 3 bit lead-in - ADDS r3,r3,r1 ; (adapter detects RD operation) - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - -; started input operation : now loop until r6 shifts into Carry - -02 - LDR r5,%03 ; counter for 8 bits per byte - ADD pc,pc,r0 -03 - & 2_00000001000000010000000100000001 -04 - LDR r3,[r2] ; read start bit repeatedly - ADDS r3,r3,r1 - BCC %04 ; loop until interface is ready -05 - LDR r3,[r2] ; read a bit of the byte - ADDS r3,r3,r1 - ADCS r4,r4,r4 ; SHL r4, add carry bit. - - ADDS r5,r5,r5 ; loop until byte is read - BCC %05 - - ADDS r6,r6,r6 ; loop until word is read - BCC %04 - - ADD pc,r0,r14 ; back to the caller - - -; -; Primitives for sending data to the interface -; -; - Send a byte to the interface (from r4 lsb) -; - Send a (4 byte) word to the interface (from r4) -; -; Required register setup is presumed done by a recent ts_GetCommand. -; r0, r1 and r2 have critical values -; r14 is the link address -; - -ts_SendWord ROUT - LDR r6,%01 ; counter for 4 bytes per word - ADD pc,pc,r0 ; (bit set 4 left shifts from Carry) -01 - & 1 :SHL: (32 - 4) - B ts_Putdata - -ts_SendByte ROUT - LDR r6,%01 ; counter for single byte - ADD pc,pc,r0 -01 - & (3 :SHL: 7) -02 ADDS r4,r4,r4 ;shift byte into highest 8 bits - ADDS r6,r6,r6 - BCC %02 ;stop when byte shifted, - ;leaving bit 31 set in r6 - -ts_Putdata ROUT - -; Wait - gap between successive WS attempts or successive bytes - -01 LDR r3,%02 - ADD pc,pc,r0 -02 - & ts_recover_time -03 ADDS r3,r3,r3 ; 16-loop delay - BCC %03 - - LDR r3,[r2] ; Test for adapter ready for data - ADDS r3,r3,r1 ; (adapter detects WS operation) - LDR r3,[r2] - ADDS r3,r3,r1 - BCC %10 ; skip out if adapter not present - LDR r3,[r2] - ADDS r3,r3,r1 - BCC %01 ; loop back until adapter is ready - -; Adapter ready - loop around all the bits in the byte - - LDR r5,%04 ; load bits-per-byte counter - ADD pc,pc,r0 -04 - & (1 :SHL: (32-8)) - -05 LDR r3,%06 ; delay before sending bit - ADD pc,pc,r0 -06 - & ts_recover_time -07 ADDS r3,r3,r3 ; 16-loop delay - BCC %07 - - ; Send a single bit : 1 pulse for 1, 2 pulses for 0 - - LDR r3,[r2] - ADDS r4,r4,r4 ; shift current bit into Carry - LDRCC r3,[r2] ; second pulse if bit is 0 - - ; repeat until 8 bits are sent - - ADDS r5,r5,r5 - BCC %05 - -; Repeat for all the bytes to be sent (1 or 4) - - ADDS r6,r6,r6 - BCC %01 - -; Go to TXRDY to ensure the host sees the transmit request - - LDR r3,%08 ; delay before sending pattern - ADD pc,pc,r0 -08 - & ts_recover_time -09 ADDS r3,r3,r3 ; 16-loop delay - BCC %09 - - LDR r3,[r2] - ADDS r3,r3,r1 ; dummy - space between pulses - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - -; All sent - r14 holds the caller's return address -10 - ADD pc,r0,r14 - - - -; -; Reporting primitive -; -; - Send the text (nul-terminated, at r4) to the display -; -; Interface registers need to be set up : this function is called from test -; code rather than external interface code. -; -; The display is assumed to be a standard 16 character LCD module using -; the Hitachi HD44780 display controller. -; The 16-digit module uses a single 44780. This is an abnormal use of the -; controller, and requires it to be set to two-line mode, with the first -; 8 displayed characters on the first 'line', and the second 8 on the -; second 'line'. Characters sent to the second line must be written at -; character position 40 +. In order to permit different modules to be -; fitted to later adapters, it is suggested that the first 7 characters -; be treated as a 'title' line, and the second 8 as a 'comment' line. -; A space should always be placed at the end of the title line to -; split the display fields, unless there is no 'comment' line. -; Do not display characters across the two areas as though they adjoined -; (even though they do :-) ). -; -; The controller is operated in its 4-bit mode, which allows the interface -; to drive 4 bits of alpha information and 4 bits of control information. -; The bits in a transmitted byte are assigned as : -; -; bit 0 - D4 } 4-bit mode data bus -; 1 - D5 } -; 2 - D6 } -; 3 - D7 } -; -; 4 - RS Register Select : 0 for control, 1 for data -; -; 5 - } Unassigned -; 6 - } -; -; 7 - CPEN Interface control : 0 for enable, -; 1 for disable -; -; For each message sent, the display is first initialised, using the -; following sequence (each byte is sent as 2 bytes, high nibble first, -; with RS clear in bit 4 of each byte) -; After each byte, an RD operation is performed : this is used by the -; interface hardware to strobe the data into the display. -; -; -; The message addressed by r4 is then sent (data mode : RS set in each byte) -; until a 0 byte is encountered. -; - -; -; This is the command sequence sent to initialise the display -; - -ts_initialise - = &30,&30,&30,&20 ; power-up initialisation - = &20,&80 ; 4 bit mode, two line, Font 0 - = &00,&C0 ; Display on, no cursor visible - = &00,&60 ; Incrementing display position, no shift - = &80,&00 ; Set DD RAM address 0 - = &00,&20 ; Cursor home - = &00,&10 ; Display clear -ts_initialise_end - - ASSERT ((ts_initialise_end - ts_initialise) / 2) < 32 - - -; -; This is the command sequence sent when continuation text is sent -; - -ts_extend - = &00,&C0 ; Display on, cursor invisible - = &00,&60 ; Incrementing display position, no shift -ts_extend_end - - ASSERT ((ts_extend_end - ts_extend) / 2) < 32 - -; -; One of these commands are sent when offset text is required -; - -ts_offset_table - = &80,&00 ; Set DD RAM address 0 -ts_offset_table_1 - = &80,&10 ; Set DD RAM address 1 - = &80,&20 ; Set DD RAM address 2 - = &80,&30 ; Set DD RAM address 3 - = &80,&40 ; Set DD RAM address 4 - = &80,&50 ; Set DD RAM address 5 - = &80,&60 ; Set DD RAM address 6 - = &80,&70 ; Set DD RAM address 7 - = &C0,&00 ; Set DD RAM address 40 - = &C0,&10 ; Set DD RAM address 41 - = &C0,&20 ; Set DD RAM address 42 - = &C0,&30 ; Set DD RAM address 43 - = &C0,&40 ; Set DD RAM address 44 - = &C0,&50 ; Set DD RAM address 45 - = &C0,&60 ; Set DD RAM address 46 - = &C0,&70 ; Set DD RAM address 47 - - -; This assertion is forced by the code : each sequence assumed 2 bytes. - - ASSERT ((ts_offset_table_1 - ts_offset_table) = 2) - - - - ALIGN - -; -; Here starts the code ... -; - -ts_SendQuit ROUT ; put this code BEFORE %16 - ADD pc,r0,r14 ; - - - -; -; Entry point for initialising the display and sending r4 text. -; - - -ts_SendText ROUT - -; -; Point to the command sequence to setup and clear the display -; - - LDR r0,%10 ; set zero in r0 - ADD pc,pc,r0 -10 - & 0 - LDR r7,%11 ; pointer to init sequence - ADDS r7,pc,r7 - ADD pc,pc,r0 -11 - & (ts_initialise - .) - LDR r6,%12 ; length of init sequence - ADD pc,pc,r0 -12 - & (1 :SHL: (32 - (ts_initialise_end - ts_initialise))) - B ts_SendLCDCmd - - -; -; Entry point for adding text to current cursor position -; - -ts_MoreText ROUT - - LDR r0,%10 ; set zero in r0 - ADD pc,pc,r0 -10 - & 0 - LDR r7,%11 ; pointer to command sequence - ADDS r7,pc,r7 - ADD pc,pc,r0 -11 - & (ts_extend - .) - LDR r6,%12 ; length of command sequence - ADD pc,pc,r0 -12 - & (1 :SHL: (32 - (ts_extend_end - ts_extend))) - B ts_SendLCDCmd - - -ts_PosText ROUT - -; -; Entry point for adding text at a specific cursor position -; Used iteratively by SendText, etc if cursor position command found. -; Offset into display is given in r6. -; - - LDR r0,%10 ; set zero in r0 - ADD pc,pc,r0 -10 - & 0 - LDR r7,%11 ; pointer to command sequence - ADDS r7,pc,r7 - ADD pc,pc,r0 -11 - & (ts_offset_table - .) ; offset * 2 into table of - ADDS r6,r6,r6 ; offset command sequences - ADDS r7,r7,r6 - - LDR r6,%12 ; length of command sequence - ADD pc,pc,r0 -12 - & (1 :SHL: (32 - 2)) - - -; -; Entry point for writing arbitrary command strings. -; Set r7 to point to command string, r6 length (as tables above), -; Set r4 to point to following Data string (null-terminated). -; - -ts_SendLCDCmd - - LDR r0,%01 ; set zero in r0 - ADD pc,pc,r0 -01 - & 0 - LDR r1,%02 ; set FFFFFFFF in r1 - ADD pc,pc,r0 ;(test value : sets carry when added to non-zero) -02 - & (-1) - LDR r2,%03 ; set pointer to test address - ADD pc,pc,r0 ;(points to aliased copy of a zero word) -03 - & (ts_Alias_bits + (%01 - %04)) - ADDS r2,pc,r2 ; adjust r2 for ROM-relative address - ADDS r0,r0,r0 ; dummy (to keep labels nearby !) -04 ; where pc points when added to r2 - - -; Wait - gap between successive WS attempts or successive bytes - -ts_send_command_byte ROUT - - LDR r3,%14 - ADD pc,pc,r0 -14 - & ts_recover_time -15 ADDS r3,r3,r3 ; 16-loop delay - BCC %15 - LDR r1,%16 ; reload test register - ADD pc,pc,r0 -16 - & (-1) - - LDR r3,[r2] ; Test for adapter ready for data - ADDS r3,r3,r1 ; (adapter detects WS operation) - BCC ts_SendQuit ; skip output : adapter not present - ; (backward jump helps ensure LDR r3,[r2] - ; only reads zero when adapter absent - LDR r3,[r2] ; since previous bus data is nonzero) - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - BCC ts_send_command_byte ; loop back until adapter is ready - -; Adapter ready - loop around all the bits in the byte - - - LDR r5,%21 ; load byte-shift counter ... - ADD pc,pc,r0 ; ... and bits-per-byte counter -21 - & (1 :SHL: 8) + 1 ; 24 shifts + 8 shifts - LDRB r1,[r7] -22 ADDS r1,r1,r1 ; shift byte up into m.s.d. - ADDS r5,r5,r5 - BCC %22 - - ; Send a single bit : 1 pulse for 1, 2 pulses for 0 - -23 LDR r3,[r2] - ADDS r1,r1,r1 ; shift current bit into Carry - LDRCC r3,[r2] ; second pulse if bit is 0 - - ; and wait for the inter-bit time - - LDR r3,%24 - ADD pc,pc,r0 -24 - & ts_recover_time -25 ADDS r3,r3,r3 ; 16-loop delay - BCC %25 - - ; repeat until 8 bits are sent - - ADDS r5,r5,r5 - BCC %23 - - ; do a RD operation to strobe the data out - - LDR r5,%26 - ADD pc,pc,r0 -26 - & (1 :SHL: (32 - 12)) -27 - LDR r3,[r2] - ADDS r5,r5,r5 - BCC %27 - -; Repeat for all the bytes to be sent (ts_initialise_end - ts_initialise) - - LDR r3,%33 - ADD pc,pc,r0 -33 - & 1 - ADDS r7,r7,r3 ; bump the pointer - ADDS r6,r6,r6 ; bump the counter (shift left) - BCC ts_send_command_byte - - -; -; Then send all the display bytes (in 4-bit mode) until a nul-terminator -; is reached. -; - -; -; Send a single character (as two separate 4-bit fields) -; First, look to see if it's one of : -; -; NUL - end of text string -; 0x80 - 0xfe - cursor positioning -; 0xff - introduce a hex digit -; - -ts_send_text_byte ROUT - - LDR r1,%40 ; reload test register - ADD pc,pc,r0 -40 - & (-1) - - LDRB r7,[r4] - ADDS r3,r7,r1 ; test for nul terminator - BCC ts_SendEnd - -; -; Byte isn't null. Check for >= 0x80. -; - - LDR r6,%42 ; test for cursor control - ADD pc,pc,r0 -42 - & (-&80) ; &8x means column x. - ADDS r6,r7,r6 - BCC ts_printable_char ; < &80 : write a character - -; -; Carry set : r6 now holds (value - 0x80). Check for numeric escape (&ff). -; - LDR r3,%43 - ADD pc,pc,r0 -43 - & (-&7f) - ADDS r3,r6,r3 - BCC %47 - -; -; Carry set : fetch a nybble from the top of r8 and display that. -; - - ADDS r8,r8,r8 - ADCS r6,r0,r0 - ADDS r8,r8,r8 - ADCS r6,r6,r6 - ADDS r8,r8,r8 - ADCS r6,r6,r6 - ADDS r8,r8,r8 - ADCS r6,r6,r6 - - LDRB r7,[pc,r6] - B ts_printable_char -45 - = "0123456789ABCDEF" - -; -; Not &ff : r6 holds cursor positioning offset (< &80). Skip over -; the cursor control byte and iterate thro' PosText to move -; typing position. -; - -47 - LDR r3, %48 - ADD pc,pc,r0 -48 - & 1 - ADDS r4,r3,r4 - B ts_PosText - -; -; Character is normal text : write it to the LCD. -; The shift loop is used to generate the inter-byte delay normally -; provided by ts_recover_time. Always make sure this is long enough. -; - -ts_printable_char - - ADDS r6,r0,r7 ; take a copy of character - LDR r5,%51 ; load byte-shift counter ... - ADD pc,pc,r0 ; ... and bits-per-byte counter -51 ; as a bitmask of the shift pattern - & (1:SHL:8)+(1:SHL:4)+1 ; 24 shifts + 4 shifts + 4 shifts -52 ADDS r6,r6,r6 ; shift byte up into m.s.d. - ADDS r0,r0,r0 ; slow this loop down - ensure it's - ADDS r0,r0,r0 ; always slower than ts_recover_time - ADDS r5,r5,r5 - BCC %52 - - LDR r3,[r2] ; Test for adapter ready for data - ADDS r3,r3,r1 ; (adapter detects WS operation) - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - BCC ts_printable_char ; loop back until adapter is ready - -; Adapter ready - loop around all the bits in the byte - -ts_send_tbit_upper - - ; wait for the inter-bit time - - LDR r3,%55 - ADD pc,pc,r0 -55 - & ts_recover_time -56 ADDS r3,r3,r3 ; 16-loop delay - BCC %56 - - ; Send a single bit : 1 pulse for 1, 2 pulses for 0 - - LDR r3,[r2] - ADDS r6,r6,r6 ; shift current bit into Carry - LDRCC r3,[r2] ; second pulse if bit is 0 - - ; repeat until upper 4 bits are sent - - ADDS r5,r5,r5 - BCC ts_send_tbit_upper - - ; then send the interface control bits - - LDR r1,%57 - ADD pc,pc,r0 -57 - & (8 :SHL: 28) ; assert RS control pin - -ts_send_cbit_upper - - ; wait for the inter-bit time - - LDR r3,%58 - ADD pc,pc,r0 -58 - & ts_recover_time -59 ADDS r3,r3,r3 ; 16-loop delay - BCC %59 - - ; Send a single bit : 1 pulse for 1, 2 pulses for 0 - - LDR r3,[r2] - ADDS r1,r1,r1 ; shift current bit into Carry - LDRCC r3,[r2] ; second pulse if bit is 0 - ADDS r5,r5,r5 - BCC ts_send_cbit_upper - -; -; do a RD operation to strobe the data out -; - - LDR r3,%61 - ADD pc,pc,r0 -61 - & ts_recover_time -62 ADDS r3,r3,r3 ; 16-loop delay - BCC %62 - - LDR r5,%63 - ADD pc,pc,r0 -63 - & (1 :SHL: (32 - 12)) -64 - LDR r3,[r2] - ADDS r5,r5,r5 - BCC %64 - - ; prepare to send the lower 4 bits out - - LDR r5,%70 ; bitcount mask for 4 data bits - ADD pc,pc,r0 ; and 4 interface control bits -70 - & (((1 :SHL: 4) + 1) :SHL: 24) - -ts_send_text_lower - LDR r3,%71 - ADD pc,pc,r0 -71 - & ts_recover_time -72 ADDS r3,r3,r3 ; 16-loop delay - BCC %72 - - LDR r1,%73 - ADD pc,pc,r0 -73 - & (-1) - - LDR r3,[r2] ; Test for adapter ready for data - ADDS r3,r3,r1 ; (adapter detects WS operation) - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - BCC ts_send_text_lower ; loop back until adapter is ready - -ts_send_tbit_lower - - ; wait for the inter-bit time - - LDR r3,%76 - ADD pc,pc,r0 -76 - & ts_recover_time -77 ADDS r3,r3,r3 ; 16-loop delay - BCC %77 - - ; Send a single bit : 1 pulse for 1, 2 pulses for 0 - - LDR r3,[r2] - ADDS r6,r6,r6 ; shift current bit into Carry - LDRCC r3,[r2] ; second pulse if bit is 0 - - ; repeat until lower 4 bits are sent - - ADDS r5,r5,r5 - BCC ts_send_tbit_lower - - - ; then send the interface control bits - - LDR r1,%78 - ADD pc,pc,r0 -78 - & (8 :SHL: 28) ; assert RS control pin - -ts_send_cbit_lower - - ; wait for the inter-bit time - - LDR r3,%80 - ADD pc,pc,r0 -80 - & ts_recover_time -81 ADDS r3,r3,r3 ; 16-loop delay - BCC %81 - - ; Send a single bit : 1 pulse for 1, 2 pulses for 0 - - LDR r3,[r2] - ADDS r1,r1,r1 ; shift current bit into Carry - LDRCC r3,[r2] ; second pulse if bit is 0 - - ADDS r5,r5,r5 - BCC ts_send_cbit_lower - -; -; do a RD operation to strobe the data out -; - - ; wait for the inter-bit time - - LDR r3,%82 - ADD pc,pc,r0 -82 - & ts_recover_time -83 ADDS r3,r3,r3 ; 16-loop delay - BCC %83 - - LDR r5,%84 - ADD pc,pc,r0 -84 - & 1 :SHL: (32 - 12) -85 - LDR r3,[r2] - ADDS r5,r5,r5 - BCC %85 - -; Repeat for all the bytes to be sent (until nul terminator is found) - - LDR r3,%86 - ADD pc,pc,r0 -86 - & 1 - ADDS r4,r3,r4 ; bump text pointer - B ts_send_text_byte - -; -; Wait for about 1 seconds worth of LCD operation delays to -; permit the operator to read the text. -; Use of the interface's monitor allows this delay to be increased -; or decreased externally. -; - -ts_SendEnd ROUT - - LDR r7, %01 - ADD pc,pc,r0 -01 - & (ts_pause_time + 1) ; must be an odd number - ; to ensure pairs of zeros - ASSERT ((ts_pause_time :AND: 1) = 0) - -02 - LDR r3,%03 - ADD pc,pc,r0 -03 - & ts_recover_time -04 ADDS r3,r3,r3 ; 16-loop delay - BCC %04 - LDR r1,%05 ; reload test register - ADD pc,pc,r0 -05 - & (-1) - - LDR r3,[r2] ; Test for adapter ready for data - ADDS r3,r3,r1 ; (adapter detects WS operation) - BCC ts_SendQuit ; skip output : adapter not present - LDR r3,[r2] - ADDS r3,r3,r1 - LDR r3,[r2] - ADDS r3,r3,r1 - BCC %02 ; loop back until adapter is ready - -; Adapter ready - loop around all the bits in the byte -; Note that each byte is actually 4 bits to the LCD module, -; so a even number must be sent or the display will get out -; of sync until the next display reset sequence. - - LDR r5,%10 ; bits-per-byte counter - ADD pc,pc,r0 -10 - & (1 :SHL: 24) - LDR r3,%11 - ADD pc,pc,r0 -11 - & ts_recover_time ; wait before sending data bits -12 ADDS r3,r3,r3 ; for byte timing. - BCC %12 - - ; Send a single bit : always 2 pulses for 0 - -13 LDR r3,[r2] - LDR r3,[r2] - - ; and wait for the inter-bit time - - LDR r3,%14 - ADD pc,pc,r0 -14 - & ts_recover_time -15 ADDS r3,r3,r3 ; 16-loop delay - BCC %15 - - ; repeat until 8 bits are sent - - ADDS r5,r5,r5 - BCC %13 - - ; do a RD operation to strobe the data out - - LDR r5,%16 - ADD pc,pc,r0 -16 - & 1 :SHL: (32 - 12) -17 - LDR r3,[r2] - ADDS r5,r5,r5 - BCC %17 - - ; repeat until a sufficient number of nuls are done - - ADDS r7,r7,r1 ; count down loop counter - BCS %02 - - ADD pc,r0,r14 ; back to caller - - - END diff --git a/OldTestSrc/Ioc b/OldTestSrc/Ioc deleted file mode 100644 index 5ec8b15..0000000 --- a/OldTestSrc/Ioc +++ /dev/null @@ -1,92 +0,0 @@ -; > TestSrc.IOC - - TTL RISC OS 2+ POST IO controller -; -; This initial IOC test simply reports the content of the IRQ and FIRQ -; registers, to show any unexpected pending IRQs. -; Certain of these should really be cleared, and the effect of an -; interrupt tested. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 18-Dec-89 ArtG Initial version -; 29-Nov-91 ArtG Added IOC bus test using mask registers -; 20-Jun-93 ArtG Modified for 29-bit IOMD test -; -; -;------------------------------------------------------------------------ - - [ IO_Type = "IOMD" -ts_IObase * IOMD_Base -ts_IOmask * &1fffffff -ts_IOreg1 * IOMD_VIDCUR -ts_IOreg2 * IOMD_VIDSTART -ts_IObswap * 32 -ts_IOMD_ID * &D4E7 - | -ts_IObase * IOC -ts_IOmask * &ff0000 -ts_IOreg1 * IOCIRQMSKA -ts_IOreg2 * IOCIRQMSKB -ts_IObswap * 16 - ] - -ts_IOCreg - MOV r0,#0 ; zero error accumulator - LDR r3, =ts_IObase - MOV r1,#(1 :SHL: 31) ; initialise bit-set test mask -0 - MVN r2,r1 ; make bit-clear test mask - ANDS r4,r1,#ts_IOmask - BEQ %FT1 ; skip if this bit isn't tested - STR r1,[r3,#ts_IOreg1] - STR r2,[r3,#ts_IOreg2] - LDR r4,[r3,#ts_IOreg1] -; EOR r4, r4, r1, LSR #ts_IObswap ; check bit-set test was OK - EOR r4, r4, r1 ; check bit-set test was OK - ORR r0, r0, r4 ; accumulate errors in r0 - LDR r4,[r3,#ts_IOreg2] -; EOR r4, r4, r2, LSR #ts_IObswap ; check bit-clear test was OK - EOR r4, r4, r2 ; check bit-clear test was OK - ORR r0, r0, r4 ; accumulate errors in r0 -1 - MOV r1, r1, LSR #1 ; shift mask downwards - TEQ r1,#0 - BNE %BT0 ; and loop until all bits tested - - ANDS r8, r0, #ts_IOmask - MOV pc,r14 ; return error if any bit failed - -ts_IOCstat - LDR r3, =ts_IObase - MOV r0,#0 - [ IO_Type = "IOMD" - LDRB r1,[r3,#IOMD_ID1] - ORR r0,r0,r1, LSL #(32-24) - LDRB r1,[r3,#IOMD_ID0] - ORR r0,r0,r1 - LDR r1,=ts_IOMD_ID - CMPS r0,r1 ; check IOMD identity - MOV r0,r0,LSL #16 - LDRB r1,[r3,#IOMD_VERSION] - ORR r8,r0,r1, LSL #12 - MOV pc,r14 - | - LDRB r1,[r3,#IOCControl] - ORR r0,r0,r1, LSL #(32 - 8) - LDRB r1,[r3,#IOCIRQSTAA] - ORR r0,r0,r1, LSL #(32 - 16) - LDRB r1,[r3,#IOCIRQSTAB] - ORR r0,r0,r1, LSL #(32 - 24) - LDRB r1,[r3,#IOCFIQSTA] - ORR r8,r0,r1 - ANDS r1,r1,#0 ; return zero flag (OK) - - MOV pc,r14 - ] - - END - diff --git a/OldTestSrc/MEMC1 b/OldTestSrc/MEMC1 deleted file mode 100644 index 847df36..0000000 --- a/OldTestSrc/MEMC1 +++ /dev/null @@ -1,552 +0,0 @@ -; > MEMC1 - -; MEMC interface file - MEMC1 version - -; Created by TMD 10-Aug-90 - -VInit * &03600000 -VStart * &03620000 -VEnd * &03640000 -CInit * &03660000 -; SStart * &03680000 -; SEnd * &036A0000 -; SPtr * &036C0000 - -; ***************************************************************************** -; -; SetDAG - Program DMA address generator R1 with physical address R0 -; -; in: r0 = physical address -; r1 = index of DMA address generator to program, as defined in vdudecl -; -; out: All registers preserved, operation ignored if illegal -; - - [ {FALSE} -SetDAG ENTRY "r0" - CMP r1, #MEMCDAG_MaxReason - EXIT HI - ADR r14, DAGAddressTable - LDR r14, [r14, r1, LSL #2] ; load base address in MEMC1 - MOV r0, r0, LSR #4 ; bottom 4 bits irrelevant - CMP r0, #(1 :SHL: 15) ; ensure in range - ORRCC r14, r14, r0, LSL #2 - STRCC r14, [r14] ; any old data will do - EXIT - - GBLA DAGIndex -DAGIndex SETA 0 - - MACRO - DAGTab $reason, $address - ASSERT ($reason)=DAGIndex - & $address -DAGIndex SETA DAGIndex + 1 - MEND - -DAGAddressTable - DAGTab MEMCDAG_VInit, VInit - DAGTab MEMCDAG_VStart, VStart - DAGTab MEMCDAG_VEnd, VEnd - DAGTab MEMCDAG_CInit, CInit - ] -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; CAM manipulation utility routines - -BangCamUpdate ROUT - -; R2 = CAM entry no -; R3 = logaddr -; R9 = current MEMC value -; R11 = PPL -; set and update tables - - MOV R4, #0 - LDR R4, [R4, #CamEntriesPointer] - ORR r0, r3, r11, LSL #28 ; top nibble is PPL - STR r0, [R4, R2, LSL #2] - -BangCam - -; r0 corrupted -; r1 corrupted -; R2 = CAM entry no -; R3 = logaddr -; r4 corrupted -; r5 spare! -; r6 corrupted -; r7, r8 spare -; R9 = current MEMC value -; r10 spare -; R11 = PPL -; r12 spare - - AND R4, R9, #&C ; pagesize - ADR R0, PageMangleTable - LDR R0, [R0, R4] ; load data table pointer - MOV R4, #0 -01 LDR R1, [R0], #4 - CMP R1, #-1 - BEQ %FT02 - AND R6, R2, R1 - LDR R1, [R0], #4 - CMP R1, #0 - RSBMI R1, R1, #0 - ORRPL R4, R4, R6, LSL R1 - ORRMI R4, R4, R6, LSR R1 - B %BT01 - -02 LDR R1, [R0], #4 - CMP R1, #-1 - BEQ %FT03 - AND R6, R3, R1 - LDR R1, [R0], #4 - CMP R1, #0 - RSBMI R1, R1, #0 - ORRPL R4, R4, R6, LSL R1 - ORRMI R4, R4, R6, LSR R1 - B %BT02 - -03 ORR R4, R4, #CAM - ORR R4, R4, R11, LSL #8 ; stuff in PPL - STR R4, [R4] ; and write it - MOV PC, LR - -; Data to drive CAM setting - -PageMangleTable - & PageMangle4K - & PageMangle8K - & PageMangle16K - & PageMangle32K - -; For each page size, pairs of masks and shift factors to put the bits in the -; right place. Two sets: operations on Physical Page Number, operations on -; Logical Page Number. - -; Shifts are Shift Left values (<<). Each section terminated by -1 - -PageMangle4K -; PPN: - & 2_011111111 - & 0 ; bits in right place - & -1 -; LPN: - & 2_1100000000000:SHL:12 - & (11-12)-12 ; LPN[12:11] -> A[11:10] - & 2_0011111111111:SHL:12 - & (22-10)-12 ; LPN[10:0 ] -> A[22:12] - & -1 - -PageMangle8K -; PPN: - & 2_010000000 - & 7-7 ; PPN[7] -> A[7] - & 2_001000000 - & 0-6 ; PPN[6] -> A[0] - & 2_000111111 - & 6-5 ; PPN[5:0] -> A[6:1] - & -1 -; LPN: - & 2_110000000000:SHL:13 - & (11-11)-13 ; LPN[11:10] -> A[11:10] - & 2_001111111111:SHL:13 - & (22-9)-13 ; LPN[9:0] -> A[22:13] - & -1 - -PageMangle16K -; PPN: - & 2_010000000 - & 7-7 ; PPN[7] -> A[7] - & 2_001100000 - & 1-6 ; PPN[6:5] -> A[1:0] - & 2_000011111 - & 6-4 ; PPN[4:0] -> A[6:2] - & -1 -; LPN: - & 2_11000000000:SHL:14 - & (11-10)-14 ; LPN[10:9] -> A[11:10] - & 2_00111111111:SHL:14 - & (22-8)-14 ; LPN[8:0] -> A[22:14] - & -1 - -PageMangle32K -; PPN: - & 2_100000000 - & 12-8 ; PPN[8] -> A[12] - & 2_010000000 - & 7-7 ; PPN[7] -> A[7] - & 2_001000000 - & 1-6 ; PPN[6] -> A[1] - & 2_000100000 - & 2-5 ; PPN[5] -> A[2] - & 2_000010000 - & 0-4 ; PPN[4] -> A[0] - & 2_000001111 - & 6-3 ; PPN[3:0] -> A[6:3] - & -1 -; LPN: - & 2_1100000000:SHL:15 - & (11-9)-15 ; LPN[9:8] -> A[11:10] - & 2_0011111111:SHL:15 - & (22-7)-15 ; LPN[7:0] -> A[22:15] - & -1 - -PageSizes - & 4*1024 ; 0 is 4K - & 8*1024 ; 4 is 8K - & 16*1024 ; 8 is 16 - & 32*1024 ; C is 32 - -PageShifts - = 12, 13, 0, 14 ; 1 2 3 4 - = 0, 0, 0, 15 ; 5 6 7 8 - -; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; SWI OS_UpdateMEMC: Read/write MEMC1 control register - -SSETMEMC ROUT - - AND r10, r0, r1 - MOV r12, #0 - TEQP pc, #SVC_mode+I_bit+F_bit - LDR r0, [r12, #MEMC_CR_SoftCopy] ; return old value - BIC r11, r0, r1 - ORR r11, r11, R10 - BIC r11, r11, #&FF000000 - BIC r11, r11, #&00F00000 - ORR r11, r11, #MEMCADR - STR r11, [r12, #MEMC_CR_SoftCopy] - STR r11, [r11] - TEQP pc, #SVC_mode+I_bit - ExitSWIHandler - -; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; -; ClearPhysRAM - Routine to clear "all" memory -; -; While this routine is running, keyboard IRQs may happen. For this reason -; it avoids LogRAM 0..31 (where hardware IRQ vector is) and PhysRAM -; 0..31 where the IRQ workspace is. -; - -ClearPhysRAM ROUT - MOV R0, #0 - MOV R1, #0 - MOV R2, #0 - MOV R3, #0 - MOV R4, #0 - MOV R5, #0 - MOV R6, #0 - MOV R11, #0 - MOV R8, #PhysRam - CMP R13, #512*1024 - ADDEQ R10, R8, #(512-64)*1024 ; get address that's logram 0 - ADDNE R10, R8, #512*1024 - ADD R13, R13, #PhysRam ; end of memory - ADD R8, R8, #4*8 ; skip minimal startup workspace -10 CMP R8, R10 - ADDEQ R8, R8, #4*8 ; skip physram that's logram 0 - STMNEIA R8!, {R0-R6, r11} - CMP R8, R13 - BNE %BT10 - SUB R13, R13, #PhysRam - - LDR R0, =OsbyteVars + :INDEX: LastBREAK - MOV R1, #&80 - STRB R1, [R0] ; flag the fact that RAM cleared - MOV pc, lr - -; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; -; InitMEMC - Initialise memory controller -; - -InitMEMC ROUT - LDR R0, ResetMemC_Value - STR R0, [R0] ; set ROM access times, refresh on flyback, no DMA - MOV pc, lr - -; -> MemSize - -; (non-destructive) algorithm to determine MEMC RAM configuration -; -; Dave Flynn and Alasdair Thomas -; 17-March-87 -; -; Spooling checkered by NRaine and SSwales ! -; 8MByte check bodged in by APT -; -; NOTE: Routines MemSize and TimeCPU are called by the power-on test software, -; so their specifications MUST not change. -; -; Set MEMC for 32-k page then analyse signature of possible -; external RAM configurations... -; The configurations are: -; -; Ram Size Page Size Configuration (Phys RAM) Signature -;-------------------------------------------------------------------- -; 16MByte 32k 4*32*1Mx1 A13,A20,A21,A22,A23,A23.5 distinct -; 16MByte 32k 16*8*256kx4 A13,A20,A21,A22,A23,A23.5 distinct -; -; 12MByte 32k 3*32*1Mx1 A13,A20,A21,A22,A23 OK, A23.5 fail -; 12MByte 32k 12*8*256kx4 A13,A20,A21,A22,A23 OK, A23.5 fail -; -; 8MByte 32k 2*32*1Mx1 A13,A20,A21,A22 distinct, A23 fail -; 8MByte 32k 8*8*256kx4 A13,A20,A21,A22 distinct, A23 fail -; -; 4Mbyte 32k 32*1Mx1 A13,A21,A20 distinct, A22,A23 fail -; 4Mbyte 32k 4*8*256kx4 A13,A21,A20 distinct, A22,A23 fail -; -; 2Mbyte 32k expandable 2*8*256kx4 A13,A20 distinct, A21 fails -; 2Mbyte ??? 16k fixed 2*8*256kx4 A13,A21 distinct, A20 fails -; -; 1Mbyte 8k 32*256kx1 A13,A20 fail, A19,A18,A12 distinct -; 1Mbyte 8k 8*256kx1 A13,A20 fail, A19,A18,A12 distinct -; 1Mbyte 8k 4*8*64kx4 A13,A20 fail, A19,A18,A12 distinct -; -; 512Kbyte 8k expandable 2*8*64kx4 A13,A20,A19 fail, A12,A18 distinct -; 512Kbyte 4k fixed 2*8*64kx4 A13,A20,A12 fail, A19,A18 distinct -; -; 256Kbyte 4K 8*64kx4 A13,A20,A12,A18 fail, A21,A19 ok -; 256Kbyte 4K 32*64kx1 A13,A20,A12,A18 fail, A21,A19 ok -; - -Z_Flag * &40000000 - -; MemSize routine... enter with 32K pagesize set -; R0 returns page size -; R1 returns memory size -; R2 returns value set in MEMC -; uses R3-R7 - -MemSize ROUT - MOV r7, lr - MOV r0, #PhysRam - ADD r1, r0, #A13 - BL DistinctAddresses - BNE %10 - ADD r1, r0, #A21 - BL DistinctAddresses - MOVNE r0, #Page32K - MOVNE r1, #2048*1024 - BNE MemSizeDone - - MOV r0, #PhysRam - ADD r1, r0, #4*1024*1024 - BL DistinctAddresses - MOVNE r0, #Page32K - MOVNE r1, #4*1024*1024 - BNE MemSizeDone - - MOV r0, #PhysRam - ADD r1, r0, #8*1024*1024 - BL DistinctAddresses - MOVNE r0, #Page32K - MOVNE r1, #8*1024*1024 - BNE MemSizeDone - - MOV r0, #PhysRam - ADD r1, r0, #12*1024*1024 - BL DistinctAddresses - MOV r0, #Page32K - MOVNE r1, #12*1024*1024 - MOVEQ r1, #16*1024*1024 - B MemSizeDone - -10 ADD r1, r0, #A20 - BL DistinctAddresses - BNE %20 - MOV r0, #Page16K - MOV r1, #2048*1024 - B MemSizeDone - -20 ADD r1, r0, #A19 - BL DistinctAddresses - BEQ %30 - MOV r0, #Page8K - MOV r1, #512*1024 - B MemSizeDone - -30 ADD r1, r0, #A18 - BL DistinctAddresses - BEQ %40 - MOV r0, #Page4K - MOV r1, #256*1024 - B MemSizeDone - -40 ADD r1, r0, #A12 - BL DistinctAddresses - BEQ %50 - MOV r0, #Page4K - MOV r1, #512*1024 - B MemSizeDone - -50 MOV r0, #Page8K - MOV r1, #1024*1024 - -MemSizeDone - LDR r2, ResetMemC_Value - BIC r2, r2, #&C - ORR r2, r2, r0 - STR r2, [r2] ; set MEMC to right state - MOV pc, r7 - - -; DistinctAddresses routine... -; r0,r1 are the addresses to check -; uses r2-5 -; writes interleaved patterns (to prevent dynamic storage...) -; checks writing every bit low and high... -; return Z-flag set if distinct - -DistinctAddresses ROUT - LDR r2, [r0] ; preserve - LDR r3, [r1] - LDR r4, Pattern - STR r4, [r0] ; mark first - MOV r5, r4, ROR #16 - STR r5, [r1] ; mark second - LDR r5, [r0] - CMP r5, r4 ; check first - BNE %10 ; exit with Z clear - LDR r5, [r1] ; check second - CMP r5, r4, ROR #16 ; clear Z if not same - BNE %10 -; now check inverse bit writes - STR r4, [r1] ; mark second - MOV r5, r4, ROR #16 - STR r5, [r0] ; mark first - LDR r5, [r1] - CMP r5, r4 ; check second - BNE %10 ; exit with Z clear - LDR r5, [r0] ; check first - CMP r5, r4, ROR #16 ; clear Z if not same -10 STR r3, [r1] ; restore - STR r2, [r0] - ORREQ lr, lr, #Z_Flag - BICNE lr, lr, #Z_Flag - MOVS pc, lr - -Pattern - & &AAFF5500 ; shiftable bit check pattern - -; init state with masked out page size - -ResetMemC_Value - & &E010C :OR: MEMCADR ; slugged ROMs + flyback refresh only + 32K page - -; Constants -; -A21 * 1:SHL:21 -A20 * 1:SHL:20 -A19 * 1:SHL:19 -A18 * 1:SHL:18 -A13 * 1:SHL:13 -A12 * 1:SHL:12 - -Page32K * &C ; in MEMC control reg patterns... -Page16K * &8 -Page8K * &4 -Page4K * &0 - - -; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; In r0-r6 trashable -; r9 = Current MEMC CR - -; Out r9 MEMC value with slowest ROM speed, correct pagesize -; r7 processor speed in kHz, tbs -> MEMC1a - -ncpuloops * 1024 ; don't go longer than 4ms without refresh ! -nmulloops * 128 - -TimeCPU ROUT - - BIC r9, r9, #3 :SHL: 8 - STR r9, [r9] ; turn off refresh for a bit - -; Time CPU/Memory speed - - LDR r1, =&7FFE ; 32K @ 2MHz = ~16ms limit - MOV r3, #IOC - - MOV r0, r1, LSR #8 - STRB r1, [r3, #Timer1LL] - STRB r0, [r3, #Timer1LH] - LDR r0, =ncpuloops - STRB r0, [r3, #Timer1GO] ; start the timer NOW - B %FT10 ; Looks superfluous, but is required - ; to get ncpuloops pipeline breaks - -10 SUBS r0, r0, #1 ; 1S - BNE %BT10 ; 1N + 2S - - STRB r0, [r3, #Timer1LR] ; latch count NOW - LDRB r2, [r3, #Timer1CL] - LDRB r0, [r3, #Timer1CH] - ADD r2, r2, r0, LSL #8 ; count after looping is ... - - SUB r2, r1, r2 ; decrements ! - MOV r2, r2, LSR #1 ; IOC clock decrements at 2MHz - -; Time CPU/MEMC Multiply time - - MOV r4, #-1 ; Gives worst case MUL - - MOV r0, r1, LSR #8 - STRB r1, [r3, #Timer1LL] - STRB r0, [r3, #Timer1LH] - LDR r0, =nmulloops - STRB r0, [r3, #Timer1GO] ; start the timer NOW - B %FT20 ; Looks superfluous, but is required - ; to get nmulloops pipeline breaks - -20 MUL r5, r4, r4 ; 1S + 16I - MUL r5, r4, r4 ; 1S + 16I - SUBS r0, r0, #1 ; 1S - BNE %BT20 ; 1N + 2S - - STRB r0, [r3, #Timer1LR] ; latch count NOW - LDRB r4, [r3, #Timer1CL] - LDRB r0, [r3, #Timer1CH] - ADD r4, r4, r0, LSL #8 ; count after looping is ... - - SUB r4, r1, r4 ; decrements ! - MOV r4, r4, LSR #1 ; IOC clock decrements at 2MHz - - ORR r9, r9, #1 :SHL: 8 ; set refresh on flyback - STR r9, [r9] ; restore MEMC state a.s.a.p. - -; In ROM - each cpu loop took 4R cycles @ 8/f*500ns/cycle - - LDR r0, =4*(8*500/1000)*ncpuloops*1000 - DivRem r7, r0, r2, r1 ; r2 preserved - MOV r0, #&80 ; At 8 MHz and below, run fast ROMs - LDR r1, =8050 ; Over 8 MHz, need medium ROMs - CMP r7, r1 - MOVHI r0, #&40 - LDR r1, =13000 ; Over 13 MHz, need slowest ROMs - CMP r7, r1 - MOVHI r0, #&00 - ORR r9, r9, r0 - STR r9, [r9] ; Set ROM speed appropriately - - ASSERT ncpuloops = 8*nmulloops ; for given ratio cutoff <------------ - - MOV r4, r4, LSL #10 ; *1024 to get resolution on divide - DivRem r0, r4, r2, r1 - LDR r1, =1100 ; Cutoff point; MEMC1 longer than this - CMP r0, r1 - ORRLO r7, r7, #1 :SHL: 16 ; Note MEMC1a prescence - - MOV pc, lr - -; Typical figures give (in ROM at 8MHz): - -; MEMC1 2048 CPU, 2432 MEMC -> MUL ratio 1216 -; MEMC1a 2048 864 432 - -; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - END diff --git a/OldTestSrc/Mem1IOMD b/OldTestSrc/Mem1IOMD deleted file mode 100644 index f1b6a14..0000000 --- a/OldTestSrc/Mem1IOMD +++ /dev/null @@ -1,481 +0,0 @@ -; > TestSrc.Mem1IOMD - - TTL RISC OS 2+ POST memory linetest -; -; This test code is used to perform basic integrity tests on DRAM. -; It doesn't test all locations - just walks patterns through data -; and address lines. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 1-Jun-93 ArtG Derived from Mem1 for use on Medusa -; -; -;------------------------------------------------------------------------ - -; -; Test the data and address and byte strobe lines for uniqueness. -; - - LTORG - ROUT - -1 - = "VRAM :",0 -2 - = "VRAM-F",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = "DRAM ",&ff,":",0 -4 - = "Data :",0 -5 - = &88,&ff,&ff," MByte",0 - - ALIGN - -ts_LineTest - - ADR r4,%BT1 - BL ts_SendText ; Start data line tests on VRAM - - MOV r0,#0 - MOV_fiq r9,r0 ; r9-fiq records VRAM or low DRAM address - - MOV r12, #IOMD_Base - MOV r2, #IOMD_VREFCR_VRAM_256Kx64 :OR: IOMD_VREFCR_REF_16 ; assume 2 banks of VRAM by default - STRB r2, [r12, #IOMD_VREFCR] - -; Find the size, using MemSize's method - - MOV r0, #VideoPhysRam ; point at VRAM - ADD r1, r0, #A2 ; test A2 - BL DistinctAddresses - MOVEQ r9, #2 ; we've got 2M of VRAM - BEQ %FT21 - - MOV r2, #IOMD_VREFCR_VRAM_256Kx32 :OR: IOMD_VREFCR_REF_16 - STRB r2, [r12, #IOMD_VREFCR] - ADD r1, r0, #A2 ; check for any VRAM at all - BL DistinctAddresses - MOVEQ r9, #1 ; we've got 1M of VRAM - MOVNE r9, #0 ; no VRAM -21 - BNE %FT22 - MOV_fiq r9,r0 ; record VRAM address - FAULT #R_VRAM ; indicate VRAM present - -; Report size .. if this is non-zero and the data line test fails, -; RISC OS will have problems. - -22 - ADR r4,%BT5 ; Add size (in hex Mbyte) - MOV r8,r9, LSL #24 ; to "VRam : " message - BL ts_MoreText - -; Worked out what size VRAM is, and set up IOMD register. -; Do a data line test on the resulting array, repeated at oddword address to -; ensure both banks get tested with walking 0 and walking 1 - - ADR r4,%BT4 - BL ts_SendText - MOV r1, #VideoPhysRam - BL ts_Dataline - ADDEQ r1,r1,#4 - BLEQ ts_Dataline - BEQ %FT25 ; looks OK - carry on with VRAM test -; -; Data line test failed. Report the bitmap that failed, then carry on. -; - ADR r4,%BT2 - MOV r8,r0 ; report data fault mask - BL ts_SendText - B %FT30 - -; -; If there was some VRAM found here, and it passed the dataline test, -; do the address and bytestrobe tests on it too. -; - -25 - ADRL r4,%FT75 ; announce start of address line test - BL ts_SendText - MOV r1,#VideoPhysRam - MOV r0,r9,LSL #20 ; size in MB determined before dataline test - BL ts_Addrline - BEQ %FT26 - ADRL r4,%FT76 ; failed - report error mask - MOV r8,r0 - BL ts_SendText - FAULT #R_LINFAILBIT ; and record failure - B %FT30 -26 - ADRL r4,%FT77 ; announce start of byte test - BL ts_SendText - MOV r1,#VideoPhysRam - BL ts_Byteword - ADDEQ r1,r1,#4 ; retest at an oddword boundary - BLEQ ts_Byteword - BEQ %FT27 - ADRL r4,%FT78 ; failed - report error mask - MOV r8,r0,LSL #16 - BL ts_SendText - FAULT #R_LINFAILBIT ; and record failure -27 - - -; Similarly, test each DRAM bank in turn, reporting failures or sizes for each - -30 - MOV r11, #IOMD_DRAMCR_DRAM_Large * &55 ; set all banks to be large initially - MOV r14, #IOMD_Base - STRB r11, [r14, #IOMD_DRAMCR] - MOV r0,#MMUC_D ; enable 32-bit addressing of data - SetCop r0,CR_Control - - MOV r10, #0 ; indicate no RAM found yet - MOV r9, #IOMD_DRAMCR_DRAM_Small ; bit to OR into DRAMCR - MOV r12, #DRAM0PhysRam -35 - MOV r8,r12,LSL #2 ; indicate bank under test - AND r8,r8,#(3 :SHL: 28) - ADR r4,%BT3 - BL ts_SendText - - MOV r8,#0 ; r8 indicates RAM found in this bank - MOV r0, r12 - ADD r1, r12, #A10 ; this should be OK for both configurations - BL DistinctAddresses - BNE %FT50 ; [no RAM in this bank at all] - - MOV_fiq r2,r9 ; if this is the first bank of DRAM or VRAM, - TEQS r2,#0 ; put it's address in r9_fiq - BNE %FT36 - MOV_fiq r9,r0 - -36 ADD r1, r12, #A11 ; test for 256K DRAM - BL DistinctAddresses - ORRNE r11, r11, r9 ; it is, so select small multiplexing - MOVNE r14, #IOMD_Base - STRNEB r11, [r14, #IOMD_DRAMCR] ; store new value of DRAMCR, so we can use memory immediately - MOVNE r8, #1024*1024 ; must be 1Mbyte at this address - BNE %FT50 - -; it's bigger than 256K words, so test address lines A21-A25 in sequence -; we assume that the size of each bank is a power of 2 - - MOV r8, #A21 ; now go through address lines A21-A25 -40 - ADD r1, r12, r8 ; see if this address line is unique - BL DistinctAddresses - BNE %FT50 ; if we've failed then r8 is true size, so exit - MOV r8, r8, LSL #1 ; else shift up to next - TEQ r8, #A26 ; only test up to A25 - BNE %BT40 - -50 - MOV r13,r8 ; remember size of this bank in bytes - MOV r8,r13,LSL #(24 - 20) ; and display it in 2 digits, in MBytes. - ADR r4,%BT5 - BL ts_MoreText - - ADRL r4,%FT73 ; announce data line test - BL ts_SendText - MOV r1,r12 ; do walking bit test - BL ts_Dataline - BEQ %FT55 ; looks OK, carry on to next bank - - ADRL r4,%FT74 ; bit test failed, so report it - MOV r8,r0 - BL ts_SendText ; and bit fault mask - - CMPS r13,#0 ; was any RAM thought to be here ? - BEQ %FT55 - FAULT #R_LINFAILBIT ; if so, it's faulty. - MOV r13,#0 ; so ignore it -55 - -; -; If there was some RAM found here, and it passed the dataline test, -; do the address and bytestrobe tests on it too. -; - CMPS r13,#0 - BEQ %FT60 - - ADR r4,%FT75 ; announce start of address line test - BL ts_SendText - MOV r1,r12 ; test address lines in this block - MOV r0,r13 - BL ts_Addrline - BEQ %FT56 - ADR r4,%FT76 ; failed - report error mask - MOV r8,r0 - BL ts_SendText - FAULT #R_LINFAILBIT ; and record failure - MOV r13,#0 ; then forget this memory block - -56 - ADR r4,%FT77 ; announce start of byte test - BL ts_SendText - MOV r1,r12 - BL ts_Byteword - BEQ %FT60 - ADR r4,%FT78 ; failed - report error mask - MOV r8,r0,LSL #16 - BL ts_SendText - FAULT #R_LINFAILBIT ; and record failure - MOV r13,#0 ; then forget this memory block -60 - - -; If the RAM found still seems OK, add it's size into the r10 accumulator -; Working or not, carry on to check the next bank. - - ADD r10,r10,r13 ; accumulate DRAM if any found - ADD r12, r12, #DRAM1PhysRam-DRAM0PhysRam ; move onto next bank - MOV r9, r9, LSL #2 ; shunt up position in DRAMCR - CMP r9, #&100 ; if more banks to do - BCC %BT35 ; then loop - - ADR r4,%FT70 - BL ts_SendText ; None found .. print message - - MOVS r8,r10,LSL #(24 - 20) ; all finished .. - ADREQ r4,%FT71 ; did we find any DRAM? - ADRNE r4,%FT72 - BNE %FT65 - FAULT #R_LINFAILBIT ; fault if we didn't -65 - BL ts_MoreText - B ts_endline - - -70 - = "DRAM",0 -71 - = &88,"Failed",0 -72 - = &88,&ff,&ff," MByte",0 -73 - = "Data :",0 -74 - = "Data-F",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -75 - = "Addrs :",0 -76 - = "Addrs-F",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -77 - = "Byte :",0 -78 - = "Byte-F",&88,&ff,&ff,&ff,&ff,0 - - -; -; Data line test. -; -; In : r1 - start address for test -; -; Out : r0 - failing data pattern -; r1 - address of failure -; -; -; This exercises data lines in attempt to find shorts/opens. -; It goes something like : -; -; for (ptr = address, pattern = 1; pattern != 0; pattern <<= 1) -; *ptr++ = pattern; -; *ptr++ = ~pattern; -; for (ptr = address, pattern = 1; pattern != 0; pattern <<= 1) -; result |= pattern ^ *ptr++; -; result |= ~pattern ^ *ptr++; -; return result and address -; - -ts_Dataline ROUT - -; -; Write all walking-zero, walking-one patterns -; -10 MOV r6,r1 ; set pointer for a write loop - MOV r5,#1 ; set initial test pattern - MVN r4,r5 ; and it's inverse -11 - STMIA r6!,{r4-r5} ; write the patterns - - ADDS r5,r5,r5 ; shift the pattern (into Carry) - MVN r4,r5 - BCC %BT11 ; repeat until all bits done -; -; Read back and accumulate in r0 any incorrect bits -; - MOV r6,r1 ; set pointer for a read loop - MOV r5,#1 ; set initial test pattern - MVN r4,r5 ; and it's inverse - MOV r0,#0 ; accumulate result -21 - LDMIA r6!,{r2-r3} ; read the patterns - EOR r2,r2,r4 - ORR r0,r0,r2 ; OR any failed bits into r0 - EOR r3,r3,r5 - ORR r0,r0,r2 - - ADDS r5,r5,r5 ; shift the pattern (into Carry) - MVN r4,r5 - BCC %BT21 ; repeat until all bits done -; -; After all checks at this address group, report back errors -; - MOVS r0,r0 ; check for any result bits set - MOV pc,r14 ; return r0 with error map (or 0) - - - -; -; Address line test -; -; In : r0 - size of memory block -; r1 - start address of memory block -; -; Out : r0 - failing address bit mask -; -; This exercises address lines in an attempt to find any which don't -; work (i.e., don't select unique addresses). -; -; It works something like : -; -; MaxRam = PhysRam | (Memory size - 4); -; for (pattern = 4; pattern < memsize; pattern <<= 1 ) -; *(PhysRam ^ pattern) = pattern; -; *(MaxRam ^ pattern) = ~pattern; -; for (pattern = 4; pattern < memsize; pattern <<= 1 ) -; if (*PhysRam == *(PhysRam ^ pattern)) -; result |= pattern; -; if (*MaxRam == *(MaxRam + pattern)) -; result |= pattern; -; return result -; - - -ts_Addrline ROUT - - MOVS r7,r0 ; Save memory size - SUB r6,r0,#4 ; Calculate MaxRam - ADD r6,r6,r1 ; (all-bits-set memory address) -; -; Mark (walking one, walking 0) addresses with unique patterns -; - LDR r5,=&5A5AA5A5 ; initialize end markers - STR r5,[r6] - MVN r4,r5 - MOV r3,r1 - STR r4,[r3] - - MOV r5,#4 ; initialize pattern -02 - MVN r4,r5 - EOR r3,r5,r1 ; point to (start ^ pattern) - STR r4,[r3] - EOR r3,r5,r6 ; point to (end ^ pattern) - STR r5,[r3] - - MOV r5,r5,LSL #1 ; shift test pattern up - CMPS r5,r7 ; test bit still inside memory ? - BCC %02 ; reached top bit - end this loop -; -; Check (walking one, walking 0) addresses for effectivity -; - MOV r5,#4 ; initialize pattern - MOV r3,r1 - MOV r0,#0 -04 - MVN r4,r5 - EOR r2,r5,r3 ; point to (start ^ pattern) - LDR r2,[r2] - LDR r1,[r3] - CMPS r1,r2 ; do contents differ ? - ORREQ r0,r0,r5 ; no - record ineffective bit - - EOR r2,r5,r6 ; point to (end ^ pattern) - LDR r2,[r2] - LDR r1,[r6] - CMPS r1,r2 ; do contents differ ? - ORREQ r0,r0,r5 ; no - record ineffective bit - - MOV r5,r5,LSL #1 ; shift test pattern up - CMPS r5,r7 ; test bit still inside memory ? - BCC %04 ; reached top bit - end this loop - - MOVS r0,r0 ; any result bits set - return error - MOV pc,r14 - - -; -; Byte / word test -; -; In : r1 - memory start -; -; Out : r0 - Failure indication -; -; This test ensures that individual bytes may be written to each part of a word -; without affecting the other bytes in the word. -; -; for (byte = 0; byte < 4; byte ++) -; address[0] = word_signature -; address[1] = ~word_signature -; address + byte = byte_signature -; if (address[0] != -; (word_signature & (~ff << byte * 8)) -; | (byte_signature << byte * 8) ) -; result |= (1 << byte) -; if (result != 0 -; result |= address; /* fail at address, byte(s) */ -; return result; /* pass */ -; - -ts_Byteword ROUT - - LDR r3,=&AABBCCDD ; word signature - MOV r0,#0 - MOV r2,r0 -; -; byte test loop ( for bytes 0 to 4 ...) -; -02 - MVN r4,r3 - STMIA r1,{r3,r4} ; write word signature - STRB r2,[r1,r2] ; write byte (0, 1, 2 or 3) - - MOV r4,r2,LSL #3 ; calculate expected result - MOV r5,#&ff - MVN r5,r5,LSL r4 - AND r5,r5,r3 ; word signature, byte removed - ORR r5,r5,r2,LSL r4 ; byte signature inserted - - LDR r4,[r1,#4] ; read (probable) inverse data to precharge bus - LDR r4,[r1] ; read modified word - CMPS r4,r5 - MOV r5,#1 - MOV r4,r2,LSL #2 - ORRNE r0,r0,r5,LSL r4 ; fault : set bit in result mask -; -; Loop for next byte -; - ADD r2,r2,#1 ; Bump byte counter - CMPS r2,#4 ; ... until 4 byte strobes tested - BLO %BT02 -; -; byte strobes all tested : check for errors -; - CMPS r0,#0 - MOV pc,r14 ; Result : return address and fault mask. - -; -; End of RAM line tests -; - -ts_endline - - END - \ No newline at end of file diff --git a/OldTestSrc/Mem1MEMC1 b/OldTestSrc/Mem1MEMC1 deleted file mode 100644 index 632c9bf..0000000 --- a/OldTestSrc/Mem1MEMC1 +++ /dev/null @@ -1,390 +0,0 @@ -; > TestSrc.Mem1 - - TTL RISC OS 2+ POST memory linetest -; -; This test code is used to perform basic integrity tests on DRAM. -; It doesn't test all locations - just walks patterns through data -; and address lines. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 18-Dec-89 ArtG Initial version -; 1-Jun-93 ArtG Reorganised to allow separate module for Medusa -; -; -;------------------------------------------------------------------------ - -; -; Test the data and address and byte strobe lines for uniqueness. -; - - LTORG - ROUT - -1 - = "Data :",0 -2 - = "Data @",&89,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -3 - = "Data-F",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -4 - = "Data-P",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - - - - ALIGN - -ts_LineTest - - ADR r4,%BT1 - BL ts_SendText ; Start data line tests - - MOV_fiq r0,r10_fiq - MOV r1, #PhysRam - BL ts_Dataline - BEQ ts_address ; OK : continue to next test -; -; Data line test failed. This probably also means that RISCOS got the -; configuration wrong, so set it to 32K pages and repeat - otherwise -; the data line test result may be garbage. -; - ADR r4,%BT2 - MOV r11,r0 ; save data & report fault address - MOV r8,r1,LSL #4 - BL ts_SendText - - MOV r8,r11 - ADR r4,%BT3 ; report data fault mask - BL ts_SendText - - LDR r0,=(&E000C :OR: MEMCADR) ; set 32K page size - STR r0,[r0] - MOV_fiq r11_fiq,r0 - - MOV r0,#ts_RamChunk ; limit test to 1 block - MOV r1,#PhysRam - BL ts_Dataline - - MOV r8,r0 - ADR r4,%BT4 ; ready to report data fault mask - B ts_linefault - -; -; Start the address line tests -; - ROUT - -4 - = "Addrs :",0 -5 - = "Addrs",&89,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -6 - = "Byte :",0 -7 - = "Byte",&89,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - - - -ts_address - ADR r4,%BT4 - BL ts_SendText ; Start address line tests - - MOV_fiq r0,r10_fiq - BL ts_Addrline - - ADR r4,%BT5 - MOV r8,r0,LSL #4 - BEQ %30 ; Failed : report address fault - -ts_linefault - FAULT #R_LINFAILBIT - B %31 - -30 ADR r4,%BT6 ; Start Byte/Word test - BL ts_SendText - - MOV_fiq r0,r10_fiq ; get memory size - BL ts_Byteword - - MOV r8,r0,LSL #4 ; Get result to top of r8 - BEQ %40 - FAULT #R_LINFAILBIT - - ADR r4,%BT7 - -31 BL ts_SendText - B %42 -; -; Line tests passed. Do a short test on memory that isn't there, -; in case it's supposed to be and we want to know why it's not .. - -40 - MOV_fiq r0, r10_fiq ; if there's less than 16Mbytes .. - CMP r0, #(16 * 1024 * 1024) - BCS %F42 - ADR r4, %FT44 ; briefly test the next bit of ram - BL ts_SendText ; in case it's a duff expansion - - MOV_fiq r1,r10_fiq - ADD r1,r1,#PhysRam - MOV r0,#ts_RamChunk - BL ts_Dataline - ADR r4, %FT45 - MOV r11, r0 ; report the result even if OK - MOV r8,r1,LSL #4 - BL ts_SendText ; report address - - MOV r8,r11 - ADR r4,%FT46 ; report data fault mask - BL ts_SendText -; -; End of line tests -; - -42 - B ts_IOCTest - -44 - = "Exp? :",0 -45 - = "Exp? @",&89,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -46 - = "Exp?",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - - - -; -; Data line test. -; -; In : r0 - size of memory -; r1 - start address for test -; -; Out : r0 - failing data pattern -; r1 - address of failure -; -; -; This exercises data lines in attempt to find shorts/opens. -; It goes something like : -; -; for (address = start; address < end of ram; address += ts_RamChunk) -; for (ptr = address, pattern = 1; pattern != 0; pattern <<= 1) -; *ptr++ = pattern; -; *ptr++ = ~pattern; -; for (ptr = address, pattern = 1; pattern != 0; pattern <<= 1) -; result |= pattern ^ *ptr++; -; result |= ~pattern ^ *ptr++; -; if (result |= 0) -; return result and address -; - -ts_Dataline ROUT - - ADD r7,r1,r0 ; end address -; -; Write all walking-zero, walking-one patterns -; -10 MOV r6,r1 ; set pointer for a write loop - MOV r5,#1 ; set initial test pattern - MVN r4,r5 ; and it's inverse -11 - STMIA r6!,{r4-r5} ; write the patterns - - ADDS r5,r5,r5 ; shift the pattern (into Carry) - MVN r4,r5 - BCC %BT11 ; repeat until all bits done -; -; Read back and accumulate in r0 any incorrect bits -; - MOV r6,r1 ; set pointer for a read loop - MOV r5,#1 ; set initial test pattern - MVN r4,r5 ; and it's inverse - MOV r0,#0 ; accumulate result -21 - LDMIA r6!,{r2-r3} ; read the patterns - EOR r2,r2,r4 - ORR r0,r0,r2 ; OR any failed bits into r0 - EOR r3,r3,r5 - ORR r0,r0,r2 - - ADDS r5,r5,r5 ; shift the pattern (into Carry) - MVN r4,r5 - BCC %BT21 ; repeat until all bits done -; -; After all checks at this address group, report back errors -; - MOVS r0,r0 ; check for any result bits set - MOVNE pc,r14 ; return on error -; -; Bump to another address group -; - ADD r1,r1,#ts_RamChunk - CMPS r1,r7 ; test for loop end - BLO %10 - - SUBS r1,r1,#ts_RamChunk ; no fault - last tested address - MOVS r0,r0 - MOV pc,r14 ; test complete - no failures. - - -; -; Address line test -; -; In : r0 - size of memeory -; -; Out : r0 - failing address bit mask -; -; This exercises address lines in an attempt to find any which don't -; work (i.e., don't select unique addresses). -; -; It works something like : -; -; MaxRam = PhysRam | (Memory size - 4); -; for (pattern = 4; pattern < memsize; pattern <<= 1 ) -; *(PhysRam ^ pattern) = pattern; -; *(MaxRam ^ pattern) = ~pattern; -; for (pattern = 4; pattern < memsize; pattern <<= 1 ) -; if (*PhysRam == *(PhysRam ^ pattern)) -; result |= pattern; -; if (*MaxRam == *(MaxRam + pattern)) -; result |= pattern; -; return result -; - - -ts_Addrline ROUT - - MOVS r7,r0 ; Save memory size - SUB r6,r0,#4 ; Calculate MaxRam - ADD r6,r6,#PhysRam ; (all-bits-set memory address) -; -; Mark (walking one, walking 0) addresses with unique patterns -; - LDR r5,=&5A5AA5A5 ; initialize end markers - STR r5,[r6] - MVN r4,r5 - MOV r3,#PhysRam - STR r4,[r3] - - MOV r5,#4 ; initialize pattern -02 - MVN r4,r5 - EOR r3,r5,#PhysRam ; point to (start ^ pattern) - STR r4,[r3] - EOR r3,r5,r6 ; point to (end ^ pattern) - STR r5,[r3] - - MOV r5,r5,LSL #1 ; shift test pattern up - CMPS r5,r7 ; test bit still inside memory ? - BCC %02 ; reached top bit - end this loop -; -; Check (walking one, walking 0) addresses for effectivity -; - MOV r5,#4 ; initialize pattern - MOV r3,#PhysRam - MOV r0,#0 -04 - MVN r4,r5 - EOR r2,r5,r3 ; point to (start ^ pattern) - LDR r2,[r2] - LDR r1,[r3] - CMPS r1,r2 ; do contents differ ? - ORREQ r0,r0,r5 ; no - record ineffective bit - - EOR r2,r5,r6 ; point to (end ^ pattern) - LDR r2,[r2] - LDR r1,[r6] - CMPS r1,r2 ; do contents differ ? - ORREQ r0,r0,r5 ; no - record ineffective bit - - MOV r5,r5,LSL #1 ; shift test pattern up - CMPS r5,r7 ; test bit still inside memory ? - BCC %04 ; reached top bit - end this loop - - MOVS r0,r0 ; any result bits set - return error - MOV pc,r14 - - -; -; Byte / word test -; -; In : r0 - memory size -; -; Out : r0 - address of physical ram where failure occured -; -; This test ensures (for each of four possible MEMCs fitted) -; that individual bytes may be written to each part of a word -; without affecting the other bytes in the word. -; -; for (address = PhysRam; address < PhysRam + Memsize; address += 4Mbyte) -; for (byte = 0; byte < 4; byte ++) -; address[0] = word_signature -; address[1] = ~word_signature -; address + byte = byte_signature -; if (address[0] != -; (word_signature & (~ff << byte * 8)) -; | (byte_signature << byte * 8) ) -; result |= (1 << byte) -; if (result != 0 -; result |= address; /* fail at address, byte(s) */ -; return result; -; return result; /* pass */ -; - -ts_Byteword ROUT - - ADD r7,r0,#PhysRam ; Set test limit address - MOV r1,#PhysRam ; Initial test address - LDR r3,=&AABBCCDD ; word signature -; -; MEMC test loop (for addresses 4M, 8M, ...) -; -01 - MOV r0,#0 ; clear result register - MOV r2,#0 ; clear byte count -; -; byte test loop ( for bytes 0 to 4 ...) -; -02 - MVN r4,r3 - STMIA r1,{r3,r4} ; write word signature - STRB r2,[r1,r2] ; write byte - - MOV r4,r2,LSL #3 ; calculate expected result - MOV r5,#&ff - MVN r5,r5,LSL r4 - AND r5,r5,r3 ; word signature, byte removed - ORR r5,r5,r2,LSL r4 ; byte signature inserted - - LDR r4,[r1,#4] - LDR r4,[r1] ; read modified word - CMPS r4,r5 - MOV r5,#1 - ORRNE r0,r0,r5,LSL r2 ; fault : set bit in result mask -; -; Loop for next byte -; - ADD r2,r2,#1 ; Bump byte counter - CMPS r2,#4 ; ... until 4 byte strobes tested - BLO %BT02 -; -; byte strobes all tested : check for errors -; - CMPS r0,#0 - ORRNE r0,r0,r1 - MOVNE pc,r14 ; Error : return address and fault. -; -; Loop for next MEMC -; - ADD r1,r1,#&400000 ; Bump to next MEMC - CMPS r1,r7 - BLO %01 - - MOVS r0,#0 ; Passed - return OK - MOV pc,r14 - - - END - \ No newline at end of file diff --git a/OldTestSrc/Mem2 b/OldTestSrc/Mem2 deleted file mode 100644 index 89f5bc2..0000000 --- a/OldTestSrc/Mem2 +++ /dev/null @@ -1,278 +0,0 @@ -;> MEM2C -; -; RISC OS 2+ BOOT TEST SOFTWARE -; MEMORY TEST 2 VERSION A. -; BRIAN RICE 30-10-89 -; 06-Apr-90 ArtG 0.1 Test variable memory size -; -; This file will perform a simple test on all DRAM. -; The test code for this test was taken from thhe A680 Quick memory -; test software. The software was copied straight but the number of times -; the test looped arround was cut down to two loops, because of time -; constraints when testing the memory. - -Test_wks_msize * &40 ; Space for test block size -Test_wks_return1 * &44 ; Space for return addresses -Test_wks_return2 * &48 -Test_code_off * &4C ; Where testing starts - -test_size * 13 * 4 ; Size of test group -test_mem_rsvd * Test_code_off+test_mem_template_end-test_mem_template - -; -; Quick test the RAM (pre boot style) -; - -ts_RamTest ROUT - MOV r13,r0 - STR r14,[r13,#Test_wks_return1] - STR r1,[r13,#Test_wks_msize] - - LDR r0, test_quick_pattern - BL test_mem_code - ORRS r0,r0,r0 - BNE test_mem_quit -; - LDR r0, test_quick_pattern - MVN r0, r0 ; inverse pattern - BL test_mem_code - ORRS r0,r0,r0 - -test_mem_quit - ADR r12,%22 - BEQ %10 - -; If fault detected, exit with zero flag clear, r0 pointing to failing -; location, r1 containing faulty data and r2 pointing a suitable error -; message indicating whether all-0 or all-1 data was expected. - - LDR r2,[r14] ; fetch failing instructiom - ANDS r2,r2,#1 ; calculate expected data - ADREQ r12,%20 ; and load suitable message - ADRNE r12,%21 - MOVS r0,r0 ; with zero flag set for PASS. -10 - LDR pc,[r13,#Test_wks_return1] - -; Fail messages indicate incorrect data read after WRote 0 or Wrote 1 -; to all bits at that location. - -20 - = "WR-0 RD",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -21 - = "WR-1 RD",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 -22 - = "??",0 - - ALIGN - -test_quick_pattern & &0f76 - -; Large Memory test. Generates the write + test routines in memory -; then calls them. The routine tests patterns as defined by the bottom -; 13 bits of r0. -; -; N.B. The test start address must be calculated to ensure that -; the loops finish exactly with r0 equal to End_memory -; -; The routine returns with eq true if the memory is OK. - - -test_mem_code - ROUT - - STR r14, [r13, #Test_wks_return2] -; -; Copy the ram test code into low ram, modifying MOV instructions -; to MVN in accordance with the test pattern. -; - ADR r1, test_mem_template - ADD r2, r13, #Test_code_off - LDMIA r1!, {r3-r4} ; copy initial 2 instrucions - STMIA r2!, {r3-r4} - MOV r4, #1 -0 MOVS r0, r0, ROR #1 - LDR r3, [r1], #4 - ORRCS r3, r3, #&00400000 ; Convert MOV => MVN - STR r3, [r2], #4 - ADD r4, r4, #1 - CMP r4, #13 - BLE %B0 -; -; Copy the load loop control and verify start instructions -; - LDMIA r1!, {r5-r9} - STMIA r2!, {r5-r9} -; -; Copy and modify the CMP instructions -; - MOV r0, r0, ROR #32-13 - MOV r4, #1 -1 MOVS r0, r0, ROR #1 - LDR r3, [r1], #4 - ORRCS r3, r3, #&00200000 ; Convert CMP => cmn - ORRCS r3, r3, #&00000001 ; Convert #0 => #1 - STR r3, [r2], #4 - ADD r4, r4, #1 - CMP r4, #13 - BLE %B1 -; -; Copy the verify loop control and finishing-up instructions -; - LDMIA r1!, {r5-r12} - STMIA r2!, {r5-r12} - LDMIA r1!, {r5-r12} - STMIA r2!, {r5-r12} - LDMIA r1!, {r5-r12} - STMIA r2!, {r5-r12} - -; check we've copied enough - ASSERT ((test_mem_stadd - test_mem_chk) = (24 * 4)) -; -; Calculate the test start and end addresses -; - LDR r0, [r13, #Test_wks_msize] ; size of test area - ADD r14, r13, r0 ; end of test area - SUB r1, r0, #test_mem_rsvd ; testable size - - MOV r2, #test_size ; adjust r1 to (r1 / 13*4) * (13*4) - DivRem r3, r1, r2, r4 - MUL r1, r3, r2 - SUB r0, r14, r1 ; rounded test start address - -; Do it. - MOV r1, #Test_code_off - ADD r1, r1, r13 ; pointer to copied code - MOV pc, r1 - -; -; The following code is copied (and modified) into RAM for execution -; - -test_mem_template - ROUT - STR r0, test_mem_stadd ; save initial RAM address - STR r13, test_mem_base ; save test area base address - MOV r1, #0 ; Converted to MVN if bit = 1 - MOV r2, #0 ; Converted to MVN if bit = 1 - MOV r3, #0 ; Converted to MVN if bit = 1 - MOV r4, #0 ; Converted to MVN if bit = 1 - MOV r5, #0 ; Converted to MVN if bit = 1 - MOV r6, #0 ; Converted to MVN if bit = 1 - MOV r7, #0 ; Converted to MVN if bit = 1 - MOV r8, #0 ; Converted to MVN if bit = 1 - MOV r9, #0 ; Converted to MVN if bit = 1 - MOV r10, #0 ; Converted to MVN if bit = 1 - MOV r11, #0 ; Converted to MVN if bit = 1 - MOV r12, #0 ; Converted to MVN if bit = 1 - MOV r13, #0 ; Converted to MVN if bit = 1 -0 - STMIA r0!, {r1-r13} - CMP r0, r14 - BLO %B0 - - LDR r0, test_mem_stadd -1 - LDMIA r0!, {r1-r13} -2 - CMP r1, #0 ; Converted to cmn if bit = 1 - CMPEQ r2, #0 ; Converted to cmneq if bit = 1 - CMPEQ r3, #0 ; Converted to cmneq if bit = 1 - CMPEQ r4, #0 ; Converted to cmneq if bit = 1 - CMPEQ r5, #0 ; Converted to cmneq if bit = 1 - CMPEQ r6, #0 ; Converted to cmneq if bit = 1 - CMPEQ r7, #0 ; Converted to cmneq if bit = 1 - CMPEQ r8, #0 ; Converted to cmneq if bit = 1 - CMPEQ r9, #0 ; Converted to cmneq if bit = 1 - CMPEQ r10, #0 ; Converted to cmneq if bit = 1 - CMPEQ r11, #0 ; Converted to cmneq if bit = 1 - CMPEQ r12, #0 ; Converted to cmneq if bit = 1 - CMPEQ r13, #0 ; Converted to cmneq if bit = 1 -test_mem_chk - BNE %F5 ; go report fault data - CMP r0, r14 - BLO %B1 ; else loop for next batch - MOVS r0, #0 ; All OK : return with NULL r0 -4 - LDR r13,test_mem_base - LDR pc, [r13, #Test_wks_return2] - -; Failed : repeat the last batch of tests one at a time, to determine -; the first failing address and data. -; Note that the test instructions are copied to %8 to permit individual -; execution, and %7 is overwritten with an instruction used to copy -; the failing data into r1. Change this code very carefully ! - -5 - LDR r14,%2 ; Obtain first test in the set - STR r14,%8 ; and re-execute it - SUB r0,r0,#(13*4) ; adjust pointer to bad data - ADR r14,%2 ; point to first test. -7 - B %8 ; make sure %8 is refetched -8 - & 0 ; redo the test here : - BNE %4 ; if it failed, exit with - ; r0 = ptr to memory - ; r1 = wrongly read data - ; r14 => failing instruction - - LDR r1,[r14,#4]! ;fetch next instruction - AND r1,r1,#&f0000 ;make an instruction - MOV r1,r1,LSR #16 ;to copy the next register - ORR r1,r1,#&E1000000 ;down to r1 - ORR r1,r1,#&00A00000 ;e.g. CMPEQ r10,#0 - ORR r1,r1,#&00001000 - STR r1,%7 ;and put it at %7 - LDR r1,[r14] ;then copy the next test - STR r1,%8 ;to %8 - ADD r0,r0,#4 ;bump the fault pointer - B %7 ;and execute %7 and %8. - -test_mem_stadd ; address of first test location - & 0 -test_mem_base - & 0 ; address of test block - -test_mem_template_end - -; -; Copy the L2 page table from r1 to r0, then remap the translation table's -; base address in the MMU to point to an L1 page table within it. -; - ROUT - -ts_remap_ttab - MOV r2,#FixedAreasL2Size - ADD r0,r0,r2 ; point to locations in PhysSpace - ADD r0,r0,#PhysSpace - ADD r1,r1,r2 - ADD r1,r1,#PhysSpace -10 - ASSERT ((FixedAreasL2Size :AND: ((8*4)-1)) = 0) - LDMDB r1!,{r3-r10} ; copy the page & section tables - STMDB r0!,{r3-r10} - SUBS r2,r2,#(8*4) - BNE %BT10 - - SUB r9,r1,r0 ; r9 = offset from original to copy - ADD r0, r0, #DRAMOffset_L1PT-DRAMOffset_L2PT ; r0 -> copy of L1Phys - SUB r10, r0, #PhysSpace ; keep real address of L1PT for MMU - ADD r2,r0,#((1 :SHL: (32-20))*4) ; size of L1PT - 1 word per meg of memory -11 LDR r3,[r0],#4 ; check each L1 table entry - ANDS r4,r3,#3 - CMPS r4,#L1_Page ; if it's page mapped .. - SUBEQ r3,r3,r9 ; adjust the page table base address - STREQ r3,[r0,#-4] - CMPS r0,r2 ; repeat for all the level 1 table - BNE %BT11 - - SetCop r10, CR_TTabBase ; set up MMU pointer to L1 - SetCop r0, CR_IDCFlush ; flush cache + TLB just in case - SetCop r0, CR_TLBFlush ; (data written is irrelevant) - - MOV pc,r14 - - - END - diff --git a/OldTestSrc/Mem3 b/OldTestSrc/Mem3 deleted file mode 100644 index 1313275..0000000 --- a/OldTestSrc/Mem3 +++ /dev/null @@ -1,119 +0,0 @@ - ;> RomCheck -; -; RISC OS 2+ BOOT TEST SOFTWARE -; MEMORY TEST 3 VERSION A. -; BRIAN RICE 01-11-89 -; 24.04.90 0.10 ArtG Added ROM size test -; 15.05.90 1.00 ArtG Changed to put checksum at (end - 2 words) -; 17.05.90 1.01 ArtG Changed to get ROM length from vectot table -; -; -; This file will perform quick checksum test on the OS ROMS. -; -; -; The test code for this test is a simple additive checksum routine. -; The software will read eight words from ROM then add the contents from ROM -; to a register. When the test is complete the contents of the checksum -; register is checked by adding the final word in ROM - this should give -; zero. -; The program will be run from ROM, at slowest speed. -; -; All except the last two words are checksummed : these hold the numbers -; that cause each individual ROM to CRC to zero, so they can't simultaneously -; be included in an all-zero additive checksum. - -ts_CRCsize * (2 * 4) - -; -; -;r0 IS A POINTER TO THE LOCATIONS IN MEMORY. -;r1 HAS THE CALCULATED CHECKSUM. -;r2 HOLDS A COUNTER INDICATION HOW MANY WORDS ARE LEFT TO GET -;r3 is a temporary variable -;r4 TO r11 ARE USED TO LOAD THE CONTENTS OF 8 LOCATIONS FROM THE ROM. -; - ROUT - -ts_ROM_checksum - - MOV r1, #&00 ; initialise accumulator - LDR r0, =PhysROM ; initialise pointer - LDR r2, [r0, #ts_ROMSIZE] ; initialise endstop - ADD r2, r2, r0 ; - must be at least 8 words - SUB r2, r2, #(10 * 4) ; below the real endpoint - -loop1 LDMIA r0!, {r4 - r11} ;LOAD r4 TO r11 WITH THE CONTENTS - ;OF LOCATIONS POINTED TO BY r0 - ;WHICH IS INCREMEMTED AUTOMATICALLY - ;TO POINT TO THE NEXT LOCATION -01 - ADD r1, r1, r4 ;ADD r4 TO CHECKSUM - ADD r1, r1, r5 ;ADD r5 TO CHECKSUM - ADD r1, r1, r6 ;ADD r6 TO CHECKSUM - ADD r1, r1, r7 ;ADD r7 TO CHECKSUM - ADD r1, r1, r8 ;ADD r8 TO CHECKSUM - ADD r1, r1, r9 ;ADD r9 TO CHECKSUM - ADD r1, r1, r10 ;ADD r10 TO CHECKSUM - ADD r1, r1, r11 ;ADD r11 TO CHECKSUM -02 - ASSERT ((%02 - %01) = 32) ; else r2 won't count down correctly - - CMPS r0, r2 - BCC loop1 ;loop until pointer reaches endstop - - LDMIA r0!, {r4 - r9} ; get last 6 words (miss last 2 in ROM) -03 - ADD r1, r1, r4 ;ADD r4 TO CHECKSUM - ADD r1, r1, r5 ;ADD r5 TO CHECKSUM - ADD r1, r1, r6 ;ADD r6 TO CHECKSUM - ADD r1, r1, r7 ;ADD r7 TO CHECKSUM - ADD r1, r1, r8 ;ADD r8 TO CHECKSUM - ADD r1, r1, r9 ;ADD r9 TO CHECKSUM -04 - ASSERT (((%04 - %03) + (2*4)) = 32) ; Change this if you like - - ; but be careful to count nearly - ; to the top in eights, then add - ; add in the last few words. - - MOVS r0,r1 ; should be zero if all OK - - MOV pc,r14 ;return with zero flag set on OK - ;and the calculated sum in r0. - - -; -; ROM alias check. -; This test looks for an aliased copy of the vector table at varying -; distances from the start of ROM space. -; 16K is fairly arbitrary but corresponds approximately with the size of -; the POST. If there's an alias below that, we've probably already crashed ! -; -; This test is only called if the checksum fails, in order to indicate a -; possible high ROM address line failure. - -ts_ROM_alias ROUT - - MOV r0,#PhysROM ; get some words from ROM start - LDR r3,[r0, #ts_ROMSIZE] ; get the ROM length word - LDMIA r0,{r4,r5,r6,r7} - MOV r1,#(16 * 1024) - -01 ADD r2,r0,r1 ; get some words from possible alias - LDMIA r2,{r8,r9,r10,r11} - CMPS r4,r8 - CMPNE r5,r9 - CMPNE r6,r10 - CMPNE r7,r11 - BEQ %10 ; aliased : found MS ROM address bit - - MOVS r1, r1, LSL #1 ; test the next (more significant) bit - CMPS r1, r3 ; reached the limit yet ? - BLT %01 ; no - try again. - -10 MOV r0,r1 ; reached the end, or an alias. - MOV pc,lr - - - LTORG - - END diff --git a/OldTestSrc/Mem4 b/OldTestSrc/Mem4 deleted file mode 100644 index 8d73e78..0000000 --- a/OldTestSrc/Mem4 +++ /dev/null @@ -1,630 +0,0 @@ -;> MEM4H_SCR -; -; RISC OS 2+ BOOT TEST SOFTWARE. -; MEMORY TEST 4 VERSION H. BRIAN RICE 12-01-90. -; 04-Apr-90 ArtG 0.1 Added ts_count_cams, improved reporting -; 11-Apr-90 ArtG 0.2 Use RISC OS routine BangCams for -; alternate MEMC configurations. -; 17-Apr-90 ArtG 0.3 rationalise page-counting code -; -; This file will be called by MEM6x_SCR for the purposes of assembly. -; This file will perform quick walking bit test on the CAM Entry points. -; The test code for this test was taken from the A680 test code. -; -; The module requires the running of the memory sizing routine used by -; the OS to set up the page size for this module. -; -; This test module was designed to operate on all current and future -; machines. The module is designed to handle up to 512 physical pages -; which is the maximum number of pages in a 16 MByte FOX. -; -; A 16 MB FOX has 4 MEMCs in use, each MEMC is addressed by Bits 7 and -; 12 of the logical to physical address translator. The use of bit 12 -; does have a problem in that on machines with 0.5MB of memory this is -; used to define the logical page number. Machine with 1MB or greater bit -; 12 is not used, therefore this test may hit problems on A305's. The -; intention is that A305 owners will upgrade to A310's when upgrading to -; RISC OS 2+. -; -; Because FOX can have up to 4 MEMCs fitted the following addressing is -; used to determine the MEMC accessed, bit 12, bit 7 -; 0 0 = Master MEMC = MEMC 0 -; 0 1 = Slave MEMC 1 = MEMC 1 -; 1 0 = Slave MEMC 2 = MEMC 2 -; 1 1 = Slave MEMC 3 = MEMC 3 -; -; -; This test will initialise the CAM entries for up to 512 physical pages. -; The physical pages will be mapped to logical page 5. Each page will have -; a copy of test routine vectors and a page marker. The page marker consists -; of the page number and a code to indicate which MEMC was used. The code for -; the MEMC used is as follows :- MEMC 0 0001 1110 = &1E -; MEMC 1 0010 1101 = &2D -; MEMC 2 0100 1011 = &4B -; MEMC 3 1000 0111 = &87 -; -; The page marker is arranged as follows &mm5Apppp -; | | -; | \-- Page Number &0000 ‰ &01FF. -; \--------MEMC Code as above. -; -; The patterns are chosen so that if two or more MEMCs are accessed -; together and both RAM outputs get enabled onto the data bus simultaneously, -; then there is a reasonable chance that the data returned will show the -; presence of a fault. -; -; When the CAM entries have been initialised the module will then check that -; all the pages are mapped correctly. A simple walking one pattern is used -; to check that the page is not present anywhere else in the memory area. -; This isn't really sufficient, but keeps the test time low. -; -; The tests are performed with the memory protection level set to 0. -; -; This version uses the "my abort" routine in MEM5x_SCR instead of the -; ts_dab_exp0 .. 5 method as taken from the A680 code. -; - -ts_rst_msg = "RST",0 -ts_uni_msg = "UDF",0 -ts_swi_msg = "SWI",0 -ts_pab_msg = "PAB",0 -ts_dab_msg = "DAB",0 -ts_aex_msg = "ADX",0 -ts_irq_msg = "IRQ",0 -ts_fiq_msg = "FIQ",0 -ts_bxc_msg = &85,"@",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - ALIGN - - -ts_rst ; Unused exception vectors - ADR r4, ts_rst_msg - B ts_bad_exception -ts_uni - ADR r4, ts_uni_msg - B ts_bad_exception -ts_swi - ADR r4, ts_swi_msg - B ts_bad_exception -ts_pab - ADR r4, ts_pab_msg - B ts_bad_exception -ts_dab_unexp - ADR r4, ts_dab_msg - B ts_bad_exception -ts_aex - ADR r4, ts_aex_msg - B ts_bad_exception -ts_irq - ADR r4, ts_irq_msg - B ts_bad_exception -ts_fiq - ADR r4, ts_fiq_msg - B ts_bad_exception - - -ts_bad_exception - SUBS r8, r14, #8 ; remember aborted instruction - BL ts_SendText - ADR r4, ts_bxc_msg ; display aborted address - BL ts_MoreText - B Reset - - -; -ts_rom_base * ROM ; Base address of the OS ROMS. -ts_phys_mem * (32*1024*1024) ; Physical Memory area. -ts_pagemark * &005A0000 ; + phys page number + MEMC code. -ts_pmark_pos * 32 ; Position of page mark (avoiding vectors). -ts_cam_base * &3800000 ; Base address of the CAM table in MEMC. -ts_vrest * &5 ; Unused page which all pages are mapped to. -ts_MAX_CAMS * 512 ; Most CAMs ever expected -ts_memc_codes = &1E, &2D, &4B, &87 ; List of the memc_codes to be used. -; -ts_logpages ; List of Logical pages. - & &0001 - & &0002 - & &0004 - & &0008 - & &0010 - & &0020 - & &0040 - & &0080 - & &0100 - & &0200 - & &03FF - & &03FE - & &03FD - & &03FB - & &03F7 - & &03EF - & &03DF - & &03BF - & &037F - & &02FF - & &01FF - & &0000 ; Terminator for the list. -ts_logpagesend ; End of the list. -; -; -; Exception vectors : copied to start of each page to ensure that they will always -; exist on page zero when arbitrary pages are mapped there. -; -ts_vectors - B (ts_vectors-ts_start)+ts_rom_base+ts_rst - B (ts_vectors-ts_start)+ts_rom_base+ts_uni - B (ts_vectors-ts_start)+ts_rom_base+ts_swi - B (ts_vectors-ts_start)+ts_rom_base+ts_pab -ts_dab_vector - B (ts_vectors-ts_start)+ts_rom_base+ts_dab - B (ts_vectors-ts_start)+ts_rom_base+ts_aex - B (ts_vectors-ts_start)+ts_rom_base+ts_irq - B (ts_vectors-ts_start)+ts_rom_base+ts_fiq - - -; *************************************************************************** -; -ts_CAM -; -; CAM test (full or partial) -; Start of the CAM test, all physical pages have a copy of the vectors -; so they may be mapped as page 0. Then each page is mapped at a series -; of (walking 1, walking 0) logical pages and tested to be correctly -; mapped. Other pages are set to an unused logical page by set_cam_idle -; to prevent any CAM clashes. -; -; Copy the test vectors and page marker into all the pages. -; - ROUT ; Local Branches. - MOV r13, lr ; Preserve link register in r13. - BL ts_count_CAMs ; get log2 pagesize - MOV r0, #ts_MAX_CAMS ; r0 = last page to test - SUB r0, r0, #1 -0 BL ts_copy_vectors ; Gosub ts_vectors. - SUBS r0, r0, #&01 ; bump down to next page - BGE %B0 ; repeatuntil all pages set. -; -; 'C' pseudocode for the test routine. -; -; for (i = &1ff; i >= 0; i--) -; set_cam_idle(i); -; -; find maximum page number. -; if (max_page != ts_count_CAMS) -; report CAM number error -; -; for (phys = &max_page; phys >= 0; phys--) { -; for (logp = &logpages[0]; logp < &logpages[sizof(logpages)]; logp++) { -; if (*logp == 0) { -; set_cam(*logp, phys); -; check_mapped(*logp, phys); -; } else { -; int zphys = (phys + 1) % num_pages; -; set_cam(0, zphys); -; set_cam(*logp, phys); -; check_mapped(*logp, phys); -; set_cam_idle(zphys); -; } -; } -; set_cam_idle(phys); -; } -; -; Idle the pages. -; - ROUT ; Local Branches. - MOV r12, #ts_MAX_CAMS ; always clear all 512 - just in case 4 MEMCs. - SUB r12, r12, #&01 ; Subtract 1 to make max page #. -0 MOV r1, r12 ; r1 = page number. - BL ts_set_cam_idle - SUBS r12, r12, #&01 ; bump to next page downwards - BGE %B0 ; repeatuntil page 0 done -; -; We need to find out what the maximum number of pages is, after running the above routine -; all the pages will have the pagemark programed in to each page. As stated in the intro -; programing the pages from the top down will ensure that, irrespective of the number of -; MEMCs available, that the bottom pages are programed correctly. Therefore if we start -; at the top, read in a page, check it's page number & memc code are correct, if so then -; that is possibly the maximum page number. If not then subtract 1 from the page number and -; try again until a possible good page is found. -; - ROUT ; Local Branches. - - BL ts_count_CAMs ; get log2 pagesize to r1 - MOV r8, #ts_MAX_CAMS ; r8= max. number of physical pages. -0 SUBS r8, r8, #&01 ; Subtract 1 to make it r8 - 1 Pages. - BEQ ts_bad_CAM_count ; no pages ? - shouldn't hit this! -; -; Calculate the expected page marker, in r4, for the current page, in r8. -; - ADR r4, ts_memc_codes ; r4 = address of table with the memc codes. - LDRB r4, [r4, r8, LSR#7] ; r4 = Loc pointed to by r4 + (r1 >> 7). - ORR r4, r8, r4, LSL #24 ; r4 = page number OR (MEMC code << 24). - ORR r4, r4, #ts_pagemark ; r4 = page id OR magic number -; -; The calculated page marker is now in r4, ref_p_mark. -; Current page in r8 - convert to physical address in r9. -; the pagesize power-of-2 is in r1 (from ts_count_CAMs) -; - MOV r9, r8, LSL r1 ; convert PPN to phys offset - ORR r9, r9, #ts_phys_mem ; add offset to start of phys mem -; -; r9 now has the address of the current page - read the page marker for that page. -; - LDR r9, [r9, #ts_pmark_pos] ; r9 = contents of loc pointed to by - ; r9 + ts_pmark_pos. -; -; Check that read_p_mark is valid. -; -; Either the value read is the expected pagemark, junk (no memory) or an -; aliased pagemark - if it's aliased, then either the memory or the MEMC -; isn't decoded that far. -; Bump down and try a bit lower, until it's OK. -; - CMP r4, r9 ; Is page-mark expected value ? - BNE %B0 - -; -; Found a pagemarker in the proper place. Check that the number of pages that -; appear to be present are the same as the number found by ts_count_CAMs -; (i.e. the memory size / page size). -; - SUB r0, r0, #1 ; convert count -> max page number - CMPS r0, r8 - BNE ts_bad_CAM_count -; -; If all is well, we should have the maximum usable page number in r8. -; -; Need to reset page 0 in the CAM entries, currently all pages are mapped to page 5. -; We need to have logical page 0 mapped to physical page 0. -; - MOV r0, #&00 ; r0 = &00, the page to map. - MOV r1, #&00 ; r1 = &00, the page to map to. - MOV r2, #&00 ; r2 = &00, set the protection level. - BL ts_set_camp -; -; Check we can still see the data abort vector at physical page zero -; - no good continuing if we can't. -; - MOV r0, #ts_phys_mem - LDR r0, [r0, #(ts_dab_vector - ts_vectors)] - LDR r1, ts_dab_vector - CMPS r0, r1 - BNE ts_bad_dab_vector - -; -; Now lets get on with the testing. -; - -2 ADRL r10, ts_logpages ; logp = &logpages[0] - -3 LDR r0, [r10] ; r0 = page to test - CMP r0, #&00 ; last entry ? - BNE %F4 - MOV r1, r8 ; r1 = r8, page under test - BL ts_set_cam ; Gosub ts_set_cam. - LDR r0, [r10] ; r0 current logical test page - MOV r1, r8 ; r1 = current test page - BL ts_check_mapped ; Gosub ts_check_mapped. - B %F5 - -4 ADD r12, r8, #&01 - BL ts_count_CAMs ; get total number of pages - SUB r0,r0,#1 ; make a mask for useable page - AND r0,r0,#&7f ; numbers - min(128, num_pages) - AND r12, r12, r0 ; r12 -> (r12 + 1) masked - MOV r0, #&00 ; to useable page numbers. - MOV r1, r12 - BL ts_set_cam ; Setup a page for vectors - LDR r0, [r10] ; r0 = current logical test page. - MOV r1, r8 ; r1 = current physical test page. - BL ts_set_cam ; Setup a page to test - - LDR r0, [r10] ; look up logical page again. - MOV r1, r8 ; recall physical page. - BL ts_check_mapped ; check the ts_set_cam worked. - MOV r1, r12 ; unmap the vector page - BL ts_set_cam_idle - -5 ADD r10, r10, #&04 ; next entry in test list. - ADRL r0, ts_logpagesend ; r0 = ts_logpagesend. - CMP r10, r0 ; repeat until list of logical - BLO %B3 ; pages all done. - - MOV r1, r8 ; unmap the page we just tested - BL ts_set_cam_idle - - SUBS r8, r8, #1 ; bump phys page counter down. - ANDS r8,r8,r8 - BGE %B2 ; If r8 >= 0 Then branch back to 2. - - ANDS r0,r0,#0 - MOV pc,r13 ; all done and passed - -; -; **************************************************************************** -; -ts_copy_vectors -; -; Copies the vectors to the physical page in r0 (preserved) also copies -; pagemark + phypage. -; Expects r1 (preserved) to hold log2 of pagesize -; - ROUT ; Local Branches. - - ADR r2, ts_vectors ; r2 = source address - LDMIA r2, {r4-r11} ; r4 - r11 = loc pointed to by r2, post inc. - - MOV r3, r0, LSL r1 ; r3 = r0 * 2**r1 . - ORR r3, r3, #ts_phys_mem ; r3 = r3 OR ts_phys_mem. - STMIA r3, {r4-r11} ; loc pointed to by r3, post inc = r4 to r11. -; -; find out which memc is handling the page (r0), then assign the appropiate memc_code. -; Add in the page number and pagemark, then store into the required position in the -; page in question. -; - ADR r2, ts_memc_codes ; r2 = address of table with the memc codes. - LDRB r2, [r2, r0, LSR#7] ; r2 = memc code for this phys page. - ORR r2, r0, r2, LSL #24 ; OR in phys page number. - ORR r2, r2, #ts_pagemark ; OR in pagemark. - STR r2, [r3, #ts_pmark_pos] ; loc pointed to by r1 + ts_pmark_pos = pagemark. - MOV pc, lr ; Return to caller. -; -; **************************************************************************** -; -ts_set_cam_idle -; -; This module will program the physical page (r1) to the logical page 5, ts_vrest and -; continue onto the next section ts_set_cam. -; - ROUT ; Local Branches. - MOV r0, #ts_vrest ; r0 = ts_vrest, = unused logical page. -; -; **************************************************************************** -; -ts_set_cam -; -; This module will program the physical page (r1) to the logical page (r0) at -; protection mode 0 and continue onto the next section ts_set_camp. -; - MOV r2, #&00 ; r2 = &00, memory prot level 0. -; -; **************************************************************************** -; -ts_set_camp -; -; This module will map a range the physical pages (r1) to the logical page (r0) and -; set the protection mode (r2). This module will return to the location from where -; either itself or ts_set_cam or ts_set_cam_idle were called from. -; -; Corrupts r0,r1,r2,r3,r4,r6,r9,r11 -; -; Calls the RISC OS routine BangCam to do the PPNO, LPNO bit switching. -; First, jumble the registers to suit BangCam .. -; -; r2 = CAM entry (PPNO) -; r3 = logical address -; r9 = current MEMC setting (for pagesize) -; r11 = PPL -; - MOV r3,r0 ; logical page number - MOV r11,r2 ; protection level - MOV r2,r1 ; physical page number - MOV_fiq r0, r11_fiq ; MEMC configuration - MOV r9, r0 ; keep a copy in r9 - MOV r1, r9, LSR #2 - AND r1, r1, #3 ; calculate pagesize shift - ADD r1, r1, #12 - MOV r3, r3, LSL r1 ; convert LPN to logaddr - B BangCam ; return thro' BangCam - -; -; **************************************************************************** -; -ts_check_mapped -; -; This routine will check that the CAM has been programed correctly and that the required -; page is responding when asked. A quick test is made to check that other pages are not -; responding as well. -; -; logical page in r0, -; physical page in r1, -; test that they are the same. -; -; No return value : reports faults directly and returns thro' r13 -; -; Uses (corrupts) r0,r1,r2,r3,r4,r5,r6,r7 -; -; Find out which memc is handling the page (r1), then assign the appropiate memc_code. -; Add in the page number and pagemark, then compare that pagemark with those found -; in memory at the expected logical and physical addresses. -; -; This code assumes that any system with multiple MEMCs will always have 32K pages. -; - ROUT ; Local Branches. - - MOV r3, r0 ; save the current logical pagenumber. - MOV r5, lr ; Preserve link register in case of Abort. - ADR r2, ts_memc_codes ; r2 = address of table with the memc codes. - LDRB r2, [r2, r1, LSR#7] ; fetch the memc code for this page. - ORR r2, r1, r2, LSL #24 ; build the page number into the pagemark - ORR r2, r2, #ts_pagemark ; build in the pagemark magic number -; -; r2 should now have the page_mark for the current page (r1). -; calculate the shift to convert page number to memory offset. -; - MODE FIQ_mode - MOV r4, r11_fiq, LSR #2 ; pagesize / 4K - MODE SVC_mode - AND r4, r4, #3 - ADD r4, r4, #12 -; -; if the mapping failed completely, the test might abort -; - MOV r6, #&00 ; r6 = &00, clear expected abort flag. - MOV r7, #&94 ; r7 = &94, set abort expected flag. -; -; make the pointers and test the contents -; - MOV r0, r0, LSL r4 ; r0 = LPN * pagesize. - LDR r0, [r0, #ts_pmark_pos] ; r0 = contents of loc in r0 + ts_pmark_pos. - CMP r6, #94 ; did that fetch abort ? - ADREQ r4, %F14 ; mapping totally failed - BEQ ts_CAM_fail - MOV r1, r1, LSL r4 ; r1 = PPN * pagesize. - ORR r1, r1, #ts_phys_mem ; r1 = r1 ORed with ts_phys_mem. - LDR r1, [r1, #ts_pmark_pos] ; r1 = contents of loc in r1 + ts_pmark_pos. - CMP r0, r1 ; Are the read pagemarks equal ?? - ADRNE r4, %F10 - BNE ts_CAM_fail ; Failed : mapping not equal. - CMP r0, r2 ; - ADRNE r4, %F11 - BNE ts_CAM_fail ; Failed : map equal, but corrupt -; -; test that the page doesn't exist anywhere else -; - MOV r2, #1 -0 EOR r0, r2, r3 ; Flip a (walking) bit in the LPN. - CMP r0, #ts_vrest ; Is r0 = ts_vrest ?? Where all the pages are - ; mapped to. - BEQ %F1 ; If r0 = ts_vrest then branch forward to 1. -; -; The following instruction should abort. -; - MOV r0, r0, LSL r4 ; r0 = LPN * pagesize. - MOV r6, #&00 ; r6 = &00, clear abort handled flag. - MOV r7, #&94 ; r7 = &94, set abort expected flag. - LDR r0, [r0, #ts_pmark_pos] ; get a possible pagemark from this page. - CMP r6, #&94 ; Did we go thro' the abort handler ? - BEQ %F1 ; If equal then an abort happened, good ! -; -; Not aborted - is it page zero, where the vectors live ? -; - TEQS r2, r3 - BEQ %F1 ; yes - that SHOULDN'T abort -; -; Fault - is the page mapped there the same as our test page ? -; - CMP r0, r1 - ADREQ r4, %F12 ; Failed : phys page also mapped here - ADRNE r4, %F13 ; Failed : page not unmapped - EOR r3, r2, r3 ; remake the duff LPN for the error display - B ts_CAM_fail - ; If equal then no abort happened, not good !! - -1 MOV r2, r2, LSL#1 ; bump to next-bit-set page number - CMP r2, #(ts_MAX_CAMS :SHL: 1) ; Hit number of logical pages ? - BLT %B0 ; If r2 < maximum number then loop again. - - MOV r7, #0 ; no longer expecting aborts - MOV pc, r5 ; Return to caller. - -; -; Indicate that CAM mapping test failed (PPN is not at LPN) -; Display r8, the physical page number and r3, the logical page. -; -; ***This error exit returns to the CALLER of check_mapped, thro' r13*** -; - -10 - = "CAM map",&88,&ff,&ff,&ff,".",&ff,&ff,&ff,&ff,0 -11 - = "CAM pmk",&88,&ff,&ff,&ff,".",&ff,&ff,&ff,&ff,0 -12 - = "CAM als",&88,&ff,&ff,&ff,".",&ff,&ff,&ff,&ff,0 -13 - = "CAM unm",&88,&ff,&ff,&ff,".",&ff,&ff,&ff,&ff,0 -14 - = "CAM abo",&88,&ff,&ff,&ff,".",&ff,&ff,&ff,&ff,0 - - ALIGN - - -ts_CAM_fail - MOV r0, r8, LSL #16 ; physical page # - LDR r1, =&ffff - AND r1, r1, r3 - ORR r0, r0, r1 ; add logical page # - MOV r8, r0, LSL #4 - MOV r6, #0 ; no longer expecting aborts - ORRS r0, r0, #1 - MOV pc, r13 - -; -; ************************************************************************** -; - -; Routine to return expected number of physical pages in r0. -; Uses memory size determination from r10_fiq and page mode from r11_fiq. -; Returns pagesize as power-of-two in r1, for pagenumber->address calcs. - -ts_count_CAMs - - MODE FIQ_mode - MOV r0,r10_fiq,LSR #12 ; get values determined - MOV r1,r11_fiq,LSR #2 ; by MemSize - MODE SVC_mode - - AND r1,r1,#3 ; memory / pagesize - MOV r0,r0,LSR r1 - ADD r1,r1,#12 ; page bit-shift value - - MOVS pc,lr - - -; -; ************************************************************************** -; - ROUT - -; Indicate that an unexpected number of CAM pages were found. -; -; Display as "CAM ## eee.fff" -; -; where eee is the expected maximum page number (r0), fff is the number -; of of the highest page actually found (r8). - -0 - = "CAM ##",&89,&ff,&ff,&ff,".",&ff,&ff,&ff,0 - ALIGN - -ts_bad_CAM_count - ADD r8, r8, r0, LSL #12 - MOV r8, r8, LSL #8 - ADR r4, %B0 - ORRS r0, r0 ,#1 - MOV pc, r13 -; -; ************************************************************************** -; - -; Indicate that the DAB vector wasn't visible in physmem - -0 - = "CAM vec",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff,0 - ALIGN - -ts_bad_dab_vector - ADR r4, %B0 - EOR r8,r0,r1 ; indicate which bits are lost - ORRS r0, r0, #1 - MOV pc, r13 -; -; ************************************************************************** - -; Routine to indicate that an unexpected abort was found. - -0 - = "DAB @",&88,&ff,&ff,&ff,&ff,&ff,&ff,&ff,&ff, 0 - ALIGN - -ts_unxvect - ADR r4, %B0 - SUBS r8, r14_svc, #8 ; indicate the aborting instruction - BL ts_SendText - ORRS r0, r0, #1 - MOV pc, r13 - - - - LTORG - - END diff --git a/OldTestSrc/Mem5 b/OldTestSrc/Mem5 deleted file mode 100644 index 607a8b8..0000000 --- a/OldTestSrc/Mem5 +++ /dev/null @@ -1,316 +0,0 @@ -;>MEM5D_SCR -; -; RISC OS 2+ BOOT TEST SOFTWARE. -; MEMORY TEST 5 VERSION D. BRIAN RICE 10-01-90. -; 04-Apr-90 ArtG 0.1 Use memory size to determine page count -; 11-Apr-90 ArtG 0.2 Changes to permit use of BangCam -; -; This file will be called by MEM6x_SCR for the purposes of assembly. -; This file requires the assembly of MEM4x_SCR to be perfromed at the -; same time. The program will call the cam setting routines in the cam -; test program. -; -; This file will test MEMCs ability to assert its protection over -; logical pages. -; The test code for this test was taken from the A680 test code. -; The Arm CPU has three mode of operation, Supervisor, Operating System. -; and User. Most of the time the machine will operate in user mode, in this. -; mode the designers do not want the user to have full access to the memory. -; map, therefore the MEMC(s) will check that the CPU has the appropiate -; level of authorisation to access specific area of memory. -; User mode is the lowest mode, allowing limited R/W access to the ram. -; Operating System is next up the list and is allowed some more access to -; to the ram than user mode. -; Supervisor mode this is the highest and the CPU has unlimited access to -; the entire memory map. -; -; This version has the "my abort" routine in it not the ts_dab_exp0..5 routine as -; coded from the A680 code. -; -; Set up some variables. -; -ts_wks_word * 36 ; Offset of word for workspace. -; -; **************************************************************************** -; -ts_memc_prot -; -; This module will map and assign protection mode 0 to all the pages. The -; module will then perfrom a read and write operations in supervisor and -; user modes. This is repeated for the three (four) protection modes. -; The module will check after every protection mode level that the required -; responses have been returned. -; -; Set up the memory, map and assign protection mode 0. -; - ROUT ; Local Branches. - MOV r13, lr ; Preserve the link register. - MOV r12, #&00 ; r12 = The physical page to test. - -0 ADD r8, r12, #&01 ; Get a page to use as vectors, - BL ts_count_CAMs ; get total number of pages - SUB r0,r0,#1 ; make a mask for useable page - AND r0,r0,#&7f ; numbers - min(128, num_pages) - AND r8, r8, r0 - - MOV r1, r8 ; r1 = r8, r1 = physical page 0. - MOV r0, #&00 ; r0 = &00, r0 = logical page 0. - BL ts_set_cam ; Gosub ts_set_cam, set the CAM up. -; -; Set protection mode 0 and test that page. -; - MOV r2, #&00 ; r2 = &00, r2 = protection mode 0. - BL ts_mem_prot ; Gosub ts_mem_prot. - CMP r3,#&0F ; Is r3 = &0F ? r3 = Super Read/Write ok. - ; O/S Read/Write ok. - ; User Read/Write ok. - MOV r2, #0 - BNE ts_prot_fail ; If r3 <> &0F Then branch to fail routine. -; -; Set protection mode 1 and test that page. -; - MOV r2, #&01 ; r2 = &01, r2 = protection mode 1. - BL ts_mem_prot ; Gosub ts_mem_prot. - [ CPU_Type = "ARM600" - CMP r3,#&0f ; no ABORT line to ARM600 - | - CMP r3,#&0B ; Is r3 = &0B ? r3 = Super Read/Write ok. - ] ; O/S Read/Write ok. - ; User Read only ok. - - MOV r2,#1 - BNE ts_prot_fail ; If r3 <> &0B Then branch to fail routine. -; -; Set protection mode 2 and test that page. -; - MOV r2, #&02 ; r2 = &02, r2 = protection mode 2. - BL ts_mem_prot ; Gosub ts_mem_prot. - [ CPU_Type = "ARM600" - CMP r3,#&0f ; no ABORT line to ARM600 - | - CMP r3,#&03 ; Is r3 = &03 ? r3 = Super Read/Write ok. - ] ; O/S Read only ok. - ; User No Access ok. - MOV r2,#2 - BNE ts_prot_fail ; If r3 <> &03 Then branch to fail routine. -; -; Set protection mode 3 and test that page. -; - MOV r2, #&03 ; r2 = &03, r2 = protection mode 3. - BL ts_mem_prot ; Gosub ts_mem_prot. - [ CPU_Type = "ARM600" - CMP r3,#&0f ; no ABORT line to ARM600 - | - CMP r3, #&03 ; Is r3 = &03 ? r3 = Super Read/Write ok. - ] ; O/S Read only ok. - ; User No Access ok. - MOV r2,#3 - BNE ts_prot_fail ; If r3 <> &03 Then branch to - ; fail routine. -; -; Reset the page used to idle. -; - MOV r0, r12 ; r0 = r12, idle the pages - ; being used. - BL ts_set_cam_idle ; Gosub ts_set_cam_idle. - MOV r0, r8 ; r0 = r8, idle the pages - ; being used. - BL ts_set_cam_idle ; Gosub ts_set_cam_idle. -; -; Increment the physical page counter and check that all the pages are -; done, else finish. -; - BL ts_count_CAMs - ADD r12, r12, #&01 ; do the next physical page. - CMP r12, r0 ; Done all pages ? - BLT %B0 ; If r12 <= cam_entries, - ; branch back to 0. - - ANDS r0, r0, #0 ; set zero flag : test passed - MOV pc, r13 ; Return to caller. -; -; ************************************************************************** -; -; Branch here when ts_memc_prot fails to get the proper result from -; ts_mem_prot. -; -; At this point, -; -; r3 is a map of permitted ops (user read, user write, sys read, sys write) -; r2 is the memc protection mode -; r12 is the physical page number. -; -; This is displayed as : -; -; PPL bad l.a.pppp -; -; where l is the PPL set on that page (0, 1, 2 or 3) -; a is a bitmap of the actual operations permitted (ur.uw.or.ow) -; p is the physical page number tested -; - -0 - = "PPL bad",&88,&ff,".",&ff,".",&ff,&ff,&ff,&ff,0 - ALIGN - -ts_prot_fail - AND r2, r2, #&0f - MOV r0, r2, LSL #20 ; mode bits - AND r3, r3, #&0f - ORR r0, r0, r3, LSL #16 ; permitted ops bits - BIC r12, r12, #&ff000000 - BIC r12, r12, #&ff0000 - ORR r0, r0, r12 ; current page number - - - ADR r4, %B0 ; get fail message - MOV r8, r0, LSL #8 ; shift number to suit ts_SendText - ORRS r0, r0, #1 ; fail flag - MOV pc, r13 - - -; -; -; This section will test that the physical page referenced in r12 at the set -; protection mode. During the operation of this module, aborts are expected to happen. -; The aborts are handled by the routine ts_dab. -; -; The system is running in supervisor mode and thus to check the user mode read / writes -; the address translator flag is used. The CPU has a signal called -TRANS which when used -; with MEMC forces the an address translation to be performed, this is not done whilst -; in supervisor mode because it has unlimited access to the memory map. The address -; translator falg (T) is used with STR and LDR instructions only, the effective result of -; adding the (T) to the opcode is to force the instruction to be executed as if the CPU -; was in user mode, thus unauthorised accesses will cause an abort to occur. -; -; IN: -; r12 - physical page. -; r2 - protection mode. -; OUT: -; r3 - access pattern. -; r3 = &0F, Super Read/Write ok, O/S Read/Write ok, User Read/Write ok. -; r3 = &0B, Super Read/Write ok, O/S Read/Write ok, User Read only ok. -; r3 = &03, Super Read/Write ok, O/S Read only ok, User No Access ok. -; -ts_mem_prot -; -; Set up data to write and read from memory. -; - MOV r10, lr ; Preserve link register. - MOV r1, r12 ; r1 = physical page. - MOV r0, #&01 ; r0 = logical page 1. - BL ts_set_camp - - MOV r3, #&00 ; Initialise access pattern. - MOV_fiq r5, r11_fiq ; get MEMC control - AND r5, r5, #&C - ADR r9, ts_ppl_tptrs - LDR r9, [r9, r5] ; get test address for this pagesize -; -; Test 1 system mode - write. -; - MOV r6, #&00 ; r6 = &00, clear expected abort flag. - MOV r7, #&94 ; r7 = &94, set abort expected flag. -; -; The following instruction may abort. -; - STR r1, [r9] ; Store r1 at loc pointed to by r9. - CMP r6, #&00 ; Is r6 = &00 ? If not then abort happened. - ORREQ r3, r3, #&01 ; If r6 = &00, Then update r3, access pattern. -; -; Test 2 system mode - read. -; - MOV r6, #&00 ; r6 = &00, clear expected abort flag. - MOV r7, #&94 ; r7 = &94, set abort expected flag. -; -; The following instruction may abort. -; - LDR r1, [r9] ; Load r1 from loc pointed to by r9. - CMP r6, #&00 ; Is r6 = &00 ? If not then abort happened. - ORREQ r3, r3, #&02 ; If r6 = &00 Then update r3, access pattern. -; -; Test 3 user mode - write. -; - MOV r6, #&00 ; r6 = &00, clear expected abort flag. - MOV r7, #&94 ; r7 = &94, set abort expected flag. -; -; The following instruction may abort. -; - STRT r1, [r9] ; Store r1 at loc pointed to by r9. - CMP r6, #&00 ; Is r6 = &00 ? If not then abort happened. - ORREQ r3, r3, #&04 ; If r6 = &00 Then update r3, access pattern. -; -; Test 4 user mode - read. -; - MOV r6, #&00 ; r6 = &00, clear expected abort flag. - MOV r7, #&94 ; r7 = &94, set expected expected flag. -; -; The following instruction may abort. -; - LDRT r1, [r9] ; Load r1 from loc pointed to by r9. - CMP r6, #&00 ; Is r6 = &00 ? If not then abort happened. - ORREQ r3, r3, #&08 ; If r6 = &00 Then update r3, access pattern. - MOV pc, r10 ; Return to caller. - -; -; addresses (a short way up page 1) to test PPL aborts -; - -ts_ppl_tptrs - & ( 4 * 1024) + ts_wks_word - & ( 8 * 1024) + ts_wks_word - & (16 * 1024) + ts_wks_word - & (32 * 1024) + ts_wks_word -; -; -ts_dab -; -; This routine provides the handling when a DATA ABORT occurs. -; The routine will if the abort was DATA cause the program to skip over the instruction -; that caused the abort first place. -; Data aborts could come from a variety of sources, in this module we are only concerned -; about a select group of aborts. This abort routine is called instead of the "usuall" -; abort routine. All that is required from this abort routine is to set a flag to -; indicate that an abort occured. Therefore this routine needs to be told that the -; abort that caused the routine to be called is either one of mine or not, (expected -; or unexpected). To achive this &94 is placed in r7. The abort routine will check -; for the presence of &94 in r7, if present then the abort is an expected abort. -; The abort routine will then copy r7 into r6, which is used as a flag to indicate -; that an abort occured and that it was an expected abort. Then the routine will -; return control to the program at the location after the instruction that caused to -; abort to occur. -; The return address is stored by the CPU into the link regester lr (r14), sort off. -; It must be remembered that the PC is always 2 instructions ahead. E.G. if the -; instruction that causes the abort is at &2000, then the lr will have &2008 in it, -; but we want to return to the location after the abort instruction, &2004. Therefore to -; return to the correct location &04 is removed from the lr and this is put into the pc. -; If the abort was not expected then the routine will jump to the end and another -; routine will show that an unexpected abort was generated. -; -; IN: -; r6 - Equals &00, cleared just before the instruction that could cause an abort. -; r7 - Equals &94, set just before the instruction that could cause an abort. -; -; OUT: -; r6 - Equals &94, set if an abort happened and was expected. -; r7 - Equals &94, preserved. -; - ROUT ; Local Branches. -; -; Check that it is an expected abort and not an unexpected abort. -; - CMP r7, #&94 ; Is r7 = &94, abort expected value. - BNE ts_dab_unexp ; If <> &94, Then branch to unexpected - ; abort handler. -; -; It is an expected abort, so handle it. -; - MOV r6, r7 ; r6 = r7, indicates that an abort happened. - SUB pc, lr, #&04 ; pc = link reg - &04. - ; Skip over aborting instruction. - ; By reloading the pc we return to the area - ; of code where the abort occured but 4 - ; locations further on. - - - END diff --git a/OldTestSrc/TestMain b/OldTestSrc/TestMain deleted file mode 100644 index 22fcf0d..0000000 --- a/OldTestSrc/TestMain +++ /dev/null @@ -1,78 +0,0 @@ -; > TestMain - - -; Main assembly file for isolated assembly of machine test software - -MEMCADR * &3600000 -ROM * &3800000 - - [ MEMC_Type = "IOMD" -VideoPhysRam * &02000000 ; Amazing - it's in the same place! -DRAM0PhysRam * &10000000 ; 4 DRAM banks -DRAM1PhysRam * &14000000 -DRAM2PhysRam * &18000000 -DRAM3PhysRam * &1C000000 -DRAMBaseAddressMask * &1C000000 ; used to mask off bits after stealing video RAM -PhysSpaceSize * &20000000 ; IOMD physical map is 512M big -PhysROM * &00000000 ; and real ROM starts at 0 -SAMLength * 512*4 ; SAM length in bytes for 1 bank of VRAM -EASISpacePhys * &08000000 -EASISpace * PhysSpace + EASISpacePhys - | -VideoPhysRam * &02000000 -PhysSpaceSize * &04000000 ; MEMC1 physical map is 64M big -PhysROM * &03800000 -PhysRamPhys * &02000000 ; physical space starts here - ] - - ORG ROM - - GET TestSrc/Begin -CONT - ADRL r2,TestVIDCTAB - LDR r0,=IOMD_MonitorType - LDR r0,[r0] - ANDS r0,r0,#IOMD_MonitorIDMask - ADDEQ r2,r2,#(TestVVIDCTAB-TestVIDCTAB) - MOV r0,#ts_VIDCPhys -08 LDR r1, [r2],#4 - CMP r1, #-1 - STRNE r1, [r0] - BNE %BT08 - - MOV r9,#0 -10 - ORR r9,r9,#&40000000 - STR r9,[r0] ; write the border colour - ADD r9,r9,#&00000005 - ADD r9,r9,#&00000300 - ADD r9,r9,#&00010000 - AND r9,r9,#&00ffffff - - MOV r1,#&10000 -12 ADDS r1,r1,#(-1) - BNE %BT12 - - B %BT10 - -; -; The RISC-OS MEMC setup code is re-used to ensure similar -; detection of memory configuration. The MEMC1 code is modified only -; to remove an unnecessary function. - - GBLL Module -Module SETL {FALSE} - GBLL AssembleSAtest -AssembleSAtest SETL {FALSE} - -DynAreaFlags_DoublyMapped * 1 :SHL: 6 -DynAreaFlags_NotCacheable * 1 :SHL: 5 -DynAreaFlags_NotBufferable * 1 :SHL: 4 -DynAreaFlags_APBits * 15 :SHL: 0 ; currently onl - - - END - - - - diff --git a/OldTestSrc/Vidc b/OldTestSrc/Vidc deleted file mode 100644 index 3aedb0b..0000000 --- a/OldTestSrc/Vidc +++ /dev/null @@ -1,530 +0,0 @@ -; > TestSrc.VIDC - - TTL RISC OS 2+ POST video controller -; -; The video outputs cannot be tested directly, and VIDC permits only -; write operations on its registers. -; This module performs two tests to verify VIDC's operation -; -; - measure mode 0 FLBK period against IOC timer -; - check that sound DMA occurs (MEMC reports DMA complete) -; -; This code contains timing loops affected by gross changes in processor -; speed, and will re-initialise MEMC with 4K pages and continous refresh. -; -;------------------------------------------------------------------------ -; History -; -; Date Name Comment -; ---- ---- ------- -; 18-Dec-89 ArtG Initial version -; 04-Apr-90 ArtG Use saved MEMC control register setting -; 20-Jun-93 ArtG Medusa VIDC20 / IOMD changes -; -; -;------------------------------------------------------------------------ - - -VIDC_CLOCK_CONTROL * ts_S5_base :OR: &0048 ; Fox VIDC clock control -VIDC_CLOCK_NORMAL * &0 - -VIDC_VFLYWAIT * 72000 ; 200mS timeout loop -VIDC_SOUNDWAIT * 40000 ; 100mS timeout loop - -MEMC_Sstart * MEMCADR :OR: &80000 -MEMC_SendN * MEMCADR :OR: &A0000 -MEMC_Sptr * MEMCADR :OR: &C0000 -MEMC_Son * &00800 - -ts_Soundbuf * &200 ; relative to PhysRam -ts_Soundbuf_length * &400 - - [ VIDC_Type = "VIDC20" -VIDSTIM0 * &A0000000 ; base VIDC20 register values -VIDSTIM1 * &A1000000 -VIDSFR * &B0000000 -VIDSCR * &B1000005 -VIDDMAoff * &94000024 -VIDVCOWAIT * &5 -VIDVCOFREQ * &D0000404 - | -VIDSTIM0 * &60000000 ; base VIDC register values -VIDSTIM1 * &64000000 -VIDSFR * &C0000100 - ] - - SUBT FLBK period test -; -; This test attempts to validate the video timing system by checking for -; the proper period from the vertical flyback pulse. To make life easier, -; the test is performed only in mode 0 - i.e a 20mS period. -; -; This test contains a processor-clock timed loop as an outer limit : -; it assumes that the processor will never run more than a factor of ten -; faster than an 8Mhz ARM2. -; This is valid provided that this code isn't run with an ARM3 cache enabled. -; - -; Initialise video clock control (for FOX) -; Initialise VIDC -; Clear IR interrupt request in IOC -; Poll IOC until IR appears (if ever) -; Set IOC timer 0 to 32 mS -; Clear IR interrupt request in IOC -; Poll IOC until IR appears (if ever) -; Check timer 0 has counted down 20 mS (19.8 - 20.2 mS) -; Return zero flag set on OK, clear on test failure. - - -ts_VIDC_period ROUT - - ; Initialise VIDC clock and VIDC - - [ VIDC_Type = "VIDC1a" - LDR r3, =VIDC_CLOCK_CONTROL ; - MOV r1, #VIDC_CLOCK_NORMAL - STRB r1, [r3] - ] - - MOV r7, #0 - MOV r1, #ts_VIDCPhys - ADRL r6, TestVIDCTAB -00 LDR r0, [r6],#4 ; setup using main table - CMP r0, #-1 - STRNE r0, [r1] - BNE %BT00 -01 LDR r0, [r6],#4 ; enable DMA using 2nd table - CMP r0, #-1 - STRNE r0, [r1] - BNE %BT01 - - ; Wait for the start of a flyback period - -04 - LDR r3, =IOC - [ MEMC_Type = "IOMD" - LDR r1, [r6] ; get FSIZE value from end of TestVIDCTAB - STR r1, [r3, #IOMD_FSIZE] - ] - MOV r1, #vsync_bit - STRB r1, [r3, #IOCIRQCLRA] - LDR r2, =VIDC_VFLYWAIT ; long timeout loop - C 200mS - -05 LDRB r1, [r3, #IOCIRQSTAA] - ANDS r1, r1, #vsync_bit - BNE %06 - SUBS r2, r2,#1 - BNE %05 - - LDR r0,=&fffff - ORRS r0, r0,r7, LSL #20 ; Failed : clear 0 flag - MOV pc, r14 ; ... and quit - - ; Set up IOC timer 0 -06 - LDR r1, =(32 * 1000 * 2) ; 32mS upper limit - STRB r1, [r3, #Timer0LL] - MOV r0, r1, LSR #8 - STRB r0, [r3, #Timer0LH] - MOV r0, #0 - STRB r0, [r3, #Timer0GO] ; start the timer - - ; clear the IR and T0 bits - - MOV r0, #(vsync_bit :OR: timer0_bit) - STRB r0, [r3,#IOCIRQCLRA] - - ; wait for what should be a complete vflyback period - -10 LDR r2, =VIDC_VFLYWAIT ; timeout loop - C 200 msec -11 LDRB r0, [r3,#IOCIRQSTAA] - TSTS r0, #vsync_bit - BNE %14 ; wait for end of vsync - - TSTS r0, #timer0_bit ; or timer underflow - BNE %13 - -12 SUBS r2, r2, #1 ; or last-ditch timeout - BNE %11 - -13 ORRS r0, r0,#1 ; Failed : clear 0 flag - MOV r0, #0 ; but return a zero - MOV pc, r14 ; ... and quit - - ; finished in reasonable time : check against margins. - -14 STRB r0, [r3, #Timer0LR] ; latch the current count - LDRB r2, [r3, #Timer0CL] - LDRB r0, [r3, #Timer0CH] - ADD r2, r2, r0, LSL #8 - - SUB r2, r1, r2 - MOV r0, r2, LSR #1 ; Vertical flyback time in uS - - LDR r1, =19800 ; inside limits ? - SUBS r2, r0, r1 - BLE %F20 - - LDR r1, =400 ; 19.8 -> 20.2 mS - CMPS r2, r1 - BGE %F20 - MOV r1,#0 ; OK - 0 indicates pass - - ; After success using the 24MHz reference clock, select the - ; VCO clock (also at 24MHz) and ensure the test is passed after - ; a few cycles to allow the VCO to settle. - -20 - [ VIDC_Type = "VIDC20" - - TEQ r7,#0 ; if this is the first loop .. - BNE %FT21 - TEQ r1,#0 ; and it passed OK .. - BNE %FT25 - MOV r2,#ts_VIDCPhys - LDR r3,=VIDVCOFREQ ; set the vco to 24MHz - LDR r4,=&E0000400 ; and use the vco clock - STMIA r2,{r3,r4} - MOV r7,#VIDVCOWAIT ; set the vco test loop count - B %BT04 ; and run around again - -21 ORR r0,r0,r7,LSL #20 - SUBS r7,r7,#1 ; if all attempts now made - BEQ %FT25 ; return final result - TEQ r1,#0 ; else repeat until passed - BNE %BT04 - ] - - ; return with zero flag set if timers were OK - ; measured time (in uS) in r0 if flyback was wrong, - ; bits 20+ show fail loop - 0 for refclk, 1 for vcoclk. - -25 - ORRS r1,r1,r1 - MOV pc, r14 - - - SUBT Sound DMA test -; -; This test runs the sound DMA system to prove the operation of VIDC and -; MEMC's sound DMA control and the operation of the SIRQ sound DMA complete -; interrupt. -; To avoid making a noise, set the sound muting bit on. -; -; Initialise MEMC sound DMA -; Initialise VIDC sound channel -; Initialise timer 0 and timer 1 to guard-band 10mS sound duration -; Poll IOC until IL1 (SIRQ interrupt) becomes active -; Check timer 0 has completed and timer 1 has not -; - -ts_SIRQ_period ROUT - - ; set up MEMC to point to a buffer near the start of physical RAM, - ; labelled in r9_fiq by the early memory size tests (not MemSize) - ; Registers are set as (address / 16) - ; Register bits are (register * 4) in VIDC address mask - ; Hence values written to MEMC + register offset + (pointer / 4) - - - [ MEMC_Type = "IOMD" - MOV r3,#IOMD_Base - MOV r0,#(IOMD_DMA_C_Bit :OR: IOMD_DMA_E_Bit :OR: 16) - STR r0,[r3,#IOMD_SD0CR] - MOV_fiq r0,r9 ; zero the DMA buffer - ADD r1,r0,#ts_Soundbuf_length - MOV r2,#0 -02 STR r2,[r0],#4 - CMPS r0,r1 - BNE %BT02 - | - MOV_fiq r0,r11_fiq - BIC r0, r0, #MEMC_Son ; ensure sound DMA disabled - - STR r0, [r0] - LDR r1, =(MEMC_SendN :OR: ((ts_Soundbuf + ts_Soundbuf_length) / 4)) - STR r1, [r1] - LDR r2, =(MEMC_Sstart :OR: (ts_Soundbuf / 4)) - STR r2, [r2] - LDR r0, =MEMC_Sptr ; initialise Sptr and set up again .. - STR r0, [r0] - STR r1, [r1] - STR r2, [r2] - ] - - ; Set up VIDC for 8 channels, 10uS (/8) per sample - - LDR r0, =ts_VIDCPhys - [ VIDC_Type = "VIDC20" - LDR r1, =VIDSCR ; VIDC10 mode, 24Mhz clock - STR r1, [r0] - LDR r1, =VIDDMAoff - STR r1, [r0] - ] - LDR r1, =(VIDSTIM0 + 1) ; channel 0 at 100% left - LDR r2, =((VIDSTIM1 - VIDSTIM0) + 1) - MOV r3, #7 -05 STR r1, [r0] ; .. up to 6 at 100% right - ADD r1, r1, r2 - SUBS r3, r3, #1 - BNE %05 - SUB r1, r1, #4 ; finally ch7 at centre again - STR r1, [r0] - - LDR r1, =(VIDSFR + 8) ; 10uS/byte - STR r1, [r0] - - ; Set up the timer to limit at 20 us (10uS/sample, 1024-16 bytes => 10.08 mS) - - LDR r3, =IOC - LDR r1, =(20 * 1000 * 2) ; 20 mS upper limit - STRB r1, [r3, #Timer1LL] - MOV r0, r1, LSR #8 - STRB r0, [r3, #Timer1LH] - - MOV r0, #-1 - STRB r0, [r3, #IOCControl] ; mute sound (on IOC system) - STRB r0, [r3, #Timer1GO] ; start the timer - - [ MEMC_Type = "IOMD" - MOV r0, #(IOMD_DMA_E_Bit :OR: 16) ; enable the IOMD DMA - STR r0, [r3,#IOMD_SD0CR] - MOV_fiq r0,r9 ; set the buffer pointers - MOV r4,#((ts_Soundbuf_length/2) - 16) - STR r0,[r3,#IOMD_SD0CURA] - STR r4,[r3,#IOMD_SD0ENDA] - LDR r2,[r3,#IOMD_SD0ST] - ORR r4,r4,#IOMD_DMA_S_Bit - STR r0,[r3,#IOMD_SD0CURB] - STR r4,[r3,#IOMD_SD0ENDB] - | - MOV_fiq r0, r11_fiq - ORR r0, r0, #MEMC_Son - STR r0, [r0] ; enable the MEMC1a DMA - ] - - ; set long timeout, clear the IL1, T0 and T1 bits - - LDR r2, =VIDC_SOUNDWAIT ; lastditch timeout loop - LDR r0, =(timer0_bit :OR: timer1_bit) - STRB r0, [r3,#IOCIRQCLRA] - - - ; Wait until sound DMA completes (or up to about 100 mS), - ; then check timers. - -10 - [ MEMC_Type = "IOMD" - LDRB r0,[r3, #IOMD_SD0ST] - AND r0, r0, #(IOMD_DMA_O_Bit :OR: IOMD_DMA_I_Bit) - CMPS r0, #(IOMD_DMA_O_Bit :OR: IOMD_DMA_I_Bit) - BEQ %12 - | - LDRB r0, [r3,#IOCIRQSTAB] - ANDS r0, r0, #sound_IRQ_bit - BNE %12 - ] - LDR r0, [r3, #IOCIRQSTAA] - ANDS r0, r0,#timer1_bit ; timeout if timer 1 expires - BNE %11 - - SUBS r2, r2, #1 ; or counter reaches zero - BNE %10 - -11 ORRS r0, r0, #1 ; Failed : clear 0 flag - MOV r2, #0 ; return a timeout value of 0 - B %15 ; ... and quit - - ; finished in reasonable time : check time remaining in t1 - ; Time for DMA should be 10.24ms (1024 bytes at 10us/byte) - ; less up to the time to use the final 16-byte transfer, 160us. - -12 STRB r0, [r3, #Timer1LR] ; latch the current count - LDRB r2, [r3, #Timer1CL] - LDRB r0, [r3, #Timer1CH] - ADD r2, r2, r0, LSL #8 - - SUB r2, r1, r2 - MOV r2, r2, LSR #1 ; Sound DMA time in uS - - LDR r1, =10030 ; inside limits ? - SUBS r0, r2, r1 - BLE %F13 - - LDR r1, =260 ; 10.03 -> 10.29 mS - CMPS r0, r1 - MOVLT r1,#0 ; inside limits : set Z flag - -13 ORRS r1,r1,r1 - - ; return with zero flag set if time (in r2) was within limits - -15 - [ MEMC_Type = "IOMD" - MOV r0, #IOMD_DMA_C_Bit - STR r0, [r3,#IOMD_SD0CR] - | - BIC r0, r0, #MEMC_Son - STR r0, [r0] - ] - MOV r0, r2 ; return the long time value - MOV pc, r14 - -;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; -; Data tables: VIDC := mode 0, all palette black - -TestVIDCTAB - - [ VIDC_Type = "VIDC1a" - - & &00000000 - & &04000000 - & &08000000 - & &0C000000 - & &10000000 - & &14000000 - & &18000000 - & &1C000000 - & &20000000 - & &24000000 - & &28000000 - & &2C000000 - & &30000000 - & &34000000 - & &38000000 - & &3C000000 - & &40000000 ; Border -> black - & &44000000 ; Cursor -> black - & &48000000 - & &4C000000 ; Palette programmed (avoid messy screen on reset) -; -; standard mode 0 setup (except display area disabled) -; - - & &807FC000 - & &8408C000 - & &881B0000 - & &8C1EC000 ; HDSR - & &906EC000 ; HDER - & &94770000 - & &9C400000 - & &A04DC000 - & &A4008000 - & &A8050000 ; VBSR - & &AC098000 ; VDSR - & &B0000000 ; VDER < VDSR to disable screen DMA B0000000 - & &B44DC000 ; VBER - & &E00000B2 -; -; Additional setup : cursor blanked, sound frequency test bit set -; - & &C0000100 ; SFR NB. TEST BIT! - also DFlynn requested value - & &98258000 ; HCSR - & &B8004000 ; VCSR - & &BC400000 ; VCER -; don't mess with the stereo image registers: sound code will set them. - & &FFFFFFFF ; That's the lot - -; -; Further registers to turn screen DMA on again (border all over) -; Must have a video start register before video end register to get -; a vertical flyback interrupt. -; - & &B0494000 ; VDER > VDSR to enable screen DMA - & &FFFFFFFF - ] - - [ VIDC_Type = "VIDC20" - -; This differs from the default RISC OS VIDCTAB in running from -; the 24MHZ video ref clock. H register contents are increased by 50%. - -; Program Control Register first, to clear power-down bit - - & &E0000402 ; CR: FIFO load 16 words, 1 bpp, ck/1, rclk - & &E0000402 ; - & &B1000001 ; SCR: sound disabled (+use 24MHz clock) - -; Don't bother programming all 256 palette entries, we'll be here all night -; Since we're setting up a 1 bit-per-pixel mode, just do colours 0 and 1 - - & &10000000 ; Palette address register = 0 - & &00000000 ; Colour 0 = black - & &00000000 ; Colour 1 = black - & &407f7f7f ; Border colour = grey - & &50000000 ; Pointer colour 1 = black - & &60000000 ; Pointer colour 2 = black - & &70000000 ; Pointer colour 3 = black - -; Get a stable display up so we get stable signals - - & &800005F8 ; HCR = 114 + 132 + 144 + 960 + 144 + 42 - & &8100006A ; HSWR = 114 - & &820000EA ; HBSR = 114 + 132 - & &83000174 ; HDSR = 114 + 132 + 144 - & &84000534 ; HDER = 114 + 132 + 144 + 960 - & &850005CA ; HBER = 114 + 132 + 144 + 960 + 144 - & &860000F3 ; HCSR = HDSR - - & &90000137 ; VCR = 3 + 19 + 16 + 256 + 16 + 2 - & &91000002 ; VSWR = 3 - & &92000015 ; VBSR = 3 + 19 - & &93000025 ; VDSR = 3 + 19 + 16 - & &94000024 ; VDER = VDSR -1 to disable sceeen DMA - & &95000135 ; VBER = 3 + 19 + 16 + 256 + 16 - & &96000025 ; VCSR = VDSR - & &97000025 ; VCER = VDSR - - & &C00F1003 ; EREG = comp sync, DACs on, ereg output ext lut - & &D000C385 ; FSYNREG, clk = (3+1)/(5+1) * 24MHz = 16MHz - & &F0013000 ; DCR: bus D[31:0], Hdisc - & &FFFFFFFF - - & &94000125 ; VDER > VDSR to enable screen DMA - & &FFFFFFFF - ; FSIZE is one less than number of rasters in Vflyback - & &00000037 ; (3 + 19 + 16 + 0 + 16 + 2) - 1 - - ; Alternate settings for VGA monitor - -TestVVIDCTAB - & &E0000402 ; CR: FIFO load 16 words, 1 bpp, ck/1, rclk - & &E0000402 ; - & &B1000001 ; SCR: sound disabled (+use 24MHz clock) - - & &10000000 ; Palette address register = 0 - & &00000000 ; Colour 0 = black - & &00000000 ; Colour 1 = black - & &407f7f7f ; Border colour = grey - & &50000000 ; Pointer colour 1 = black - & &60000000 ; Pointer colour 2 = black - & &70000000 ; Pointer colour 3 = black - - & &80000310 ; HCR = 92 + 45 + 0 + 640 + 0 + 16 - & &81000054 ; HSWR = 92 - & &82000080 ; HBSR = 92 + 45 - & &83000080 ; HDSR = 92 + 45 + 0 - & &84000300 ; HDER = 92 + 45 + 0 + 640 - & &85000300 ; HBER = 92 + 45 + 0 + 640 + 0 - & &86000080 ; HCSR = HDSR - - & &9000020B ; VCR = 2 + 32 + 0 + 480 + 0 + 11 - & &91000001 ; VSWR = 2 - & &92000021 ; VBSR = 2 + 32 - & &93000021 ; VDSR = 2 + 32 + 0 - & &94000020 ; VDER = VDSR -1 to disable sceeen DMA - & &95000201 ; VBER = 2 + 32 + 0 + 480 + 0 - & &96000021 ; VCSR = VDSR - & &97000021 ; VCER = VDSR - - & &C0051003 ; EREG = sep/inv sync, DACs on, ereg output ext lut - & &F0013000 ; DCR: bus D[31:0], Hdisc - & &FFFFFFFF - - ] - - END - - - -- GitLab