彙編開啟檔案 變換大小寫

2021-06-05 17:31:14 字數 1607 閱讀 2652

**在emu8086除錯成功!

assume cs:code,ds:data,es:data

data segment

readlen equ 60000

buf db readlen dup(0)

filename db 20,0,20 dup(0)

reallen dw 0

msg db 0dh,0ah,'please input filename:','$'

err db 0dh,0ah,'open error!','$'

data ends

code segment

start proc

mov ax,data

mov ds,ax

mov es,ax

mov dx,offset msg

mov ah,9

int 21h

mov dx,offset filename    ;輸入檔名

mov ah,0ah

int 21h

mov si,offset filename+2

mov bl,filename+1

mov bh,0

mov byte ptr [si+bx],0 ;結尾部填0,便於識別尾部

mov ax,3d02h     ;開啟檔案供讀寫

lea dx,filename+2

int 21h

jnc read_file

lea dx,err        ;開啟檔案出錯!

mov ah,9

int 21h

mov ax,4c00h    ;返回dos

int 21h                          

read_file:

mov bx,ax   ;控制代碼傳送

mov cx,readlen

mov dx,offset buf

mov ah,3fh   ;讀檔案

int 21h

mov reallen,ax  ;實際讀入的位元組數

lea si,buf

lea di,buf

mov cx,reallen

call chg

mov cx,0   ;移動檔案指標

mov dx,0

mov ax,4200h

int 21h

mov dx,offset buf ;寫檔案

mov cx,reallen 

mov ah,40h

int 21h

mov ah,3eh    ;關閉檔案

int 21h

;mov ax,4c00h

;int 21h

start endp      ;結束一段子程式

chg proc         ;另一段子程式,變換大小寫

cldredo:lodsb

cmp al,61h

jb s

cmp al,7ah

ja s

and al,11011111b

s:stosb

loop redo 

retchg endp

code ends

end start

VBA大小寫變換

返回轉成小寫的 string。語法 lcase string 必要的 string 引數可以是任何有效的字串表示式。如果 string 包含 null,將返回 null。說明 只有大寫的字母會轉成小寫 所有小寫字母和非字母字元保持不變。本示例使用lcase函式來將某字串轉成全部小寫。dim uppe...

彙編 大小寫轉換

1 data segment 2 定義字串緩衝區 3 maxlen 表示允許輸入的最大字元數量 4 actlen 表示實際輸入的數量 5 str 用於儲存輸入的字串 6 以下面為例,允許最大輸入5個字元,如果str後面的長度也定義為5,則實際輸入的字元數量僅為4,7 因為最後乙個字元會用於儲存0dh...

mysql 區分大小寫 大小寫敏感 配置

linux下mysql預設區分大小寫 windows下mysql預設不區分大小寫 檢視是否區分大小寫 lower case table names引數詳解 lower case table names 0 其中 0 區分大小寫,1 不區分大小寫 mysql在linux下資料庫名 表名 列名 別名大小...