The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: nikkho on June 07, 2017, 05:46:02 PM

Title: .switch requires 32 bit registers
Post by: nikkho on June 07, 2017, 05:46:02 PM
It seems that the new .switch directive implementation, is requiring a 32 bit CPU, no matter if we are forcing .8086, which seems to be a bug.
Take a look at the following example:

.8086
mov ax, word ptr ds:[82h]
.switch ax
   .case 'h-'
      call ShowHelp
      .break
   .case 'r-'
      lea dx, acReset
      call PrintText
      call DoReset
      .break
   .default
      call DoIt
      .break
.endswitch


UASM will report the following:
SAMPLE.ASM(14) : Warning A4130: Incompatible with segment alignment: 8
SAMPLE.ASM(14) : Warning A4130: Incompatible with segment alignment: 8
SAMPLE.ASM(14) : Error A2030: Instruction or register not accepted in current CPU mode
SAMPLE.ASM(14) : Error A2030: Instruction or register not accepted in current CPU mode


Title: Re: .switch requires 32 bit registers
Post by: jj2007 on June 07, 2017, 06:40:51 PM
It's by design, for 32- and 64-bit only. But you don't need .switch, just use .if x   ... .elseif y ... .endif. Or code your own switch macro.
Title: Re: .switch requires 32 bit registers
Post by: habran on June 07, 2017, 08:46:12 PM
As I said before ASMC support 16 bit switch
UASM is not build for a nostalgia but for advanced programming;)
Title: Re: .switch requires 32 bit registers
Post by: nikkho on June 07, 2017, 09:24:54 PM
Thank. .switch is working fine on ASMC.
If you are curious, take a look: http://nikkhokkho.sourceforge.net/static.php?page=UPTIME