@Rick
It was getting late(early) when I made my last post.
SETQ2 is back in the game.
Here's the code that currently works at this end.
Note: I am still using the #@ combination?
con
sys_clk = 50_000_000
baud_rate = 115_200
rx_pin = 63
tx_pin = 62
' start off HUBEXEC in HUBRAM
dat orgh 1
' move the data space to COGRAM
loc adra,@data_start
setq #$1FF
rdlong $000,adra
' move the code to LUT for LUTEXEC
' loc adra,@data_start + $200 << 2
mov adra,#@lut_start
setq2 #$1FF
rdlong $000,adra
' zero the HUBRAM after data & code is moved, to prove we are in LUTEXEC
:loop
mov ptra, @data_start << 2
wrlong val, ptra++
djnz count, @:loop
jmp @$200 ' jump to LUT LONG #$000
' build the $3FF image you will copy to COG + LUT
data_start
org $0, $400 << 2
long 0[16]
regx long $12345678
bit_time long sys_clk / baud_rate
val long 0
count long $400
timer long 0 'res 1
dx long 0 'res 1
nibc long 0 'res 1
code0 long 0 'res 1
lut0 long 0 'res 1
' res $200 - lut0
data_end
' this is ugly - I'd like to say org $200 here or SEGLUT
' instead of just doing a res to account for the rest of COG space
' the address counter has moved up to start of LUT
lut_start long $0FFFFFFF ' dummy value, easy to find (NOP)
setb outb,#tx_pin
setb dirb,#tx_pin
wait4start testb inb,#rx_pin wz 'press a key to start in PST
if_nz jmp #wait4start
'### TEST CODE ####
rdlut lut0,#0 ' I expect to pick up $0FFFFFFF
' from LUT address $0 here
mov val,regx
call @show_hex
call @newline
mov val,lut0
call @show_hex
call @newline
here jmp @here
'============================================================
newline mov dx,#13
send_byte setb dx,#8
shl dx,#1
getcnt timer
rep @endrep,#10
testb dx,#0 wz
setbnz outb,#tx_pin
addcnt timer,bit_time
waitcnt
shr dx,#1
endrep
ret
'============================================================
show_hex mov nibc,#8 '8 x nibbles
show_hex2 mov dx,val
shr dx,#28
cmp dx,#9 wz,wc
if_a add dx,#"A"-10
if_be add dx,#"0"
call @send_byte
shl val,#4
djnz nibc,@show_hex2
ret
Comments
I used to think it was good.
PNUT tells me "Constant must be from 0-511"
Of course, I haven't found a combination of #@!#@$% that works...or even compiles cleanly.
Yes 511 longs loaded,well spotted.
@Rick
It was getting late(early) when I made my last post.
SETQ2 is back in the game.
Here's the code that currently works at this end.
Note: I am still using the #@ combination?
Chhers
Brian
FWIW #@ returns the value of $8D which is the same value that Pnut shows in the Ctrl-M "List - Toggle PASM" screen.
That appears to be the byte offset of lut_start in hub ram. At which point, you would think "#lut_start" would have given you the same value.
#lut_start returns $64