EXTRN n_buildings PUBLIC MeetUser .MODEL SMALL .STACK 100h ;----------------------------------------------------------------------- INCLUDE GRAPHS.LIB ; Includes file with graph-mode macros INCLUDE IMAGES.LIB ; Includes the routines that will draw INCLUDE MY_MACRO.LIB ; the images. ;------DATA SEGMENT---------------------------------------------------- .DATA Meet DB 'Please, input number of buildings(2-9):$' User_int DB 10,13,' Program terminated by user. $' Pause_string DB 10,13,' Press any key to continue . . . $' ;----------------------------------------------------------------------- .CODE MeetUser PROC push ax push bx push cx push dx push ds mov ax,@DATA mov ds,ax clear_screen print_string meet mov bx,3932h call digit_read cmp al,27 jne get_1st_number print_string User_Int End_prog get_1st_number: sub al,30h mov byte ptr n_buildings,al print_string pause_string key_wait pop ds ; pop dx ; pop cx ; Restoring registers pop bx ; pop ax ; ret ; Return to Main module MeetUser ENDP ; End of MeetUser procedure DIGIT_READ PROC ;Input bl-ascii code of the smallest digit ; bh-ascii code of the biggest digit ;Output al=27 ESC was pressed mov ah,0 start_input: int 16h cmp al,27 je end_input cmp al,bl jb start_input cmp al,bh ja start_input push ax mov dl,al mov ah,2 int 21h pop ax end_input: ret ENDP END