Correct way to hard reset in the bootblock on 1.3-3.1?
I've updated a boot block which works correctly on 1.3-3.1. However, a hard reset consistently puts a PAL 1.3 A500 in NTSC mode until I've booted to CLI once and soft reset manually.
What can I do to prevent this? The bootdisk is found here, and here's the relevant portion of code: Code:
;a6=execbase, -$1e=Supervisor() |
The correct way is to use exec/ColdReboot() whenever it is available, because this call does some additional services compared to the code above, and your system may need such services.
Even under 1.3, the above code is not correct, problem being that your code may be in chip mem or expansion ram, and then the "reset" "pulls the rug" under the CPU. You can make it "somewhat working" by using the prefetch feature of the 68k, though then the reset and the JMP need to be on the same LW. |
Hmm, are you sure this works in 100% cases? E.g. KS 3.0 exec ColdReset jumps to a second reset at $f800d0, while you jump to $f800d2.
You took a shortcut (exec goes through the ROM end address) since ROM gets mapped to $0 and at $2 there's a jmp $f800d2, but you also don't have a decrement by 2 before taking a post-reset jmp (a0), and overshoot the 2nd reset by 2 bytes. Not sure if related or intended, just in case... |
Quote:
|
Sounds like you trigger KS 1.3 bug, there is always 1/227 chance of NTSC misdetection.
68000/010 prefetch is fully word based, long word alignment won't make any difference whatsoever. 68020+ prefetch long words. If unaligned, it still prefetches full long from aligned address (=address - 2). |
Quote:
This piece of code seems to trigger it 227/227 times (on 1.3 only) :D Quote:
It was not aligned to longword, but I fixed that and still the same behavior. So no software in RAM can use the RESET instruction for anything? What about MapROM and resident stuff? Certainly they use this instruction. I'd be happy to use ColdReboot(), so what would the use of it look like, is it consistent across OS1.3-3.1, and is there a WarmReboot()? :) |
Quote:
|
Code:
|
Precisely.
|
Ross's code works, and for a soft reset I would go
Code:
jsr _LVOSuperState(a6) |
See Ross' code. That's the better choice. Again, if exec/ColdReboot() exists, use it!
|
Thomas, I'm using it, I'm just wondering if the code in my last comment is a correct SoftReset. I need that also in my bootblock.
My existing SoftReset code works fine on all systems, I just want to know if it's correct. |
Well, as stated, not always, and exactly not if ColdReboot() has something else to do. In many, but no all cases, the two snippets work identical. I'd go for Ross' code, still.
|
I actually just checked ColdReboot() in two ways: resident vectors and cleared memory. Ross's code for 1.3 does that, but ColdReboot() under 2.0+ keeps resident vectors (e.g. from 3.1 early boot menu/"boot without s-seq") and does not clear memory. (!)
Sheesh... :D Let's define a hard reset then: resident vectors are killed, and (at least pertinent) memory is cleared. (This is the only way for a bootblock to kill a (in-RAM) virus before booting.) Now I'm in a dilemma, because I can use only the 1.3 part of Ross's code in this use case. I hoped to get this mammagamma done... Edit: So it could be a difference in expectations, hence my definition. Is there documentation on what ColdReboot() does? |
So you want the system to rebuild execbase and company?
There are several ways (such as clearing the exec checksum). But if you want to be brutal: Code:
.v1x jsr _LVOSuperState(a6) |
Regarding clearing Exec checksum: Is this what existing old code does in OP? (clr.l $26(a6)) this doesn't clear RAM or resident vectors on 3.1 at least. This is the definition and what it does on 1.3 (with <=512KB Chip RAM, I just found out)
I can try your brutal code. I've already spent 7h on this, what's an hour more on a Saturday. *makes Scooby-Doo sound* Edit: just to be clear the only goal left is code to make hardresets clear RAM and kill resident vectors on 2.0+. SlightlyBelowRoomTemperatureMaybeAThinSweaterIsCalledForBoot() in Exec V36+ does... less. :D Edit 2: Nope, brutal code did not clear memory at $7e000 under 3.1 :crying seems to clear resident vectors tho! |
Quote:
But I think there is no clear-ram code in KS3.x, you have to do it manually.. |
OK, primary goal is to kill viruses, so I will let go of secondary purpose of clearing RAM on >1.3. Thanks again Ross. You know so much OS stuff! :great
I mean I could feed the Amiga users who dare boot a floppy on a 3.1 machine to the sharks WRT viruses. They might have valid resident vectors like Blizzard accelerator stuff. Then again those users can opt to not hardreset because they know. It would be nice for an antivirus boot block to actually work on >1.3. |
Quote:
|
Quote:
|
All times are GMT +2. The time now is 04:12. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.