[A83] Re: LCDBusy


[Prev][Next][Index][Thread]

[A83] Re: LCDBusy




In a message dated Mon, 19 Mar 2001 10:16:50 AM Eastern Standard Time, "Robert Maresh" <gardenerbm@netzero.net> writes:

<< Why do we use this routine:  (33 clocks)

                 LCD_BUSY::
                     PUSH    AF
                     inc     hl

                     dec     hl
                     POP     AF
                     RET



When we could use this one: (32, could change it to be 33?)

LCD_BUSY:

  halt
  halt
  halt
  halt
  halt
  halt
  halt 
  halt
  ret

Sure, it's four bytes larger, but I thought halt saves on battery life.  Is this one of TI's oversights, or am I completely wrong???

Bob Maresh


 >>

The latter :-)  While opcode tables list halt as 4 t-states, that's a very misleading statement.  Sure it takes 4 t-states for the processor to load and process the opcode, but what halt actually DOES is wait for the next interrupt before continuing execution, which takes approximately 1/200th of a second.  Your 8 halts would take a MUCH longer time to execute than any normal opcodes, because halts don't just execute through but rather serve like a timer.  That's why they save battery power--the calculator sits and does nothing for 1/200th of a second.

You could use nops instead of halts if you actually wanted to save a t-state, but there's really no point to that...