Jul. 8th, 2010

joshua0: (Default)
joshua@escape:~/blargcpu$ cat l5test.l5
extern int printchar(i: int);

int main () {
  var cur: int;

  for (cur = 0x41; cur < 0x5B; cur++)
    printchar(cur);

  printchar(0x0A);
  return 0;
}
joshua@escape:~/blargcpu$ make l5test.bin
snipe/bin/snipe l5test.l5
blarg-elf-as -ol5test.o l5test.s
blarg-elf-ld -T blargcpu.ld -ol5test.elf l5test.o l5rt.o
blarg-elf-ld: l5test.elf: warning: allocated section `.text' not in segment
blarg-elf-objcopy -Obinary l5test.elf l5test.bin
joshua@escape:~/blargcpu$ ./blargcpu -r l5test.bin
blargcpu> cont
ABCDEFGHIJKLMNOPQRSTUVWXYZ
^C hit; breaking into debugger
blargcpu> q
Bye.
joshua@escape:~/blargcpu$

(snipe is the evolution of the L5 compiler that [livejournal.com profile] zagarus and I wrote for Frank's compilers class.) It's been completely gutted of all of its x86ness, and all the innards are now full of my toy CPU, blargCPU. I forward-ported the old version of my binutils port from 2005, and made a few changes to the architecture, and I can now confidently say that I have produced a fail.

I'll dump code in git sooner or later. The barrier to that right now is that my binutils port requires touching a lot of generated code (config.sub, et al), and I'm not sure how comfortable I am making changes to the things that generate them (or how much I care). Anyone know any binutils wizards?
Page generated Aug. 21st, 2025 10:48 pm
Powered by Dreamwidth Studios