1 / 16

การประมวลผลสตริงและตาราง

การประมวลผลสตริงและตาราง. การประมวลผลสตริงมักจะทำกับสิ่งต่อไปนี้ ย้ายข้อมูลสตริงจากตำแหน่งหนึ่งไปยังอีกตำแหน่งหนึ่ง ค้นหาไบต์หรือเวิร์ดข้อมูล เก็บตัวอักขระลงในสตริง เปรียบเทียบข้อมูลสตริง. กลุ่มคำสั่งสตริง. MOVSB,MOVSW,MOVSD ย้ายข้อมูลสตริงจากหน่วยความจำตำแหน่งหนึ่งไปยังอีกตำแหน่งหนึ่ง

obert
Download Presentation

การประมวลผลสตริงและตาราง

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. การประมวลผลสตริงและตารางการประมวลผลสตริงและตาราง • การประมวลผลสตริงมักจะทำกับสิ่งต่อไปนี้ • ย้ายข้อมูลสตริงจากตำแหน่งหนึ่งไปยังอีกตำแหน่งหนึ่ง • ค้นหาไบต์หรือเวิร์ดข้อมูล • เก็บตัวอักขระลงในสตริง • เปรียบเทียบข้อมูลสตริง

  2. กลุ่มคำสั่งสตริง • MOVSB,MOVSW,MOVSD ย้ายข้อมูลสตริงจากหน่วยความจำตำแหน่งหนึ่งไปยังอีกตำแหน่งหนึ่ง • CMPSB,CMPSW,CMPSD เปรียบเทียบข้อมูลในหน่วยความจำสองตำแหน่ง • SCASB,SCASW นำข้อมูลในสตริงมาเปรียบเทียบกับค่าในหน่วยความจำ • STOSB เก็บสตริงลงหน่วยความจำ • LODSB นำค่าสตริงจากหน่วยความจำมาเก็บใน AX

  3. MOVSB ย้ายไบต์ข้อมูลจากหน่วยความจำตำแหน่ง DS:SI ไปยังตำแหน่ง ES:DI STRING1 DB ‘HELLO’ STRING2 DB 5 DUP (?)

  4. แฟลกทิศทาง (Direction flag : DF) cld ;clear Direction flage std ;set Direction flag

  5. Ex: ตัวอย่างโปรแกรม STRING1 DB ‘HELLO’ STRING2 DB 5 DUP (?) MOV AX , @DATA MOV DS , AX MOV ES , AX LEA SI , STRING1 LEA DI , STRING2 CLD MOVSB MOVSB

  6. REP Prefix REP Repeat while CX > 0 REPZ , REPE Repeat while the Zero flag is set and CX >0 REPNZ , REPNE Repeat while the Zero flag is clear and CX > 0

  7. Ex: ตัวอย่างโปรแกรมคัดลอกข้อมูล 10 ไบต์ CLD MOV SI , OFFSET string1 MOV DI , OFFSET string2 MOV CX , 10 REP MOVSB

  8. การเลื่อนค่าตัวชี้

  9. การเปรียบเทียบสตริง

  10. EX : โปรแกรมเปรียบเทียบค่าใน STRING1 STRING1 DB ‘ABC’ Before SCASB MOV AX,@DATA DI MOV AX,ES STRING1 ‘A’ ‘B’ ‘C’ CLD LEA DI , STRING1 AL ‘B’ MOV AL,’B’ SCASB SCASB

  11. EX : โปรแกรมเปรียบเทียบค่าใน STRING1 STRING1 DB ‘ABC’ After SCASB MOV AX,@DATA DI MOV AX,ES STRING1 ‘A’ ‘B’ ‘C’ CLD LEA DI , STRING1 AL ‘B’ MOV AL,’B’ ZF = 0 SCASB SCASB

  12. EX : โปรแกรมเปรียบเทียบค่าใน STRING1 STRING1 DB ‘ABC’ After SCASB MOV AX,@DATA DI MOV AX,ES STRING1 ‘A’ ‘B’ ‘C’ CLD LEA DI , STRING1 AL ‘B’ MOV AL,’B’ ZF = 1 SCASB SCASB

  13. EX : โปรแกรม Store String MOV AH , @DATA MOV ES,AX Before STOS LEA DI,STRING1 DI CLD STRING 1 ‘H’ ‘E’ ‘L’ ‘L’ ‘O’ MOV AL,’A’ STOSB AL A STOSB

  14. EX : โปรแกรม Store String MOV AH , @DATA MOV ES,AX After STOSB LEA DI,STRING1 DI CLD STRING 1 ‘A’ ‘E’ ‘L’ ‘L’ ‘O’ MOV AL,’A’ STOSB AL A STOSB

  15. EX : โปรแกรม Store String MOV AH , @DATA MOV ES,AX After STOSB LEA DI,STRING1 DI CLD STRING 1 ‘A’ ‘A’ ‘L’ ‘L’ ‘O’ MOV AL,’A’ STOSB AL A STOSB

  16. CONVERT PROC ; input : AL = number ; output : AX = ASCII digits, AL = high digit , AH = low digit MOV AH , 0 MOV DL , 10 DIV DL OR AX , 3030H RET CONVERT ENDP

More Related