English Amiga Board


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

 
 
Thread Tools
Old 07 December 2014, 12:52   #1
jimmy2x2x
Beyond Mutton
jimmy2x2x's Avatar
 
Join Date: Mar 2011
Location: North West, UK
Age: 46
Posts: 347
Reading / writing files and the keyboard

I've just pulled an all-nighter getting my little side project together (love dungeon - it's in the zone) and I'm missing a couple of elements, how to read the keyboard, specifically the esc key and how to read and write files (I want to load and save scores) I only have mobile phone internet until the bband connects on the 18th, so I'm a bit limited at the moment.

I've also had a couple of bug reports regarding 3 things.

1. The mode pointer doesn't appear after exciting the game (think this might be dma related, although I can't reproduce this under emulation)

2. RTC pauses for the duration of the game, no idea on this, but really looked much yet.

3. This is most concerning, apparently the floppy motor keeps spinning when the game is booted from floppy, would really like to sort this one asap. Years ago I had a version of pipe mania that did this and it burned out my drive!

I'm still hacking away at the blitter code, but I want to finish off love dungeon properly first before getting too involved.

Again, any help is very much appreciated.
jimmy2x2x is offline  
AdSense AdSense  
Old 07 December 2014, 20:15   #2
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,019
Quote:
Originally Posted by jimmy2x2x View Post
how to read the keyboard,
Basically you want to install a level 2 interrupt handler, check the SP interrupt flag and read the next key code from the CIA's SDR register. The handshaking is important!
I hate to mention the public Solid Gold source on Aminet. But it's a good reference for most things you will ever need in Amiga game development. The keyboard handler is in input.asm.

Quote:
how to read and write files (I want to load and save scores)
First you have to decide whether your game will take over the system completely or not. When you kill the OS then you have to write the disk routines yourself. Keeping multitasking alive gives you the option to load from and write to any device (and you would also rather install an OS compliant keyboard handler).

IMHO this is a general decision: either take over everything and say good bye to the OS forever, or follow the rules of AmigaOS and use the system calls. Everything in between is an ugly hack, which makes me shudder.

If you want to go the ugly, hackish way, then I remember there are articles in this forum how to wake up parts of the OS to do a disk access.

When you take over the hardware, then there are complete trackdisk read/write/format routines in SolidGold/trackdisk.asm. But your game will be limited to floppy disks, as you certainly don't want to write drivers for the various IDE and SCSI hardware.


Quote:
1. The mode pointer doesn't appear after exciting the game (think this might be dma related, although I can't reproduce this under emulation)
With a good startup/cleanup code it shouldn't happen. On a standard hires native screen?

Quote:
2. RTC pauses for the duration of the game, no idea on this, but really looked much yet.
The RTC or the CIA timer? AFAIK both should continue running, even when all interrupts are disabled. They can be stopped by writing into their registers. An RTC is located at $dc0000 or $d80000. The OS uses the CIA-A TOD as clock, so a write-access to $bfe801, $bfe901 or $bfea01 would stop it.


Quote:
3. This is most concerning, apparently the floppy motor keeps spinning when the game is booted from floppy, would really like to sort this one asap. Years ago I had a version of pipe mania that did this and it burned out my drive!
Either use CIAB port B ($bfd100) to turn the motor off, or wait a second when starting the game, before disabling interrupts.
phx is offline  
Old 07 December 2014, 20:28   #3
jimmy2x2x
Beyond Mutton
jimmy2x2x's Avatar
 
Join Date: Mar 2011
Location: North West, UK
Age: 46
Posts: 347
Thanks so much for a very comprehensive reply, just a quick general question regarding disk activity. I was thinking, read the file at game start, before I take the system and write it after I return the system but before exiting the program, would this work OK to use library calls in this situation?
jimmy2x2x is offline  
Old 07 December 2014, 20:58   #4
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,019
Yes. When you don't need any disk access while the game is running, then this is a very good solution.
phx is offline  
AdSense AdSense  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading files from current directory in assembly hukka Coders. System 27 14 June 2014 00:40
LS-120: writing/reading Amiga diskettes? Pfloyd Amiga scene 7 26 July 2008 23:15
ADF/IPF reading/writing on a PC? cappuchok support.Hardware 19 03 October 2006 06:45
Writing AVI BippyM support.WinUAE 16 21 May 2005 00:43

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 18:39.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.11883 seconds with 12 queries