Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/28/02 13:09
Read: times


 
#28059 - RE: Clean code
I came across the following method of outputting text strings in a bit of code I used to have to maintain. It's horrible but it does allow you to place the text 'inline' in your code:

; code
LCALL OUTPUTSTRING
DB 0AH,0DH,"My Text",00H
; code

OUTPUTSTRING:
POP DPH
POP DPL
LOOP:
MOV A,#00H
MOVC A,@A+DPTR
JZ EXITOUTPUTSTRING
LCALL TXCHAR
INC DPTR
SJMP LOOP
EXITOUTPUTSTRING:
INC DPTR
PUSH DPL
PUSH DPH
RET


TXCHAR:
JNB TI, TXCHAR
CLR TI
MOV SBUF,A
RET

If you're just starting out do have a look at the many debates on this forum regarding 'C' versus assembler. You could save yourself a lot of time.

List of 20 messages in thread
TopicAuthorDate
Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code - to Donald            01/01/70 00:00      
RE: Clean code George, Donald            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Null terminator            01/01/70 00:00      
CRLF? LFCR?            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Clean code - to Philip            01/01/70 00:00      
RE: Null terminator            01/01/70 00:00      
Hyperterminal alternative            01/01/70 00:00      
RE: Clean code            01/01/70 00:00      
RE: Hyperterminal alternative            01/01/70 00:00      
RE: Hyperterminal alternative            01/01/70 00:00      

Back to Subject List