log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Rougol April 2024 meeting on monday is Anniversary time (News:1)
- WROCC April 2024 meeting o...changes to our phone lines (News:1)
- April developer 'fireside' chat is on saturday night (News:)
- March 2024 News Summary (News:4)
- WROCC Newsletter Volume 41:11 reviewed (News:)
- WROCC March 2024 meeting o... Hughes and Peter Richmond (News:1)
- Rougol March 2024 meeting on monday with Bernard Boase (News:)
- Drag'n'Drop 13i2 edition reviewed (News:)
- South-West Show 2024 talks (News:4)
- February 2024 News Summary (News:1)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: Programming: Shift-Reset
 
  Shift-Reset
  sirbod (20:38 22/5/2012)
  sirbod (17:46 12/6/2012)
    swirlythingy (22:39 12/6/2012)
      Phlamethrower (23:06 12/6/2012)
        sirbod (23:22 12/6/2012)
          swirlythingy (15:07 13/6/2012)
            sirbod (16:04 13/6/2012)
              sirbod (21:35 15/6/2012)
                Phlamethrower (23:43 15/6/2012)
                  sirbod (10:07 16/6/2012)
                    sirbod (23:15 4/7/2012)
      sirbod (23:43 12/6/2012)
  sirbod (10:29 5/7/2012)
 
Jon Abbott Message #120461, posted by sirbod at 20:38, 22/5/2012
Member
Posts: 563
Is it possible to cause a Shift-Reset programmatically?

What I'm trying to do is boot from a floppy mounted under ADFFS, I have this working manually via:

1. F12, *DIR adfs::0.$
2. Perform a Shift-Reset via the keyboard

I would like to add a menu option to automate it.

EDIT: I just stumbled upon Deeva, which does the following:

MOV R1, #Service_PreReset
SWI "OS_ServiceCall"
MOV R0, #&3800000
LDR R0, [R0]
STR R0, [R0, -R0]

SWI "XOS_EnterOS"
TEQP PC, #&FC000003
MOV PC, #0


Which obviously won't work for all, as page 0 may be locked.

EDIT2: I think I mean Shift-Break!

[Edited by sirbod at 06:27, 30/5/2012]
  ^[ Log in to reply ]
 
Jon Abbott Message #120571, posted by sirbod at 17:46, 12/6/2012, in reply to message #120461
Member
Posts: 563
Shift-Break doesn't work on RISC OS 3.5+ in the same way it does on RISC OS 3.1 (As per PRM5a-249)

On 3.1 "*DIR adfs::0.$" followed by Shift-Break does a soft reset and then boots from the floppy.

On 3.5+ it does a hard reset and then boots from the HD (ie the configured FS) but without running !Boot.

As well as needing an answer to the Q above, how on earth do you perform a soft-reset in RISC OS 3.5+? PRM5a-248 states "the previous concept of hard and soft resets is no more", does that mean soft-reset has gone?

Can I code a soft-reset?
  ^[ Log in to reply ]
 
Martin Bazley Message #120573, posted by swirlythingy at 22:39, 12/6/2012, in reply to message #120571

Posts: 460
As well as needing an answer to the Q above, how on earth do you perform a soft-reset in RISC OS 3.5+? PRM5a-248 states "the previous concept of hard and soft resets is no more", does that mean soft-reset has gone?
That doesn't bode well, but if this is a problem specific to 3.5+, then what does the OS_Reset SWI (introduced in that version) do?
  ^[ Log in to reply ]
 
Jeffrey Lee Message #120575, posted by Phlamethrower at 23:06, 12/6/2012, in reply to message #120573
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
That doesn't bode well, but if this is a problem specific to 3.5+, then what does the OS_Reset SWI (introduced in that version) do?
OS_Reset does the equivalent of a hard reset.

I knew that soft resets don't exist in RISC OS 5, but it hadn't clicked that they didn't exist in 3.5 either.

So to answer the original question: It is possible to program a soft-reset, but only on pre-RiscPC.
  ^[ Log in to reply ]
 
Jon Abbott Message #120577, posted by sirbod at 23:22, 12/6/2012, in reply to message #120575
Member
Posts: 563
Is it possible to lift the code from RISC OS 3.1 and get it working on RISC OS 3.5?

Could I possibly simulate it? eg

1. *ADFS
2. *DRIVE 0
3. *DIR ADFS::0.$
4. *Configure NoBoot (Shift-Break should in theory set this - not that it does, but some games check for it eg Arcade 3)
5. Reset the MontonicTime, which I don't believe is possible, so hijack OS_ReadMonitonicTime and alter the result. According to PRM1-446 this should only be reset on a hard-reset but its also reset on a soft-reset
6. &.!BOOT

What else does a soft-reset do?

[Edited by sirbod at 00:43, 13/6/2012]
  ^[ Log in to reply ]
 
Jon Abbott Message #120578, posted by sirbod at 23:43, 12/6/2012, in reply to message #120573
Member
Posts: 563
That doesn't bode well, but if this is a problem specific to 3.5+, then what does the OS_Reset SWI (introduced in that version) do?
A hard reset
  ^[ Log in to reply ]
 
Martin Bazley Message #120579, posted by swirlythingy at 15:07, 13/6/2012, in reply to message #120577

Posts: 460
5. Reset the MontonicTime, which I don't believe is possible
In that case, how on earth does the BASIC statement "TIME=0" work?

I know for a fact that it's possible, because I've had dreadful problems with badly-written software (e.g. Prophet3) doing it in the desktop for arbitrary reasons and completely mucking up any timer-based events which relied on the monotonic timer to be triggered.

[Edited by swirlythingy at 15:08, 13/6/2012]
  ^[ Log in to reply ]
 
Jon Abbott Message #120581, posted by sirbod at 16:04, 13/6/2012, in reply to message #120579
Member
Posts: 563
There is no documented way (that I've found at any rate) to reset the Monotonic Time. I've just hijacked OS_ReadMonotonicTime and subtract the time a simulated softboot occurs.

What I've yet to figure out, is how to perform an EXEC of the above commands after a call to TaskManager_Shutdown.

ServiceCall &80 (ShutdownComplete) is the obvious one - except it doesn't occur when shutdown is complete, it occurs before its complete and before the Wimp exits.

I also tried using CallAfter when ServiceCall &80 occurs. The problem is, the CallAfter doesn't occur until something triggers it, such as pressing a key!

Anyone have any ideas?
  ^[ Log in to reply ]
 
Jon Abbott Message #120601, posted by sirbod at 21:35, 15/6/2012, in reply to message #120581
Member
Posts: 563
Out of interest, does CallAfter get dealt with in the same way as CallBack, ie off the SWI vector when in user mode? That's how it appears to be working.

I could hook into TickerV, switch to user mode and trigger the CallAfter via an SWI. Having said that, I never managed to get callbacks working for disc swapping.

The other alternative is to insert keys into the keyboard buffer.

[Edited by sirbod at 21:36, 15/6/2012]
  ^[ Log in to reply ]
 
Jeffrey Lee Message #120608, posted by Phlamethrower at 23:43, 15/6/2012, in reply to message #120601
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
TIME doesn't use OS_ReadMonotonicTime; it uses the system clock (OS_Word 2/3).

CallAfter's and CallEvery's aren't callbacks; they're executed from an IRQ context within the 100Hz timer interrupt handler.
  ^[ Log in to reply ]
 
Jon Abbott Message #120611, posted by sirbod at 10:07, 16/6/2012, in reply to message #120608
Member
Posts: 563
CallAfter's and CallEvery's aren't callbacks; they're executed from an IRQ context within the 100Hz timer interrupt handler.
in that case, why after setting up a CallAfter to do an OS_CLI "EXEC ...", and then exiting the desktop via TaskManager_Shutdown, does the EXEC not occur until I press a key?

I've yet to investigate in any detail.
  ^[ Log in to reply ]
 
Jon Abbott Message #120769, posted by sirbod at 23:15, 4/7/2012, in reply to message #120611
Member
Posts: 563
I've now investigated and it seems Exec's aren't triggered correctly when called via a CallBack.

Steps to repro, using a module with service entry:

1. Call SWI "TaskManager_Shutdown" within the desktop

2. Module service code:

TEQ R1, #&80
BEQ callback_boot
MOV PC, R14


.callback_boot
STMFD R13!, {R0-R2, R14}

MOV R0, #128
ADR R1, bootFloppy
SWI "XOS_CallAfter"

LDMFD R13!, {R0-R2, PC}


.bootFloppy
STMFD R13!, {R0-R2, R14}

ADR R0, execLine
SWI "XOS_CLI"

LDMFD R13!, {R0-R2, PC}


.execLine EQUS "Exec Something"
EQUB 0
ALIGN


EDIT: As a consequence of this, I can get discs with their boot option set to "Run" to work, but "Exec" requires a key to be pressed!

EDIT2: Inserting a key into the keyboard buffer seems to work as a workaround.

[Edited by sirbod at 09:36, 5/7/2012]
  ^[ Log in to reply ]
 
Jon Abbott Message #120772, posted by sirbod at 10:29, 5/7/2012, in reply to message #120461
Member
Posts: 563
My final code for a simulated boot, assuming you've quit from the Desktop already:

STMFD R13!, {R1-R2, R14}

;reset Monotonic Time here

MOV R0, #14
MOV R1, #8
SWI "XOS_FSControl" ;select ADFS

ADR R0, set_CSD
SWI "XOS_CLI" ;set the CSD to adfs::0.$

MOV R0, #39
ADR R1, set_URD
SWI "XOS_FSControl" ;set the URD to adfs::0.$

MOV R0, #15
SWI "XOS_FSControl" ;boot the floppy

LDMFD R13!, {R1-R2, R14}

.set_CSD EQUS "DIR "
.set_URD EQUS "adfs::0.$" : EQUB 0 : ALIGN


You need to reset MonotonicTime to 0, the only way to do that is to capture the SWI vector and subtract the time the code above was called.

I've verified this on several games, where part of the protection is to check they were booted.
  ^[ Log in to reply ]
 

The Icon Bar: Programming: Shift-Reset