Giter VIP home page Giter VIP logo

Comments (8)

BenoitAdam94 avatar BenoitAdam94 commented on May 26, 2024 1

Ok I fixed it : I Included EVERY files :

#include "tileset.h"
#include "tileset.c"
#include "tilemap.h"
#include "tilemap.c"

Also, I still don't know why, I got an added tile on the right of the image. :

https://imgur.com/a/gtQrBi3

from img2gb.

flozz avatar flozz commented on May 26, 2024

Bonjour,

Il ne s'agit pas tout à fait du bon endroit pour poser votre question car elle ne concerne pas le logiciel img2gb... mais c'est vrai que j'avais pas prévu qu'on essayerais de me contacter ^^'

Si je regarde la commande que vous décrivez, il semble manquer 2 fichiers .rel (probablement tileset.rel et tilemap.rel)., ce qui explique les références manquantes.

  1. Essayez-vous de compiler l'exemple de l'article ou votre propre programme ?
  2. Vous entrez les commandes à la main ou vous utilisez les fichiers .bat fournits ?
  3. Quelle version de Windows utilisez-vous ?

Je n'ai pas de système Windows sous la main ce soir donc je vais pas pouvoir tester quoi que ce soit, mais j'essayerais de regarder ça demain du coup :)

from img2gb.

BenoitAdam94 avatar BenoitAdam94 commented on May 26, 2024

désolé je n'ai pas l'habitude de github...

Je ne vois aucune mention de fichier rel nul part ?

Voici le code CMD complet :

L:\LOGICIELS\Devellopement\gameboy>gbdk-n-master\bin\gbdk-n-compile.bat hello.c
L:\LOGICIELS\Devellopement\gameboy>set GBDK_DIR=L:\LOGICIELS\Devellopement\gameboy\gbdk-n-master\bin\..
L:\LOGICIELS\Devellopement\gameboy>sdcc -mgbz80 --no-std-crt0 -I "L:\LOGICIELS\Devellopement\gameboy\gbdk-n-master\bin\..\include" -I "L:\LOGICIELS\Devellopement\gameboy\gbdk-n-master\bin\..\include\asm" -c hello.c
L:\LOGICIELS\Devellopement\gameboy>02linkhello.bat
L:\LOGICIELS\Devellopement\gameboy>gbdk-n-master\bin\gbdk-n-link.bat hello.rel -o hello.ihx
L:\LOGICIELS\Devellopement\gameboy>set GBDK_DIR=L:\LOGICIELS\Devellopement\gameboy\gbdk-n-master\bin\..
L:\LOGICIELS\Devellopement\gameboy>sdcc -mgbz80 --no-std-crt0 --data-loc 0xc0a0 -L "L:\LOGICIELS\Devellopement\gameboy\gbdk-n-master\bin\..\lib" "L:\LOGICIELS\Devellopement\gameboy\gbdk-n-master\bin\..\lib\crt0.rel" gb.lib -o a.ihx hello.rel -o hello.ihx
?ASlink-Warning-Undefined Global '_TILEMAP' referenced by module 'hello'
?ASlink-Warning-Undefined Global '_TILESET' referenced by module 'hello'

L:\LOGICIELS\Devellopement\gameboy>

De toute façon la solution au dessus marche (on a répondu en même temps)... a part ce tile supplémentaire qui s'ajoute

1/ L'exemple situé dans \img2gb-master\example
2/ j'ai isolé chaque commande du tutoriel "programmez!" dans un *.bat différent (du coup j'ai 3 bat + le lancement de l'émulateur), je ne suis pas arrivé a faire un seul et unique *.bat.
3/ Windows

from img2gb.

flozz avatar flozz commented on May 26, 2024

Also, I still don't know why, I got an added tile on the right of the image. :

Ça je peux l'expliquer par contre :

  • lorsque la GameBoy s'initialise, elle affiche le logo de Nintendo. Une fois la séquence de boot terminée, elle masque juste la couche Background, mais la tilemap du logo y est toujours présente.

  • Il semblerait que l'image que vous essayez d'afficher soit juste assez petite pour qu'un bout du logo apparaisse encore, mais comme vous avez chargés vos propres tuiles en mémoire, c'est l'une des vôtres qui est affichée.

image

Le plus simple pour éviter ça, c'est de remplir toute la couche Background avec l'id d'une tuile vide

:)

from img2gb.

flozz avatar flozz commented on May 26, 2024

L:\LOGICIELS\Devellopement\gameboy>gbdk-n-master\bin\gbdk-n-compile.bat hello.c

En fait, cette commande doit être répétée pour chaque fichier .c, ce qui donnera à chaque fois un fichier .rel

L:\LOGICIELS\Devellopement\gameboy>gbdk-n-master\bin\gbdk-n-link.bat hello.rel -o hello.ihx

et du coup il faudra lister tous les fichiers .rel dans la commande ci-dessus.

Si vous téléchargez le code des exemples sur le site du magazine, j'y ai ajouté un fichier Make.bat qui automatise la compilation du tout (il faut juste modifier une variable en haut du script pour changer le nom du programme)

from img2gb.

BenoitAdam94 avatar BenoitAdam94 commented on May 26, 2024

ah ok

mais du coup c'est pas plus simple d'inclure tous les fichiers c dans le même fichier ? Quel est l'intérêt des *.rel ?

ah je n'avais pas vu les exemples sur le site je vais voir ça

from img2gb.

flozz avatar flozz commented on May 26, 2024

mais du coup c'est pas plus simple d'inclure tous les fichiers c dans le même fichier ?

Ça revient à tout écrire dans un seul fichier. Ça ne posera pas de problèmes particuliers pour un petit programme, mais ça peut commencer à poser des problème sur des logiciels plus gros.

Quel est l'intérêt des *.rel ?

Les fichiers .rel c'est la même chose que les fichiers .o des compilateurs classiques. C'est des fichiers qui contiennent le code compilé (le code pour la machine) de votre fichier .c.

Pour faire simple, le compilateur compile individuellement chaque fichier .c, ce qui donne un fichier .rel. Et après c'est le rôle de l'éditeur de lien de générer le code final à partir de tous les fichiers .rel.

Pour plus d'informations sur les étapes de la compilation d'un programme C, vous pouvez lire les deux pages suivantes :

La seule différence dans notre cas, c'est qu'on a une étape supplémentaire à la fin pour générer la ROM. :)

from img2gb.

flozz avatar flozz commented on May 26, 2024

Je ferme l'issue, n'hésites pas à me contacter via Twitter si besoin ;)

from img2gb.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.