; *** Listing 9-5 ***
; An example of performing a switch statement with just a
; few cases, all consecutive, by using CMP to test for each
; of the cases.
; Macro to perform switch statement. This must be a macro
; rather than code inside the REPT block because MASM
; doesn't handle LOCAL declarations properly inside REPT
; blocks, but it does handle them properly inside macros.
local ValueWas1, ValueWas2, ValueWas3, ValueWas4
TEST_VALUE = 1
mov cx,TEST_VALUE ;set the test value
HANDLE_SWITCH ;perform the switch test
TEST_VALUE = (TEST_VALUE MOD 5)+1 ;cycle the test value from
; 1 to 4