Adjust code to a program which puts asterisks in all characters of the output display (rather than just the first character) when the program halts due to an error.
; Convert intext to upper case with some OS 'flavor' JMP UCstart intext: DB "In Text !@#" ; Variable DB 0xFF ; String terminator ucA: DB 'A' ; upper case A value ucZ: DB 'Z' ; upper case Z value lca: DB 'a' ; lower case a value lcz: DB 'z' ; lower case z value lcuc: DB 0d ; Will hold lc to uc difference ; not needed outbuf: DB 0xE8 ; output buffer start memloc UCstart: ; Calculate the difference between lca and ucA values ; Store result in lcuc MOV A, [ucA] MOV B, [lca] SUB B, A MOV [lcuc], B ; For remainder ; reg C has the memloc of the current char ; reg B has the current output offset ; reg A has the current char ASCII value MOV C, intext ; Get 1st char of intext memloc MOV B, 0x00 ; Set output buffer offset to 0 loopch: MOV A, [C] ; Get next intext char value CMP A, 0xFF ; Check if string terminator JNE convch ; If not convert the character HLT ; normal termination (i.e., string terminator) convch: CMP A, [lca] ; Is char >= lc a? JB showch ; If not show the char CMP A, [lcz] ; Is char <= lc z? JA showch ; If not show the char SUB A, [lcuc] ; Subtract to convert to upper case showch: MOV [OBchar], A ; 'Pass' the ASCII character MOV [OBloc], B ; 'Pass' the buffer offset CALL OBch ; Have the 'OS' output the character INC B ; increment output buffer memloc INC C ; increment intext memloc JMP loopch ; process next character ; OS code OBbeg: DB 0xE8 ; Output buffer begin location OBend: DB 0xFF ; Output buffer end location OBchar: DB 0x00 ; Passed ASCII character to output OBloc: DB 0x00 ; Passed output buffer offset OBch: PUSH A ; preserve reg A value PUSH B ; preserve reg B value MOV A, [OBchar] ; get the 'passed' char in reg A MOV B, [OBloc] ; get the 'passed' buffer offset ADD B, [OBbeg] ; Calc output buffer location CMP B, [OBbeg] ; Check if location >= OB begin loc JB OBErr ; If not jump to error CMP B, [OBend] ; Check if location <= OB end loc JA OBErr ; if not jump to error MOV [B], A ; put character into output buffer POP B ; restore reg B POP A ; restore reg A RET OBErr: ; Invalid output attempted ; a 'real' OS would have the app exit with an error code MOV B, [OBbeg] ; Get loc of output buffer MOV [B], '*' ; put an * to indicate an issue HLT ; error termination
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more