Page 184 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 184

Introduction to Microprocessors


                  Notes          baton back to the caller. This statement can appear only once at the end of the subroutine
                                 declaration.

                                 13.2 Restart Sequence

                                 The restart sequence is made up of three machine cycles
                                 In the 1st machine cycle:

                                 The microprocessor sends the INTA signal. While INTA is active the microprocessor reads the
                                 data lines expecting to receive, from the interrupting device, the opcode for the specific RST
                                 instruction.
                                 In the 2nd and 3rd machine cycles:
                                 The 16-bit address of the next instruction is saved on the stack.
                                 Then the microprocessor jumps to the address associated with the specified RST instruction.

                                 How does the external device produce the opcode for the appropriate RST instruction?
                                 The opcode is simply a collection of bits. So, the device needs to set the bits of the data bus to the
                                 appropriate value in response to an INTA signal.

                                 During the interrupt acknowledge machine cycle, (the 1st machine cycle of the RST operation):
                                 The Microprocessor activates the INTA signal. This signal will enable the Tri-state buffers, which
                                 will place the value EFH on the data bus.





                                              Explain, How we work with subroutines?


                                 13.3 Conditional Call Instruction

                                 The call instruction is used for two purposes.
                                 1. to invoke an internal or external procedure as a subroutine

                                 2. to activate/deactivate a condition trap subroutine handler

                                 13.3.1 Subroutine call

                                         call procedureName [ argumentExpression [ , argumentExpression [ , ...etc ] ]


                                 This form of the call instruction invokes an internal or external procedure named procedureName,
                                 or a built-in function, as a subroutine. A series of arguments can optionally be prepared by the
                                 argument Expression values. These arguments can be acquired in the subroutine by using either
                                 the parse arg or arg instructions, or the arg built-in function. The subroutine can optionally return
                                 a result, which can be acquired by referencing the special RESULT variable. Often the result can
                                 be processed directly in-place, by using a function call instead.
                                 The name provided as procedureName can be provided as a quoted string -- e.g. 'X2C'. When it
                                 is a quoted string, an internal procedure is not invoked, and a built-in function or external
                                 procedure is invoked instead. When a built-in function is invoked, using this technique, the name
                                 in quotes should be in upper case.





        178                              LOVELY PROFESSIONAL UNIVERSITY
   179   180   181   182   183   184   185   186   187   188   189