source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 623

Last change on this file since 623 was 623, checked in by krille_n_, 22 months ago

Changes:

  • Reversed the change to IdeDPT.asm in r622 as it didn't work as intended.
  • Reordered some procedures to reduce alignment padding.
  • Added two new defines (EXTRA_LOOP_UNROLLING_SMALL and EXTRA_LOOP_UNROLLING_LARGE) that should improve transfer speeds for some hardware combinations, specifically 808x CPUs with any IDE controller using port I/O and any CPU with XT-IDE controllers.
  • Added a new define (USE_086) for use with 8086 and V30 CPUs only. Unlike the other USE_x86 defines, this define will not change the instruction set used and is therefore compatible with all CPUs. However, it will apply padding to make jump destinations WORD aligned which should improve performance on 8086/V30 CPUs but on 8088/V20 CPUs there is no benefit and, in addition to wasting ROM space, it might in fact be slower on these machines. Since the vast majority of XT class machines are using 8088/V20 CPUs this define is not used in the official XT builds - it's primarily intended for custom BIOS builds.
  • XTIDECFG: The URL to the support forum has been updated.
File size: 15.5 KB
Line 
1####################################################################################################
2# Makefile to build XTIDE Universal BIOS.                                                          #
3#                                                                                                  #
4# Valid makefile targets are:                                                                      #
5# all       Removes existing files and builds binary files in \Build (without checksums)           #
6# small     Builds only binaries smaller than or equal to 8 kiB (without checksums)                #
7# large     Builds only binaries larger than 8 kiB (without checksums)                             #
8# custom    Builds custom binary without checksum (change DEFINES_CUSTOM / BIOS_SIZE_CUSTOM first) #
9# clean     Removes all files from \Build                                                          #
10# checksum* Same as 'all' but also applies checksums to the binaries                               #
11# strings*  Compress src\Strings.asm to src\StringsCompressed.asm                                  #
12# unused*   Checks if there are any unused functions that can be removed to save space             #
13#                                                                                                  #
14# * at the end of target name means that Perl is required for the job.                             #
15# Build directory must be created manually if it does not exist.                                   #
16#                                                                                                  #
17#                                                                                                  #
18# Following modules can be included or excluded:                                                   #
19# MODULE_8BIT_IDE             Support for 8-BIT IDE cards like XTIDE                               #
20# MODULE_8BIT_IDE_ADVANCED    Support for memory mapped and DMA based cards like JRIDE and XTCF    #
21# MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers (requires USE_386)       #
22# MODULE_COMPATIBLE_TABLES    Support for ill behaving software that tries to access DPT directly  #
23# MODULE_BOOT_MENU            Boot Menu for selection of drive to boot from                        #
24# MODULE_EBIOS                Enhanced functions for accessing drives over 8.4 GB                  #
25# MODULE_HOTKEYS              Hotkey Bar to boot from any drive                                    #
26# MODULE_IRQ                  IDE IRQ support                                                      #
27# MODULE_SERIAL               Virtual hard disks using serial port                                 #
28# MODULE_SERIAL_FLOPPY        Virtual floppy drives using serial port (requires MODULE_SERIAL)     #
29# MODULE_STRINGS_COMPRESSED   Use compressed strings to save space                                 #
30# MODULE_VERY_LATE_INIT       Initialize on INT 13h if our INT 19h handler is not called           #
31# MODULE_POWER_MANAGEMENT     Power Management support                                             #
32# MODULE_WIN9X_CMOS_HACK      Hack for Windows 9x compatibility                                    #
33# MODULE_MFM_COMPATIBILITY    Restores BDA drive count for MFM/SCSI controllers that expect to be  #
34#                             the only hard drive controller in the system                         #
35#                                                                                                  #
36# Not modules but these affect the assembly:                                                       #
37# ELIMINATE_CGA_SNOW          Prevents CGA snowing at the cost of a few bytes                      #
38# RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
39# NO_ATAID_VALIDATION ***     Excludes code that tries to ensure proper communication with drives  #
40# NO_ATAID_CORRECTION         Excludes code that corrects illegal CHS values from some CF cards    #
41# USE_086                     Applies WORD alignment padding for use with 8086/V30 CPUs only       #
42# USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
43# USE_286                     Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
44# USE_386                     Use instructions supported by 386 and later (defines USE_286)        #
45# USE_AT                      Use features supported on AT and later systems (not available on XT) #
46# USE_UNDOC_INTEL             Optimizations for Intel CPUs - do NOT use on NEC V20/V30/Sony CPUs   #
47# USE_NEC_V                   Optimizations for use with NEC V20/V30 CPUs only                     #
48# CLD_NEEDED                  Only needed for compatibility with buggy software/BIOSes             #
49# EXTRA_LOOP_UNROLLING_SMALL  Improves transfer speed on some CPU + IDE controller combinations    #
50# EXTRA_LOOP_UNROLLING_LARGE  Same as above but faster and uses more ROM space                     #
51#                                                                                                  #
52# ** AT Builds only (when USE_AT is defined)                                                       #
53# *** Use this only when certain known good drives are not being detected (eg WD Caviars)          #
54####################################################################################################
55
56###########################################
57# Source files and destination executable #
58###########################################
59
60# Assembly source code file (*.asm):
61SRC_ASM = Src/Main.asm
62
63# Program executable file name without extension:
64PROG = ide
65
66
67#######################################
68# Destination and include directories #
69#######################################
70
71# Directory where binary file will be compiled to
72BUILD_DIR = Build
73
74# Subdirectories where included files are:
75HEADERS = Inc/
76HEADERS += Inc/Controllers/
77HEADERS += Src/
78HEADERS += Src/Handlers/
79HEADERS += Src/Handlers/Int13h/
80HEADERS += Src/Handlers/Int13h/EBIOS/
81HEADERS += Src/Handlers/Int13h/Tools/
82HEADERS += Src/Handlers/Int19h/
83HEADERS += Src/Device/
84HEADERS += Src/Device/IDE/
85HEADERS += Src/Device/MemoryMappedIDE/
86HEADERS += Src/Device/Serial/
87HEADERS += Src/Initialization/
88HEADERS += Src/Initialization/AdvancedAta/
89HEADERS += Src/Menus/
90HEADERS += Src/Menus/BootMenu/
91HEADERS += Src/Libraries/
92HEADERS += Src/VariablesAndDPTs/
93
94# Subdirectories where library files are:
95LIBS = ../Assembly_Library/Inc/
96LIBS += ../Assembly_Library/Src/
97LIBS += ../Assembly_Library/Src/Display/
98LIBS += ../Assembly_Library/Src/File/
99LIBS += ../Assembly_Library/Src/Keyboard/
100LIBS += ../Assembly_Library/Src/Menu/
101LIBS += ../Assembly_Library/Src/Menu/Dialog/
102LIBS += ../Assembly_Library/Src/String/
103LIBS += ../Assembly_Library/Src/Time/
104LIBS += ../Assembly_Library/Src/Util/
105LIBS += ../Assembly_Library/Src/Serial/
106LIBS += ../XTIDE_Universal_BIOS/Inc/
107HEADERS += $(LIBS)
108
109
110##################################
111# Assembler preprocessor defines #
112##################################
113DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT NO_ATAID_VALIDATION CLD_NEEDED EXTRA_LOOP_UNROLLING_SMALL
114DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES EXTRA_LOOP_UNROLLING_LARGE
115
116DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
117DEFINES_XTPLUS = $(DEFINES_XT) USE_186
118DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
119DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN9X_CMOS_HACK
120
121DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
122DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
123DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
124DEFINES_386_LARGE = $(DEFINES_386) $(DEFINES_COMMON_LARGE)
125
126DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION NO_ATAID_CORRECTION CLD_NEEDED
127
128DEFINES_CUSTOM = ?
129
130
131###################
132# Other variables #
133###################
134
135# Target size of the BIOS, used in Main.asm for number of 512B blocks (CNT_ROM_BLOCKS) and by checksum Perl script below ('make checksum').
136# Note! The size must be a multiple of 2 KB for compatibility reasons.
137BIOS_SIZE_TINY = 4096
138BIOS_SIZE_SMALL = 8192
139BIOS_SIZE_LARGE = 12288
140BIOS_SIZE_CUSTOM = ?
141
142# Add -D in front of every preprocessor define declaration
143DEFS_XT = $(DEFINES_XT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
144DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
145DEFS_AT = $(DEFINES_AT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
146DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
147DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
148DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
149DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_TINY)
150DEFS_386 = $(DEFINES_386:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
151DEFS_386_LARGE = $(DEFINES_386_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
152DEFS_CUSTOM = $(DEFINES_CUSTOM:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_CUSTOM)
153
154# Add -I in front of all header directories
155IHEADERS = $(HEADERS:%=-I%)
156
157# Path + target file to be built
158TARGET = $(BUILD_DIR)/$(PROG)
159
160
161#########################
162# Compilers and linkers #
163#########################
164
165# Make
166MAKE = mingw32-make.exe
167
168# Assembler
169AS = nasm.exe
170
171# use this command to erase files.
172RM = -del /Q
173
174
175#############################
176# Compiler and linker flags #
177#############################
178
179# Assembly compiler flags
180ASFLAGS = -f bin                # Produce binary object files
181ASFLAGS += $(IHEADERS)          # Set header file directory paths
182ASFLAGS += -Worphan-labels      # Warn about labels without colon
183ASFLAGS += -Ox                  # Optimize operands to their shortest forms
184
185
186############################################
187# Build process. Actual work is done here. #
188############################################
189
190all: clean small large
191    @echo All done!
192
193small: xt_tiny xt xtplus at 386
194    @echo All small binaries built!
195
196large: xt_large xtplus_large at_large 386_large
197    @echo All large binaries built!
198
199at:
200    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
201    @echo * Small AT version "$(TARGET)_at.bin" built.
202
203at_large:
204    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
205    @echo * Large AT version "$(TARGET)_atl.bin" built.
206
207xtplus:
208    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
209    @echo * Small XT Plus version "$(TARGET)_xtp.bin" built.
210
211xtplus_large:
212    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
213    @echo * Large XT Plus version "$(TARGET)_xtpl.bin" built.
214
215xt:
216    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
217    @echo * Small XT version "$(TARGET)_xt.bin" built.
218
219xt_large:
220    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
221    @echo * Large XT version "$(TARGET)_xtl.bin" built.
222
223xt_tiny:
224    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
225    @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
226
227386:
228    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
229    @echo * Small 386 version "$(TARGET)_386.bin" built.
230
231386_large:
232    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -l"$(TARGET)_386l.lst" -o"$(TARGET)_386l.bin"
233    @echo * Large 386 version "$(TARGET)_386l.bin" built.
234
235custom:
236    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_CUSTOM) -l"$(TARGET)_cstm.lst" -o"$(TARGET)_cstm.bin"
237    @echo * Custom version "$(TARGET)_cstm.bin" built.
238
239strings: src\Strings.asm
240    @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_AT_LARGE) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
241    @perl ..\Tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
242    @echo StringsCompressed.asm updated!
243
244clean:
245    @$(RM) $(BUILD_DIR)\*.*
246    @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
247
248checksum: all
249    @perl ..\Tools\checksum.pl $(TARGET)_tiny.bin $(BIOS_SIZE_TINY)
250    @perl ..\Tools\checksum.pl $(TARGET)_xt.bin $(BIOS_SIZE_SMALL)
251    @perl ..\Tools\checksum.pl $(TARGET)_xtp.bin $(BIOS_SIZE_SMALL)
252    @perl ..\Tools\checksum.pl $(TARGET)_at.bin $(BIOS_SIZE_SMALL)
253    @perl ..\Tools\checksum.pl $(TARGET)_xtl.bin $(BIOS_SIZE_LARGE)
254    @perl ..\Tools\checksum.pl $(TARGET)_xtpl.bin $(BIOS_SIZE_LARGE)
255    @perl ..\Tools\checksum.pl $(TARGET)_atl.bin $(BIOS_SIZE_LARGE)
256    @perl ..\Tools\checksum.pl $(TARGET)_386.bin $(BIOS_SIZE_SMALL)
257    @perl ..\Tools\checksum.pl $(TARGET)_386l.bin $(BIOS_SIZE_LARGE)
258
259unused:
260    @echo "XT Tiny"
261    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -o"$(TARGET)_unused_tiny.asm" -l"$(TARGET)_unused_tiny.lst"
262    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -o"$(TARGET)_unused_tiny.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
263    @perl ..\Tools\unused.pl $(TARGET)_unused_tiny.lst $(TARGET)_unused_tiny.asm
264    @echo "XT Small"
265    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
266    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
267    @perl ..\Tools\unused.pl $(TARGET)_unused_xt.lst $(TARGET)_unused_xt.asm
268    @echo "XT Large"
269    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -l"$(TARGET)_unused_xtl.lst"
270    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
271    @perl ..\Tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
272    @echo "XT Plus Small"
273    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_unused_xtp.asm" -l"$(TARGET)_unused_xtp.lst"
274    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_unused_xtp.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
275    @perl ..\Tools\unused.pl $(TARGET)_unused_xtp.lst $(TARGET)_unused_xtp.asm
276    @echo "XT Plus Large"
277    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -o"$(TARGET)_unused_xtpl.asm" -l"$(TARGET)_unused_xtpl.lst"
278    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -o"$(TARGET)_unused_xtpl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
279    @perl ..\Tools\unused.pl $(TARGET)_unused_xtpl.lst $(TARGET)_unused_xtpl.asm
280    @echo "AT Small"
281    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
282    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
283    @perl ..\Tools\unused.pl $(TARGET)_unused_at.lst $(TARGET)_unused_at.asm
284    @echo "AT Large"
285    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -l"$(TARGET)_unused_atl.lst"
286    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
287    @perl ..\Tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
288    @echo "386 Small"
289    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -o"$(TARGET)_unused_386.asm" -l"$(TARGET)_unused_386.lst"
290    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -o"$(TARGET)_unused_386.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
291    @perl ..\Tools\unused.pl $(TARGET)_unused_386.lst $(TARGET)_unused_386.asm
292    @echo "386 Large"
293    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -o"$(TARGET)_unused_386l.asm" -l"$(TARGET)_unused_386l.lst"
294    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -o"$(TARGET)_unused_386l.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
295    @perl ..\Tools\unused.pl $(TARGET)_unused_386l.lst $(TARGET)_unused_386l.asm
296
Note: See TracBrowser for help on using the repository browser.