View difference between Paste ID: t5hPy62e and 1F82dPiP
SHOW: | | - or go back to the newest paste.
1-
; Copia datos a la memoria RAM de la SNES
1+
; Copies data to the SNES RAM
2-
; @entrada	DE: Datos del paquete
2+
; @input    DE: Packet data
3-
; @entrada	HL: Gráficos a copiar por VRAM-transfer
3+
; @input    HL: Graphical data address
4-
; @entrada	[AUXVAR]: Flag que indica si se están copiando datos de tiles 2bpp
4+
; @input    [_AUXVAR]: Flag that indicates if we are copying 2bbp tile data
5
copysnes:
6
    di
7
    push	de
8-
    call	display_off				; Deshabilitamos interrupciones y apagamos el LCD, ya que vamos a modificar la VRAM
8+
    call	display_off				; We disble interruptions and turn off the LCD because we are going to modify the VRAM data
9
    ld		a,	%11100100
10-
    ld		[rBGP],	a				; Paleta asignada a los gráficos a copiar
10+
    ld		[rBGP],	a				; VRAM-transfer background palette value
11
    ld		de,	_VRAM + 2048
12
    ld		a,	[_AUXVAR]
13
    and		a
14
    jr		z,	.copysnes_0
15-
    call	parsesgbbordertiles		; Convierte los gráficos de 2bpp a 4bpp
15+
    call	parsesgbbordertiles		; Turns the 2bpp graphics into 4bpp
16
    jr		.copysnes_1
17
.copysnes_0:
18
    ld		bc,	4096
19-
    call	copymem					; Copiamos en la VRAM los 4KB que van a transferirse a la VRAM de la SNES
19+
    call	copymem					; We copy to the Game Boy VRAM the 4KB data that is going to be transferred to the SNES RAM
20
.copysnes_1:
21-
    ; Copiamos en el fondo visible de _SCRN0 los 4KB de datos que se transmitirán a la SNES por VRAM transfer
21+
    ; We copy to the visible _SCRN0 background the 4KB data that is going to be transferred to the SNES RAM by VRAM-transfer
22
    ld		hl,	_SCRN0
23-
    ld		de,	12					; Ancho adicional del fondo
23+
    ld		de,	12					; Background additional width
24-
    ld		a,	$80					; Dirección en VRAM del primer tile a transferir
24+
    ld		a,	$80					; VRAM address of the first tile
25-
    ld		c,	13					; Filas de datos a copiar
25+
    ld		c,	13					; Rows of data to be copied
26
.copysnes_2:
27-
    ld		b,	20					; Ancho del fondo visible
27+
    ld		b,	20					; Visible background width
28
.copysnes_3:
29-
    ld		[hli],	a				; Asignación del tile nulo
29+
    ld		[hli],	a				; Tile set
30
    inc		a
31
    dec		b
32
    jr		nz,	.copysnes_3
33-
    add		hl,	de					; Siguiente fila de tiles del fondo visible
33+
    add		hl,	de					; Next visible background tile row
34
    dec		c
35
    jr		nz,	.copysnes_2
36
    ld		a,	LCDCF_DEFAULT
37-
    ld		[rLCDC],	a			; Encendemos el LCD para que la transferencia pueda producirse
37+
    ld		[rLCDC],	a			; We turn on the LCD so the transfer can be made
38-
    pop		hl						; Recuperamos la definición del paquete
38+
    pop		hl						; Packet definition
39-
    call	sgbpackettransfer		; Enviamos el paquete que producirá la transferencia
39+
    call	sgbpackettransfer		; We send the packet that will produce the transfer
40
    xor		a
41-
    ld		[rBGP],	a				; Restauramos la paleta de colores del fondo a un valor nulo
41+
    ld		[rBGP],	a				; We restore the background palette
42
    ret
43
44-
; Convierte los gráficos 2bpp apuntados por HL a 4bpp y los almacena en la dirección apuntada por DE
44+
; Turns the 2bbp graphics pointed by HL to 4bpp and stores them in the address pointed by DE
45
parsesgbbordertiles:
46
    ld		b,	128
47
.parsesgbbordertiles_0:
48-
    ; Copiamos los bit planes 1 y 2 de los datos de los tiles
48+
    ; We copy the data of the 1 and 2 bit planes of the tiles
49
    ld		c,	16
50
.parsesgbbordertiles_1:
51
    ld		a,	[hli]
52
    ld		[de],	a
53
    inc		de
54
    dec		c
55
    jr		nz,	.parsesgbbordertiles_1
56-
    ; Los bit planes 3 y 4 se setean a cero
56+
    ; The 3 and 4 bit planes are set to zero
57
    ld		c,	16
58
    xor		a
59
.parsesgbbordertiles_2:
60
    ld		[de],	a
61
    inc		de
62
    dec		c
63
    jr		nz,	.parsesgbbordertiles_2
64
    dec		b
65
    jr		nz,	.parsesgbbordertiles_0
66
    ret