.MODEL SMALL
.STACK 100H
.DATA?
STRING1 DB "The Computer Programmers Motto:",0
STRING2 DB "When in doubt,", 0
STRING3 DB "mumble!", 0
STRING4 DB 128 dup(?)
STRING5 DB 128 dup(?)
lstring EQU $ - string1
.CODE
START:
MOV AX, @DATA ; set up addressability of data
MOV DS,AX ;
MOV SI,0 ; index register
MOV CX,LSTRING ; loop counter number of bytes to move
L1:
MOV AL,STRING1[SI] ; get char from source
LOOP L1 ; repeat for entire string
mov ax, 4000h ; set up service to display string
mov bx, 1 ; to monitor
mov cx, 31 ; number of bytes to print
mov dx,OFFSET STRING1 ; where to find it
int 21h ; do it
MOV AH, 2 ; carriage return
MOV DL, 0DH
INT 21H
MOV DL, 0AH ; line feed
INT 21H
L2:
MOV AL,STRING2[SI] ; get char from source
LOOP L2 ; repeat for entire string
mov ax, 4000h ; set up service to display string
mov bx, 1 ; to monitor
mov cx, 14 ; number of bytes to print
mov dx,OFFSET STRING2 ; where to find it
int 21h ; do it
MOV AH, 2 ; carriage return
MOV DL, 0DH
INT 21H
MOV DL, 0AH ; line feed
INT 21H
L3:
MOV AL,STRING3[SI] ; get char from source
LOOP L3 ; repeat for entire string
mov ax, 4000h ; set up service to display string
mov bx, 1 ; to monitor
mov cx, 7 ; number of bytes to print
mov dx,OFFSET STRING3 ; where to find it
int 21h ; do it
MOV AH, 2 ; carriage return
MOV DL, 0DH
INT 21H
MOV DL, 0AH ; line feed
INT 21H
L4:
MOV AL,STRING1[SI] ; get char from source
MOV STRING4[DI],AL ; store in the target
INC SI ; move to next character
LOOP L4 ; repeat for entire string
mov ax, 4000h ; set up service to display string
mov bx, 1 ; to monitor
mov cx, lstring ; number of bytes to print
mov al,OFFSET STRING4 ; where to find it
int 21h ; do it
MOV AH, 2 ; carriage return
MOV DL, 0DH
INT 21H
MOV DL, 0AH ; line feed
INT 21H
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ah,4ch ; set up service to return to OS
int 21h
END start
vendredi 20 février 2015
WHY IS THERE A SPACE AND AND A ! at the beggining of my last printed string from the loop?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire