9Fermer11
chickendudeLe 31/01/2013 à 18:02
Je te l'avais écrit la nuit dernière mais la connexion d'internet s'était rompu, donc une version qui fait exactement la même chose que ce que tu utilises maintenant :
;b = # columns
;c = # rows
;d = starting x
;e = starting y
rectangle_filled_xor:
	ld a,$AE			;xor (hl)
	jr rectangle_filled2
rectangle_filled_solid:
	ld a,$B6			;or (hl)
rectangle_filled2:
	push de
	push bc
		ld hl,or_xor
		ld (hl),a			;use smc for xor/solid fill
		ld a,d				;starting x
		and $7				;what bit do we start on?
		ex af,af'
			ld a,d			;starting x
			ld l,e			;ld hl,e
			ld h,0			; ..
			ld d,h			;set d = 0
			add hl,de		;starting y * 12
			add hl,de		;x3
			add hl,hl		;x6
			add hl,hl		;x12
			rra				;a = x coord / 8
			rra				;
			rra				;
			and %00011111	;starting x/8 (starting byte in gbuf)
			ld e,a			;
			add hl,de		;add x
			ld de,gbuf		;
			add hl,de		;hl = offset in gbuf
		ex af,af'
		or a				;clear carry and check if a = 0
		ld e,a
		ld a,%10000000
		 jr z,$+6
			rra
			dec e
			jr nz,$-2
rectangle_loop_y:
		push af				;the rotated bit (pixel) to draw (bit 0-7)
		push bc
		push hl
rectangle_loop_x:
			ld e,a
or_xor = $
			or (hl)			;smc will modify this to or/xor
			ld (hl),a
			ld a,e
			rrca
			 jr nc,$+3
				inc hl
			djnz rectangle_loop_x
		pop hl
		pop bc				;restore b (# columns)
		pop af
		ld de,12
		add hl,de			;move down to next row
		dec c
		 jr nz,rectangle_loop_y
rectangle_end:
	pop bc
	pop de
	ret
C'est pas trop optimisé (quand même plus rapide/petit que ta routine), mais l'idée est là. Pour l'utiliser, on peut faire :
start:
	ld de,$041B
	ld bc,$1103
	call draw_box2
	call ionFastCopy
	bcall _getkey
	ret

draw_box2:
	call rectangle_filled_solid
	inc d
	inc e
	dec b
	dec b
	dec c
	dec c
	call rectangle_filled_xor
	ret


EDIT : Et si tu veux utiliser du SMC dans un APP, tu peux charger ces routines dans RAM. Tu peux aussi rechercher les "metatiles" (c'est pareil à ce que l'on a fait pour la GBA, si tu veux afficher un sprite de 16x16 il faut 4 sprites de 8x8) pour gagner de l'espace. Je crois que la taille de la carte ne va pas être le problème, ça sera plutôt tous les datas/sprites des pokémon. Pour la 83+, je peux t'aider avec les APPs smile

EDIT 2 : Ah, et jettez un coup d'oeuil ici : http://www.omnimaga.org/index.php?topic=9844.0 wink