English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 11 November 2018, 15:49   #1
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
CIA-A DDRA fixed I/O bits direction

Another thread where I was undecided whether to write in support.WinUAE or in the Coders.Asm/Hardware section.

This time this section won

I'm debugging an old game, that only work in KS1.x and only in some configurations, in an attempt to patch it (a not so simple job).
A game from 1987/88 that mix system code and hardware banging.
It use system to open multiple screens then mess with copper list to switch between them..
If you drag the main screen, after a while, game crash.

Original programmer, in an attempt to prevent this, used a strange method:
Code:
	move.b	#$43,($BFE201)
So DDRA(/FIR0) as an output.

WinUAE take /FIR0 as usual and screen dragging is permitted (and crash).
How a real machine behave?
Is the left mouse button really inhibited in this way or is it the programmer who's completely wrong?

Thanks.
ross is offline  
Old 11 November 2018, 16:35   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,507
If fire/mouse left button is output and data is high: button press will pull it down and reading pin state returns zero. When not pressed, it returns back programmed state. (IO pin is designed to work this way, there is no danger of damage.)

But there is at least one known CIA variant (that did not exists in 1987/88) where data register written value is always returned if output=1 when register is read. Actual pin state is ignored.

So there is possibility there are other CIAs with same "feature".

Does the game work if you tick advanced chipset "CIA 391078-01" checkbox?
Toni Wilen is offline  
Old 11 November 2018, 16:39   #3
aros-sg
Registered User
 
Join Date: Nov 2015
Location: Italy
Posts: 191
Bone Cruncher?
aros-sg is offline  
Old 11 November 2018, 17:22   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by Toni Wilen View Post
Does the game work if you tick advanced chipset "CIA 391078-01" checkbox?
Yes, it works!

Thanks for the detailed information.
So a CIA variant existed 1987/88


Quote:
Originally Posted by aros-sg View Post
Bone Cruncher?
Yep
ross is offline  
Old 11 November 2018, 17:31   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,507
Same variant can't exist in 87/88 because it is SMD chip, first used in A600.

Also HRM says reading IO port will always return current state of pin, regardless of data direction.

Need to do some more tests..

391078-01 8520 has the "bug". 391078-02 8520 again works as documented (some A1200s and A4000s have -01, some -02). Perhaps there are also DIP 8520s that have same "bug".

EDIT: "original" discussion: http://eab.abime.net/showthread.php?t=88434

Last edited by Toni Wilen; 11 November 2018 at 17:45.
Toni Wilen is offline  
Old 11 November 2018, 17:56   #6
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
HOL report as a 1988 game: http://hol.abime.net/182

But inside main executable there is (c) 1987 and the game intro is dated november 1987.
No evidence for the main exe because no original available.
Anyway probably programmed between these years.

There is a write to $bfe201 at start and then only a few read from $bfe001.

Yes, so it seems that in fact there are some DIP 8520s that have same bug.

Quote:
Originally Posted by Toni Wilen View Post
EDIT: "original" discussion: http://eab.abime.net/showthread.php?t=88434
Thanks for the link, very interesting.
ross is offline  
Old 13 November 2018, 20:02   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,507
I tested my A1000 and unexpectedly it has "buggy" CIA! (I thought it was SMD bug only so I didn't do any DIP CIA tests previously..)

MOS 8520A-1 0786 S

Different later DIP CIAs from A500s (all not buggy):

CSG 8520A-1 2991.

CSG 318029-03 8520PD 4291 24

CSG 8520 A-1 0391 24

CSG 8520A-1 0590 24

Still to test: 89 dated 8520.

So apparently early CIAs are also "buggy", later ones work as documented, then for some reason first SMD CIAs have same bug. Perhaps they accidentally based it on original design?

Test program is linked in above linked thread. (press joystick button, check output: **** **** = ok, **-* **-* = "bug")

EDIT: Even the very first HRM (1985) mentions that CIA IO pins always reads pin state, regardless of data direction.

Last edited by Toni Wilen; 13 November 2018 at 20:16.
Toni Wilen 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
A500 joystick direction stuck Amiga1992 support.Hardware 34 01 June 2021 22:25
example of a CIA timer interrupt in assembler using cia.resource Apollo Coders. Asm / Hardware 3 05 July 2013 08:40
A point in the right direction... vroom6sri New to Emulation or Amiga scene 15 26 November 2010 21:40
New and need a point in the right direction robjbray Amiga scene 1 23 December 2007 12:19
[Fixed] Couple of bits of info for HOL [idoru] HOL contributions 2 17 January 2003 15:26

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 22:44.

Top

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