Welcome, Guest. Please login or register.


Author Topic: How to do a proper soft-reset? (Read 909 times)

Offline ssr86

  • EP user
  • *
  • Posts: 359
  • Country: pl
  • OS:
  • Windows NT 6.2 Windows NT 6.2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
How to do a proper soft-reset?
« on: 2016.July.08. 23:15:11 »
I've noticed another problem with my code this time it's something with the soft-reset.

The reset routine I'm using (copy-pasted from one of available examples):
Code: [Select]
resetRoutine
        di
        ld      sp,0100h
        ld      a,0ffh
        out     (0b2h),a
        ld      c,40h
        exos    0
        ld      a,01h
        out     (0b3h), a
        ld      a,06h
        jp      0c00dh
Installed with:
Code: [Select]
        ld      a,0ffh
        out     (0b2h),a ;system segment to page2
        ld      hl,resetRoutine
        ld      (0bff8h),hl ;store soft reset in EXOS segment

My problem is that in a wip that uses more than 64kb I need to reset the machine at least twice (do a hard-reset?) to make it to the boot screen (after a single reset the machine hangs). Another problem is about the sdcard - with all my wips - after a successful reset I need to manually change the current drive to :f: to autorun the file-explorer. However that is not the case with most of the other software. What am I doing wrong?
After reseting the machine in

Offline Zozosoft

  • EP addict
  • *
  • Posts: 13467
  • Country: hu
  • OS:
  • Unknown Unknown
  • Browser:
  • Opera 9.80 (Opera Mini 7.6.40234) Opera 9.80 (Opera Mini 7.6.40234)
    • View Profile
    • http://enterprise.iko.hu/
Re: How to do a proper soft-reset?
« Reply #1 on: 2016.July.09. 08:36:24 »
Where you run this code? It is needed to be installed on Page0 segment.

Offline ssr86

  • EP user
  • *
  • Posts: 359
  • Country: pl
  • OS:
  • Windows NT 6.2 Windows NT 6.2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: How to do a proper soft-reset?
« Reply #2 on: 2016.July.09. 14:49:46 »
Where you run this code? It is needed to be installed on Page0 segment.
I run it in the startup/loader code - it is installed from code on page0

Offline geco

  • EP addict
  • *
  • Posts: 5421
  • Country: hu
  • OS:
  • Linux / Sony Ericsson SK17iv Linux / Sony Ericsson SK17iv
  • Browser:
  • Safari 4.0 Safari 4.0
    • View Profile
Re: How to do a proper soft-reset?
« Reply #3 on: 2016.July.09. 21:27:06 »
Hm, i can think only for that something writes to that area where soft reset routine resides, because it is on EXOS page0,and everything seems tobe ok. Could you please attach a snapshot?
Or something is overwritten on FF segment, which is necessary for soft reset.

Offline ssr86

  • EP user
  • *
  • Posts: 359
  • Country: pl
  • OS:
  • Windows NT 6.2 Windows NT 6.2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: How to do a proper soft-reset?
« Reply #4 on: 2016.July.10. 01:33:34 »
Or something is overwritten on FF segment, which is necessary for soft reset.
You were right. I changed the reset setup to use page3 to see if maybe my loader doesn't corrupt my page2 which had segment $ff set and after that the reset works well - no problem with getting to the boot screen.

There is still the thing about reseting the current sd drive letter, which can be made to automatically reset to drive f, but my reset routine doesn't do that. What should be added?