Skip to content

Instantly share code, notes, and snippets.

@reidrac
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reidrac/c8c788873806c38dcd62 to your computer and use it in GitHub Desktop.
Save reidrac/c8c788873806c38dcd62 to your computer and use it in GitHub Desktop.
/*
Esto es, por ejemplo, del Ninjajar.
En lugar de usar una variable para acceder a los parámetros,
podéis usar __CALLEE__ call convention de Z88DK.
(esto es de memoria, pero igual hasta va!)
*/
void peta_el_beeper (unsigned char n) {
// Cargar en A el valor de n
asm_int [0] = n;
#asm
ld a, (_asm_int)
call playsfx
#endasm
}
void __CALLEE__ peta_el_beeper(unsigned char n) {
#asm
; uso de y hl porque playsfx machacan su contenido
pop de ; dir retorno
pop hl ; parametro
push de ; restaura retorno
ld a, l ; carga el en A el valor del parametro (n)
call playsfx
#endasm
}
void __FASTCALL__ peta_el_beeper(unsigned char n) {
#asm
ld a, l ; carga el en A el valor del parametro (n)
call playsfx
#endasm
}
/* o incluso, sin peta_el_beeper! renombrando playsfx a _playsfx */
extern __FASTCALL__ playsfx(unsigned char n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment