Author Topic: .switch requires 32 bit registers  (Read 1577 times)

nikkho

  • Regular Member
  • *
  • Posts: 12
.switch requires 32 bit registers
« 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



jj2007

  • Member
  • *****
  • Posts: 10258
  • Assembler is fun ;-)
    • MasmBasic
Re: .switch requires 32 bit registers
« Reply #1 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.

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: .switch requires 32 bit registers
« Reply #2 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;)
Cod-Father

nikkho

  • Regular Member
  • *
  • Posts: 12
Re: .switch requires 32 bit registers
« Reply #3 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