?? hprsndx.asm
字號(hào):
go2: mov si,offset should_be
xor ax,ax
cmp cx,016h
jz cal_char
add si,cx
MOV al,byte ptr [si] ;put byte of calculated in al
sub al,041h
push ax
push cx
mov ax,cx
mov cx,00002h
div cx
pop cx
pop ax
test dx,dx
jz nodouble
add ax,ax
nodouble: cmp ax,0001ah
jb allrighty
sub ax,00019h
allrighty: add [di],ax
inc cx
jmp go2
cal_char: mov ax,[di]
mov cx,01ah
xor dx,dx
div cx
mov bx,dx
inc bl
mov si,offset to_enter+017h ;added one here, made it read the last char
mov bh,byte ptr [si]
sub bh,041h
add bl,bh
cmp bl,01ah
jge rotate2
jmp go_on
rotate2: sub bl,01ah
go_on: mov si,offset encodestr
mov bh,000h
add si,bx
MOV bl,byte ptr [si]
mov si,offset to_enter+018h ;added one here cause of the '-'
mov byte ptr [si],bl
RET
checksum endp
;******************************************************************************
; check and shape up user input
;******************************************************************************
read_input proc near
mov ax,@data
mov ds,ax
mov es,ax
xor dx,dx
xor ax,ax
xor cx,cx
mov si,offset keyb
mov al,byte ptr [si+1] ;get number of chars put in by user
cmp al,000h
jz step_no_input ;number is zero
mov bx,ax
add si,2 ;move si to beginning of input
loopstart: cmp bx,000h
jnz notalldone
jmp reformat
step_no_input: jmp no_input
notalldone: mov al,byte ptr [si]
cmp al,061h ; 'a' checking for letters or other chars
jge letsee3
cmp al,041h ; 'A'
jge letsee4
jmp nolet
letsee3: cmp al,07bh ;'z'
jge nolet
sub al,020h ;capitalize
jmp putitinmem
letsee4: cmp al,05bh ;'Z'
jge nolet
putitinmem: mov di,si
sub di,dx
mov byte ptr [di],al
dec bx
inc si
jmp loopstart
nolet: inc dx
dec bx
inc si
jmp loopstart
reformat: xor bx,bx
mov si,offset keyb
mov bl,byte ptr [si+1] ;get number of chars put in by user
sub bx,dx ;substract number of not-letters
cmp bl,000h
jz no_input
cmp bl,010h
jg strip ;if name is over 16, strip 6th to ...
mov si,offset keyb ;if name is =< 16 chars, repeat till full
add si,002h
mov di,offset should_be
add di,006h
mov al,010h
div bl ;full times to repeat is in al, remaining is in ah
;(bl= number of valid letters in code)
loopje: mov si,offset keyb ;if name is =< 16 chars, repeat till full
add si,002h
mov cl,bl
repz movsb ;put it in once
dec al ;one done
cmp al,000h ;check if needs repeating
jz last_time ;no, go put in remaining
jmp loopje ;yes, do it again
last_time: mov si,offset keyb
add si,002h
mov cl,ah
repz movsb ;put in the remaining chars
ret
strip: mov si,offset keyb
add si,002h
mov di,offset should_be
add di,006h
mov cl,006h
repz movsb ;put 1st 6 in place
xor ax,ax
mov al,bl
mov cl,002h
div cl
mov si,offset keyb
xor cx,cx
mov cl,al
add si,cx ;put next 4 in place
mov cl,004h
repz movsb
sub bl,004h ;six from end, the two non chars
;from beginning 'keyb' counted
mov si,offset keyb
add si,bx
mov cl,006h
repz movsb
ret
no_input: mov dx,offset notright
mov ah,009h
int 21h
jmp exit
read_input endp
;******************************************************************************
; spam the code
;******************************************************************************
spam PROC near
mov ax,@data
mov ds,ax
mov es,ax
mov di,offset should_be
mov al,byte ptr[di]
cmp al,'S'
MOV AH,09H
jnz wormessage
MOV DX,offset personals ;display personal message
INT 21H
jmp dispcode
wormessage: MOV DX,offset personalw ;display personal message
INT 21H
dispcode: MOV AH,09H
MOV DX,offset to_enter ;display right code
INT 21H
RET
spam endp
;******************************************************************************
; the main program
;******************************************************************************
begin PROC near
mov ax,@data
mov ds,ax
mov es,ax
MOV AH,09H
MOV DX,offset header ;display header
INT 21H
CALL input ;get user input
call read_input
CALL calculate ;calculate code from input
call checksum ;calculate last char
CALL spam ;spam calculated code
exit: MOV AX,4C00H ;and exit
INT 21H
begin ENDP
END START
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -