vsnyder@jato.jpl.nasa.gov (Van Snyder) (02/28/91)
I have been poking around in the ROM with a disassembler, and have noticed some things that lots of other folks have probably also noticed. But attention could only improve them. 1. It's obvious that part of it was written in C and part in assembler. The parts that were written in C would be greatly improved simply by compiling them with a compiler having a decent optimizer. I don't know what quality optimizers are in existing ST compilers. But MetaWare has High C and Professional Pascal on 680x0 platforms -- it shouldn't be too great a trick to transport them to the ST. Probably the only way this will happen, though, is if Atari approaches MetaWare (408/429-META). The things one finds especially unpleasant about the present rom code are the complete lack of global common sub-expression elimination, especially array element references, and other just plain silly things that are almost completely local, such as "LINK 0" instructions. 2. The parts that were written in assembler would also benefit from being assembled with a better assembler. For example, the AssemPro assembler can be told to put references into PC relative addressing mode. There're lots of places where instructions have 32 bit addresses, but PC relative would work equally well. 3. Some of the stuff in assembler would benefit from simple things that a human must nonetheless do: all I/O addresses above $ffff8000 can be absolute short, because the hardware sign extends, that is, $ffff8800 can be coded $8800. Lots of little subprograms start "MOVE SR,-(SP)" and end "MOVE (SP)+,SR; RTS". They could instead end "RTE" or "RTR". There are a few places where one finds "MOVE.W #0,-(SP); MOVE.W #$xxx,-(SP)". These could be replaced by "MOVE.L #$xxx0000,-(SP)". 4. This isn't on precisely the same subject, but it wouldn't hurt to vector more of the intra-BIOS and intra-XBIOS calls. For example, I'd like to hook to a task scheduler at the point where FLOPRD goes into it's wait loop (What good is a DMA if the first thing you do after starting it is ask "hey, are you done? hey, are you done? hey, are you done? hey, are you done? hey, are you done? hey, are you done? hey, are you done? hey, are you done? ... up to $60000 times)? If the intra-BIOS calls and GEMDOS-BIOS calls were vectored, one could replace FLOPRD, and not need to replace RWABS as well. Also, patches would be easier, when the inevitable bugs are found. Is it reasonable at least to hope that the next ROM will be compiled with better tools, even if none of the expensive human-engineering intensive things are done? -- vsnyder@jato.Jpl.Nasa.Gov ames!elroy!jato!vsnyder vsnyder@jato.uucp