This preview shows page 1. Sign up to view the full content.
Unformatted text preview: BRNZP AFTERSWAP AFTERSWAPADD R1 R1 #1 next mem address AND R0 R0 #0 zero R0 AND R6 R6 #0 zero R6 ADD R6 R7 #0 put last address into R6 NOT R6 R6 ADD R6 R6 #1 negative of last address ADD R0 R1 R6 subtract addresses BRNP STORECHARS if not last address, compare again BRZ GOAGAIN if last address, test if there were any swaps GOAGAINADD R4 R4 #0 BRZ END If R4 is zero, no swaps, then sort is complete BRP RESET if R4 is anything else, there were swaps, reset. RESETAND R4 R4 #0 reset R4 to zero ADD R1 R1 #-16 set R1 back to first char addr BRNZP STORECHARS compare again ENDTRAP x25 stop program .END...
View Full Document
- Spring '07