News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

.switch requires 32 bit registers

Started by nikkho, June 07, 2017, 05:46:02 PM

Previous topic - Next topic

nikkho

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



jj2007

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.

habran

As I said before ASMC support 16 bit switch
UASM is not build for a nostalgia but for advanced programming;)
Cod-Father

nikkho

Thank. .switch is working fine on ASMC.
If you are curious, take a look: http://nikkhokkho.sourceforge.net/static.php?page=UPTIME