Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 100h
- SETPOS macro X,Y
- MOV AH, 2H
- MOV DL, Y
- MOV DH, X
- INT 10H
- ENDM
- PRT macro STR
- MOV AH, 9H
- MOV DX, OFFSET STR
- INT 21H
- ENDM
- STRAPPEND macro CH
- MOV CL, BUFFLEN
- MOV DL, CH
- CALL SUBSTR
- ENDM
- .data
- mip DB 'Hallo werld!$'
- BUFFMAX DB 40
- BUFFLEN DB 1
- app DB 40 DUP(?),'$'
- .code
- MOV AX, @DATA
- MOV DS, AX
- MOV DI, OFFSET mip
- INC DI
- MOV BYTE PTR[DI], 'e'
- GETINP:
- MOV AH, 1H
- INT 21H
- CMP AL, 0DH
- JE INPEND
- STRAPPEND AL
- JMP GETINP
- INPEND:
- CMP BUFFLEN, 41
- JL EXITP
- STRAPPEND '$'
- EXITP:
- PRT app
- MOV AH, 4CH
- INT 21H
- ;------- CALL STATEMENTS --
- SUBSTR PROC
- ; TAKES CL AS CH INDEX, AND DL AS CHAR
- LEA DI, app
- MOV BL, 0
- SUBNXT:
- INC DI
- INC BL
- CMP CL, BL
- JE SUBDONE
- JMP SUBNXT
- SUBDONE:
- MOV BUFFLEN, CL
- INC BUFFLEN
- MOV BYTE PTR[DI], DL
- RET
- SUBSTR ENDP
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement