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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/19/01 03:05
Read: times


 
#15852 - RE: Monitor Routine for Printing a Strin
i like the "flat-return" in that. it beats restoring the stack for a RET instruction.

the code appears to be unusable though. the loop does implement a buffer or pointer. the code prints the first character, awaits timing for the next byte to be sent, and instead of loading it, it jumps to the character (or next) as it drops into printdone to execute the character as an opcode. bad idea.

the missing code would loop on characters until the termination sentinal was loaded, THEN just to printdone.

hmmmm, want to make it more efficient and save a byte?

mov a,#1h becomes clr a and the effective return address is the termination 0 which is interpreted as a NOP instruction.

in fact, since the exit was on a 0h loaded into the accumulator from the table, you can remove the mov a,#1h altogether and not bother with clr a sinces its deterministically zero.

;same code sped up a little.
;watchdog support removed
;-----
PRINT:
pop dph
pop dpl
sjmp begin ;jmp around to min loop time

mchrok: ;loop for next character
mov sbuf,a
loop1X: CPL WATCH_DOG ;for long strings
JNB ti,loop1X ;wait till sent
CLR ti ;drop thru to fetch next char

prtstr: ;fetch a character and test it
clr a
movc a, @a+dptr
inc dptr ;bump for next fetch or ret adr
cjeq a,#0h,mchrok ;jif not term sentinal
jmp @a+dptr ;else jmp to next opcode
;-----

cool
duh

List of 6 messages in thread
TopicAuthorDate
Monitor Routine for Printing a String            01/01/70 00:00      
RE: Monitor Routine for Printing a String            01/01/70 00:00      
RE: Monitor Routine for Printing a String            01/01/70 00:00      
RE: Monitor Routine for Printing a String            01/01/70 00:00      
RE: Monitor Routine for Printing a Strin            01/01/70 00:00      
RE: Monitor Routine for Printing a Strin            01/01/70 00:00      

Back to Subject List