Author Topic: .switch macro  (Read 804 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5664
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
.switch macro
« on: July 13, 2016, 06:20:36 AM »
With only a slight massage, Greg Falen's switch macro work fine in ML64.


; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm64\include\masm64rt.inc

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

entry_point proc

    .stack

    LOCAL var   :QWORD

    mov var, 4

    .switch var
      .case 1
        conout "Option 1",lf
      .case 2
        conout "Option 2",lf
      .case 3
        conout "Option 3",lf
      .case 4
        conout "Option 4",lf
      .case 5
        conout "Option 5",lf
      .default
        conout "Invalid number",lf
    .endsw

    waitkey

    void(ExitProcess,0)

    ret

entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: