Enhanced OS independent CPU and FPU detection - #18
Conversation
… of Kickstart 1.2 and later. Based on code by Chris Hooper: https://github.com/cdhooper/amigapci_stm32/blob/main/amiga/cpu_control.c Photon: http://coppershade.org/asmskool/PhotonsMiniStartup/PhotonsMiniWrapper1.04!.S M. Wandel: https://wandel.ca/homepage/execdis/exec_disassembly.txt
- added 68080 ID to global constants - enforced 60 columns limit
Verified working on Kickstart 37.350 and 40.63 with various cpu and fpu combinations in WinUAE
|
fpu detection crash fixed on plain 68000 machines. |
|
@larsonmars finally verified working with Kickstart 1.3..my vasm DOS script needed fixing, so it now produces Kickstart 1.x compatible hunks ;D |
Signed-off-by: 0xecc0-devices <retromachines@vodafonemail.de>
…on of emulation environment Signed-off-by: 0xecc0-devices <retromachines@vodafonemail.de>
- added emulation environment variable $Emulation which detects UAE, Emu68 or Musashi emulations - added CPU revision environment variable $CPURev for MC68060/MC68LC060/MC68EC060 and AC68080 - fixed and simplified AC68080 detection (note: AC68080 doesn't support CACR.NAI) - added detection of MC68LC060/MC68EC060 which will be shown for now as '68LC060' in $CPU - added detection of MC68LC040/MC68EC040 which will be shown for now as '68LC040' in $CPU - added detection of MC68EC020 which will be shown as '68EC020' in $CPU - refactored CPU string output to use a table based approach instead of digit replacement - optimized various assembler instructions as of VASM's suggestion - updated and corrected function header documentation for various functions
There was a problem hiding this comment.
Thank you very much for the detection improvements! This will make many people happy.
I made some comments for your consideration.
Unfortunately, I cannot just approve as is, because the tests fail due to breaking change with $CPU and $FPU. I also made some comments there. If we want to keep it the way it is now, we would have to adapt the test (the startup-sequence).
Also, we must not forget to create the Aminet release, where we mention your contribution in the .readme (I can do that in an extra commit when the PR is complete).
| ************************************************************ | ||
| * * | ||
| * SYSVARS V.0.18 * | ||
| * SYSVARS V.0.23 * |
There was a problem hiding this comment.
Could we use v.0.19?
EDIT: I understand that you did some versions in your fork. I suggest we use a versioning scheme, such as 0.20a1 or 0.20b1 for the next changes if you intent to merge it, so we keep one branch with the major versions.
There was a problem hiding this comment.
Sure, no problem. I reverted the version back to 0.19
For further versions, I'll follow your suggestion using current version +a1/b1
|
|
||
| PROGVER: macro | ||
| dc.b "$VER: SYSVARS 0.18",0 | ||
| dc.b "$VER: SYSVARS 0.23",0 |
There was a problem hiding this comment.
see above, would be good to have 0.19
There was a problem hiding this comment.
Sure, no problem. I reverted the version back to 0.19
For further versions, I'll follow your suggested naming scheme
| MC68060_ID EQU $0430 | ||
|
|
||
| ; constants for detection of 24bit addressing | ||
| KICK_VER equ $00F8000C |
There was a problem hiding this comment.
Fixed that, too.
| endc | ||
|
|
||
| movea.l EXEC_BASE,a6 ; get exec base in A6 | ||
| movea.l EXEC_BASE.w,a6 ; get exec base in A6 |
There was a problem hiding this comment.
Could you elaborate the benefit of using EXEC_BASE.w instead of just EXEC_BASE? I would expect assemblers to do it right either way, but the added .w is noisier.
There was a problem hiding this comment.
Because vasm will complain with optimization abs.l -> abs.w
How about a simple macro?
;-----------------------------------------------------------
; get's exec.library base address to passed address register
;-----------------------------------------------------------
; Macro Arguments:
; 1: address register to store the exec.library address in
;-----------------------------------------------------------
EXECBASE macro
movea.l EXEC_BASE.w,\1
endm
| .cpuName: | ||
| dc.b "68000",0,0,0 | ||
| dc.b "68010",0,0,0 | ||
| dc.b "68EC020",0 |
There was a problem hiding this comment.
I very much appreciate that we can now distinguish EC versions of a CPU. However, putting it into the name like this we loose the ability to use inequality operators (less/greater than) in scripts, which is quite common to enable certain tools only for certain CPU generations or newer (see also the test that must we must adapt so it works again).
Maybe we can split the EC/LC as separate $CPUVariant variable, or we could create variables for the actual CPU feature (or the lack thereof), such as $MMU. As we already have $FPU, which can be 68881, 68882 and internal, the information in $CPU, $FPU, $MMU would be sufficient to determine whether it is an LC/EC CPU.
What would you prefer?
There was a problem hiding this comment.
I didn't think much about that. But you're right..for a script tool the $CPU variable denotes the integer compatibility, which doesn't differ between the XC/EC/LC variants.
I'd go with your suggestion to keep $CPU, $FPU and $MMU separated and clean from variants. I'm not even convinced that the $CPUVariant variable would be necessary.
| | **``$CPU``** | always | installed CPU, for example ``68030`` (68080 is supported, but see [limitations](#Kickstart-13-and-below)) | ||
| | **``$FPU``** | if CPU ≥ 68020 | installed FPU, one of ``68881``, ``68882``, ``internal``, or empty for LC/EC 040 and 060 CPUs where no FPU is available (see [limitations](#Kickstart-13-and-below)) | ||
| | **``$CPU``** | always | installed CPU, for example ``68030`` | ||
| | **``$FPU``** | always | installed FPU, one of ``68881``, ``68882``, ``internal``, or ``none`` for LC/EC 040 and 060 CPUs where no FPU is available |
There was a problem hiding this comment.
Like with the CPU, this is a breaking change. Is there a reason why you changed the FPU to be always available again? The inital sysvars version also had this defined always. I had this later changed to be not defined for CPUs below MC68020 so it is consistent with other properties that are only defined when they can technically be available. AFAIK, there can never be any FPU with anything below MC68020, but maybe I'm wrong. Also, why is 'none' better then just empty?
There was a problem hiding this comment.
It's possible to have an FPU with the 68000 as a peripheral (see Motorola AN947). But it's rather impractical.
In Amiga DOS scripts you would probably go for IF EXISTS checking for the availability of the environment variable and then compare the value with IF $FPU EQ or something similar.
I think script-wise there's no real difference between checking for existance of the variable or getting it's value evaluated.
I'll just revoke the change that sets the variable when there's no FPU detected.
- removed detection of MC68EC020/MC68LC040/MC68EC040/MC68LC060/MC68EC060 which makes $CPU showing the integer unit's capabilities - refactored CPU string output to use digit replacement again - added macro for getting exec.library base pointer to improve readability avoiding assembler optimization output
|
Any thoughts on the changes? |

Rewrote CPU and FPU detection which now should be OS independent. Veryfied working on OS3.1 and WinUAE only though.