-
Lookup Table
Hi anyone. I want to make a lookup table in my program. At the first I wanted to make it with LOOKUP. But I want to use program memory instead of RAM. So I think
that LOOKUP instruction can't help me in this regard! I make this lookup table in asm:
ASM
TABLE
ADDWF 02,1
RETLW 0X01
RETLW 0X02
RETLW 0X04
RETLW 0X08
RETLW 0X10
RETLW 0X20
RETLW 0X40
.
.
.
RETLW 0X80
ENDASM
END
I recall table with CALL TABLE. Unfortunately it doesn't work. Why? What should I do? Thanks for helpful replies.
-
Hi,
PEEKCODE and POKECODE should do it nicely ... just read the manual ...
Alain
-
also find this excellent thread started by Melanie
"Making Program Code Space your playground"
-
Hi yasser,
What precisely are you trying to do? PBP does not use RAM to create lookup tables except for the index & result variables.
-
Peek, Poke, DB, ASM ...?
Hi and thanks for your replies. I visited above links. I want to save data on program memory space and send them to LEDs byte by bytes. This is a part of my program:
Send:
StrAddr = $370
for j = 0 to 2
CharAddr = StrAddr + (80*j)
for k = 0 to 79
PeekCode CharAddr+k, x
GOSUB DISPLAY
next k
next j
RETURN
Send_Back:
StrAddr = $460
for j = 2 to 0 step -1
CharAddr = StrAddr + (80*j)
for k = 79 to 0 STEP -1
PeekCode CharAddr+k, x
GOSUB DISPLAY
next k
next j
RETURN
'************************************************* ****************
' Introduction of Image *
'************************************************* ****************
@ org 370h
Pokecode $00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$0 1,$01,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00, $00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$0 1,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00, $00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$01,$0 1,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00, $00,$01,$01,$01,$03
Pokecode $00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$0 1,$01,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00, $00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$0 1,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00, $00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$01,$0 1,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00, $00,$01,$01,$01,$03
Pokecode $00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$0 1,$01,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00, $00,$00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$0 1,$01,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00, $00,$00,$01,$01,$01,$03,$00,$00,$00,$00,$01,$01,$0 1,$03,$00,$00,$00,$00,$01,$01,$01,$03,$00,$00,$00, $00,$01,$01,$01,$03
-------------------------------------------
It doesn't work. Why?
Can you tell me about DB usage? How can I use it? I used ASM code (as I said above). Why didn't it work correct?
Thanks alot
-
-
Thanks