'Clean-up' after a warm reset

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

displaced
Atari freak
Atari freak
Posts: 60
Joined: Sat Aug 06, 2016 7:09 pm

'Clean-up' after a warm reset

Postby displaced » Thu Apr 04, 2019 8:02 am

Hi,

I'm working on my Raspberry Pi Zero-based USB keyboard and mouse adapter for the ST (see here for info (long thread!).

One issue is that after a warm reset after playing a game, the ST's in a rather crashy state. Roughly 60% of the time, the HxC Floppy Selector program will crash with 2-3 bombs at startup after a warm reset after playing a game.

Is it possible to write a small tool that, when loaded from AUTO, will simulate a cold boot as far as possible -- remove any non-default interrupt routines, etc?

Alternatively, is there a way to trigger a cold reboot in code? The tool could then:

  • Check for a flag file
  • If not present, create it and perform a cold reboot
  • If present, delete it and exit (since the flag file indicates a cold boot has been performed

Thanks!
Chris

tzok
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 106
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: 'Clean-up' after a warm reset

Postby tzok » Thu Apr 04, 2019 9:05 am

Ctrl+Alt+Shift+Del = Cold Boot (in Rainbow TOS and newer).

displaced
Atari freak
Atari freak
Posts: 60
Joined: Sat Aug 06, 2016 7:09 pm

Re: 'Clean-up' after a warm reset

Postby displaced » Thu Apr 04, 2019 10:54 am

tzok wrote:Ctrl+Alt+Shift+Del = Cold Boot (in Rainbow TOS and newer).


Ah - this is on TOS 1.02, sadly. I know I could upgrade, but if there's an alternative in code, that'd be great - especially if I can offer a routine to HxC's jeff to help improve the HxC file selector.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2461
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: 'Clean-up' after a warm reset

Postby charles » Thu Apr 04, 2019 11:04 am

use the rom of rainbow tos , and find the routine it performs on cold reboot
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

Zippy
Captain Atari
Captain Atari
Posts: 185
Joined: Sun Feb 01, 2004 1:58 am

Re: 'Clean-up' after a warm reset

Postby Zippy » Thu Apr 04, 2019 3:31 pm

If you clear the 3 "memval" system variables (@ $420.w, $43a.w, $51a.w), or even just the first one at $420.w, then jump to the reset vector in $4.w it should do a BIOS cold boot rather than warm boot.

From supervisor mode:

clr.l $420.w
move.l $4.w,a0
jmp (a0)

but without the actual hardware reset line on the 68000 not sure it'll do exactly what you want like pressing reset button would on real hardware.

ijor
Hardware Guru
Hardware Guru
Posts: 3781
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: 'Clean-up' after a warm reset

Postby ijor » Thu Apr 04, 2019 5:04 pm

Zippy wrote:but without the actual hardware reset line on the 68000 not sure it'll do exactly what you want like pressing reset button would on real hardware.


One of the first thing TOS boot code does is to execute the RESET instruction. This instruction does assert the reset signal. At board level it is the same as pressing the hardware button. The only difference is that the CPU itself is not reset. But as long at is not halted, it shouldn't matter.
Fx Cast: Atari St cycle accurate fpga core

Zippy
Captain Atari
Captain Atari
Posts: 185
Joined: Sun Feb 01, 2004 1:58 am

Re: 'Clean-up' after a warm reset

Postby Zippy » Thu Apr 04, 2019 6:12 pm

ijor wrote:One of the first thing TOS boot code does is to execute the RESET instruction. This instruction does assert the reset signal. At board level it is the same as pressing the hardware button.


Yup, but I wasn't sure if the reset button would also reset other hardware chips in addition to the 68000, chips that wouldn't be reset with the 68000 "reset" instruction, if you see what I mean? I never looked at an ST schematic as I never was much of a hardware guy. :) Or did you mean the software "reset" instruction would execute a complete hardware reset from the 68000 using the reset pin as an output?

<edit> Yes I just looked it up in ST Internals, the 68000 reset line is indeed bi-directional... clever! :D But for a software emulator, I guess it depends on the level of emulation of the other hardware chips, how or if the reset line is implemented or how the 68000 "reset" instruction affects them.

joska
Hardware Guru
Hardware Guru
Posts: 4343
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: 'Clean-up' after a warm reset

Postby joska » Fri Apr 05, 2019 7:05 am

This should do it:

Code: Select all

; Reset machine
reset:
   clr.l   -(sp)
   move.w   #$20,-(sp)
   trap   #1
   add.l   #6,sp
   clr.l      $420.w
   move.w   #$2700,sr
   reset
   move.l   #$ffff,d0
_wait:
   dbra      d0,_wait
   move.l   4.w,a0
   jmp      (a0)


This is from my MonSTer tools, it's called when you switch TOS from software. I can't remember why I disable interrupts before the RESET, but I'm sure I did it for a reason :)
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

czietz
Hardware Guru
Hardware Guru
Posts: 918
Joined: Tue May 24, 2016 6:47 pm

Re: 'Clean-up' after a warm reset

Postby czietz » Fri Apr 05, 2019 8:29 am

Although I wonder why you use the RESET instruction after all, given that it's more or less the first thing that TOS will do after you jump to it at the end of the routine. Did you need two hardware resets?

joska
Hardware Guru
Hardware Guru
Posts: 4343
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: 'Clean-up' after a warm reset

Postby joska » Fri Apr 05, 2019 8:32 am

The MonSTer card TOS selection switches are only read on RESET. If I don't reset before jumping to TOS, it will start executing the current TOS but switch to the new TOS after the TOS RESET command.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 2 guests

cron