1

I need my output to be put in colons on the terminal but they always display in the first row. I need to implement a part of code (which I am trying to find out on YouTube but they are using different microprocessors and I am not very familiar with assembly language to make the difference) to make instead of a space an enter to jump to the next row.

For example, how can I print the output of this loop in a new line every time this loop runs:

Label2:
 JSR out2hex                ; print the counter
 LDAB #$3A                  ; load to B ASCII code of ":"
 JSR putchar                ;print to the screen the character
 LDAB #$24                  ; load to B the character of ASCII code of "$"
 JSR putchar                ; print to the screen the character
 LDAB A,X                   ; load to B the value of X+A
 JSR out2hex                ; print into the screen the hex value of it
 INCA                       ; increment the counter, the value in   
                            ;accumulator A
 LDAB #$82                  ; load to B the ASCII code of ","
 JSR putchar                ; print the character of it
 CMPA #20                   ; compare the counter with 20 (which represents  
                            ;the number of elements in the array
 BNE Loop2                  ; branch if the counter in A is not equal to 20     
                            ;to the Loop2
Bixo
  • 95
  • 10
  • 1
    What terminal? Perhaps you need carriage return *and* newline? – Peter Cordes Mar 30 '20 at 14:02
  • @Peter Cordes. Yes there has to be with carriage return but I do not know the code which does it. The terminal is on the CodeWarrior software. – Bixo Mar 30 '20 at 14:19
  • newline `'\n'` is ASCII code 10 (0xa). – Peter Cordes Mar 30 '20 at 14:23
  • @Peter Codes. I edited the question with a current code that I have, every time this code runs it displays the output in a row. Can you play modify it so it can show the output in different rows every time it runs? I am just trying to get the idea of how to list different outputs on the lines that the program needs. – Bixo Mar 30 '20 at 14:35
  • Have you even tried outputting an ASCII newline carriage return with `putchar`? Your current code doesn't output either, so it's not surprising the cursor stays on the same line. – Peter Cordes Mar 30 '20 at 14:36
  • $82 is not ASCII (0-127), and it's certainly not comma (as comments say). `Label2` is same as `Loop2`? Replace $82 (that you call comma) with ASCII 13 followed by ASCII 10 to have a CR/LF sequence printed. Learn the most common ASCII codes by heart, not that difficult. This is useful for any language, not just assembly. – tonypdmtr Apr 02 '20 at 22:24

0 Answers0