To: vxp@imaginet.fr ("centek" )
From: dlanor@oden.se (Ronald Andersson)
Organization: Atari
Subject: Re: Full turbo speed for MagiC (solved)
X-Mailer: NEWSie Version 0.94 (Atari)

Dear sirs,

I am sorry I can't direct this reply with certainty to the one who wrote
the mail I am answering, but I believe it was Rodolphe because he signed
an earlier mail on this subject.


>Hello,
>
>The CT2 is gone !!

It arrived here today (Thursday April 8th), and I have installed it again.
I find no visible difference at all.  It still requires a large extra fan
so I can't use original keyboard, and it still fails to boot MagiC 6 in
TOS 7.x mode.


>This conversation has no sense !!
>Ask to people who use CT2 and magic !!!

That's a bit difficult actually, since no one I know around here uses both.
(And I need to see this with my own eyes, to learn how to do it.)


>Think what you want : magic is used here about 10 Hours par days and 7/7
>days !!!!
>And it is on CT2 tos 7 !!!!!!!!

I believe that the MagiC you speak of using in that mode must be some older
version, with different reset routines than MagiC 6 has.


This time I insist that you take me seriously, which you didn't before.
I do not _guess_ at the reason for the failure, because I _know_ it.
The definite proof of that follows below in the form of a disassembly of
a small part of the MagiC RESET code.  This now proves the guess I made
earlier concerning MagiC clearing PMMU registers at boot.

Check it out below. Then tell me how TOS 7.x FastRAM mapping can survive.

;----------------------------------------------------------------------------
;disassembly of MagiC 6 RESET code as booted into ST RAM on a Falcon
;----------------------------------------------------------------------------
ROM_head:	;Here starts the OS header (at RAM address $00004C56)
	bra.s	RESET_code		;So jump to ROM_head RESETs machine
	dc.w	0400			;TOS version code = 4.00 for MagiC 6
	dc.l	RESET_code		;->RESET_code  (valid RESET ptr)
	dc.l	ROM_head		;->ROM_head for safety
	dc.l	$0003CC86		;->OS RAM variable end
	dc.l	RESET_code			;->RESET_code  (reserved ptr)
	dc.l	$000277BE		;->OS gem_mpb
	dc.l	$06091998		;OS date in BCD format
	dc.w	$0003			;OS config flags
	dc.w	$24C9			;same OS date in GEMDOS format
	dc.l	$00002992		;->OS pool
	dc.l	$00000C34		;->KBshift byte
	dc.l	$00002E96		;->p_run ptr (active basepage)
	dc.l	$00000000		;reserved
;----------------------------------------------------------------------------
;Here starts the actual RESET code
;----------------------------------------------------------------------------
RESET_code:
	move	#$2700,sr		;disable interrupts
	move 	#$0100,$8606.w		;\/ Reset the
	move 	#$0000,$8606.w		;/\ DMA counter
	cmpi.l	#$FA52235F,$00FA0000	;check for diagnostic cartridge
	bne.s	done_diagnostic		;we're done with it if not found
	lea 	done_diagnostic(pc),a6	;a6 -> return address for cartridge
	jmp 	$00FA0004		;jump to diagnostic cartridge

done_diagnostic:			;diagnostic done (or skipped)
	lea 	ROM_head,a7		;use stack below pseudo ROM area
	lea 	done_init_1(pc),a0	;setup temporary vector using a0
	move.l	a0,$0008.w		;  ''  for bus errors
	move.l	a0,$0010.w		;  ''  for illegal instructions
	move.l	a0,$002C.w		;  ''  for line_F exceptions
;
;The vectors setup above cause ST/STe machines to 'bomb' to done_init_1
;when attempts are made below to access 68030-specific stuff.
;Later tests on SP etc then tell MagiC what kind of machine is active
;
	moveq	#$00,d0			;d0 = 0
	movec	d0,vbr			;clear vector base register
	move.l	#$00000808,d0		;d0 = $808
	movec	d0,cacr			;clear and disable both caches
;
;The next instructions refer to a zero longword at address $9026. (I checked)
;
	pmove	$00009026.l,TC		;clear TC   (Kills TOS 7.x FastRAM ! )
	pmove	$00009026.l,TT0		;clear TT0  (Alters TOS 7.x I/O decode)
	pmove	$00009026.l,TT1		;clear TT1  (no effect on TOS 7.x map)
	frestore $00009026.l		;Init FPU, and test for existence
done_init_1:
;----------------------------------------------------------------------------
;I cut the disassembly here, because the above proves my point.
;----------------------------------------------------------------------------

As you can see from the above, the MagiC 6 init code will destroy acess to
FastRAM as mapped via PMMU in TOS 7.x mode.  If that FastRAM is also where
the above code has been loaded, then the system will lock up completely.

And lockup is exactly what I get when trying to boot MagiC 6 under TOS 7.x.
Coincidence...?  I don't think so !

If you still insist that MagiC 6 runs easily in TOS 7.x mode, then I would
like some proof of it, or clear instructions on exactly how to do it...
It most certainly does not work here.

Please don't get me wrong now.  I LIKE the CT2B despite its shortcomings.
But I do want you to be aware of them, so that there is some chance of
them being fixed at some future time.

