Skip to content

Instantly share code, notes, and snippets.

@ABelliqueux
Created July 20, 2021 14:44
Show Gist options
  • Save ABelliqueux/a7a77e32928b3d94ab19abb3f14c718b to your computer and use it in GitHub Desktop.
Save ABelliqueux/a7a77e32928b3d94ab19abb3f14c718b to your computer and use it in GitHub Desktop.
Regexp rules to convert psx asm to gas syntax

replace symbols declarations

symbol equ value becomes

.equ symbol,value

replace rXX wit $XX

s\ r([0-9]{1,2}) \ \$\1

replace labels .stuff with stuff:

s\ ^\.([a-zA-Z_0-9]*) \ \1\:

replace SYMBOL rh 1

rh -> .short rw -> .long rb -> .byte

SYMBOL rh 1 =>

       .short 1```

s\ ^([A-Z0-9_A-Z_a-z0-9]*)\ *\.([a-z]*)\ ([0-9]*) \ .\1:\n\t\t\.\2 \3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment