Sometimes in 8085assembly language coding, we require to repeat a certain program segment for multiple times. In those situations, we can define sub-routines. In those subroutines, we can enclose our repeatedly reusable Instruction set or code. And then as when required we shall call those sub-routines accordingly. Sub-routines can also be called as procedures.Whenever the instructions in a subroutine are required to be executed, we branch program control to the subroutine using th CALL instruction. CALL is a 3-Byte instruction, with 1 Byte for the opcode, and 2 Bytes for the address of the subroutine. CALL mnemonics stands for “call ... Read More
contextlib module of Python's standard library defines ContextManager class whose object properly manages the resources within a program. Python has with keyword that works with context managers. The file object (which is returned by the built-in open() function) supports ContextManager API. Hence we often find with keyword used while working with files.Following code block opens a file and writes some data in it. After the operation is over, the file is closed, failing which file descriptor is likely to leak leading to file corruption.f = open("file.txt", "w") f.write("hello world") f.close()However same file operation is done using file's context manager capability ... Read More
A module object is characterized by various attributes. Attribute names are prefixed and post-fixed by double underscore __. The most important attribute of module is __name__. When Python is running as a top level executable code, i.e. when read from standard input, a script, or from an interactive prompt the __name__ attribute is set to '__main__'.>>> __name__ '__main__'From within a script also, we find a value of __name__ attribute is set to '__main__'. Execute the following script.'module docstring' print ('name of module:', __name__)Outputname of module: __main__However, for an imported module this attribute is set to name of the Python script. ... Read More
The builtins module is automatically loaded every time Python interpreter starts, either as a top level execution environment or as interactive session. The Object class, which happens to be the base class for all Python objects, is defined in this module. All built-in data type classes such as numbers, string, list etc are defined in this module. The BaseException class, as well as all built-in exceptions, are also defined in it. Further, all built-in functions are also defined in the built-ins module.Since this module is imported in the current session automatically, normally it is not imported explicitly. All the built-in ... Read More
In 8085 Instruction set, depending upon one of the flag bit values (excluding AC flag bit), the conditional call instructions will branch to a subroutine. The branch takes place based on the value of Cy flag, Z flag, P flag, or S flag. There is no call instruction based on the value of AC(Auxiliary Carry) flag bit. This is because generally, no one is interested in branching to a subroutine based on this flag bit value. The conditional call instructions are 3 Bytes in length, 1 Byte for the opcode, and another 2 Bytes for the subroutine address i.e.low-order Byte ... Read More
In 8085 Instruction set, CNC is a mnemonic, which stands for “Call if Not Carry”. This instruction is used to branch to the subroutine whose 16-bit address is provided in the instruction, only if Cy flag value is 0. If Cy flag value is 1, program flow continues in the main program sequentially. It is a3-Byte instruction.Mnemonics, OperandOpcode(in HEX)BytesCNC LabelD43Let us consider the following sample code for a better explanation –AddressHex CodesMnemonicComment200031LXI SP, 5000HSP ← 5000H.Initializing the SP200100Low order Byte of the address200250High order Byte of the address20033EMVI A, 40HA ← 40H, Initializing the Accumulator with initial value 40H20044040H as ... Read More
In 8085 Instruction set, CC is a mnemonic, which stands for “Call if Carry”. This instruction is used to branch to the subroutine whose 16-bit address is provided in the instruction, only if Cy flag value is 1. If Cy flag value is 0, program flow continues in the main program sequentially. It is a3-Byte instruction.Mnemonics, OperadOpcode(in HEX)BytesCC LabelDC3Let us consider the following sample code for a better explanation –AddressHex CodesMnemonicComment200031LXI SP, 5000HSP ← 5000H.Initializing the SP200100Low order Byte of the address200250High order Byte of the address20033EMVI A, 40HA ← 40H, Initializing the Accumulator with initial value 40H20044040H as operand200506MVI ... Read More
In 8085 Instruction set, CNZ is a mnemonic, which stands for “Call if Not Zero”. This instruction is used to branch to the subroutine whose 16-bit address is provided in the instruction, only if the Z flag value is 0. If Z flag value is 1, program flow continues in the main program sequentially. It is a 3-Byte instruction.Mnemonics, OperandOpcode(in HEX)BytesCNZ LabelC43Let us consider the following sample code for a better explanation –AddressHex CodesMnemonicComment200031LXI SP, 5000HSP ← 5000H.Initializing the SP200100Low order Byte of the address200250High order Byte of the address20033EMVI A, 40HA ← 40H, Initializing the Accumulator with initial value ... Read More
In 8085 Instruction set, CZ is a mnemonic, which stands for “Call if Zero”. This instruction is used to branch to the subroutine whose 16-bit address is provided in the instruction, only if the Z flag value is 1. If Z flag value is 0, program flow continues in the main program sequentially. It is a 3-Byte instruction.Mnemonics, OperandOpcode(in HEX)BytesCZ LabelCC3Let us consider the following sample code for a better explanation –AddressHex CodesMnemonicComment200031LXI SP, 5000HSP ← 5000H.Initializing the SP200100Low order Byte of the address200250High order Byte of the address20033EMVI A, 40HA ← 40H, Initializing the Accumulator with initial value 40H20044040H ... Read More
In 8085 Instruction set, CPO is a mnemonic, which stands for “Call if Parity Odd”. This instruction is a used to branch to the subroutine whose 16-bit address is provided in the instructions, only if P flag value is 0. If Z flag value is 1, program flow continues in the main program sequentially. It is a 3-Byte instruction.Mnemonics, OperandOpcode(in HEX)BytesCPO LabelE43Let us consider the following sample code for a better explanation –AddressHex CodesMnemonicComment200031LXI SP, 5000HSP ← 5000H.Initializing the SP200100Low order Byte of the address200250High order Byte of the address20033EMVI A, 40HA ← 40H, Initializing the Accumulator with initial value ... Read More