journal of all scince V.1. NO.1 | Page 44

L: call printscr MOV AH , 4CH Int 21H Seg1 ends End L : " ?% 8 V @ call , ret ?% 8 call p ==> push ip mov ip,offset(p) ret ==> pop ip . " seg1 segment DW 50 dup(?) X DW 0 seg1 ends 6 seg2 segment assume cs:seg2, SS:seg1 getch proc mov ah,0 int 16H ret getch endp putch proc push BX mov bh,0 mov bl,0FH mov ah,0EH int 10H pop BX ret putch endp get_number proc call getch call putch cmp AL'+', JNE L1 mov bx,0 push bx call getch JMP start L1:cmp AL'-', JNE L3 mov bx,0FFFFH : • K % W " PC #8 T %87 % C = 8 % :V ` . " % 5 AX %8U % % EC O HG C = * % % getnumber U HJG % AX 8 8 % EC O HG C = * % % shownumber change_cursor endp NEG cx push bx b:call get_number mov ax,cx call getch call change_cursor JMP r2 JMP start mov di,0 L3:mov bx,0 r1 : mov cx,ax mov si,ax push bx r2:mov ax,cx mov bp,offset x JMP L2 mov dx,0 mov cx,1 start: call putch mov bx,10 p2:cmp cx,si L2:sub al,30H div bx JA p3 mov bl,al INC si mov ax,si mov bh,0 mov cx,ax mov dx,0 L:call getch add dx,30H div cx call putch push dx cmp dx,0 cmp al,13 cmp cx,0 JNE p1 JE Q JE exit1 mov word ptr[bp],cx sub al,30h JMP r2 add bp,2 mov cl,al exit1: pop ax inc di mov ch,0 call putch p1: inc cx mov ax,10 dec si JMP p2 mul bx JNZ exit1 p3:mov bp,offset x add ax,cx ret p4:cmp di,0 mov bx,ax show_number endp JNA p5 JMP L Q:mov ax,bx mov ax,word ptr[bp[ change_cursor proc pop bx add bp,2 push ax cmp bx,0FFFFH dec di mov bh,0 JNE exit call show_number mov dh,2 NEG ax mov ax,20H mov dl,0 exit: ret call putch mov ah,2 get_number endp JMP p4 int 10H show_number proc p5:mov ah,4ch pop ax mov si,0 int 21h ret cmp ax,0 seg2 ends JG r1 end b mov cx,ax mov al,2DH call putch