Page 2 of 4

Posted: Sun Jan 25, 2009 12:18 am
by Graz
Jorge Nuno wrote:I'm not :wink: It's that I only do DMA copies in VBlank. And clearing register $81 should disable all kinds of DMA, unless there is some obscure bug.
I see. I saw
Jorge Nuno wrote: Well the code is started with a move #$2700 to sr, so that accidental dma is not started.
and was quite puzzled. :D

Posted: Sun Jan 25, 2009 12:43 am
by Jorge Nuno
True. That phrase could be better written.

What to do/check when the code locks? Maybe I missed some procedure... (This sucks... Regen runs this even with "EmulateLockups=1")

I have uploaded (again) after fixing everything I could remember, I hope it works this time. I'd like that it work on the real machine before going on with it :)

Posted: Sun Jan 25, 2009 1:44 am
by TascoDLX
I'm not going very deep here but...

Code: Select all

00022A: move.b $A11001,d0
except the version register is at $A10001, right?

Also...

Code: Select all

00028E: movem (a6),d0-7/a0-6
This was copied from the original ip and it won't work the same here -- at this point, a6 points to ROM not RAM. It will put garbage data in all the registers. But you can probably remove the instruction since your code doesn't assume that the registers are clear anyway.

And the word at $000302 [$8F01] should be $8F02 in order for the initial CRAM and VSRAM clears to work correctly.

Posted: Sun Jan 25, 2009 2:09 am
by Jorge Nuno
TascoDLX wrote:I'm not going very deep here but...

Code: Select all

00022A: move.b $A11001,d0
except the version register is at $A10001, right?
Yep! Thanks for the notice. 8)
TascoDLX wrote: Also...

Code: Select all

00028E: movem (a6),d0-7/a0-6
This was copied from the original ip and it won't work the same here -- at this point, a6 points to ROM not RAM. It will put garbage data in all the registers. But you can probably remove the instruction since your code doesn't assume that the registers are clear anyway.
Yeah that code was almost just pasted in there, I don't care much what it does.

Now I clear them all manually, just in case.
TascoDLX wrote: And the word at $000302 [$8F01] should be $8F02 in order for the initial CRAM and VSRAM clears to work correctly.
Done.
Reupped again.

Posted: Sun Jan 25, 2009 10:08 pm
by TmEE co.(TM)

Posted: Sun Jan 25, 2009 11:15 pm
by Jorge Nuno
Done and reupped... I really hope it runs this time, it's getting frustrating...

Posted: Mon Jan 26, 2009 3:18 am
by HardWareMan
I use standard hardware init code, it written as linear algorythm and use it as "include" at start of program.

Code: Select all

*Hardware init
	move.l	sp,a7
	move.w	#$2700,sr
	tst.l	$a10008.l
	bne.s	SkipJoyDetect
	tst.w	$a1000c.l
SkipJoyDetect:
	Bne	SkipTable
	lea	Table(pc),a5                      *
	movem.w	(a5)+,d5-d7              *
	movem.l	(a5)+,a0-a4              *
	move.b	-$10ff(a1),d0		*Version number
	andi.b	#$0f,d0
	beq.s	WrongVersion
	move.l	#$53454741,$2f00(a1)	*Security code (SEGA)
WrongVersion:
	move.w	(a4),d0
	moveq	#$00,d0
	movea.l	d0,a6
	move	a6,usp
	moveq	#$17,d1			*VDP register setup
FillLoop:
	move.b	(a5)+,d5
	move.w	d5,(a4)
	add.w	d7,d5
	dbra	d1,FillLoop
	move.l	(a5)+,(a4)
	move.w	d0,(a3)
	move.w	d7,(a1)
	move.w	d7,(a2)
L0250:	btst	d0,(a1)
	bne.s	L0250
	moveq	#$25,d2			*Init A00000
Filla:	move.b	(a5)+,(a0)+
	dbra	d2,Filla
	move.w	d0,(a2)
	move.w	d0,(a1)
	move.w	d7,(a2)
L0262:	move.l	d0,-(a6)		*Erase RAM
	dbra	d6,L0262
	move.l	(a5)+,(a4)
	move.l	(a5)+,(a4)
	moveq	#$1f,d3			*Init C00000
Filc0:	move.l	d0,(a3)
	dbra	d3,Filc0
	move.l	(a5)+,(a4)
	moveq	#$13,d4			*Init C00000
Fillc1:	move.l	d0,(a3)
	dbra	d4,Fillc1
	moveq	#$03,d5			*Init C00011
Fillc2:	move.b	(a5)+,$0011(a3)
	dbra	d5,Fillc2
	move.w	d0,(a2)
	movem.l	(a6),d0-d7/a0-a6
	move	#$2700,sr
	tst.w	$00C00004
	jmp	SkipTable
Table:	dc.w	$8000,$3fff,$0100,$00a0,$0000,$00a1,$1100,$00a1
	dc.w	$1200,$00c0,$0000,$00c0,$0004,$0414,$302c,$0754
	dc.w	$0000,$0000,$0000,$812b,$0001,$0100,$00ff,$ff00
	dc.w	$0080,$4000,$0080,$af01,$d91f,$1127,$0021,$2600
	dc.w	$f977,$edb0,$dde1,$fde1,$ed47,$ed4f,$d1e1,$f108
	dc.w	$d9c1,$d1e1,$f1f9,$f3ed,$5636,$e9e9,$8104,$8f01
	dc.w	$c000,$0000,$4000,$0010,$9fbf,$dfff
SkipTable:
I believe this 3 lines can be placed after "WrongVersion" label, but maybe VDP hardware required some delay after startup?

Code: Select all

	lea	Table(pc),a5                      *
	movem.w	(a5)+,d5-d7              *
	movem.l	(a5)+,a0-a4              *

Posted: Mon Jan 26, 2009 3:26 am
by Jorge Nuno
I have that piece of code in my prog (a bit modified), too, in fact it was you who gave me it, some months ago.

Posted: Mon Jan 26, 2009 6:15 am
by HardWareMan
Jorge Nuno wrote:I have that piece of code in my prog (a bit modified), too, in fact it was you who gave me it, some months ago.
Heh. I must be forget this. %)

Posted: Mon Jan 26, 2009 7:55 pm
by TmEE co.(TM)
This stuff still does not want to work....

Posted: Mon Jan 26, 2009 8:08 pm
by Jorge Nuno
Bah! :? :shock: :(

Is DTACK high?

Posted: Tue Jan 27, 2009 3:49 am
by HardWareMan
Jorge Nuno wrote:Bah! :? :shock: :(
Is DTACK high?
You do some access to restricted area? Why?

Posted: Tue Jan 27, 2009 3:56 am
by Jorge Nuno
Hopefully not! That's why I was asking.

Posted: Tue Jan 27, 2009 8:16 am
by TascoDLX
Don't know if it makes a difference but your RAM check routine is writing to ROM area. (deja vu? :wink:)

Code: Select all

0004A6 LEA $E00000,a0
0004AC MOVE #$00000801,d1 
@loop:
0004B2 ADDA #$00000400,a0
0004B8 CMPA #$01000000,a0
0004BE MOVE.W d1,(a0)
0004C0 SUBQ #1,d1
0004C2 BNE @loop
It writes #$0002 to $000000 and #$0001 to $000400.

And it seems to detect an extra 1024 bytes.

You might want to fix that.

Posted: Tue Jan 27, 2009 12:08 pm
by Jorge Nuno
Yup! the CMPA #$01000000 was just before the BNE, but it was leaking a word into $0, so I moved the CMPA before the write, but forgot to fix the branch! Thanks. :D

EDIT
The problem is probably in somewhere else... :(

Also my program doesn't run properly in Nemesis's Exodus... Don't know if it's my fault or not, it runs fine in Fusion/Gens/Regen.


Reupped :shock: