[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Corruption of high TPA

Alan Hourihane píše v Čt 11. 06. 2009 v 15:41 +0100:
> > The crash occurs only when the OS loads the program at some memory 
> > location where there is an invalid read address just after. For example, 
> > at the end of the FastRam (like EmuTOS). I guess that with the right 
> > memory protection parameters, the space just after the TPA is marked as 
> > unreadable, it is probably what happens on my setup.
> This is the same tst.s I compiled before and it works here.

Maybe you just forgot to set its "Load to Alt RAM" flag so you were
testing your videoram.

Please try running the attached executable and post your results.

BTW, it's crashing in plain TOS 4.04 :-) EmuTOS seems to be the only OS
that can run it without crash :) Hopefully FreeMiNT will be the next

Though I am not sure who's going to fix TOS so the MiNTlib will need
some sort of SP adjustment, anyway :-)


	move.l	4(sp),a0	| get basepage
	move.l	4(a0),d0	| get _base->p_hitpa
	and.l	#$fffffffc,d0	| align on lower 4 bytes
	move.l	d0,sp		| this is the new stack
	move.l	d0,d4

	pea	msg
	move.w	#9,-(sp)	| Cconws()
	trap	#1
	addq.l	#6,sp
	move.l	d4,d0
	bsr	printnum
	pea	eol
	move.w	#9,-(sp)
	trap	#1
	addq.l	#6,sp
	move.w	#8,-(sp)	| Cnecin()
	trap	#1
	addq.l	#2,sp

	clr.w	-(sp)		| Pterm0()
	trap	#1

printnum	movem.l	d0-d3/a0-a3,-(sp)
	move.l	d0,d1
	moveq	#7,d2
	lea	.prtend(pc),a0
.prloop	move.l	d1,d0
	asr.l	#4,d1
	and.l	#$0F,d0
	add	#'0',d0
	cmp	#'9',d0
	ble	.pr2
	add	#('A'-'9'-1),d0
.pr2	move.b	d0,-(a0)
	dbf	d2,.prloop
	pea	(a0)
	move	#9,-(sp)
	trap	#1
	addq	#6,sp
	movem.l	(sp)+,d0-d3/a0-a3
	ds.b	8
.prtend	dc.b	0

msg:	dc.b	"Hello! SP=$",0
eol:	dc.b	13,10,0

Attachment: print_sp.tos
Description: Binary data