Jump to content
43oh

noexec

Members
  • Content Count

    0
  • Joined

  • Last visited

Reputation Activity

  1. Like
    noexec reacted to Mac in Compact async serial tx   
    In assembly language programs, how about storing const strings, two characters per word, inline with your code? There will be two (2) words overhead for each string plus a one time cost of fourteen (14) words for a PutStr subroutine. The subroutine pulls the string address from the stack, prints the string, then returns to the instruction immediately following the inline string. This method should save a bunch of memory when you have more than one const string to print.
     
    Food for thought. Kind regards, Mike
     

    call #PutStr ; print "in-line" const string .char "Test",10,13,0 ; "text" + + + 0 terminator

    PutStr ; { Mike McLaren } 14 words mov.w @SP, R9 ; copy return addr to R9 bump mov.b @R9+, R12 ; copy string char to R12 tst.b R12 ; end of string? jz wrap ; yes, branch, else call #Put232 ; output the character and jmp bump ; loop wrap bit.b #1, R9 ; an odd return address? jz exit ; no, branch, else inc.w R9 ; force word boundary exit mov.w R9, 0(SP) ; update the return address ret ; ret to 1st instruct after string
×
×
  • Create New...