
Create a watch in emu8086 code#
This window (Figure 11) views the source code the highlighted instruction is the next one to be executed You can watch and change them during the executing of your code. When you press Emulate, this window (Figure 10) will appear, it displays the value of all Registers, flags, block of memory (1K) at a time as Hex value, Decimal value, and ASCII char, and disassembled machine code.

If it's possible for Call GETINPUTS to return more than the valid choices, then you need to guard against this by writing defensive code especially avoiding to fall through in the beneath code. Given that the values are known to be in the range, you can replace the pair cmp al, 2 je IPABeer2 with a simple jmp IPABeer2. This way you can omit the cmp al, 1 instruction. If, when comparing with the value 2, you find that the Carry Flag is set, then you know that the value in AL was below 2. Now we can reduce the number of comparisons even further by investigating more than just the Zero Flag (testing for equality). You can replace the pair cmp al, 4 je Ale with a simple jmp Ale. Given that the values are known to be in the range, the 4th comparison is not needed since it will always jump. The naive approach would be to test for each case like in next snippet: BeerTypes: Let's presume that the Call GETINPUTS gives valid choices in both Inputs (1, 2, 3, or 4) and Inputs (1 or 2).

LostCoast db 'Pouring Raspberry Brown Ale from Lost Coast Brewery.','$'

Yuengling db 'Pouring Traditional Lager from Yuengling.','$'ĬigarCity db 'Pouring Maduro from Cigar City.','$' Metropolitan db 'Pouring Magnetron Black Lager from Metropolitan Brewing.','$' TreeHouse db 'Pouring Julius from Tree House Brewing Company.','$'īlueMoon db 'Pouring Belgiun Wheat from Blue Moon.','$'įunkyBuddha db 'Pouring Floridian Hefeweizen from Funky Buddha.','$' Searching db 'Pouring Your Beer Selection.',0Ah,0Ah,0Dh,'$'ĭogfishHead db 'Pouring 60 Minute from Dogfish Head.','$'

BeerSelection db 'Please choose a style of beer?',0Dh,0Ah,0Ah,'Press 1 for IPA, 2 for Wheat Beer, 3 for Dark Lager, or 4 for Brown Ale.',0Dh,0Ah,0Ah,'$'īeerChoice db 'Which beer would you like?',0Dh,0Ah,0Ah,'Press 1 for the first beer and 2 for the second beer',0Dh,0Ah,0Ah,'$'
Create a watch in emu8086 how to#
If anyone knows how to fix this problem, I would really appreciate knowing why this is happening. For the initial question, I ask the user to select a choice from 1 to 4, but the third and fourth choice do not work. For a school project, I was told to create a program that asks a user two questions and each question has multiple choices.
