There's a principle in software engineering: Don't Repeat Yourself. By this, Hunt and Thomas mean "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." But unfortunately, technical and political obstacles inherent in certain platforms don't always make this easy.
Some time ago, I wrote a proof-of-concept implementation of 6502 assembly language as ca65 macros that output .byte statements. I intended for this to lead to an assembler that emits SPC700 opcodes, so that I can share music sequence interpretation code between NES and Super NES versions of a music engine. And blargg delivered, first by making a Sony-syntax assembler as a macro pack, then by adding a layer of 65C02-to-Sony preprocessor macros on top of that.
Today I noticed that Leushenko of Programming Puzzles & Code Golf Stack Exchange implemented something along the same lines: an x86-to-C assembler as a set of C preprocessor macros. In theory, this would help with porting old PC games that use assembly language subroutines to modern ARM-based platforms. And doing something similar for 6502 would allow sharing game logic code between NES and PC versions of a game.
Very polyglot. Such portability. Wow.
Some time ago, I wrote a proof-of-concept implementation of 6502 assembly language as ca65 macros that output .byte statements. I intended for this to lead to an assembler that emits SPC700 opcodes, so that I can share music sequence interpretation code between NES and Super NES versions of a music engine. And blargg delivered, first by making a Sony-syntax assembler as a macro pack, then by adding a layer of 65C02-to-Sony preprocessor macros on top of that.
Today I noticed that Leushenko of Programming Puzzles & Code Golf Stack Exchange implemented something along the same lines: an x86-to-C assembler as a set of C preprocessor macros. In theory, this would help with porting old PC games that use assembly language subroutines to modern ARM-based platforms. And doing something similar for 6502 would allow sharing game logic code between NES and PC versions of a game.
Very polyglot. Such portability. Wow.