Minimal changes to get m6502 to compile (won't work)
[Apout.git] / TODO
1                     Things to do in the Apout Emulator
2                     ----------------------------------
3
4 Ensure stream buffering works!
5
6         Do some decent testing and code reading to make me happier.
7
8 Speed Apout up
9
10         The biggest bottlenecks are the effective address calculations
11         in ea.c. After compiling 2.11BSD /sys/GENERIC kernel with a
12         gprof'd apout, we get:
13
14           %   cumulative   self              self     total           
15         time   seconds   seconds    calls  ms/call  ms/call  name    
16        64.9       3.64     3.64                             .mcount (123)
17         6.1       3.99     0.34  1609635     0.00     0.00  load_src [5]
18         5.6       4.30     0.31  1665976     0.00     0.00  mov [4]
19         5.3       4.60     0.30        2   148.44   959.47  run <cycle 1> [3]
20         3.4       4.79     0.19  1238127     0.00     0.00  load_dst [7]
21         2.2       4.91     0.12   602275     0.00     0.00  store_dst [10]
22         1.3       4.98     0.08   374121     0.00     0.00  loadb_src [12]
23         1.3       5.05     0.07   672481     0.00     0.00  store_dst_2 [13]
24         1.2       5.12     0.07   365911     0.00     0.00  cmp [6]
25         1.1       5.18     0.06   323386     0.00     0.00  movb [8]
26         1.1       5.24     0.06   515335     0.00     0.00  bne [15]
27
28         Everything else is below 1%. It doesn't look like there is
29         much room for improvement, maybe 10% worth?
30
31         We could go to having 65,536 separate functions, one for
32         each possible instruction. That would mean a large reorganisation
33         of the source, and would result in a significantly larger
34         binary for apout.
35
36         I've broken open some of the mov() functions which has improved
37         things a few percent. I did expand itab[] to 64K entries, but
38         the improvement was negligible. However, I should come back &
39         revisit this sometime.
40
41         Would it be worth adding STREAM_BUFFERING into bsdtrap.c? Possibly.
42         After a GENERIC kernel compile, I found that reads averaged 580
43         chars/read, writes averaged 115 chars/write. However, after getting
44         buffering to work in bsdtrap.c, I found that it actually slowed down
45         the GENERIC kernel compile, so I've left the code in but disabled it.
46
47 Finish off 2.11BSD emulation
48
49         Finish off all the missing syscalls. This means I will have to
50         learn how the new signal stuff actually works. Emulating signals
51         is going to be really interesting, I can see!
52         
53         Enumerate and write all of the ioctls: yucko. That means all of
54         the terminal stuff, blah!
55
56 Fix up the floating-point
57
58         If the UNIX binaries never use the FP error handling, then don't
59         bother to implement it. We should, however, implement doubles.
60         We should spend some time to ensure that the FP operations are
61         accurate, both in terms of FP accuracy, and in giving results
62         as if they were on a real PDP-11.
63
64 Make it work on big-endian machines
65
66         This would cause a lot of heartache in the code. It's not that
67         pretty now, but can you imagine the #ifdefs once big-endian
68         support is added? I guess some well-written macros could help.
69
70 Tidy up the code
71
72         In particular, aout.c is a mess. Should be more modular.