having issues with accessing structs

Started by smoalne, May 29, 2009, 11:37:26 AM

Previous topic - Next topic

smoalne

hello,
I am trying to follow the AoA text from webster.cs.ucr.edu and am having issues with trying to get a struct req. to work.
here is a sample piece of MY code.  what am i doing wrong?

here is the struct:
      mode              struct
      modbits           byte    ?
      reg                 byte    ?
      rm                  byte    ?
      mode              ends

      instr1adr         mode    {}
      instr2adr         mode    {}

      axbx              mode    {11b, 000b,000b}
      axdisp            mode    {00b,000b,110b}
      cxdispbxsi        mode    {01b,001b,000b}


      sptr1             dword    axdisp
      sptr2             dword    instr2adr

     mov al, axbx.modbits
     mov Instr1Adrs.modbits, al
     mov al, axbx.reg
     mov Instr1Adrs.reg, al
     mov al, axbx.rm
     mov Instr1Adrs.rm, al

i get an error stating that i cant use 16 bit registers w/ 32 bit arguments.  I tried changing the struct to words instead of bytes and the registers from al to eax but still get the same errors.  I am confused as to why i am still getting these errors.
could somebody help out with an interpretation of the errors and what i am doing incorrectly ?

thanks, Jeff

dedndave

sptr1 and sptr2 are 32-bit args - where is the code for those ?

PBrennick

Perhaps the problem is in the Instr1Adrs structure. Show us the code for that structure please.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

ToutEnMasm


Perhaps i need to learn something,but masm don't use the }.Replace all this { by <  and } by > and all will be good.
Perhaps are you using a c++ compiler ?????

Jimg

The only problem I can see is you have to spell the variables the same.  This works-
mode              struct
      modbits           byte    ?
      reg                 byte    ?
      rm                  byte    ?
mode              ends
.data
      instr1adr         mode    {}
      instr2adr         mode    {}

      axbx              mode    {11b, 000b,000b}
      axdisp            mode    {00b,000b,110b}
      cxdispbxsi        mode    {01b,001b,000b}

      sptr1             dword    axdisp
      sptr2             dword    instr2adr
.code
     mov al, axbx.modbits
     mov instr1adr.modbits, al
     mov al, axbx.reg
     mov instr1adr.reg, al
     mov al, axbx.rm
     mov instr1adr.rm, al