arash_total 0 Newbie Poster

hi ,
Code calculator in error, please help resolve this error. I compile code calculator emu8086 I'll error on line 71.
The second question: this calculator in 10 base worked.
How can the numbers in binary form as the input received and as output .
to download emu8086 http://www.emu8086.com
tnx

.model huge
.stack 100h
.data

numstring db 10 dup(?), "$"

keypressed db ? ; VARIABLE TO STORE ASCII OF PRESSED KEY FROM AL

line0 db "               CALCULATOR (press ESC to exit program)"
line1 db 10,13, "      _____________________"
line2 db 10,13, "     |  _________________  |"
line3 db 10,13, "     | |              0. | |"
line4 db 10,13, "     | |_________________| |"
line5 db 10,13, "     |  ___ ___ ___   ___  |"
line6 db 10,13, "     | | 7 | 8 | 9 | | + | |"
line7 db 10,13, "     | |___|___|___| |___| |"
line8 db 10,13, "     | | 4 | 5 | 6 | | - | |"
line9 db 10,13, "     | |___|___|___| |___| |"    
lineA db 10,13, "     | | 1 | 2 | 3 | | x | |"
lineB db 10,13, "     | |___|___|___| |___| |"
lineC db 10,13, "     | | . | 0 | = | | / | |"
lineD db 10,13, "     | |___|___|___| |___| |"
lineE db 10,13, "     |_____________________|", "$"


print0 db "0" , "$"
print1 db "1" , "$"
print2 db "2" , "$"
print3 db "3" , "$"
print4 db "4" , "$"
print5 db "5" , "$"
print6 db "6" , "$"
print7 db "7" , "$"
print8 db "8" , "$"
print9 db "9" , "$"


.code
    call initds
call clrscrandprintcalc
call getkeyandpaintcalc
call terminateprog


mov ax ,3;
int 10h

mov ah,9
lea dx ,print1
int 21h

;======== If its neccessary please don't touch the code beginning here======
;========INITIALIZE=DATA=SEGMENT============
proc initds near
mov ax, @data ; init DS
mov es, ax
mov ds, ax
ret
initds endp
;======CLEAR=THE=SCREEN=AND=PRINT=THE=CALCULATOR=========
proc clrscrandprintcalc near
mov ax, 3; CLEARSCREEN
int 10h
mov ah, 9
lea dx, line1 ; PRINT CALCULATOR
int 21h
ret
clrscrandprintcalc endp
;======GET=INPUT=FROM=USER=AND=PAINT=CORRESPONDING=KEY=IN=THE=CALCULATOR=======
proc getkeyandpaintcalc near
jumps ; FOR LONG JUMPS
lea si, numstring; LOAD SI WITH BASE ADDRESS OF NUMSTRING
mov di, 0 ; COUNTER FOR PRINTING
mov ah, 2
mov bh, 0
mov dx,0316h ; POSITION CURSOR IN THE LCD DISPLAY OF OUR CALCULATOR
int 10h ; INTERRUPT TO POSITION CURSOR
ulit:
mov ah, 7 ;GET KEY
int 21h
mov keypressed, al ; MOVE AL TO KEYPRESSED
cmp ch, 0; DOES CH HAVE A PREVIOUS VALUE? TO CHECK IF CLEARPREVIOUS PROCEDURE IS TO BE CALLED
je skip
call clearprevious
skip:
cmp keypressed, '0' ; TEST THE INPUTS
je do0
cmp keypressed, '1'
je do1
cmp keypressed, '2'
je do2
cmp keypressed, '3'
je do3
cmp keypressed, '4'
je do4
cmp keypressed, '5'
je do5
cmp keypressed, '6'
je do6
cmp keypressed, '7'
je do7
cmp keypressed, '8'
je do8
cmp keypressed, '9'
je do9
cmp keypressed, '.'
je doperiod
cmp keypressed, '='
je doequals
cmp keypressed, '+'
je doplus
cmp keypressed, '-'
je dominus
cmp keypressed, '*'
je dotimes
cmp keypressed, '/'
je dodivide
cmp keypressed, 1Bh
je exit
mov ch, 0
jmp ulit

do0:            ;POSITION THE X AND Y OF THE BLOCKS FOR EACH KEY
mov cx,0D0Ch
mov dx,0D0Eh
jmp do
do2:
mov cx,0B0Ch
mov dx,0B0Eh
jmp do
do5:
mov cx,090Ch
mov dx,090Eh
jmp do
do8:
mov cx,070Ch
mov dx,070Eh
jmp do
do7:
mov cx,0708h
mov dx,070Ah
jmp do
do4:
mov cx,0908h
mov dx,090Ah
jmp do
do1:
mov cx,0B08h
mov dx,0B0Ah
jmp do
doperiod:
mov cx,0D08h
mov dx,0D0Ah
jmp do
do9:
mov cx,0710h
mov dx,0712h
jmp do
do6:
mov cx,0910h
mov dx,0912h
jmp do
do3:
mov cx,0B10h
mov dx,0B12h
jmp do
doequals:
mov cx,0D10h
mov dx,0D12h
jmp do
doplus:
mov cx,0716h
mov dx,0718h
jmp do
dominus:
mov cx,0916h
mov dx,0918h
jmp do
dotimes:
mov cx,0B16h
mov dx,0B18h
jmp do
dodivide:
mov cx,0D16h
mov dx,0D18h
do:
mov ax, 0600h ; CALL FUNCTION 
mov bh, 70h ;   TO PAINT (WITH WHITE)
int 10h  ;      THE KEY

mov al, keypressed
mov numstring[si], al
inc si
inc di
;call printnums
jmp ulit
exit:
ret
getkeyandpaintcalc endp


;===============================
proc printnums near
push cx
push bx
mov cx, di
here:
mov bx, 0
mov ah,2
mov dl, numstring[bx]
int 21h
loopne here
pop bx
pop cx
ret
printnums endp

;===CLEARS=THE=PREVIOUS=PAINTED=KEY=AND=REDRAWS=THE=LINE=IN=THE=BOTTOM=OF=THE=KEY=====
proc clearprevious near
mov ax, 0600h
mov bh, 07h ; PAINT WITH BLACK
int 10h ; FUNCTION TO PAINT. NOTE THAT WE DID NOT CHANGE THE VALUES OF CX AND DX
mov ah,2 ; POSITION CURSOR, READY TO REDRAW THE LINE
mov bh, 0
mov dx, cx
int 10h ; INTERRUPT TO POSTION CURSOR
mov dl,'_'
int 21h ; THREE INT 21H BECAUSE
int 21h ; THE LOWER LINE CONSISTS
int 21h ; OF THREE (3) UNDERSCORES
mov dx,0316h ; POSITION CURSOR IN THE LCD DISPLAY OF OUR CALCULATOR
sub dx, di
int 10h ; INT[/ICODE]ERRUPT TO POSITION CURSOR
ret
clearprevious endp
;====TERMINTATE=THE=PROGRAM======
proc terminateprog near
mov ah, 4ch;
int 21h
ret
endp terminateprog
;===============================
end
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.