source: trunk/INCLUDE/ASM.INC@ 45

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

Now using compressed HidePartTable (auxdebug on) [2012-02-24]

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!!

Fixes

o HidePartTabled now uses a 6-bit compressed format

Bitfield functions are used to manipulate the table.
Modifications mostly in PARTSCAN.ASM, PART_SET.ASM and PARTMAIN.ASM.
TODO: Determine impact on upgrading from previous versions.

Changes

o Changed LVM Label behavior

If they are the same, the LVM VolumeName is synced to LVM PartitionName
so they are the same again after the edit.
If they differ, only the LVM VolumeName is updated.

o Implemented stop scanning when partition limit of 45 is exceeded

User is presented with a warning pop-up.
Pressing a key will continue and the partitions that were found
so far are displayed in the menu.
The color of the selection bar is changed to red to indicate this
overflow situation.

o New overlap macro that works correctly with JWasm and Tasm

Now uses DB n DUP (<filler>) to fill space before a new ORG.
When overlap occurs n goes negative causing assembler error.

File size: 5.8 KB
RevLine 
[29]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
32
[45]33; Rousseau:
34; My editor (Geany) keeps auto-completing 'call' to 'callfar' because
35; of this definition. Since it's not used anywhere I disabled it.
36;~ callfar Macro destination
37 ;~ push cs
38 ;~ call &destination
39;~ EndM
[43]40
[45]41
[43]42;
[45]43; OLD OVERLAP CHECKER, DOES NOT WORK WELL WITH JWASM.
44;
[43]45; NOTE: Overlapchecking in JWasm is not as reliable as in Tasm.
46; Because it's a single pass assembler, the current location can be
47; incorrect. Tasm with multiple passes works correct.
48; FIXME: Get JWasm and Tasm use some common ECHO/%OUT method.
49; (Tasm only pases first word of non-quoted string to a macro)
50check_overlap MACRO loc
51
52 ; Exit macro immediately if no overlap.
53 ; We don't want to assign values to z_last_... if there is no
54 ; overlap because they would then hold the values the last time this
55 ; macro was called and not those of the last overlap.
56 IF (loc - $) LE 0
57 ;~ IF ($ - loc) GE 0
58 EXITM
59 ENDIF
60
61 ; Calculate the overlap.
62 z_last_overlap_size = (loc - $)
63 z_last_overlap_location = loc - z_last_overlap_size
64
65 IFDEF JWASM
66 ; Output message.
67 ECHO
68 ECHO ** ERROR: LOCATION OVERLAP DETECTED [JWASM] ! **
69 ECHO . THIS IS MOST LIKELY CAUSED BY CODE / DATA
70 ECHO . EXPANSION TOWARDS AN 'ORG' DIRECTIVE.
71 ECHO . LOOK AT 'z_last_overlap_location' TO SEE WHERE.
72 ECHO . LOOK AT 'z_last_overlap_size' TO SEE SIZE.
73 ECHO . FORCING ERROR...
74 ECHO
75 ENDIF
76 IFDEF TASM
77 IF2
78 ; Output message (only on pass2).
79 %OUT
80 %OUT ** ERROR: LOCATION OVERLAP DETECTED [TASM] ! **
81 %OUT . THIS IS MOST LIKELY CAUSED BY CODE / DATA
82 %OUT . EXPANSION TOWARDS AN 'ORG' DIRECTIVE.
83 %OUT . LOOK AT 'z_last_overlap_location' TO WHERE.
84 %OUT . LOOK AT 'z_last_overlap_size' TO SEE SIZE.
85 %OUT . FORCING ERROR...
86 %OUT
87 ENDIF
88 ENDIF
89
90 ; Terminate assembly by forcing an error.
91 .ERR
[45]92ENDM
[43]93
[45]94
95;
96; A normal ORG directive resets the location counter where code and data is
97; going to be emitted. If the location counter is reset back to a point
98; where code or data already has been emitted, this will be overwritten
99; without warning.
100; This macro does a check for this condition and aborts if it exists.
101; If there is space between the new location and the last emitted code or data
102; will be filled.
103;
104; There are differences between assemblers on when and how labels and values
105; are evaluated. Since JWasm is a single-pass assembler, some expressions
106; do not work that do work in multi-pass Tasm.
107; That's why the actual check for overlap is done by db getting a negative
108; value if an overlap occured.
109; So don't change the (after - before) calculations by assigning it to a
110; variable; that will break this macro.
111;
112ORIGIN MACRO loc
113 ;~ IFDEF JWASM
114 ;~ db (@F - $) dup('X')
115 ;~ ORG loc
116 ;~ @@:
117 ;~ ENDIF
118
119 ; Use this value to fill the gap between the new origin and the last
120 ; emitted code or data.
121 fillchar = 'X'
122
123 ; Mark the location of the last emitted code or data.
124 z_&loc&_1before:
125
126 ; JWasm can do db 0 dup (0).
127 IFDEF JWASM
128 db (z_&loc&_2after - z_&loc&_1before) dup(fillchar)
129 ENDIF
130
131 ; Tasm cannot.
132 IFDEF TASM
133 IF (z_&loc&_2after - z_&loc&_1before) NE 0
134 db (z_&loc&_2after - z_&loc&_1before) dup(fillchar)
135 ENDIF
136 ENDIF
137
138 ; Set the new origin.
139 ORG loc
140
141 ; Mark the new location.
142 z_&loc&_2after:
143
144 ; Calculate the gap.
145 z_&loc&_3gap = z_&loc&_2after - z_&loc&_1before
146
147 ;
148 ; Note that the variables are prefixed with z_ so they appear
149 ; at the end of the list-file.
150 ;
[43]151ENDM
152
153
[45]154
[29]155; Shortcuts for pointer-types
[30]156bptr equ byte ptr
157wptr equ word ptr
158dptr equ dword ptr
159qptr equ qword ptr
160tptr equ tbyte ptr
161
162
163sector_size equ 512
164image_size_60secs equ 7800h
165image_size_62secs equ 7c00h
166
167;image_size equ image_size_60secs
168image_size equ image_size_62secs
169
170sector_count equ image_size / sector_size ; Image size in sectors
171
172IF image_size EQ image_size_60secs
173 partition_count equ 30 ; Maximum number of partitions supported
174ELSE
175 partition_count equ 45 ; Maximum number of partitions supported
176ENDIF
Note: See TracBrowser for help on using the repository browser.