source: trunk/INCLUDE/ASM.INC@ 43

Last change on this file since 43 was 43, checked in by Ben Rietbroek, 12 years ago

BSS Corruption Problem located (auxdebug on) [2012-02-21]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

Problem

o Function with Xrefs goes out-of-bounds because hideparttable is too small

Has only 30 entries and should be 45.
Lost partition checker initializes out-of-bounds.

Info

o About the hideparttable

For each partition it can be specified which other partitions need to
be hidden when that partition is booted. This is useful for legacy DOS
but also braindead Windows that presents HPFS/JFS partitions as
unformatted and tries to persuade the user to format them.
With v1.07 the numer of partitions that can be handled was expanded from
30 to 45, but the size of the hideparttable was overseen.

o The need to compress the hideparttable

The old size was 30x30=900 bytes while the required size is 45x45=2045 bytes.
This amount of space is not available in the image.
Since 6 bits are enough to identify the partition number to be hidden,
the solution is to devide the table into bitfields. This will result
in a table of (45*45*6)/8=1519 bytes, which can be fitted.

Changes

Revamped the sources quite a bit and moved the history to a separate
file. (AIR-BOOT.HIS)

New

o FIXCODE script for Linux

Just until the C version is ready...

File size: 4.1 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18; Some Standard macros to make life easier with ALP and other assemblers :D
19
20MPush Macro reglist
21 irp reg,<reglist>
22 push reg
23 EndM
24EndM
25
26MPop Macro reglist
27 irp reg,<reglist>
28 pop reg
29 EndM
30EndM
31
32callfar Macro destination
33 push cs
34 call &destination
35EndM
36
37
38;
39; An ORG directive resets the location counter where code and data is
40; generated. If the location counter is reset back to a point where
41; code or data already has been generated, this will be overwritten
42; without warning.
43; This macro can be used with every ORG directive to check for this condition,
44; and when it occurs further assembly is terminated.
45
46; NOTE: Overlapchecking in JWasm is not as reliable as in Tasm.
47; Because it's a single pass assembler, the current location can be
48; incorrect. Tasm with multiple passes works correct.
49; FIXME: Get JWasm and Tasm use some common ECHO/%OUT method.
50; (Tasm only pases first word of non-quoted string to a macro)
51check_overlap MACRO loc
52
53 ; Exit macro immediately if no overlap.
54 ; We don't want to assign values to z_last_... if there is no
55 ; overlap because they would then hold the values the last time this
56 ; macro was called and not those of the last overlap.
57 IF (loc - $) LE 0
58 ;~ IF ($ - loc) GE 0
59 EXITM
60 ENDIF
61
62 ; Calculate the overlap.
63 z_last_overlap_size = (loc - $)
64 z_last_overlap_location = loc - z_last_overlap_size
65
66 IFDEF JWASM
67 ; Output message.
68 ECHO
69 ECHO ** ERROR: LOCATION OVERLAP DETECTED [JWASM] ! **
70 ECHO . THIS IS MOST LIKELY CAUSED BY CODE / DATA
71 ECHO . EXPANSION TOWARDS AN 'ORG' DIRECTIVE.
72 ECHO . LOOK AT 'z_last_overlap_location' TO SEE WHERE.
73 ECHO . LOOK AT 'z_last_overlap_size' TO SEE SIZE.
74 ECHO . FORCING ERROR...
75 ECHO
76 ENDIF
77 IFDEF TASM
78 IF2
79 ; Output message (only on pass2).
80 %OUT
81 %OUT ** ERROR: LOCATION OVERLAP DETECTED [TASM] ! **
82 %OUT . THIS IS MOST LIKELY CAUSED BY CODE / DATA
83 %OUT . EXPANSION TOWARDS AN 'ORG' DIRECTIVE.
84 %OUT . LOOK AT 'z_last_overlap_location' TO WHERE.
85 %OUT . LOOK AT 'z_last_overlap_size' TO SEE SIZE.
86 %OUT . FORCING ERROR...
87 %OUT
88 ENDIF
89 ENDIF
90
91 ; Terminate assembly by forcing an error.
92 .ERR
93
94ENDM
95
96
97; Shortcuts for pointer-types
98bptr equ byte ptr
99wptr equ word ptr
100dptr equ dword ptr
101qptr equ qword ptr
102tptr equ tbyte ptr
103
104
105sector_size equ 512
106image_size_60secs equ 7800h
107image_size_62secs equ 7c00h
108
109;image_size equ image_size_60secs
110image_size equ image_size_62secs
111
112sector_count equ image_size / sector_size ; Image size in sectors
113
114IF image_size EQ image_size_60secs
115 partition_count equ 30 ; Maximum number of partitions supported
116ELSE
117 partition_count equ 45 ; Maximum number of partitions supported
118ENDIF
Note: See TracBrowser for help on using the repository browser.