English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 03 June 2016, 00:27   #1
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
System takeover/shutdown

Hi,

So I am almost finished my first game which is a trackloaded direct hardware game.

But it would seem kids these days like to load stuff from hard drive so I thought I would do a workbench version also. Luckily the way I wrote the game made it fairly easy to get a version up and running.

I changed all of my sections to chip ram using vlink, so the loader just loads everything into chip ram (the trackloaded version runs in 512kb, but the workbench version loads everything so it takes about 650kb of chip ram). The routines that would track load stuff from disk just copies it around in ram in the workbench version.

I wrapped my entry point using Photon's startup code.

I grabbed the workbench message port handling code from Howtocode5.txt.

And everything seems to save/restore pretty well.

So far I have noticed two things:

(1) If I am playing a module before I run the game, it will not be running when I return. A start and stop on the player will get it going again. Not sure if this is normal or I am not restoring something.

(2) If I launch the game from a floppy in workbench, the drive motor doesn't stop. Not sure how to deal with this one. Any ideas ? I know how to turn of the drive motor, it's just that it could be any drive and when launched from HD wouldn't be needed.

Are there any other tests people can suggest to make sure I am cleaning up correctly ?
alpine9000 is offline  
Old 03 June 2016, 00:38   #2
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
Quote:
Originally Posted by alpine9000 View Post
Hi,

So I am almost finished my first game which is a trackloaded direct hardware game.

But it would seem kids these days like to load stuff from hard drive so I thought I would do a workbench version also. Luckily the way I wrote the game made it fairly easy to get a version up and running.

I changed all of my sections to chip ram using vlink, so the loader just loads everything into chip ram (the trackloaded version runs in 512kb, but the workbench version loads everything so it takes about 650kb of chip ram). The routines that would track load stuff from disk just copies it around in ram in the workbench version.

I wrapped my entry point using Photon's startup code.

I grabbed the workbench message port handling code from Howtocode5.txt.

And everything seems to save/restore pretty well.

So far I have noticed two things:

(1) If I am playing a module before I run the game, it will not be running when I return. A start and stop on the player will get it going again. Not sure if this is normal or I am not restoring something.

(2) If I launch the game from a floppy in workbench, the drive motor doesn't stop. Not sure how to deal with this one. Any ideas ? I know how to turn of the drive motor, it's just that it could be any drive and when launched from HD wouldn't be needed.

Are there any other tests people can suggest to make sure I am cleaning up correctly ?
To stop the drive motor, you can either write the relevant bits to the drive motor registers, or, just have a small delay after the last floppy access which gives the drive more time to finish and switch off itself.

Waiting 3 seconds should be enough, obviously the delay should occur before you take over the system.
Galahad/FLT is online now  
Old 03 June 2016, 00:40   #3
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by Galahad/FLT View Post
To stop the drive motor, you can either write the relevant bits to the drive motor registers, or, just have a small delay after the last floppy access which gives the drive more time to finish and switch off itself.

Waiting 3 seconds should be enough, obviously the delay should occur before you take over the system.
Cheers, I guess I was wondering more if I can detect that the app was loaded from a floppy so I know I need to turn it off. I guess this is more of a system programming thing, and I know next to nothing about the OS.
alpine9000 is offline  
Old 03 June 2016, 00:44   #4
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
Quote:
Originally Posted by alpine9000 View Post
Cheers, I guess I was wondering more if I can detect that the app was loaded from a floppy so I know I need to turn it off. I guess this is more of a system programming thing, and I know next to nothing about the OS.
Try this.

lea $bfd100,a5
bset #7,(a5)
bset #6(a5)
bset #5(a5)
bset #4(a5)
bset #3(a5)
bset #3(a5)
Galahad/FLT is online now  
Old 04 June 2016, 18:26   #5
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by Galahad/FLT View Post
Try this.

lea $bfd100,a5
bset #7,(a5)
bset #6(a5)
bset #5(a5)
bset #4(a5)
bset #3(a5)
bset #3(a5)

Why are you setting the #3 bit twice? (typo, or a more important reason?)
Lonewolf10 is offline  
Old 07 June 2016, 09:03   #6
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by alpine9000 View Post
Hi,

And everything seems to save/restore pretty well.

So far I have noticed two things:

(1) If I am playing a module before I run the game, it will not be running when I return. A start and stop on the player will get it going again. Not sure if this is normal or I am not restoring something.
I think I found out what was causing this. I think there might be a small bug in the P6112 player (not 100% sure if I am reading it right or if my configuration is valid). I am running in mode 2 (interrupt mode, non system friendly). So CIA should not be used? So in P1_Init when I changed:

Code:
        ...
        lea $bfd000,a0
        lea P61_timers(pc),a1
        move.b #$7f,$d00(a0)

        ifne p61cia                     ;only affect cia if actually used                                                         
        move.b #$10,$e00(a0)
        endc
	move.b #$10,$f00(a0)
        ...
to:

Code:
        ...
        lea $bfd000,a0
        lea P61_timers(pc),a1

        ifne p61cia                     ;only affect cia if actually used                                                         
        move.b #$7f,$d00(a0)
        move.b #$10,$e00(a0)
        move.b #$10,$f00(a0)
        endc
       ...
My music seems to play fine and if ProTracker is playing a mod before I run my game, it will continue playing after I quit my game.

Unfortunately I haven't spent any serious time looking at how P6112 works so I can't really be sure if this is a legit fix, or just a change that makes it work by fluke?

Anyone have any experience with this ?
alpine9000 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Roadshow Shutdown Issue manic23 support.Apps 21 09 May 2016 15:29
trackdisk.device after system takeover alpine9000 Coders. Asm / Hardware 20 21 March 2016 09:17
startup/system takeover sidewinder Coders. General 15 28 February 2016 16:33
Shutdown Sim085 support.Other 2 26 March 2015 00:29
Virus that stays in memory even after shutdown cosmiq Coders. General 54 01 March 2014 17:27

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:54.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08169 seconds with 15 queries