Shop OBEX P1 Docs P2 Docs Learn Events
Running in LUT exec mode - Page 2 — Parallax Forums

Running in LUT exec mode

2»

Comments

  • ozpropdev wrote: »
    mindrobots wrote: »
    Good, it's not just me, we're both crazy!!! :)
    Crazy is good, right? :o

    I used to think it was good.
              mov	ptrb,#@lut_start
    

    PNUT tells me "Constant must be from 0-511"

    Of course, I haven't found a combination of #@!#@$% that works...or even compiles cleanly.


  • @Ray
    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?
    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
    
    Chhers
    Brian :)


  • @Ray
    FWIW #@ returns the value of $8D which is the same value that Pnut shows in the Ctrl-M "List - Toggle PASM" screen.
    TYPE: 4A   VALUE: 02FAF080   NAME: SYS_CLK
    TYPE: 4A   VALUE: 0001C200   NAME: BAUD_RATE
    TYPE: 4A   VALUE: 0000003F   NAME: RX_PIN
    TYPE: 4A   VALUE: 0000003E   NAME: TX_PIN
    TYPE: 55   VALUE: FFF00019   NAME: LOOP
    TYPE: 55   VALUE: FFF00029   NAME: DATA_START
    TYPE: 55   VALUE: 04000069   NAME: REGX
    TYPE: 55   VALUE: 0440006D   NAME: BIT_TIME
    TYPE: 55   VALUE: 04800071   NAME: VAL
    TYPE: 55   VALUE: 04C00075   NAME: COUNT
    TYPE: 55   VALUE: 05000079   NAME: TIMER
    TYPE: 55   VALUE: 0540007D   NAME: DX
    TYPE: 55   VALUE: 05800081   NAME: NIBC
    TYPE: 55   VALUE: 05C00085   NAME: CODE0
    TYPE: 55   VALUE: 06000089   NAME: LUT0
    TYPE: 55   VALUE: 0640008D   NAME: DATA_END
    TYPE: 55   VALUE: 0640008D   NAME: LUT_START     <<<<<<<<<<<<<
    TYPE: 55   VALUE: 07000099   NAME: WAIT4START
    TYPE: 55   VALUE: 094000BD   NAME: HERE
    TYPE: 55   VALUE: 098000C1   NAME: NEWLINE
    TYPE: 55   VALUE: 09C000C5   NAME: SEND_BYTE
    TYPE: 55   VALUE: 0C0000E9   NAME: ENDREP
    TYPE: 55   VALUE: 0C4000ED   NAME: SHOW_HEX
    TYPE: 55   VALUE: 0C8000F1   NAME: SHOW_HEX2
    
  • ozpropdev wrote: »
    @Ray
    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 $8D
    #lut_start returns $64
Sign In or Register to comment.