; LABELS.ASM -IAN! idallen@ncf.ca July 2000 ; ; Purpose: ; Show the difference in syntax between two types of labels: ; Labels on CODE require a colon after the label. ; Labels on DATA must not be followed by a colon. ; ; Algorithm PseudoCode: ; initialize counter from MAXL ; do { ; output an asterisk ; decrease counter by value in DOWN ; } while ( counter is not zero ) ; exit ; ; Note: This code has a bug - the loop never terminates. Why? ; ;---------------------------------------------------------------------- Labels segment assume CS:Labels,DS:Labels ; .COM format uses only one segment org 100h ; .COM format executable starts at 100h ;---------------------------------------------------------------------- START: MOV BX,MAXL ; initialize BX to start the loop WHILE: MOV DL,CHAR ; output this CHAR on the screen MOV AH,02h INT 21h SUB BX,DOWN ; decrease BX and loop if not zero JNZ WHILE MOV AH,4Ch ; code to terminate this LABELS program MOV AL,0h ; set a zero return status from LABELS INT 21h MAXL DW 0FFh ; max loop start value DOWN DW 2h ; go down by this much each time CHAR DB '*' ; output this character ;---------------------------------------------------------------------- Labels ends end start ; "start" is the label on the first instruction