1 / 11

Assembly

Assembly. Session 10 string manipulations. MOVING Strings. Determine Current Location Determine New Location Determine number of bytes to transport TRANSPORT. START. Flow. init current + future pointers. Read Current Write Future. char was a $.

gil
Download Presentation

Assembly

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. Assembly Session 10 string manipulations

  2. MOVING Strings • Determine Current Location • Determine New Location • Determine number of bytes to transport • TRANSPORT

  3. START Flow init current + future pointers Read Current Write Future char was a $ increase both currentand future pointers by 1 YES NO STOP

  4. Code PROG EQU 0100h FROM EQU 0020h TO EQU 8000h EOT EQU 0024h ;---------------------------------------------------------- ORG 0000h jp PROG ; ;---------------------------------------------------------- ORG FROM DB "Inholland Is Great!!$" ;---------------------------------------------------------- ORG PROG ; This routine moves a string to ; another location and ends with a stop ; when a $ is reached ; ld BC,FROM ld HL,TO loop: ld a,(BC) ld (hl),a inc BC inc HL ; cp EOT jp nz,loop ; ; endmov: halt

  5. String reverse diverse methods: • using pointers • move one forward, the other backwards • using stack • stack is first in, last-out

  6. principle H E L L H E L L L L E H O O O PUSH POP

  7. Flow START stack the string unstack the string STOP

  8. Stack stack the string point at stringmake a token Read pointed characterstack character and eventual token char was end of string? increase pointer NO YES

  9. Unstack unstackthe string point at destination POP a characterand store it at destination Token? increase pointer NO YES

  10. BUBBLESORT H E L L O E H L L O E H L L O E H L L O E H L L O

  11. BUBBLESORT 2 E H L L O E H L L O E H L L O E H L L O E H L L O

More Related