Variable Declarations...
JmpCtr dw 0,0,0,0,0,0,0,0,0,0,0
; Your goal is to determine the final
; value of these 11 16-bit words
; Note that because each word occupies two bytes,
; the total size of this array is 22 bytes.
Code section...
MOV CX, 0
Tornado:
CMP CX, 5000h ; Your code may be written flawlessly,
JAE SomeWhere ; but without good commenting nobody
; can understand it!
INC word [JmpCtr+0]
MOV AX, 0E700h ; Unfortunately you won't get any help
ADD AX, CX ; here.
JC OverTheRainbow
INC word [JmpCtr+2]
TEST CX, 2
JZ OverTheRainbow ; Here we jump over the rainbow,
; sometimes...
INC word [JmpCtr+4]
JMP OverTheRainbow
SomeWhere: ; Hey we made it somewhere! Too bad
; this label doesn't reflect what's going
INC word [JmpCtr+6] ; to happen in this section of code.
CMP CX,7000h
JGE ToTo
INC word [JmpCtr+8] ; Good comments not only help others read
; your code, they help you debug it.
CMP CX,-32256
JL Melting
INC word [JmpCtr+10] ; Poor comments can't help anybody.
CMP CX, 67h
JO Emerald ; A horrible comment would say:
JS OverTheRainbow ; "Compares CX to 67h"
INC word [JmpCtr+12]
JMP OverTheRainbow
Oz:
INC word [JmpCtr+14]
JMP Kansas ; What a state!
ToTo:
INC word [JmpCtr+16]
JMP OverTheRainbow
Emerald:
INC word [JmpCtr+18] ; Increments the jump counter
JMP OverTheRainbow
Melting: ; Yeah, the label goes with the theme but
; it's completely useless.
INC word [JmpCtr+20]
OverTheRainbow: ; No pot of gold here.
INC CX
CMP CX, 0A000h
JNE Tornado ; Not again!
Kansas:
LOOP Oz ; Almost the end of the program!!
|