OPTION SCOPED CSEG SEGMENT ASSUME CS:CSEG,DS:DSEG MAIN PROC ; Sicherstellen von ASSUME DS:DSEG MOV AX,DSEG MOV DS,AX ; X := UP1(A,B) PUSH A PUSH B CALL UP1 MOV X,AX ; WriteLn(X) PUSH X CALL DOUT CALL CRLF ; X := UP2(A,B) MOV AX,SEG A PUSH AX MOV AX,OFFSET A PUSH AX MOV AX,SEG B PUSH AX MOV AX,OFFSET B PUSH AX CALL UP2 MOV X,AX ; WriteLn(X) PUSH X CALL DOUT CALL CRLF ; X := UP3(T) MOV AX,SEG T PUSH AX MOV AX,OFFSET T PUSH AX CALL UP3 MOV X,AX ; Write(X) PUSH X CALL DOUT ; Programmende MOV AX,4C00h INT 21h MAIN ENDP ; Function UP1(Y,Z:Word):Word; ; Begin ; UP1 := Y+Z ; End UP1 PROC PUSH BP MOV BP,SP MOV AX,[BP+6] ADD AX,[BP+4] POP BP RET 4 UP1 ENDP ; Function UP2(Var Y,Z:Word):Word; ; Begin ; UP2 := Y+Z ; End UP2 PROC PUSH BP MOV BP,SP PUSH DS PUSH BX MOV DS,[BP+10] MOV BX,[BP+8] MOV AX,[BX] MOV DS,[BP+6] MOV BX,[BP+4] ADD AX,[BX] POP BX POP DS POP BP RET 8 UP2 ENDP ; Function UP3(Var Y:tTabelle):Word; ; Var F,I : Word; ; Begin ; F := 0; ; For I := 0 To 9 Do ; F := F+Y[I]; ; UP3 := F ; End UP3 PROC PUSH BP MOV BP,SP SUB SP,4 PUSH DS PUSH BX PUSH SI MOV WORD PTR [BP-2],0 MOV WORD PTR [BP-4],0 LOOP1: CMP WORD PTR [BP-4],9 JA LOOP2 MOV AX,[BP-2] MOV DS,[BP+6] MOV BX,[BP+4] MOV SI,[BP-4] SHL SI,1 ADD AX,[BX+SI] MOV [BP-2],AX INC WORD PTR [BP-4] JMP LOOP1 LOOP2: MOV AX,[BP-2] POP SI POP BX POP DS MOV SP,BP POP BP RET 4 UP3 ENDP DOUT PROC ; Write(Y) PUSH BP MOV BP,SP PUSH AX PUSH BX PUSH CX PUSH DX MOV AX,[BP+4] MOV BX,10 MOV CX,0 LOOP1: MOV DX,0 DIV BX PUSH DX INC CX CMP AX,0 JNE LOOP1 MOV AH,2 LOOP2: POP DX ADD DL,'0' INT 21h LOOP LOOP2 POP DX POP CX POP BX POP AX POP BP RET 2 DOUT ENDP CRLF PROC ; WriteLn PUSH AX PUSH DX MOV AH,2 MOV DL,13 INT 21h MOV DL,10 INT 21h POP DX POP AX RET CRLF ENDP CSEG ENDS DSEG SEGMENT ; Var A : Word A DW 19 ; Var B : Word B DW 23 ; Type tTabelle = Array[0..9] of Word ; Const T : tTabelle = (2,3,5,7,11,13,17,19,23,29) T DW 2,3,5,7,11,13,17,19,23,29 ; Var X : Word X DW ? DSEG ENDS SSEG SEGMENT STACK DW 1024 DUP (?) SSEG ENDS END MAIN