我无法弄清楚如何在我的tasm汇编作业中删除一行

时间:2013-05-14 11:38:26

标签: tasm

我有一个已编译的汇编程序,我被要求通过删除cmd提示符中显示的最后一行来修改它。我是装配新手,所以我找不到解决方案。

当你运行它时会出现5行,我正在尝试删除下面的行;

Press [q]uit [e]xecute [c]lear:

;Serhad Ali Turhan   040060390
    .8086 
    .MODEL small 
    .STACK 256 
    .DATA 
;~~~~~~ Declarations ~~~~~~~~
CR  equ 13d
LF  equ 10d
cPrompt  DB 'Press [q]uit [e]xecute [c]lear: $' 
cName      DB 'SERHAD ALI TURHAN',CR,LF,'$'
cNum       DB 'Electronical Engineering',CR,LF,'$'
cSch     DB 'ITU Ayazaga Kampusu 34469 Maslak-ISTANBUL',CR,LF,'$'
vDW    DB 0 ;Day of the Week
vMon       DB 0 ;Month
vDM    DB 0 ;Day of the month
cDW0       DB 'SUNDAY$   '  ;All days are 10 bytes
cDW1       DB 'MONDAY$   '
cDW2       DB 'TUESDAY$  '
cDW3       DB 'WEDNESDAY$'
cDW4       DB 'THURSDAY$ '
cDW5       DB 'FRIDAY$   '
cDW6       DB 'SATURDAY$ '


vI2S_I   DW 0       ;2 bytes
vI2S_S   DB ?,?,?,?,'$' ;4 bytes

cExcode  DB 0
;~~~~~~~~ Main Program ~~~~~~~~ 
    .CODE 
MAIN    PROC 
    mov   ax,@data    ; Initialize DS to address 
        mov   ds,ax       ; of data segment 
    call    pClr    
    jmp pExecute
    jmp pMenu       ;

;~~~~~ Menu ~~~~~
pMenu:

    lea     dx,cPrompt  ;
    call    puts        ;
    call    getc        ;AL has user selection  
    push    ax      ;Store it 
    call    pNL     ;
    pop ax      ;
    cmp al,'q'  ;al?=q 
    je  lQuit       ;Quit
    cmp al,'c'  ;al?=c
    je  lClr        ;Clear screen

    cmp al,'e'  ;
    je  pExecute    ;

    jmp pMenu       ;
lClr:
    call    pClr
    jmp pMenu       ;
lQuit:
    call    pQuit

;~~~~~~~~
pExecute:   
    call    pInfo
    call    pClock  
    call    pDate
    call    pNL
    jmp pMenu       ;
pInfo:
    lea dx,cName    ;
    call    puts        ;Display Name
    lea   dx,cNum
    call    puts        ;Display Department
    lea dx,cSch
    call    puts        ;Display School Address
    ret
pClock:
    mov ah,2ch  ;get time
    int 21h
    push    dx
    push    cx  
    mov al,ch       ;ch->hour

    call    pDisp
    mov dl,':'
    call    putc    
    pop ax      ;cl->minute

    call    pDisp
    mov dl,':'
    call    putc    
    pop ax      ;dh->seconds
    mov al,ah
    call    pDisp

    call    pNL
    ret
pDate:
    mov ah,2ah  ;get date
    int     21h 

    mov vDW,al  ;Store day of week
    mov vMon,dh ;Store month
    mov vDM,dl  ;Store day of month
    mov vI2S_I,cx   ;Year will be stored in 
    call    pI2S        ;vI2S_s as ASCII

    mov al,vDM  ;Print day of month
    call    pDisp
    mov dl,'.'
    call    putc

    mov al,vMon ;Print month
    call    pDisp
    mov dl,'.'
    call    putc

    lea dx,vI2S_S   ;Print year
    call    puts
    mov dl,'-'
    call    putc

    call    pDW     ;Print day of week

    ret
pDW:
    mov al,vDW
    mov bl,10       ;All days are 10 bytes
    mul bl
    mov ah,0
    mov bx,ax
    lea dx,cDW0[bx]
    call    puts
    ret
pDisp:
    xor ah,0        ;
    aam
    add ax,3030h    ;
    push    ax
    mov dl,ah       ;
    call    putc
    pop dx
    call    putc
    ret
;vI2S_I=1000*vI2S_S[0]+100*vI2S_S[1]+10*vI2S_S[2]+vI2S_S[3]
pI2S:               ;intToStr
    mov cx,1000     ;
    mov     ax,vI2S_I   ;   
    mov dx,0    
    div cx      ;
    add al,'0'
    mov vI2S_S,al   ;

    mov cx,100  ;
    mov ax,dx
    mov dx,0    
    div cx
    add al,'0'
    mov vI2S_s[1],al

    mov cx,10       ;
    mov ax,dx
    mov dx,0    
    div cx
    add al,'0'
    mov vI2S_s[2],al
    add dl,'0'
    mov vI2S_s[3],dl    ;


    ret

;~~~~~~~~ Screen I/O Functions ~~~~~~~~
getc:
    mov ah,1h       ;read character from keyboard
    int 21h     ;to al
    ret         ;
putc:
    mov ah,2h       ;display character 
    int 21h     ;at dl
    ret         ;
puts:   
    mov ah,9h       ;display string terminated by '$'
    int 21h     ;at the adress dx
    ret         ;
;~~ Clear screen ~~~~
pClr:   
    mov ax,03h  ;
    int 10h     ;
    ret         ;
;~~ New Line ~~~~~~~
pNL:
    mov dl,CR       ;
    call    putc        ;
    mov dl,LF       ;
    call    putc        ;
    ret 
;~~~~~~~~~ Exit ~~~~~~~~~~~~~~~
;return to DOS 
pQuit:     
    mov     ah,4Ch       ; DOS function: Exit program 
    mov     al,cExcode   ; Return exit code value 
    int     21h          ; Call DOS. Terminate program 
MAIN ENDP 
END     MAIN         ; End of program / entry point

1 个答案:

答案 0 :(得分:0)

我会提出一些指导性问题:

  1. 您希望阻止的文字是否会出现在代码中?
  2. 是否以某种方式识别出来?
  3. 该标识符是否存在于代码的其他位置?
  4. 这种用法在哪里?
  5. 您只关心一些指令。这些问题可以帮助您找到它们,并希望了解哪一个要删除。