BSP construction debugging
[dosdemo] / README.md
1 Building and running on DOS
2 ---------------------------
3 Make sure you have Watcom or OpenWatcom installed, and the appropriate env-vars
4 set (the watcom installer automatically adds them to autoexec.bat by default).
5
6 Run wmake to build. Needs dos4gw.exe in current dir.
7
8 The demo requires VESA Bios Extensions (VBE) 2.0. If your graphics card doesn't
9 support VBE 2.0 or greater, then make sure to run the `univbe` TSR first, or
10 the demo will fail to find a usable LFB video mode.
11
12
13 Cross-compile on GNU/Linux
14 --------------------------
15 source owdev script with contents (change WATCOM var as necessary):
16
17   export WATCOM=$HOME/devel/ow
18   export PATH=$WATCOM/binl:$PATH
19   export INCLUDE=$WATCOM/h:$INCLUDE
20
21 Run wmake to build. Needs dos4gw.exe and wstub.exe in current dir or PATH
22
23 Simply running ./demo.exe might invoke magic of the ancients to start wine,
24 which will in turn start dosbox, which will execute the DOS binary! If the gods
25 are slumbering in valhalla, just typing `dosbox demo.exe` should do the trick.
26
27
28 Building and running with the SDL backend
29 -----------------------------------------
30 Run make to build (assuming make on your system is GNU make), or use the visual
31 studio 2013 project on Windows.
32
33 The SDL backend will scale the framebuffer up, by the factor specified in the
34 `FBSCALE` environment variable. So run the demo as: `FBSCALE=3 ./demo` for
35 a 3x scale factor, or just export the `FBSCALE` env var in the shell you are
36 going to use for running the demo. The default scale factor is 2x.
37
38 Datafiles
39 ---------
40 The demo datafiles are in their own subversion repo. To checkout the data files
41 run the following in the demo root directory:
42
43   svn co svn://mutantstargoat.com/datadirs/dosdemo data
44
45 Random optimization details about the Pentium1 (p54c)
46 -----------------------------------------------------
47 Use cround64 (util.h) for float -> integer conversions, instead of casts.
48
49 Performance measurement with RDTSC:
50     perf_start();
51     /* code under test */
52     perf_end(); /* result in perf_interval_count */
53
54 Cache organization (L1): 8kb data / 8kb instruction
55 128 sets of 2 cache lines, 32 bytes per cache line.
56
57 Addresses which are multiples of 4096 fall in the same set and can only have
58 two of them in cache at any time.
59
60 U/V pipe pairing rules:
61  - both instructions must be simple
62  - no read-after-write or write-after-write reg dependencies
63  - no displacement AND immediate in either instruction
64  - instr. with prefixes (except 0x0f) can only run on U pipe.
65  - prefixes are treated as separate 1-byte instructions (except 0x0f).
66  - branches can be paired if they are the second instr. of the pair only.
67
68 Simple instructions are:
69  - mov reg, reg/mem/imm
70  - mov mem, reg/imm
71  - alu reg, reg/mem/imm (alu: add/sub/cmp/and/or/xor)
72  - alu mem, reg/imm
73  - inc reg/mem
74  - dec reg/mem
75  - push reg/mem
76  - pop reg
77  - lea reg,mem
78  - jmp/call/jcc near
79  - nop
80  - test reg,reg/mem
81  - test acc,imm
82
83 U-only pairable instructions:
84  - adc, sbb
85  - shr, sar, shl, sal with immediate
86  - ror, rol, rcr, rcl with immediate=1