English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 01 November 2020, 21:48   #21
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
Quote:
Originally Posted by BastyCDGS View Post
How does, e.g. WHDLoad do it with MMU snoop options enabled?
On Snoop the custom/cia memory is declared write-protected, on SnoopOCS/ECS/AGA invalid.
All work is then done in the exception handler which differs for 68030, 68040 and 68060. The access is validated regarding size (b/w/l), type of custom register (read-only, write-only, strobe) and several special checks (blitter, copper, ...). Valid writes are saved internally and performed. Valid reads are performed.

68030: all data is contained in the exception stackframe, whdload uses a transparent translation and moveS to write the original data (works only on boards where a usable FC is available, this avoids to change the mmu setup

68040: Write data is contained in the exception stackframe. On writes mmu setup is adapted, data written and mmu setup restored. On reads mmu setup is adapted, instruction executed in trace mode and after mmu setup restored. Special handling for movem with full ea decoder.

68060: No read/write data in the stackframe. On reads adapt mmu, execute in trace mode and restore mmu. On writes adapt MMU, execute in trace mode to save the written data to the internal memory, adapt mmu, execute the same instruction a second time to write the data to the original location, restore mmu.
Wepl is offline  
Old 03 November 2022, 11:05   #22
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,170
is there some available 68k source that emulates blitter from cpu?

WinUAE of course does that, but something simpler maybe? asm or C? which could take blitter registers in input can write data the way the blitter does?

I'm interested in replicating some polygon fill code found in Killing Cloud.

Code:
	; mode: 0000 0111 1100 1010
	; - no shifting
	; - use b,c,d
	; - LF7 LF6 on, LF5, LF4 off
	; - LF3 LF1 on, FCI & LINE off
	MOVE.W	#$07ca,bltcon0(A5)		;0d20c: 3b7c07ca0040
	MOVE.W	#$0000,bltcon1(A5)		;0d212: 3b7c00000042
	MOVE.W	#$ffff,bltadat(A5)		;0d218: 3b7cffff0074
	TST.B	16(A0)			;0d21e: 4a280010
	BNE.W	lb_0d29c		;0d222: 66000078
	MOVEA.L	18(A0),A2		;0d226: 24680012
	MOVEA.L	22(A0),A3		;0d22a: 26680016
lb_0d22e:
	MOVE.W	(A2)+,D2		;0d22e: 341a
	MOVE.W	(A3)+,D3		;0d230: 361b
	MOVEQ	#-16,D4			;0d232: 78f0
	MOVE.W	D2,D1			;0d234: 3202
	AND.W	D4,D2			;0d236: c444
	AND.W	D3,D4			;0d238: c843
	EOR.W	D2,D1			;0d23a: b541
	EOR.W	D4,D3			;0d23c: b943
	SUB.W	D2,D4			;0d23e: 9842
	BLT.S	lb_0d290		;0d240: 6d4e
	MOVEA.L	A1,A0			;0d242: 2049
	LSR.W	#3,D2			;0d244: e64a
	ADDA.W	D2,A0			;0d246: d0c2
	LSR.W	#4,D4			;0d248: e84c
	ADDQ.W	#1,D4			;0d24a: 5244
	MOVEQ	#20,D0			;0d24c: 7014
	SUB.W	D4,D0			;0d24e: 9044
	ADD.W	D0,D0			;0d250: d040
	ORI.W	#$0100,D4		;0d252: 00440100
	ADD.W	D3,D3			;0d256: d643
	ADD.W	D1,D1			;0d258: d241
	BTST	#6,sd_ctl(A5)		;0d25a: 082d00060002
lb_0d260:
	BTST	#6,sd_ctl(A5)		;0d260: 082d00060002
	BNE.S	lb_0d260		;0d266: 66f8
	MOVE.W	0(A6,D1.W),bltafwm(A5)	;0d268: 3b7610000044
	MOVE.W	32(A6,D3.W),bltalwm(A5)	;0d26e: 3b7630200046
	MOVE.L	A4,bltbpt(A5)		;0d274: 2b4c004c
	MOVE.L	A0,bltcpt(A5)		;0d278: 2b480048
	MOVE.L	A0,bltdpt(A5)		;0d27c: 2b480054
	MOVE.W	D0,bltbmod(A5)		;0d280: 3b400062
	MOVE.W	D0,bltcmod(A5)		;0d284: 3b400060
	MOVE.W	D0,bltdmod(A5)		;0d288: 3b400066
	; main blit of most 3D (filled polygons)
	; without that write, only cockpit and bitmaps are displayed
	; nothing is filled or erased,
	; only lines appear on the display
	MOVE.W	D4,bltsize(A5)		;0d28c: 3b440058 blit (in-game)
lb_0d290:
	LEA	-160(A1),A1		;0d290: 43e9ff60
	DBF	D5,lb_0d22e		;0d294: 51cdff98
jotd is offline  
Old 03 November 2022, 17:21   #23
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by jotd View Post
I'm interested in replicating some polygon fill code found in Killing Cloud.
It doesn't seem like a polygon filling routine to me, at least not in the usual ways and terms.

What it seems to do is extract a series of columns (of constant height and variable width) from the source 'bitmap' and insert it into the destination bitmap.
Basically a limited cookie-cut blit where the mask is fixed and 'trimmed'.

So it would be more appropriate to designate it as a 'columns renderer'.
Of course I'm not fully sure of it, you should check the main code flow to be sure
ross is offline  
Old 03 November 2022, 18:37   #24
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
For prototyping simple area blits I use the attached C++ code. Should be easy enough to turn into C or asm if you need to. It's not optimized in any way, doesn't handle line/fill modes and probably has issues with some corner cases.
Attached Files
File Type: zip blitter.zip (2.1 KB, 38 views)
paraj is offline  
Old 03 November 2022, 22:36   #25
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,170
that looks neat and exactly what I'm looking for! I think I'll have to convert it to C to be able to link to asm easily for a test. Shouldn't be a problem.
jotd 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
When is the 68k processor faster then the blitter at copying memory redblade Coders. Asm / Hardware 20 08 May 2019 22:57
Fake86 (68k SDL Port) - 8086 PC emulator NovaCoder project.Amiga Game Factory 5 08 November 2018 11:13
Hatari ST emulator for 68K? Angus request.Apps 14 25 September 2013 20:31
amiga 68k emulator petee1979 support.OtherUAE 11 28 June 2008 10:07
68k Mega Drive Emulator Hewitson request.Apps 11 04 February 2008 08:55

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 13:34.

Top

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