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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/16/05 07:44
Read: times


 
#99493 - 16 bit table
Responding to: ???'s previous message
If I understand it right, you have an 8 bit index and want to read up to 256 values of 16 bit:

        mov     a, r0                   ;r0 = index (8 bit)
        add     a, r0                   ;index * 2
        mov     dptr, #table            ;table base
        jnc     m1
        inc     dph                     ;upper 128 values
m1:     mov     r0, a
        movc    a, @a+dptr              ;get high byte
        xch     a, r0
        inc     a
        movc    a, @a+dptr              ;get low byte
        mov     dpl, a
        mov     dph, r0
        ret

table:  dw      1, 5, 1234, 65534       ;table of 16 bit values
        dw      0, 255



Peter


List of 14 messages in thread
TopicAuthorDate
Code optimization suggestion?            01/01/70 00:00      
   Table            01/01/70 00:00      
      Table?            01/01/70 00:00      
         Another table ...            01/01/70 00:00      
   CJNE            01/01/70 00:00      
      Everybody is saying to use a table            01/01/70 00:00      
         My confsion            01/01/70 00:00      
   two tables            01/01/70 00:00      
      Tables            01/01/70 00:00      
         sure            01/01/70 00:00      
            gurus don't subtract constants            01/01/70 00:00      
   16 bit table            01/01/70 00:00      
      bit table            01/01/70 00:00      
   Table indexing            01/01/70 00:00      

Back to Subject List