Amiga.org
Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: Ral-Clan on March 20, 2008, 03:51:10 PM
-
Is it possible to write a startup sequence function so, during a warm re-boot, a command is NOT executed if it already has been during a previous boot?
Here is my problem:
1. The first thing my Startup-Sequence executes upon cold booting is ROMTAGMEM to initialise the 32MB of RAM on my 040 accelerator. This file MUST be the first thing in the startup sequence to function. Once executed the Amiga carries out a warm reboot.
2. Upon this warm reboot, the startup sequence executes again. Next SETPATCH is encountered and installs the "AmigaOS ROM UPDATE" file from OS3.9. This requires a second warm reboot.
3. Now...during THIS warm re-boot , when my Amiga encounters the ROMTAGMEM command at the top of the startup sequence, I get a crash and hanging grey screen. I highly suspect that this is because the new exec.library from the "AMIGAOS ROM UPDATE" doesn't like ROMTAGMEM if it's executed AFTER SETPATCH.
So, I need to prevent ROMTAGMEM from even being acknowledged after SETPATCH is executed.
The only way I can think of doing this is with some sort of "IF...THEN" statement so that if ROMTAGMEM has already been executed, the Amiga will skip it entirely on a subsequent warm reboot. Is this possible? I've never done it before.
I'm thinking that a simple way to do it would be to activate a flag of some sort after ROMTAGMEM is executed the first time. The flag could be something as simple as writing a small text file to the hard drive right after executing ROMTAGMEM for the first time. Then in subsequent re-boots, {b]IF[/b] the file "xyz.txt" EXISTS, skip the ROMTAGMEM line in the startup-sequence. At the very end of the startup sequence, after the Amiga has booted sucessfully, this test file "flag" can be deleted.
Something like this (please excuse my syntax, I know not what I am doing and it's just to give the idea):
STARTUP-SEQUENCE
IF FILE SYS:flag.txt exists THEN SKIP
ROMTAGMEM 5 10 80000 (parameters here)
PRINT "ROMTAGMEM ON" >SYS:FLAG.txt
END
C: SETPATCH >QUIET
...and so on....
I have never done anything like this before. Maybe there is a better way. I don't even know the proper syntax.
-
version >nil: someromcomponent 45
if warn
; component is not present or is older than v45.x
else
; that component as v45.x or later is present
endif
You obviously pick some component updated by the "AmigaOS ROM Update", for example scsi.device.
-
ral-can,
You are on the right track hun. An IF-THEN sequence is the answer. Set up a variable to set it to 0 in the beginning then if ROMTAGMEM is executed by SETPATCH, set it to 1. Then add: IF A=1 SKIP; which will skip to the next line in the Startup-Sequence. You will have to use a variable that isn't used by the Startup-Sequence. Always set a variable to the default condition; 0 usually being FALSE and 1 being TRUE. There are several other ways of doing this. AmigaDOS is very rich.
Tabatha
-
tabbybasco wrote:
Set up a variable to set it to 0 in the beginning then if ROMTAGMEM is executed by SETPATCH, set it to 1. Then add: IF A=1 SKIP; which will skip to the next line in the Startup-Sequence.
Not after a warm reboot it won't.
--
moto
-
We probably don't need someone who hasn't written a custom startup-sequence in about 10 years to re-enforce that Piru's solution is correct.... But, I'll do it anyhow. :-P
In your case, you don't even need the else clause.
version >nil: someromcomponent 45
if warn
ROMTAGMEM
endif
setpatch
[... startup continues ...]
-
Thanks! But what exactly does the "WARN" part of
IF WARN
do?
-
The c:version command has extra switches besides displaying the version number. It can also compare a file or library version number to a fixed number to see if it meets minimum requirements. If it does not, it sets a warn value.
version >NIL: somelib 45
returns a warn if the version of somelib is below 45, and a succeed if 45 or above.
The IF WARN checks if the previous command set a warn value. :-)
(EDITED to add clarity)
-
Comment removed because I realise you answered it in the previous post.