src/video/ataricommon/SDL_ataric2p.S
changeset 1086 93207759e065
parent 734 0310bb01091f
child 1312 c9b51268668f
equal deleted inserted replaced
1085:49d154d0c56e 1086:93207759e065
    36 
    36 
    37 	.globl	_SDL_Atari_C2pConvert
    37 	.globl	_SDL_Atari_C2pConvert
    38 	.globl	_SDL_Atari_C2pConvert8
    38 	.globl	_SDL_Atari_C2pConvert8
    39 	.globl	_SDL_Atari_C2pConvert4
    39 	.globl	_SDL_Atari_C2pConvert4
    40 	.globl	_SDL_Atari_C2pConvert4_pal
    40 	.globl	_SDL_Atari_C2pConvert4_pal
    41 	.globl	_SDL_Atari_table_c2p
       
    42 
    41 
    43 /* ------------	Conversion C2P, 8 bits ------------ */
    42 /* ------------	Conversion C2P, 8 bits ------------ */
    44 
    43 
    45 	.text
    44 	.text
    46 _SDL_Atari_C2pConvert8:
    45 _SDL_Atari_C2pConvert8:
   245 	movel	d2,a5
   244 	movel	d2,a5
   246 	movel	d1,a4
   245 	movel	d1,a4
   247 	movel	d3,a3
   246 	movel	d3,a3
   248 
   247 
   249 	cmpl	a0,a2
   248 	cmpl	a0,a2
   250 	bgt	SDL_Atari_C2p8_pix16
   249 	bgt		SDL_Atari_C2p8_pix16
   251 
   250 
   252 	movel	a3,a1@+
   251 	movel	a3,a1@+
   253 	movel	a4,a1@+
   252 	movel	a4,a1@+
   254 	movel	a5,a1@+
   253 	movel	a5,a1@+
   255 	movel	a6,a1@+
   254 	movel	a6,a1@+
   284 
   283 
   285 	addl	d0,c2p_cursrc
   284 	addl	d0,c2p_cursrc
   286 	addl	d1,c2p_curdst
   285 	addl	d1,c2p_curdst
   287 
   286 
   288 	subqw	#1,c2p_row
   287 	subqw	#1,c2p_row
   289 	bne	SDL_Atari_C2p8_rowloop	
   288 	bne		SDL_Atari_C2p8_rowloop	
   290 
   289 
   291 	moveml	sp@+,d2-d7/a2-a6
   290 	moveml	sp@+,d2-d7/a2-a6
   292 	rts
   291 	rts
   293 
   292 
   294 /* ------------	Conversion C2P, 4 bits ------------ */
   293 /* ------------	Conversion C2P, 4 bits ------------ */
   329 	moveq	#0,d1
   328 	moveq	#0,d1
   330 	moveq	#7,d5
   329 	moveq	#7,d5
   331 c2p4_bcl07:
   330 c2p4_bcl07:
   332 #if defined(__M68020__)
   331 #if defined(__M68020__)
   333 	moveb	a0@+,d0
   332 	moveb	a0@+,d0
   334 	lea	a2@(0,d0:w:4),a3
   333 	lea		a2@(0,d0:w:4),a3
   335 #else
   334 #else
   336 	moveq	#0,d0
   335 	moveq	#0,d0
   337 	moveb	a0@+,d0
   336 	moveb	a0@+,d0
   338 	lslw	#2,d0
   337 	lslw	#2,d0
   339 	lea	a2@(0,d0:w),a3
   338 	lea		a2@(0,d0:w),a3
   340 #endif
   339 #endif
   341 	lsll	#1,d1
   340 	lsll	#1,d1
   342 	orl	a3@,d1
   341 	orl		a3@,d1
   343 	dbra	d5,c2p4_bcl07
   342 	dbra	d5,c2p4_bcl07
   344 
   343 
   345 	movepl	d1,a1@(0)
   344 	movepl	d1,a1@(0)
   346 	addw	d3,a1
   345 	addw	d3,a1
   347 	swap	d3
   346 	swap	d3
   351 	moveq	#0,d1
   350 	moveq	#0,d1
   352 	moveq	#7,d5
   351 	moveq	#7,d5
   353 c2p4_bcl815:
   352 c2p4_bcl815:
   354 #if defined(__M68020__)
   353 #if defined(__M68020__)
   355 	moveb	a0@+,d0
   354 	moveb	a0@+,d0
   356 	lea	a2@(0,d0:w:4),a3
   355 	lea		a2@(0,d0:w:4),a3
   357 #else
   356 #else
   358 	moveq	#0,d0
   357 	moveq	#0,d0
   359 	moveb	a0@+,d0
   358 	moveb	a0@+,d0
   360 	lslw	#2,d0
   359 	lslw	#2,d0
   361 	lea	a2@(0,d0:w),a3
   360 	lea		a2@(0,d0:w),a3
   362 #endif
   361 #endif
   363 	lsll	#1,d1
   362 	lsll	#1,d1
   364 	orl	a3@,d1
   363 	orl		a3@,d1
   365 	dbra	d5,c2p4_bcl815
   364 	dbra	d5,c2p4_bcl815
   366 
   365 
   367 	movepl	d1,a1@(0)
   366 	movepl	d1,a1@(0)
   368 	addw	d3,a1
   367 	addw	d3,a1
   369 	swap	d3
   368 	swap	d3
   371 	dbra	d6,c2p4_bclx
   370 	dbra	d6,c2p4_bclx
   372 
   371 
   373 	| Double line ?
   372 	| Double line ?
   374 
   373 
   375 	tstl	c2p_dblligne
   374 	tstl	c2p_dblligne
   376 	beq	c2p4_nodblligne
   375 	beqs	c2p4_nodblligne
   377 
   376 
   378 	movel	a5,a6			| src line
   377 	movel	a5,a6			| src line
   379 	movel	a5,a1			| dest line
   378 	movel	a5,a1			| dest line
   380 	addl	c2p_dstpitch,a1
   379 	addl	c2p_dstpitch,a1
   381 
   380 
   407 	/* a0 is a 256-word light palette */
   406 	/* a0 is a 256-word light palette */
   408 	movel	sp@(4),a0
   407 	movel	sp@(4),a0
   409 
   408 
   410 	moveml	d2-d3,sp@-
   409 	moveml	d2-d3,sp@-
   411 
   410 
   412 	lea	_SDL_Atari_table_c2p,a1
   411 	lea		_SDL_Atari_table_c2p,a1
   413 	movew	#255,d3
   412 	movew	#255,d3
   414 c2p_pal_initbcl:
   413 c2p_pal_initbcl:
   415 	movew	a0@+,d0
   414 	movew	a0@+,d0
   416 	lsrw	#4,d0
   415 	lsrw	#4,d0
   417 	and	#15,d0
   416 	andw	#15,d0
   418 
   417 
   419 	moveq	#3,d1
   418 	moveq	#3,d1
   420 c2p_pal_initbyte:
   419 c2p_pal_initbyte:
   421 	btst	d1,d0
   420 	btst	d1,d0
   422 	sne	d2
   421 	sne		d2
   423 	negw	d2
   422 	negw	d2
   424 	moveb	d2,a1@(0,d1:w)
   423 	moveb	d2,a1@(0,d1:w)
   425 
   424 
   426 	dbra	d1,c2p_pal_initbyte
   425 	dbra	d1,c2p_pal_initbyte
   427 
   426 
   432 
   431 
   433 	rts
   432 	rts
   434 
   433 
   435 /* ------------	Buffers ------------ */
   434 /* ------------	Buffers ------------ */
   436 
   435 
   437 	.data
   436 	.bss
   438 
   437 
   439 	.even
   438 	.even
   440 	.comm	_SDL_Atari_C2pConvert,4
   439 	.comm	_SDL_Atari_C2pConvert,4
   441 	.comm	_SDL_Atari_table_c2p,2048
   440 	.comm	_SDL_Atari_table_c2p,1024
   442 
   441 
   443 	.comm	c2p_source,4	/* Source framebuffer */
   442 	.comm	c2p_source,4	/* Source framebuffer */
   444 	.comm	c2p_dest,4	/* Destination framebuffer */
   443 	.comm	c2p_dest,4		/* Destination framebuffer */
   445 	.comm	c2p_width,4	/* Width of zone to convert */
   444 	.comm	c2p_width,4		/* Width of zone to convert */
   446 	.comm	c2p_height,4	/* Height of zone to convert */
   445 	.comm	c2p_height,4	/* Height of zone to convert */
   447 	.comm	c2p_dblligne,4	/* Double the lines while converting ? */
   446 	.comm	c2p_dblligne,4	/* Double the lines while converting ? */
   448 	.comm	c2p_srcpitch,4	/* Source pitch */
   447 	.comm	c2p_srcpitch,4	/* Source pitch */
   449 	.comm	c2p_dstpitch,4	/* Destination pitch */
   448 	.comm	c2p_dstpitch,4	/* Destination pitch */
   450 	.comm	c2p_cursrc,4	/* Current source line */
   449 	.comm	c2p_cursrc,4	/* Current source line */
   451 	.comm	c2p_curdst,4	/* Current destination line */
   450 	.comm	c2p_curdst,4	/* Current destination line */
   452 	.comm	c2p_rowlen,2	/* Line length in bytes */
   451 	.comm	c2p_rowlen,2	/* Line length in bytes */
   453 	.comm	c2p_row,2	/* Current line number */
   452 	.comm	c2p_row,2		/* Current line number */