View Single Post
Old 24 November 2020, 15:06   #27
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,479
Quote:
Originally Posted by redblade View Post
Hi, Ross can you provide some more technical information with your patch please?
Well, if you want to see the ugly code I wrote, no problem

As stated in the previous message I didn't intend to spend too much time on it, so I just dedicated a few minutes of work.
There were much better ways to handle it but I just wanted to make it work on an A500 (512k + 512k).
The problem is that the intro was located and executed at a too low absolute memory location and in many situations the original hunk was overwritten (with bad result at exit..).
So what I do is:
- check that the code is loaded at a lower location than the absolute start point, otherwise I exit with no_mem error;
- use a chip_c section to allow the previous condition
- use a code_bss to reserve upper space for absolute positioning in a pre-allocated space
- launch the intro and exit in peace

Among all the wonderful code I wrote this is a very shitty thing to show you

Code:
	SECTION	intro,code_c

start
	lea	$1c700,a0
	lea	intro(pc),a1
	moveq	#103,d0
	cmpa.l	a1,a0
	blo.b	exit

	move.l	#intro_end-intro,d0
	adda.l	d0,a0
	adda.l	d0,a1
	lsr.l	#3,d0
	subq.w	#1,d0
.cc	move.l	-(a1),-(a0)
	move.l	-(a1),-(a0)
	dbf	d0,.cc
	jsr	(a0)
	moveq	#0,d0

exit
	rts

	cnop	0,8
intro
	incbin	intro.bin

	cnop	0,8
intro_end

	dx.b	125976

	end
ross is offline  
 
Page generated in 0.04374 seconds with 11 queries