code segment para assume cs:code org 100h ;prog seg prefix addrss hex no of 256 jmp initze savint dd ? ;for saving address of es:bx. count dw 0000h ;count of 17 tics. hours db ? mins db ? sec db ? testnum: push ax ;store all the contents of register push bx ;(not to change original values of register) push cx push dx push cs push es push si push di mov ax,0b800h ;starting address of display, to access screen memory mov es,ax ;es has base and bx has offset by default mov cx,count inc cx mov count,cx cmp cx,011h ;hexadecimal value of 17 jne exit mov cx,0000h mov count,cx call time exit: pop di pop si pop es pop ds pop dx pop cx pop bx pop ax jmp cs:savint ;jump to normal isr ;——————convert procedure——————– convert proc and al,0f0h ror al,4 add al,30h call disp mov al,dh and al,0fh add al,30h call disp ret endp ;————————time procedure—————- time proc mov ah,02h ;character outpuT int 1ah ;this gives system clk mov hours,ch mov mins,cl mov sec,dh mov bx,0f90h ;location for displaying clk mov al,hours mov dh,hours call convert mov al,’:’ call disp mov al,mins mov dh,mins call convert mov al,’:’ call disp mov al,sec mov dh,sec call convert ret endp ;———————–display procedue—————- disp proc mov ah,0ffh ;for setting attribute. 0ffh -> grey background + blink. 0fh -> black background and no blink mov es:bx,ax ;write into video buffer inc bx inc bx ;two times increment bcoz for e.g. 12 is in hours then ‘:’ ret endp ;——————initialization———————— initze: push cs ;code segment pop ds ;pop data segment cli ;clear int flag so that our program can run mov ah,35h ;get original interrupt vector i.e. obtains address of current interrupt handler routine mov al,08h ;intrrupt no. 08 -> for timer int 21h mov word ptr savint,bx ;base is saved to savint temporarily mov word ptr savint+2,es ;offset is saved. +2 because 2 bytes of base is skipped. mov ah,25h ;set int vector to our ISR mov al,08h mov dx,offset testnum ;new add for intrrupt ;before it was es:bx now it is ds:dx for setting. ;offset is keyword int 21h mov ah,31h ;make prog resident(request tsr) mov dx,offset initze ;size of program sti ;set intrrupt flag int 21h code ends end
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
code segment assume cs:code main : jmp init mes db “This is screen saver$” old_time dd ? old_kbd dd ? buff db 4000 dup(0) cnt db 0 flag db 0 our_time: push ax push bx push cx push dx push es push ds push ss push si push di mov ax,cs mov ds,ax cmp flag,1 je exit_time inc cnt cmp cnt,100 jne exit_time mov flag,01 mov si,0b800h mov es,si mov cx,2000 lea di,buff mov si,0 save: mov al,es:[si] mov [di],al mov al,’ ‘ mov es:[si],al inc si inc di mov al,es:[si] mov [di],al mov al,00100111b mov es:[si],al inc si inc di dec cx jnz save lea di,mes mov si,2000 print_mes: mov al,[di] cmp al,’$’ je exit_time mov es:[si],al inc di add si,2 jmp print_mes exit_time: pop di pop si pop ss pop ds pop es pop dx pop cx pop bx pop ax jmp cs:old_time our_kbd: push ax push bx push cx push dx push es push ds push ss push si push di mov ax,cs mov ds,ax mov cnt,0 cmp flag,0 je exit_kbd mov flag,0 mov si,0b800h mov es,si mov si,0 mov cx,4000 lea di,buff restore: mov al,[di] mov es:[si],al inc si inc di dec cx jnz restore exit_kbd: pop di pop si pop ss pop ds pop es pop dx pop cx pop bx pop ax jmp cs:old_kbd init: mov ax,cs mov ds,ax cli mov ah,35h mov al,8 int 21h mov word ptr old_time,bx mov word ptr old_time+2,es mov ah,25h mov al,8 lea dx,our_time int 21h mov ah,35h mov al,9 int 21h mov word ptr old_kbd,bx mov word ptr old_kbd+2,es mov ah,25h mov al,9 lea dx,our_kbd int 21h mov ah,31h mov al,0 lea dx,init int 21h sti code ends end main
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
section .data msg db 10,13,”Enter single digit count of numbers to add:” msgl equ $-msg msg1 db 10,13,”Enter four digit number:” msgl1 equ $-msg1 msg2 db 10,13,”Addition is:” msgl2 equ $-msg2 nwline db 10 cnt db 0 cnt1 db 0 arr times 80 db 0 section .bss num resb 5 numcnt resb 2 disp_buff resb 4 %macro accept 2 mov eax,3 mov ebx,0 mov ecx,%1 mov edx,%2 int 80h %endmacro %macro disp 2 mov eax,4 mov ebx,1 mov ecx,%1 mov edx,%2 int 80h %endmacro section .text global _start _start: disp msg,msgl accept numcnt,2 mov al,[numcnt] sub al,30h mov [cnt],al mov [cnt1],al mov esi,arr l1: disp msg1,msgl1 accept num,5 call ascii_to_original mov [esi],bx add esi,2 dec byte[cnt] jnz l1 disp msg2,msgl2 mov eax,0 mov esi,arr l6: mov bx,[esi] add ax,bx add esi,2 dec byte[cnt1] jnz l6 mov bx,ax call original_to_ascii disp nwline, 1 mov eax,1 mov ebx,0 int 80h ascii_to_original: mov edi,num mov ecx,4 mov ebx,0 l2: rol bx,4 mov al,[edi] cmp al,39h jbe l3 sub al,07h l3: sub al,30h mov ah,0 add bx,ax inc edi loop l2 ret original_to_ascii: mov ecx,4 mov esi,disp_buff l4: rol bx,4 mov dl,bl and dl,0fh cmp dl,09h jbe l5 sub dl,07h l5: add dl,30h mov [esi],dl inc esi loop l4 disp disp_buff,4 ret
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
section .data msg db 10,13,”Entered Array is” msg_l equ $-msg msg1 db 10,13,”Select Operation:” msg_l1 equ $-msg1 msg2 db 10,13,”1.Overlapped Transfer” msg_l2 equ $-msg2 msg3 db 10,13,”2.Non-Overlapped Transfer” msg_l3 equ $-msg3 msg6 db 10,13,”4.Non-Overlapped Transfer with String Instruction” msg_l6 equ $-msg6 msg7 db 10,13,”3.Overlapped Transfer with String Instruction” msg_l7 equ $-msg7 msg4 db 10,13,”5.Exit” msg_l4 equ $-msg4 msg5 db 10,13,”Enter Overlap position” msg_l5 equ $-msg5 msg0 db 10,13,”Transferred Array is” msg_l0 equ $-msg0 nwline db 10 arr dd 11111111h,22222222h,33333333h,44444444h newarr times 8 dd 0 section .bss opt resb 2 pos resb 1 cnt resb 1 cnt1 resb 1 temp resb 1 disp_buff resb 8 %macro display 2 mov eax,4 mov ebx,1 mov ecx,%1 mov edx,%2 int 80h %endmacro %macro accept 2 mov eax,3 mov ebx,0 mov ecx,%1 mov edx,%2 int 80h %endmacro section .data global _start _start: display msg1,msg_l1 display msg2,msg_l2 display msg3,msg_l3 display msg7,msg_l7 display msg6,msg_l6 display msg4,msg_l4 display nwline,1 accept opt,2 sub byte [opt],30h cmp byte [opt],01h je OVP cmp byte [opt],02h je NON_OVP cmp byte [opt],03h je OVP_S cmp byte [opt],04h je NON_OVP_S cmp byte [opt],05h je exit call exit ;–OVP– OVP: display msg,msg_l mov byte [cnt],4h mov edi,arr call original_to_ascii call COPYNUM call COPY display msg0,msg_l0 mov al,[pos] mov byte [cnt],al mov edi,arr call original_to_ascii jmp _start original_to_ascii: push ecx display nwline,1 pop ecx mov ebx,[edi] mov ecx,8 mov esi,disp_buff l4: rol ebx,4 mov dl,bl and dl,0fh cmp dl,09h jbe l5 add dl,07h l5: add dl,30h mov [esi],dl inc esi loop l4 add edi,4 display disp_buff,8 dec byte [cnt] jnz original_to_ascii display nwline,1 ret COPYNUM: mov esi,arr mov edi,arr mov byte [cnt],4h pos_esi: add esi,4 dec byte [cnt] jnz pos_esi sub esi,4 display msg5,msg_l5 display nwline,1 accept pos,2 sub byte [pos],30h mov byte [cnt],4h mov al,[pos] add al,[cnt] mov [cnt],al dec byte [cnt] mov [pos],al dec byte [pos] pos_edi: add edi,4 dec byte [cnt] jnz pos_edi sub edi,4 ret COPY: mov byte [cnt1],4h lnew: mov eax,[esi] mov [edi],eax sub esi,4 sub edi,4 dec byte [cnt1] jnz lnew ret ;–NON_OVP– NON_OVP: display msg,msg_l mov edi,arr mov byte [cnt],4h call original_to_ascii call COPYNUMA display msg0,msg_l0 mov byte [cnt],4h mov edi,newarr call original_to_ascii jmp _start COPYNUMA: mov esi,arr mov edi,newarr mov byte [cnt1],4h lnewA: mov eax,[esi] mov [edi],eax add esi,4 add edi,4 dec byte [cnt1] jnz lnewA ret ;–OVP_STRING– OVP_S: mov edi,arr mov byte [cnt],4h display msg,msg_l call original_to_ascii call COPYNUM display msg0,msg_l0 std mov ecx,4 l1O: movsd loop l1O mov al,[pos] mov byte [cnt],al mov edi,arr call original_to_ascii jmp _start ;–NON_OVP_STRING– NON_OVP_S: display msg,msg_l mov edi,arr mov byte [cnt],4h call original_to_ascii mov esi,arr mov edi,newarr mov ecx,4 l1S: movsd loop l1S display msg0,msg_l0 mov byte [cnt],4h mov edi,newarr call original_to_ascii jmp _start ;–EXIT– exit: mov eax,1 mov ebx,0 int 80h
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
section .data msg db 10,13,”Enter Hex number (max. FFFFH)”, 10 msglen equ $-msg msg2 db 10,13,”The converted BCD number is:”, 10 msglen2 equ $-msg2 nwline db 10 nwlen equ $-nwline msg3 db 10,13,”Enter BCD number: (Note: Enter 5 digit. E.g. 00018)”, 10 msglen3 equ $-msg3 msg4 db 10,”Choose one of the following:”, 10, “(1)Hex to BCD”, 10, “(2)BCD to Hex”, 10, “(3)Exit”, 10 msglen4 equ $-msg4 msg5 db 10,”The converted Hex number is:”, 10 msglen5 equ $-msg5 section .bss cnt resb 1 num resb 5 num1 resb 1 num2 resb 6 numbuff resb 5 num3 resb 4 opt resb 1 %macro disp 2 mov eax,4 mov ebx,1 mov ecx,%1 mov edx,%2 int 80h %endmacro %macro accept 2 mov eax,3 mov ebx,0 mov ecx,%1 mov edx,%2 int 80h %endmacro section .text global _start _start: ;–MENU– disp msg4, msglen4 accept opt, 2 sub byte[opt], 30h ;mov eax, [opt] cmp byte[opt], 01h jz hextobcd cmp byte[opt], 02h jz bcdtohex cmp byte[opt], 03h jz exit ;–Hex to BCD– hextobcd: disp msg, msglen accept num, 5 call ascii_to_original mov eax, 0 mov eax, ebx mov cx, 10 mov byte[cnt], 00h l1: mov edx, 0 div cx push dx ;Pushing Remainder inc byte[cnt] cmp ax, 0 jnz l1 disp msg2, msglen2 l6: pop dx add dl, 30h mov [num1], dl disp num1, 1 dec byte[cnt] jnz l6 disp nwline, nwlen jmp _start ;–BCD to Hex– bcdtohex: disp msg3, msglen3 accept num2, 6 mov esi, num2 mov eax, 0 ;clear since it is used by default by mul instruction mov ebx, 10 ;since we multiply 10 according to places. E.g. unit place -> *1 ten’s place -> *10 etc. and we add mov ecx, 05 ;5 digit number max. (65,535) l5: mov edx, 0 ;before multiplication, initialize mul ebx mov edx, 0 ;To clear higher bytes since we are doing operaiton on dl mov dl, [esi] sub dl, 30h add eax, edx inc esi dec ecx jnz l5 mov [numbuff], eax disp msg5, msglen5 call original_to_ascii disp nwline, nwlen jmp _start ;Example: 18 BCD to 12h Hex ;8*1 = 08 = 0000 1000 ; + ;1*10= 0A = 0000 1010 ; ———– ; 0001 0010 ;For 18, it will be stored as: [30][30][30][31][38] ;Step by Step execution: ; (1) eax = 0 dl = 0 ; eax = 0 ; (2), (3) same as above since 0 (30) ; (4) eax = 0 dl = 01 ; eax = 01 ; (5) eax = 10 (i.e. 0A) dl = 08 ; eax = 12 (i.e. 00C0) ;–Exit– exit: mov eax, 1 mov ebx, 0 int 80h ;–ASCII to Original– ascii_to_original: mov edi,num mov ecx,2 mov bx,0 l2: rol bx,4 mov al,[edi] cmp al,39h jbe l3 sub al,07h l3: sub al,30h mov ah,0h add bx,ax inc edi loop l2 ret ;–Original to ASCII– original_to_ascii: disp nwline, nwlen mov edi, numbuff mov bx, [edi] mov ecx, 5 mov esi, num3 l7: rol bx, 4 mov dl, bl and dl, 0fh cmp dl, 09h jbe l8 add dl, 07h l8: add dl, 30h mov [esi], dl inc esi loop l7 disp num3, 4 ret
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
section .data m db 10,13,”Enter your choice : “,10,”1.Calculate Length.”,10,”2.Reverse the string.”,10,”3.Check if Pallindrome.”,10 ml equ $-m msg db 10 ,”Enter a string : ” msglen equ $-msg msg1 db 10 ,”Length of string is:” msg1len equ $-msg1 msg2 db 10 ,”Reverse string is:” msg2len equ $-msg2 msg3 db 10 ,”String is a Pallindrome!” msg3len equ $-msg3 msg4 db 10 ,”String is not a Pallindrome!” msg4len equ $-msg4 msg5 db 10 ,”Do you want to continue(y/n)? : ” msg5len equ $-msg5 nl db 10 section .bss string resb 50 strl equ $-string str_len resb 40 revstring resb 50 num resb 16 choice resb 2 %macro accept 2 mov rax,0 mov rdi,0 mov rsi,%1 mov rdx,%2 syscall %endmacro %macro display 2 mov rax,1 mov rdi,1 mov rsi,%1 mov rdx,%2 syscall %endmacro section .text global _start _start: display msg,msglen accept string,50 dec rax mov [str_len],rax display m,ml accept choice,2 cmp byte[choice],’1′ je A1 cmp byte[choice],’2′ je A2 cmp byte[choice],’3′ je A2 A1: display msg1,msg1len mov rbx,[str_len] call original_to_ascii jmp conti A2: mov rsi,string mov rdi,revstring mov rcx,[str_len] add rsi,rcx dec rsi l1: mov al,[rsi] mov [rdi],al dec rsi inc rdi loop l1 display msg2,msg2len display revstring,50 display nl,1 cmp byte[choice],’3′ je A3 jmp conti A3: mov rsi,string mov rdi,revstring mov rcx,[str_len] l4: mov al,[rsi] mov bl,[rdi] cmp al,bl je l5 display msg4,msg4len jmp conti l5: inc rsi inc rdi loop l4 display msg3,msg3len display nl,1 conti: display msg5,msg5len accept choice,2 cmp byte[choice],’y’ je _start exit: mov rax,60 mov rbx,0 syscall original_to_ascii : mov rcx,16 mov rdi,num l2: rol bx,4 mov dl,bl and dl,0fh cmp dl,09h jbe l3 add dl,07h l3: add dl,30h mov [rdi],dl inc rdi loop l2 display num,16 ret
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
;****str1.asm**** extern conc_proc,sub_proc global str1,str1_size,str2,str2_size ;global should be used instead of extern %include “macro.asm” section .data msg db 10,13,”Enter the first string : ” msgl equ $-msg msg1 db 10,13,”Enter the second string : ” msgl1 equ $-msg1 msg2 db 10,10,”######## WELCOME TO MENU DRIVEN PROGRAMME #########” db 10,10,”1)Contactenate the string”,10,”2)Substring”,10,”3)Exit” db 10,10,”Enter your choice ” msgl2 equ $-msg2 section .bss choice resb 2 str1 resb 50 str2 resb 50 str1_size resb 4 str2_size resb 4 section .text global _start _start: display msg,msgl accept str1,50 dec eax mov [str1_size],eax display msg1,msgl1 accept str2,50 dec eax mov [str2_size],eax display msg2,msgl2 accept choice,2 cmp byte [choice],31h je l1 cmp byte [choice],32h je l2 exit l1: call conc_proc jmp _start l2: call sub_proc jmp _start ;****str2.asm**** global conc_proc,sub_proc extern str1,str1_size,str2,str2_size %include “macro.asm” section .data msg db 10,”Contactenated string is ” msgl equ $-msg msg1 db 10,”Substring is present” msgl1 equ $-msg1 msg2 db 10,”Substring is not present” msgl2 equ $-msg2 msg3 db 10,”Number of substring is ” msgl3 equ $-msg3 section .bss str3 resb 100 str3_size resb 2 subs resb 50 end_add resb 4 curr_add resb 4 ;we have to use curr_add sscount resb 2 dispbuff resb 4 section .text global _main _main: conc_proc: mov esi,str1 mov edi,str3 mov ecx,0 ;this step should be include otherwise it well give error mov ecx,[str1_size] rep movsb mov esi,str2 mov ecx,0 mov ecx,[str2_size] rep movsb mov ecx,0 mov ecx,[str1_size] add ecx,[str2_size] mov [str3_size],ecx display msg,msgl display str3,[str3_size] ret sub_proc: mov esi,str1 mov [curr_add],esi mov ecx,[str1_size] add esi,ecx dec esi mov [end_add],esi mov eax,00h mov [sscount],eax mov esi,str1 begin: mov edi,str2 mov ecx,00h mov ecx,[str2_size] repe cmpsb jne conti inc byte [sscount] conti: inc byte [curr_add] mov esi,[curr_add] cmp esi,[end_add] jbe begin cmp byte [sscount],00h je no display msg3,msgl3 display msg1,msgl1 mov bx,[sscount] mov ecx,4 mov esi,dispbuff l1: rol bx,4 mov al,bl and al,0fh cmp al,9h jbe l2 add al,7h l2: add al,30h mov [esi],al inc esi loop l1 ;add eax,30h ;mov [sscount],eax display dispbuff,4 jmp end no:display msg2,msgl2 end: ret ;****macro.asm**** %macro display 2 mov eax,4 mov ebx,1 mov ecx,%1 mov edx,%2 int 80h %endmacro %macro accept 2 mov eax,3 mov ebx,0 mov ecx,%1 mov edx,%2 int 80h %endmacro %macro exit 0 mov eax,1 mov ebx,0 int 80h %endmacro
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
section .data msg db 10,13,”Which operation to perform:1.Successive Addition2.Add and rotate left3.Exit” msglen equ $-msg msg1 db 10,13,”Enter first 4 digit hexadecimal no:” msg1len equ $-msg1 msg2 db 10,13,”Enter second 4 digit hexadecimal no:” msg2len equ $-msg2 msg3 db 10,13,”Result by first method is:” msg3len equ $-msg3 msg4 db 10,13,”Result by second method is:” msg4len equ $-msg4 section .bss choice resb 2 abc resb 8 %macro display 2 mov rax,1 mov rdi,1 mov rsi,%1 mov rdx,%2 syscall %endmacro %macro accept 2 mov rax,0 mov rdi,0 mov rsi,%1 mov rdx,%2 syscall %endmacro num1 resb 5 num2 resb 5 cnt resb 1 num resb 5 number resb 4 section .text global _start _start: display msg,msglen accept choice,2 mov al,[choice] sub al,30h cmp al,01 je successive_addition cmp al,02 je add_rol cmp al,03 je exit successive_addition: display msg1,msg1len accept num,5 call ascii_original mov [num1],rbx display msg2,msg2len accept num,5 call ascii_original mov [num2],rbx mov rbx,0 mov rax,0 ;used for sum variable mov rdx,0 ;used for carry mov rbx,[num1] mov rcx,[num2] l11: add rax,rbx jnc l12 inc rdx ;ie carry=carry+1 l12: dec rcx jnz l11 mov rbx,0 call original_ascii jmp _start add_rol: display msg1,msg1len accept num,5 call ascii_original mov [num1],bx display msg2,msg2len accept num,5 call ascii_original mov [num2],bx mov rax,0 mov rbx,0 mov rcx,0 mov cx,16 mov ax,[num1] mov bx,[num2] l15: ;add rax,rax shl ax,1 jnc l66 add ax,bx l66: dec cl jnz l15 ;mov bx,ax call original_ascii exit: mov rax,60 mov rbx,0 syscall ascii_original: mov esi,num mov ecx,4 mov bx,0 l2: rol bx,4 mov al,[esi] cmp al,39h jbe l3 sub al,07h l3: sub al,30h mov ah,0 add bx,ax inc esi loop l2 ret original_ascii: mov ecx,4 mov esi,number l4: rol ax,4 mov dl,al and dl,0fh cmp dl,09h jbe l5 add dl,07h l5: add dl,30h mov [esi],dl inc esi loop l4 display number,4 ret
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.
%macro disp 4 mov eax,%1 mov ebx,%2 mov ecx,%3 mov edx,%4 int 80h %endmacro section .data arr dd 10.00 , 20.00 , 30.00 , 40.00 , 50.00 num dd 5.00 mult dd 10000.00 dot db “.” newl db 10 section .bss mean rest 1 result resb 15 temp resb 1 meanst resd 1 store1 resd 1 store2 resd 1 section .text global _start _start: mov esi,arr mov edx,5 finit ; initialization of co processor fldz ;load zero on top the stack ;ADDITION OF ARRAY STARTED above: fadd dword[esi] ; top of the stack= top of the stack+[esi] add esi,4 dec edx jnz above ;ADDITION OF ARRAY ENDED fdiv dword[num] ;top of the stack = top of the stack/[num] fst dword[meanst];this will store top of the stack real in [meanst] variable fmul dword[mult];this will store =top of the stack multiply by 10000.00 this is done to print decimal fbstp tword[mean]; this will convert top of the stack to BCD and pop in mean register ;mean get displayed mov esi,mean call print ;variance (variance =((firstno. -mean)2+(secondno. -mean)2….)/totalnumber disp 0,0,0,0 mov esi,0 mov esi,arr ;first esi will point to the array mov edx,5 ;as there are total 5 number mov dword[store2],0h ;initialisinf store2 to 0 which will contain final variance answer above4: fldz ;top of stack is initialize to 0 fadd dword[esi] ;top of stack is initialise by [esi] fsub dword[meanst] ;mean is subtracted fst dword[store1] ; no. -mean is stored in [store1] fmul dword[store1] ;top of the stack is multiply by same number fadd dword[store2] ;added to top of stack fst dword[store2] ;finally store store2 number which final value will have (firstno. -mean)2+(secondno. -mean)2…. add esi,4 ;as array is dd dec edx ;counter is decremented jnz above4 fdiv dword[num] ;top of stack will be divided by total number thus having variance value fst dword[store1] ;store top of stack in store1 fmul dword[mult] ;multiply top of stack with 10000 fbstp tword[mean] ;and store in mean variable mov esi,mean call print ;display of variance disp 0,0,0,0 fldz fld dword[store1] fsqrt ;this will find square root of variance and store in top of stack fmul dword[mult] fbstp tword[mean] mov esi,mean call print disp 1,0,0,0 ;exit is called print: disp 0,0,0,0 ;all ax,bx,cx,dx register is initialize to 0 mov edi,result ;edi pointing through display buffer add esi,9 ;esi now pinted to last element mov edx,10 ;edx act as a counter ;this loop is for checking when the byte of esi is not 0 if not 0 then move to below else repeat process above1: mov al,byte[esi] cmp al,00 jne below dec esi dec edx jmp above1 below: mov eax,0 ;eax is initialise to 0 above3: mov al,byte[esi] ;al will contain 2 packed number mov cx,2 ;cx is used as counter above2: rol al,4 mov [temp],al ;first ah bit will convert into ascii then al register converted into ascii and al,0FH add al,30h mov [edi],al inc edi mov al,[temp] dec cx jnz above2 dec esi cmp edx,3 jne below1 mov al,byte[dot] ;if edx become 3 then . should be printed mov [edi],al inc edi below1: dec edx jnz above3 disp 4,1,result,15 disp 4,1,newl,1 ret
Pratik Kataria is currently learning Springboot and Hibernate.
Technologies known and worked on: C/C++, Java, Python, JavaScript, HTML, CSS, WordPress, Angular, Ionic, MongoDB, SQL and Android.
Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.