Block structure of the program. Modular program structure
Often large programs use subroutines to implement auxiliary algorithms. In JA, subroutines are formalized in the form of procedures.
Description of procedures
(name of the process) PROC (parameter) (body of the process) (name of the process) ENDP where (name of the process) – must be repeated twice and is used to refer to the procedure; (parameter) can take one of two values -Calling procedures
In YA, all transitions between the main program and the procedure must be organized by yourself. If a procedure can return to DOS, then it can be called with the jump command to the procedure name JMP (process name). If you need to return to the calling program, then the easiest way is to use the call command CALL (process name). Then the body of the procedure must contain a return command RET There is another possibility: remember the return address using the stack and organize the return using jump commands. When calling a procedure, you should take into account the parameters passed to the procedure and its location relative to the point of call, i.e. the type of transition in the CALL command is determined automatically, For example(for procedure p). P CALL P If this is a close call (NEAR), then the following actions are performed: Stack:= AB, IP:= offset P where AB is the return address, i.e. the effective address of the command following the call; A far call (FAR) provides the actions: Stack:= CS, Stack:= AB, CS:= seg P, IP:= offset P If the procedure description is in a segment below the call command, then the branch attribute must be specified with the PTR statement. For example, CALL FAR PTR P; long distance call PLocation of procedures in a segment
- Internal procedures are in the same segment as the calling program.
Stop ENDP text ENDS END ; end of file without entry point The merging of these files occurs at the linking step, i.e. separate broadcast required. For example, for MASM MASM/ZI PR MASM/ZI P1 where ZI is an option that allows you to place it in an object file full information about line numbers and symbols of the source module (IM). After PR.obj and P1.obj are formed, they need to be combined into a single boot file LINK/C0 PR P1, COMPOZ where C0 is an option that transfers symbolic information to the boot file, allowing the CV debugger to display the full text of the MI, including labels and comments. The COMPOZ.exe module is ready for execution. Can include a procedure from the library. To do this, the INCLUDE directive (library file name) is placed before the IM segments For example p, to connect the IO.asm file you should write INCLUDE IO.asm S SEGMENT 'stack' … S ENDS D SEGMENT 'data' … D ENDS C SEGMENT 'code' ASSUME CS:C, SS:S, DS:D Begin: … …C ENDS END Begin
Passing parameters between procedures (organized at the request of the programmer)
- Passing parameters through MP registers
- Passing parameters by reference means passing the address (name) of the memory location corresponding to the actual parameter (passing a named value from assembler to Pascal).
To do this, you can use the name of the memory location or load the address into a register (BX, BP, SI or DI, since the procedure can use these registers for addressing) before calling the procedure.
- Passing parameters via the stack.
; end of procedure | ; in the calling program |
POP BP | CALL p |
RET | ADD SP, 2*k ; SP correction |
PENDP | … |
- Problem saving registers when calling a procedure
(proc name) proc
PUSH BP for maintenance
Mov BP, SP stack
PUSH saving registers,
used in the procedure
body proc.
POP... register recovery
POP BP recovery BP
Previously, the tabular type of layout was widespread on the Internet, to which this page is dedicated. However, over time, this approach to creating a website structure became outdated, and it was replaced by block layout.
Differences between block layout and tabular layout
If the table layout implies that the page contents are inside the tag Block layout does not have the disadvantages of tabular layout - search engines it is indexed better, its code is not so sprawling, and the blocks The only noticeable disadvantage of block layout is that sites made on it may be displayed differently in browsers. To avoid this, you need to make the layout “cross-browser”, that is, displayed equally by any browser. IN graphic editor a website layout is created: it is marked where which area of the page (header, bottom, sidebar, main content) will be located and how much space it will take up, pictures and backgrounds are prepared. Each part of the page is placed in its own block The final HTML document is a collection of blocks
, then the concept of block layout is based on the active use of universal tags
is a table that should be used to display tabular data and nothing more.
The essence of block layout