Monday, June 27, 2022

gdb, intel flavour

J'ai beau avoir de nombreuses heures de gdb derrière moi, la syntaxe AT&T opcode source, destination, ça reste quelque-chose de complètement non-naturel. Quand on s'est habitué à écrire du code assembleur avec opcode destination, source, on y reste. Pareil pour les 42(%eax,%ebx,4) vs. [eax + ebx*4 + 42].

Et voilà qu'à travers le wiki du projet "gdb-dashboard", je découvre qu'il est possible de passer gdb en mode 'intel' d'une simple commande.

set disassembly-flavor intel

là. c'est tout.

I've been using gdb a lot already, but that never made the AT&T assembly syntax natural to me. So I was quite (happily) shocked to discover an option to switch to intel syntax instead. Huzzah! And not only that, but a 'dashboard' option that let me have disassembly + source + values + registers + backtrace view of what I'm doing without losing the power of the basic text-mode GDB command line !

So if you don't mind I'll make this post my advanced-gdb-recipies until all my work stations are in sync.

Et si on veut la même chose en sortie d'objdump, ce sera

objdump -M intel -mes-autres-options

[ sauvegarder et continuer ]

Attention: gdb-dashboard et ddd sont mutuellement exclusifs.

A tout hasard, un appel x86_64, ça donne call(rdi, rsi, rdx, rcx, r8, r9, stack...)

Et si jamais le débuggeur insiste sur le fait que "No function contains program counter for selected frame", on peut toujours forcer disas address, +size ou utiliser set disassemble-next-line on

edit: pour montrer/cacher un panneau, on utilise juste dashboard nom_du_panneau

Juste, pour éviter les pointeurs en bleu-foncé illisible, on peut ajouter les commandes gdb classiques à la fin du fichier .gdbinit (avant `python Dashboard.start()`):

set style address background none
set style address foreground cyan
set style address intensity dim 

Et pour les noms de registres (en noir sur mon Pc de bureau T_T), il faut aller éditer le style "low" ... j'en profite pour tester ces codes ANSI 256-couleurs:

'style_low': {
   'default' : '38;5;103' # 32-16 = 36*red + 6*green + blue
}


Sunday, June 05, 2022

Nova the Squirrel

She's created some games on the NES and now she's creating a sequel for her best title on the SNES. How could one be more awesome than this? Well, she could be doing it in open-source 65* assembly, for instance ? Check: she does that too. She's Nova, likes world building and character design and her mascot character is a green squirrel going also under the name "Nova". I've been following her twitter account for a handful of years now, and it's really about time I give her platformer a try, be it only to tell you about it.

I can't deny a mario-worldish aesthetics to the world in which Nova the Squirrel takes place, but it would be reductive to claim it to be a Mario clone. 

Elle est plus jeune que la NES, plus jeune que la SuperNES, et à son âge, je me disais que finalement, en programmant sur GBA/NDS je pourrais probablement faire mon jeu sans avoir besoin de reconstruire un OS en premier. Elle, c'est Nova. Elle a décidé de faire son jeu en assembleur 6502 sur NES puis de lui donner une suite sur la reine des 16-bits. Tout sa dans son propre univers, avec ses propres graphismes. Et en open-source, s'il vous plaît. De quoi faire péter le compteur de génialitude.

Ne vous laissez pas endormir par l'aspect Mario-like de ses graphismes: considérer "Nova the Squirrel" comme un clone de SMW serait réducteur. Les comportements des adversaires sont plus variés, et le personnage peut 'emprunter' les techniques des monstres qu'elle rencontre. On rencontre des bumpers, des briques destructibles, des items à ramasser ... tout le panel d'interactions avec l'environnement qu'on pourrait attendre d'un jeu peaufiné et ambitieux des années 16-bit répond présent.

From what I've been able to test from her demo, there's an interesting variety of monster motions, power-up that come as a sort of 'copy ability' flavour (triggered by UP+SHOOT, which I always seem to forget ^^"), bumpers, breakable bricks, collectibles and such. And slopes.

Your default attack is just stunning monsters, copied abilities may defeat them. Although not all power might defeat all monsters (conway's Glider deletes the red stompers, but bombs just stun them, for instance).

Since it's a demo, i can't really tell the story yet, but it could go like some fastfood-king has invaded squirrel-land and over consuming fastfood twisted the mind of inhabitants making them dangerous to anyone. If you see a flying burger in this game, remember: it is not trying to heal you.

The game smartly comes up with a sort of level selection screen that acts as a mini-map. Some of the levels come up with so many mechanics that I fail to find words to describe them, producing avalanche of block-changes, with crates-that-turn-into-bumpers-that-then-disappear, or blocks that disappear into arrows that destroy more nearby blocks.

Seriously, there's significant amount of work in the game engine here.

Si son jeu NES est aujourd'hui achevé, l'épisode Super-Nintendo est toujours à l'état de démo. Il faudra imaginer soi-même le pitch du jeu et on pourra sans vergogne passer en revue toutes les armes prévues dans le jeu. Il faudra se débrouiller un peu aussi pour découvrir les commandes disponibles et les mouvements du personnage, y compris le "copy ability" assez cruxial pour avancer. Mais à part ça, la démo propose déjà des environnements variés et des niveaux bonus en mode 7. Possible que l'aspect sonore soit toujours en grand chantier... je n'ai plus la mémoire très précise à ce sujet (traduction écrite plusieurs mois après la version Anglaise)

And just when I thought I had discovered enough to write a post about it, Nova surprises me with a mode-7 bonus round (?) possibly inspired by chip challenge.

And I was also about to miss that START takes you to an inventory where the demo-mode pre-loaded all sort of powers for you to toy with. From the fire and bottles-throwing you can already find in-game to exotic devices like a sword or a fishing rod.

Seriously, the amount of work and love in here is amazing. (yeah I know, you expected 'insane' instead, but that wouldn't be respectful at all. This is dedication).

Seriously, girl/miss/ma'am/squirrel, you rock. I hope you'll keep rocking for long and I'd better start coding again so I can be up to the challenge and get at least half as amazing as I see you are.

edit: quite interesting to read her write

Back in 2007 or so, I was using a DS for tons of stuff and I always wanted to make my own homebrew for it, but I wasn't a good enough programmer back then. I am now, but it's probably a bit late for some of those projects to feel worth making to me, at least for the DS.