0

i have given the below structure:

BPB_FAT16   STRUCT                     ; Base BPB_FAT16. Size=0x19=25.
BytesPerSector      DW  0x0200 ; Size of HW sector, usualy 512.
SectorsPerCluster   DB  0x01   ; Valid values 1,2,4,8,16,32,64,128.
ReservedSectors     DW  0x0001 ; NrOfSectors preceding FAT.
NumberOfFats        DB  0x02   ;
RootEntries         DW  0x00E0 ; Max number of YWORD entries in the 
                           ;root 
                           ;dir.
SmallSectors        DW  0x0B40 ; See also .LargeSectors.
MediaDescriptor     DB  0xF0   ; 0xF0 floppy disk, 0xF8 hard disk.
SectorsPerFat       DW  0x0009 ;
SectorsPerTrack     DW  0x0012 ;
NumberOfHeads       DW  0x0002 ;
HiddenSectors       DW 0x00000000
LargeSectors        DW 0x00000000
                  ;       Extended BPB_FAT16. Size=0x1A=26.
PhysicalDriveNumber DB 0x00   ; 0x00 floppy disk, 0x80 hard disk.
Reserved            DB 0x00   ;
BPB_FAT16 ENDS  ;   Total BPB_FAT16. Size=0x33=51.

Bpb BPB_FAT16   ; variable Bpb is of type BPB_FAT16   

i am assigned an assembly project, i got stuck in below given code line:

CMP [OFFSET Bpb.SmallSectors],AX

this line of code is giving following error:

**error : immediate operand not allowed**

please guide me, where i am doing mistake?

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 1
    `CMP [Bpb.SmallSectors],AX` ? – Michael Petch Aug 08 '20 at 03:26
  • 1
    `offset` doesn't work or make sense inside square brackets normally; don't use it with a struct either. That keyword is what makes that operand parse as an immediate, even though it's inside square brackets. The linked duplicate explain MASM square brackets. – Peter Cordes Aug 08 '20 at 03:53

0 Answers0