|
Written by Various Authors
|
getpass
by Jake Bush
;Summary: Get a password type input.
;Compatibility: x86
;Notes: input:
; BX = Max length to save.
; ES:DI = Location to save the input. (Size must be at least
; BX + 1).
; output:
; none.
getpass:
pusha
xor cx, cx
.1: xor ah, ah
int 16h
cmp al, 0dh
je .4
cmp cx, 0h
je .2
cmp al, 8h
je .3
.2: cmp cx, bx
je .1
cmp al, 20h
jb .1
stosb
pusha
mov al, '*'
mov ah, 0eh
xor bh, bh
mov cx, 1h
int 10h
popa
inc cx
jmp .1
.3: dec di
dec cx
pusha
mov al, 8h
mov ah, 0eh
xor bh, bh
mov cx, 1h
int 10h
mov al, ' '
int 10h
mov al, 8h
int 10h
popa
jmp .1
.4: mov al, 0h
stosb
popa
ret
strcmp
by Jake Bush
;Summary: Compares two strings.
;Compatibility: x86
;Notes: input:
; DS:SI = String 1.
; ES:DI = String 2.
; output:
; CF = 0 = Equal
; 1 = Unequal
strcmp:
pusha
.1: mov al, [ds:si]
mov ah, [es:di]
cmp ah, al
jne .2
cmp ax, 0h
je .3
inc si
inc di
jmp .1
.2: stc
jmp .4
.3: clc
.4: popa
ret
strlwr
by Jake Bush
;Summary: Converts all the characters in a ASCIIz string to lower-case.
;Compatibility: x86
;Notes: input:
; DS:SI = Location of an string to convert.
; ES:DI = Location to save the converted string.
; output:
; none.
strlwr:
pusha
.1: lodsb
cmp al, 0h
je .3
cmp al, 41h
jb .2
cmp al, 90h
ja .2
or al, 00100000b
.2: stosb
jmp .1
.3: popa
ret
strupr
by Jake Bush
;Summary: Converts all the characters in a ASCIIz string to upper-case.
;Compatibility: x86
;Notes: input:
; DS:SI = Location of an string to convert.
; ES:DI = Location to save the converted string.
; output:
; none.
strupr:
pusha
.1: lodsb
cmp al, 0h
je .3
cmp al, 61h
jb .2
cmp al, 7ah
ja .2
xor al, 00100000b
.2: stosb
jmp .1
.3: popa
ret
|