The MASM Forum

64 bit assembler => 64 bit assembler. Conceptual Issues => Topic started by: K_F on October 18, 2016, 04:55:10 AM

Title: Probably a dumb question ?
Post by: K_F on October 18, 2016, 04:55:10 AM
Can I still use ASSUME in 64bit to access structures

Assume rbx:Ptr Elf32_Ehdr
.
.
Mov [Rbx].e_ident, Rax ;
Title: Re: Probably a dumb question ?
Post by: hutch-- on October 18, 2016, 07:59:47 AM
Van,

Not in ML64, you use the other notation and it works OK. It may work OK in one of the Watcom forks.
Title: Re: Probably a dumb question ?
Post by: K_F on October 18, 2016, 08:08:36 AM
Thanks .. thought as much
Starting on my first serious 64 bit proggy... .. more reading to do.. :t
Title: Re: Probably a dumb question ?
Post by: hutch-- on October 18, 2016, 08:40:42 AM
Van,

This format works in ML64.

    mov eax, lpRct

    mov (RECT PTR [eax]).left,   10
    mov (RECT PTR [eax]).top,    12
    mov (RECT PTR [eax]).right,  14
    mov (RECT PTR [eax]).bottom, 16

One of the Watcom folks should be able to help you with any of the forks.
Title: Re: Probably a dumb question ?
Post by: jj2007 on October 18, 2016, 09:10:58 AM
include \Masm32\MasmBasic\Res\JBasic.inc      ; ## builds in 32- or 64-bit mode with ML, AsmC, JWasm, HJWasm ##
m2m equ xmov
.code
MyTest proc <cb> uses rsi rLeft, rTop, rRight, rBottom      ; requires MasmBasic (http://masm32.com/board/index.php?topic=94.0)
Local rc0:RECT
  rc equ <[rsi.RECT]>
  lea rsi, rc0

  m2m rc.left, rLeft                ; the most elegant solution, works
  m2m rc.top, rTop                  ; for both ML and Watcom forks

  m2m [rsi.RECT.right], rRight      ; works for both, too

  ifidni @AsmUsed$(0), <ml64>
      m2m [rsi.RECT.bottom], rBottom
  else
      Assume rsi:PTR RECT           ; old and clumsy syntax but the Watcom forks can handle that
      m2m [rsi].bottom, 1004        ; rBottom
  endif

  Print Str$("Left/Top/Right/Bottom: %i/%i/%i/%i\n\n", rc.left, rc.top, rc.right, rc.bottom)
  ret
MyTest endp
Init
  PrintLine Chr$("This code was assembled with ", @AsmUsed$(), " in ", jbit$, "-bit format", 13, 10)
  jinvoke MyTest, 101, 102, 103, 104
  Inkey "-- hit any key --"
EndOfCode

OPT_64      1      ; put 0 for 32 bit, 1 for 64 bit assembly
OPT_Assembler      ML
OxPT_Assembler      AsmC      ; remove the x to activate the
OxPT_Assembler      JWasm      ; option; the last one counts


This code was assembled with ml64 in 64-bit format

Left/Top/Right/Bottom: 101/102/103/104


Always willing to help with assembler-related questions ;)
Title: Re: Probably a dumb question ?
Post by: K_F on October 19, 2016, 05:14:29 AM
Thank you gentlemen.. :biggrin:
Title: Re: Probably a dumb question ?
Post by: rrr314159 on October 19, 2016, 12:15:14 PM
Quote from: K_F on October 18, 2016, 04:55:10 AM
Can I still use ASSUME in 64bit to access structures

I've mentioned before that the straw that broke the camel's back - made me, finally, reject ML64 in favor of HJWasm - was ASSUME. Microsoft took it out for no good reason, and I find it very convenient.

But one thing puzzles me - what the h*ll does this have to do with the ANC, and SA race problems?
Title: Re: Probably a dumb question ?
Post by: K_F on October 20, 2016, 03:32:24 AM
Where do you get that from ?.. we're talking 64 bit here  ;)
Title: Re: Probably a dumb question ?
Post by: rrr314159 on October 20, 2016, 04:33:25 AM
True ... ANC is only about 8 bit, or perhaps 7 ...