How should I change the code using the 8085 microprocessor to execute and read what is in quotes?

63 Views Asked by At

I am trying to write a code in an assembly programming language using 8085 microprocessor. The code should change all uppercase characters into lowercase taking into account that the text is written in ASCII code. My simulator does not read what is in the brackets, to be more precise cpi 'A' (6th row), the same problems happen with other text in the brackets. Maybe someone knows how to change it so the simulator would be able to read that.

lowercase: mov b, a ; move N (length of text) to register B
    mov c, h ; move high byte of HL to register C
    mov d, l ; move low byte of HL to register D

lowercaseloop: ldax d ; load character from memory address pointed to by HL into accumulator
    cpi 'A'; compare character in accumulator with uppercase 'A'
    jc lowercaseskip ; if character is less than 'A', skip to next character
    cpi 'Z'+1 ; compare character in accumulator with one greater than uppercase 'Z'
    jnc lowercaseskip ; if character is not less than or equal to 'Z', skip to next character
    add a, 'a'-'A' ; convert uppercase character to lowercase
    stax d ; store character in accumulator back to memory address pointed to by HL

lowercaseskip: inx h ; increment high byte of HL
    inx d ; increment low byte of HL
    dec b ; decrement B (counter)
    jnz lowercaseloop ; repeat loop until B becomes zero
    ret ; return to caller
0

There are 0 best solutions below