((Explanation : We have a number. Let the number be pissed off in the register AX. Now, we have to come on 1s equilibrise of this number. Ones full complement of a number means to invert each bit of a number. NEG instruction in 8086 allows us, to find 2s complement of a number, subtracting 1 from 2s complement gives the 1s complement of the number. eg. :AX = 1234 H. | | |0001 |0010 |0011 |0100 |= 1234 H | |NEG AX | |1110 |1101 |1100 |1100 |= EDCC | | central AX, 1 | | | | | 1 | | | | |1110 |1101 |1100 |1011 |= EDCB | i.e. 1s complement of 1234 H = EDCB. ((Algorithm : look I: set the data memory. Step II:Load the number in AX. Step terce: make up ones mind 2s complement of numbe r. Step IV:1s comp = 2s comp 1. Step V: parade the result. Step VI:Stop. ((Flowchart : Refer flow chart 1. ((Program : .model smallFlowchart 1 .data a dw 1234H .
code mov ax, @data; Initialize data discussion section mov ds, ax mov ax, a; Load number1 in ax neg ax; find 2s compement. Result in ax sub ax, 1; 1s complement=2s comp-1 mov ch, 04h; deem of physiques to be displayed mov cl, 04h; Count to axial motion by 4 bits mov bx, ax; Result in reg bx l2:rol bx, cl; roll bl so that mutual savings bank comes to lsb mov dl, bl; load dl with data to be displayed and dl, 0fH; get notwithstanding if lsb cmp dl, 09; check i! f digit is 0-9 or earn A-F jbe l4 add dl, 07; if letter add 37H else only add 30H l4:add dl, 30H mov ah, 02; Function 2 under INT 21H (Display character) int 21H declination ch; Decrement Count jnz l2 mov ah, 4cH; Terminate Program int 21H end ((Result : C:\programs>tasm 1scomp.asm Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International Assembling rouse: 1scomp.asm Error...If you emergency to get a full essay, order it on our website: OrderCustomPaper.com
If you want to get a full essay, visit our page: write my paper
No comments:
Post a Comment