You can place it in that position - BUT as You maybe see I use some more LONG's after Yours and before END of COG - 8 Longs
It is why I fixed it to position I use
long "C"[$1D8-$]
$1D4 + 16 byte identifier (maybe removed to save space)
Currently I am using 19 longs although I am hoping to reduce this to 16 longs. Would it help if I started the LmmFun at cog $1E0 for the time being???
--------------------------------------------------------
|Change and to show diferent part of COG |
| COG IStart List_Count Var_s_Start Var_Count |
--------------------------------------------------------
1F0- 00000000 0000000A 000001E4 00000008
.
.
4 Long's after it are 2 spare ones
And 2 placeholder for INDA, INDB
Ok, I understand some of what you are saying. I will start the my 16 longs at $1E0 beginning with LmmFun. For now I also need an extra 3 longs so I will place them before $1E0, so at $1DD and if I need a few more (temporary) I will go backwards from that. This way I can put your $1F0-1F7 in my code for you to make it easier for you.
I will look at putting in the cmd03 bits in, but commented out, so its easy for you to enable.
I will drop out the identifier in cog ram. No need for it any more.
I will post an update shortly and you can comment on what I've done.
.
lmm_bittime long _bitrate ' bit rate for baud
''----------------------------------- 0_Dump Help Variables -------------------------------------------
long LMM_Pos-1
' long LMM_Pos
'LMM_Pos org $
Showp_ org $
'' $1F2
I_Start long 0 ''IStart
I_countL Long 10 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
long 0 ''Spare Long's
count long 5
BYTE "INDA"
BYTE "INDB"
.
.
.
Change in:
>
:nothex
MOV lmm_x, I_Start '' 0000000000 --- I_Start --- Variable that I have after Yours COG_LMM
' 'JFWD @_HubReturn ' \ <jump fwd>
rdlong lmm_pc, lmm_pc ' | JUMP...
long @_HubReturn ' / ...PC = ADDR <returns to calling routine>
.
--------------------------------------------------------
|Change and to show diferent part of COG |
| COG [B][COLOR=#ff0000] t[/COLOR][COLOR=#ff0000]IStar[/COLOR][/B] [B][COLOR=#0000ff]List_Count[/COLOR][/B] Var_s_Start Var_Count |
--------------------------------------------------------
1F0- [B][COLOR=#ff0000]00000000[/COLOR][/B] [B][COLOR=#0000ff]00000004[/COLOR][/B] 000001E4 00000008
.
Sapieha,
Here is what I have now. I see you added another. But is this what you are after???
BTW I have changed command M to L = List. I will change the call to _LIST instead of _DUMP later as well to be consistent.
Sapieha,
Here is what I have now. I see you added another. But is this what you are after???
BTW I have changed command M to L = List. I will change the call to _LIST instead of _DUMP later as well to be consistent.
'-------------------------------------------------------
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
long "C"[$1D8-$-10] ''Hard coded COG LMM Extra Variables --------
'' If You NEED add some more longs Change "C"[$1D8-$-10-X_longs]
''===============================================================================================
LMM_Pos ---------------- Show Start of used area (LMM_Pos - 1 = USER Code area in Longs
''===============================================================================================
strptr_version long @_str_vers ' hub address of version string
strptr_code long @_str_hcode ' hub address of code header string
strptr_long long @_str_hlong ' hub address of code header string
strptr_msg1 long @_str_msg1 ' hub address of message1
'count long I_countL '' Moved to one of free longs Space after MY variables
wait long 0
delay500ns long _xinfreq /2 ' 0.5 sec
delay5s long _xinfreq * 5 ' 5 sec
temp long $1A2B3C4D
temp2 long "1" + "2"<<8 + $0D<<16 ' Tx "12",<cr> and skips B3=0
'------------------------------------------------------------------------------
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
long "C"[$1D9-$] ''Hard coded COG LMM position -------- Chj filler for cog size
''
byte "=== COG LMM ====" ' 16 byte identifier (maybe removed to save space)
''
''########### the above "=== COG LMM ====" may be deleted to save space ##########################
''=======[ Cog LMM execution unit & parameter(s) ]=============================
''
'' Currently 18 longs. Calls save & restore Z & C flags
''-------[ LMM workareas ]------------------------------
'' These are additional workareas and may not be required in a later revision...
lmm_v long 0 ' workarea value
lmm_bittime long _bitrate ' bit rate for baud
''-------[ LMM entry points ]---------------------------
LmmFun add lmm_pc, #4 ' inc PC (skips _LmmRx jump instr)
LmmRx add lmm_pc, #4 ' inc PC (skips _LmmTx jump instr)
LmmTx '
''-------[ LMM execution loop ]-------------------------
LmmLoop rdlong lmm_opcode, lmm_pc ' rdlong (read LMM hub instr into OPCODE using PC)
add lmm_pc, #4 ' PC++ (inc PC to next LMM hub instr)
lmm_op2 nop ' rdlong delay (optional 2nd instruction execution)
lmm_opcode nop ' rdlong result (execute the LMM hub instr)
jmp #LmmLoop ' loop
''-------[ LMM return address ]-------------------------
LmmFun_ret
LmmRx_ret
LmmTx_ret nop ' stores user cog return addr + Z & C flags (11 bits)
''-------[ LMM parameters ]-----------------------------
lmm_f long 0 ' parameter passed to LMM routine (function options; returns unchanged)
lmm_x long 0 ' parameter passed to/from LMM routine (typically a value)
lmm_c long 0 ' parameter passed to/from LMM routine (typically a count)
lmm_p long 0 ' parameter passed to/from LMM routine (typically a hub pointer)
''-------[ LMM workareas ]------------------------------
' Following are workareas used by the LMM routines. Later, some of these may be shifted to hub or stack to save cog space.
lmm_pc long @_LmmCogReturn + 4 ' LMM PC (program counter)
lmm_sp long @_hub_stack ' LMM SP (stack pointer)
lmm_w long 0 ' workarea for LMM_call
lmm_mode long 0 ' saved in dump
'------------------------------------------------------------------------------
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''###############################################################################################
long LMM_Pos
' fit $1F0 ------------- Dont function ---------------------
Vars_P org $ '
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
''-----------------------------------------------------------------------------------------------
I_Start long 0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
long 0 ''Spare Long
count long I_countL
BYTE "INDA" ''Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' I tested both with FIT and RES and it NOT function
''-----------------------------------------------------------------------------------------------
' res 1 ------------- Dont function ---------------------
' fit $1F8 ------------- Dont function --------------------- ' The P2 registers
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
''===============================================================================================
.
With that remove this as it is not longer used
''00000000000------------------------ To place before Instruction's to Show ---------------------
IStart
''00000000000------------------------------------------------------------------------------------
'the following is a 0.5 sec delay mechanism only (allows PST to start)
getcnt wait
add wait,delay500ns
waitcnt wait,0
add wait,delay5s
add wait,delay5s
''11111111111----------------------- To place after last Instruction to Show ---------------------
IEnd
''11111111111------------------------------------------------------------------------------------
'-------------------------------------------------------
Rom_Monitor
mov lmm_f, #_MONITOR '\ set rom monitor mode
call #LmmFun wz,wc '/
'-------------------------------------------------------
temp long $1A2B3C4D
temp2 long "1" + "2"<<8 + $0D<<16 ' Tx "12",<cr> and skips B3=0
'count long I_countL '' --------- Moved to one of free longs Space after MY variables
wait long 0
delay500ns long _xinfreq /2 ' 0.5 sec
delay5s long _xinfreq * 5 ' 5 sec
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
long "C"[$1D9-$-5] ''Hard coded COG LMM Extra Variables --------
'' If You NEED add some more longs Change "C"[$1D8-$-5-X_longs]
'' byte "=== COG LMM ====" ' 16 byte identifier (Removed)
''===============================================================================================
LMM_Pos
strptr_version long @_str_vers ' hub address of version string
strptr_code long @_str_hcode ' hub address of code header string
strptr_long long @_str_hlong ' hub address of code header string
strptr_msg1 long @_str_msg1 ' hub address of message1
'------------------------------------------------------------------------------
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
long "C"[$1D9-$-1] ''Hard coded COG LMM position -------- Chj filler for cog size
''
'' byte "===" ' 4 byte identifier (maybe removed to save space)
''
''########### the above "=== COG LMM ====" may be deleted to save space ##########################
''=======[ Cog LMM execution unit & parameter(s) ]=============================
''
'' Currently 18 longs. Calls save & restore Z & C flags
''-------[ LMM workareas ]------------------------------
'' These are additional workareas and may not be required in a later revision...
lmm_v long 0 ' workarea value
lmm_bittime long _bitrate ' bit rate for baud
''-------[ LMM entry points ]---------------------------
LmmFun add lmm_pc, #4 ' inc PC (skips _LmmRx jump instr)
LmmRx add lmm_pc, #4 ' inc PC (skips _LmmTx jump instr)
LmmTx '
''-------[ LMM execution loop ]-------------------------
LmmLoop rdlong lmm_opcode, lmm_pc ' rdlong (read LMM hub instr into OPCODE using PC)
add lmm_pc, #4 ' PC++ (inc PC to next LMM hub instr)
lmm_op2 nop ' rdlong delay (optional 2nd instruction execution)
lmm_opcode nop ' rdlong result (execute the LMM hub instr)
jmp #LmmLoop ' loop
''-------[ LMM return address ]-------------------------
LmmFun_ret
LmmRx_ret
LmmTx_ret nop ' stores user cog return addr + Z & C flags (11 bits)
''-------[ LMM parameters ]-----------------------------
lmm_f long 0 ' parameter passed to LMM routine (function options; returns unchanged)
lmm_x long 0 ' parameter passed to/from LMM routine (typically a value)
lmm_c long 0 ' parameter passed to/from LMM routine (typically a count)
lmm_p long 0 ' parameter passed to/from LMM routine (typically a hub pointer)
''-------[ LMM workareas ]------------------------------
' Following are workareas used by the LMM routines. Later, some of these may be shifted to hub or stack to save cog space.
lmm_pc long @_LmmCogReturn + 4 ' LMM PC (program counter)
lmm_sp long @_hub_stack ' LMM SP (stack pointer)
lmm_w long 0 ' workarea for LMM_call
lmm_mode long 0 ' saved in dump
'------------------------------------------------------------------------------
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''###############################################################################################
long LMM_Pos
' fit $1F0 ------------- Dont function ---------------------
Vars_P org $ '
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
''-----------------------------------------------------------------------------------------------
I_Start long $0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
long 0 ''Spare Long
count long I_countL
BYTE "INDA" ''Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' I tested both with FIT and RES and it NOT function
''-----------------------------------------------------------------------------------------------
' res 1
' fit $1F8 ' The P2 registers
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
.
With LMM in COG mods I posted in previous 2 thread's
([ Be aware that no other form of specify place for COG_LMM don't function correctly])
It is all Mods needed in lmm code LIST code
For that MODE to function.
1.
''-----------------------------------------------------------------------------------------------------------------------------------------
xxxxxM[n]<cr> Display (DUMP) from cog/hub ----- (Counter of lines to display programed in -- I_countL Long 10)
xxxxx[.yyyyy]M[n]<cr> Display (DUMP) from cog/hub
xxxxx is 'from addr'
yyyyy is optional 'to addr'
n is optional n=1/2/3 for smon/code/long else mon
''-----------------------------------------------------------------------------------------------------------------------------------------
2.
cmp lmm_c, #0 wz ' z if = $0 --- If Not addres entered init with LAST address
''--------------
if_z MOV lmm_x, I_Start '' 0000 --- I_Start --- Variable that I have after Yours COG_LMM
:nothex2
3.
:cmd10
' command ?
mov lmm_c, I_countL ' save '---- 88888 ---- 'count'
cmp lmm_w, #"G" wz ' z if "G"
4.
'' now check if "," follows... 000000000000000000 Removed 000000000000000000000
''
:cmd03
'' I_countL = My Lines count '
mov lmm_c, I_countL ' save 'count'
mov lmm_f, #_COUNT+_HDG ' set 'count' option
5.
On entry -- If not any other addres specified by that command ----- xxxxx[.yyyyy]M[n]<cr>
':start mov lmm_x, #0
:start mov lmm_x, I_Start ' preset addr=0
:again
6.
:cmd_M
MOV I_Start,lmm_x
or lmm_f, #_DUMP+_MON ' set dump mode
7.
:cmd_L
MOV I_Start,lmm_x
or lmm_f, #_DUMP+_MON ' set dump mode
Now after all test's.
Function correctly and place all LMM longs in correct place with special REGISTER's uninitialised.
As You can see I moved out that longs from PROTECTED area as them are not necessary in that place.
'count is moved to one of spare longs after My Variables
'-------------------------------------------------------
[B][COLOR=#ffa500]temp [/COLOR][/B]long $1A2B3C4D
[COLOR=#ffa500][B]temp2 [/B][/COLOR]long "1" + "2"<<8 + $0D<<16 ' Tx "12",<cr> and skips B3=0
'[B][COLOR=#ff0000]count [/COLOR][/B]long I_countL '' --------- [B]Moved [/B]to one of free longs Space after MY variables
[B][COLOR=#ffa500]wait [/COLOR][/B]long 0
[COLOR=#ffa500][B]delay500ns [/B][/COLOR]long _xinfreq /2 ' 0.5 sec
[COLOR=#ffa500][B]delay5s [/B][/COLOR]long _xinfreq * 5 ' 5 sec
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1DA + 16 byte identifier (maybe removed to save space)
''
long "C"[$1DA-$-5] ''Hard coded COG LMM Extra Variables --------
'' If You NEED add some more longs Change "C"[$1D8-$-5-X_longs]
'' byte "=== COG LMM ====" ' 16 byte identifier (Removed)
''===============================================================================================
LMM_Pos
strptr_version long @_str_vers ' hub address of version string
strptr_code long @_str_hcode ' hub address of code header string
strptr_long long @_str_hlong ' hub address of code header string
strptr_msg1 long @_str_msg1 ' hub address of message1
'------------------------------------------------------------------------------
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
long "C"[$1DA-$-1] ''Hard coded COG LMM position -------- Chj filler for cog size
''
'' byte "===" ' 4 byte identifier (maybe removed to save space)
''
''########### the above "=== COG LMM ====" may be deleted to save space ##########################
''=======[ Cog LMM execution unit & parameter(s) ]=============================
''
'' Currently 18 longs. Calls save & restore Z & C flags
''-------[ LMM workareas ]------------------------------
'' These are additional workareas and may not be required in a later revision...
lmm_v long 0 ' workarea value
lmm_bittime long _bitrate ' bit rate for baud
''-------[ LMM entry points ]---------------------------
LmmFun add lmm_pc, #4 ' inc PC (skips _LmmRx jump instr)
LmmRx add lmm_pc, #4 ' inc PC (skips _LmmTx jump instr)
LmmTx '
''-------[ LMM execution loop ]-------------------------
LmmLoop rdlong lmm_opcode, lmm_pc ' rdlong (read LMM hub instr into OPCODE using PC)
add lmm_pc, #4 ' PC++ (inc PC to next LMM hub instr)
lmm_op2 nop ' rdlong delay (optional 2nd instruction execution)
lmm_opcode nop ' rdlong result (execute the LMM hub instr)
jmp #LmmLoop ' loop
''-------[ LMM return address ]-------------------------
LmmFun_ret
LmmRx_ret
LmmTx_ret nop ' stores user cog return addr + Z & C flags (11 bits)
''-------[ LMM parameters ]-----------------------------
lmm_f long 0 ' parameter passed to LMM routine (function options; returns unchanged)
lmm_x long 0 ' parameter passed to/from LMM routine (typically a value)
lmm_c long 0 ' parameter passed to/from LMM routine (typically a count)
lmm_p long 0 ' parameter passed to/from LMM routine (typically a hub pointer)
''-------[ LMM workareas ]------------------------------
' Following are workareas used by the LMM routines. Later, some of these may be shifted to hub or stack to save cog space.
lmm_pc long @_LmmCogReturn + 4 ' LMM PC (program counter)
lmm_sp long @_hub_stack ' LMM SP (stack pointer)
lmm_w long 0 ' workarea for LMM_call
lmm_mode long 0 ' saved in dump
'------------------------------------------------------------------------------
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''###############################################################################################
long LMM_Pos
' fit $1F0 ------------- Dont function ---------------------
Vars_P org $ '
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
''-----------------------------------------------------------------------------------------------
I_Start long $0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
long 0 ''Spare Long
[COLOR=#ff0000][B]count[/B][/COLOR] long I_countL
BYTE "INDA" ''Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' I tested both with FIT and RES and it NOT function
''-----------------------------------------------------------------------------------------------
' res 1
' fit $1F8 ' The P2 registers
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
byte "%"[(_HUB_BASE-(_COG_BASE+_COG_SIZE))-16] ' filler to _HUB_BASE
''===============================================================================================
DAT
''=======[ Hub Resident LMM Routines ]==$01800=================================
org 0 ' used for label calcs
_HubResident
Small addition(correction) to supported LIST modes.
''-----------------------------------------------------------------------------------------------------------------------------------------
''----------------------------- List modes suported ---------------------------------------------------------------------------------------
''-----------------------------------------------------------------------------------------------------------------------------------------
xxxxxL[n]<cr> Display (DUMP) from cog/hub ----- (Counter of lines to display programed in -- I_countL Long 10)
xxxxx [,cc]L[n]<cr> Display (DUMP) from cog/hub ----- (Counter of lines to display programed in -- I_countL Long 10)
[,cc] (Autochanges Counter of lines to display programed in -- I_countL Long 4_initialy)
L[n] Repeat List of last addres and counter
xxxxx[.yyyyy]L[n]<cr> Display (DUMP) from cog/hub
xxxxx is 'from addr'
yyyyy is optional 'to addr'
cc is optional 'New Lines counter'
n is optional n=1/2/3 for smon/code/long else mon
''-----------------------------------------------------------------------------------------------------------------------------------------
Very nice and useful tool. I am certain it will be very handy for my experiments
Thanks Bill.
I need this to debug my version of the spin interpreter for P2. I am just going to port it without any changes required for existing P1 spin code (well mostly none as there probably will be some gotchas).
I also had a quick shot at running it on the P1 yesterday - only need to make it work with FDX.
Sapieha,
I will take a look at your reposted file shortly and incorporate it. Thanks for posting the file.
Yes, I can skip the ascii bits on loading hub/cog. I have thought about the problem of loading cog memory with the byte structure of both my byte outputs from cog and pnut output. I think that if the load is being done to cog, then I should get a whole long first (whether it is in byte/word/long mode), and then copy to cog. This will resolve your problem and makes sense to users too.
I will change _DUMP to _LIST shortly as well, to keep consistency.
I think I will do M for move next...
xxxxx.yyyyy,ccMz<cr>
where xxxxx = from cog/hub address; yyyyy = to cog/hub address; cc = decimal count; z = "B"/"W"/"L"
To accommodate fill/clear, just set the first location (byte/word/long) and then move for a "length-1"
Look at entire Code I posted --- If possible don't Remove: only rename to new version this ---- LSD_0xx_c
This parts. As I use them in p2load dos window CUT from edited code and PASTE in p2load window.
( I never type more that necessary )
''################################################################################################
''## ##
''## ------ Used for CUT and PASTE in Debuger window ------ After <Ctrl-L twice in PNut ##
''## ##
''## p2load -b 115200 -v -s LSD_062_c.obj -h -T ##
''## ##
''############# the following is example code and may be deleted #################################
In code LSD_062_c.spin -- You will find all info that I have be thinking You need.
For MOVE if possible use same conventions as I use in DUMP for xxxxx and cc.
Sapieha,
I will take a look at your reposted file shortly and incorporate it. Thanks for posting the file.
Yes, I can skip the ascii bits on loading hub/cog. I have thought about the problem of loading cog memory with the byte structure of both my byte outputs from cog and pnut output. I think that if the load is being done to cog, then I should get a whole long first (whether it is in byte/word/long mode), and then copy to cog. This will resolve your problem and makes sense to users too.
I will change _DUMP to _LIST shortly as well, to keep consistency.
I think I will do M for move next... xxxxx.yyyyy,ccMz<cr>
where xxxxx = from cog/hub address; yyyyy = to cog/hub address; cc = decimal count; z = "B"/"W"/"L"
To accommodate fill/clear, just set the first location (byte/word/long) and then move for a "length-1"
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
' long "C"[$1DA-$-1] ''Hard coded COG LMM position -------- Chj filler for cog size
long "C"[$1E0-$-3] ''Hard coded COG LMM position -------- Chj filler for cog size
''
'' byte "===" ' 4 byte identifier (maybe removed to save space)
''
''########### the above "=== COG LMM ====" may be deleted to save space ##########################
''=======[ Cog LMM execution unit & parameter(s) ]=============================
''
'' Currently 18 longs. Calls save & restore Z & C flags
''-------[ LMM workareas ]------------------------------
'' Additional internal workareas (may not be required in a later revision)
lmm_v long 0 ' workarea value
lmm_bittime long _bitrate ' bit rate for baud
''-------[ LMM entry points ]---------------------------
LmmFun add lmm_pc, #4 ' inc PC (skips _LmmRx jump instr)
LmmRx add lmm_pc, #4 ' inc PC (skips _LmmTx jump instr)
LmmTx '
''-------[ LMM execution loop ]-------------------------
LmmLoop rdlong lmm_opcode, lmm_pc ' rdlong (read LMM hub instr into OPCODE using PC)
add lmm_pc, #4 ' PC++ (inc PC to next LMM hub instr)
lmm_op2 nop ' rdlong delay (optional 2nd instruction execution)
lmm_opcode nop ' rdlong result (execute the LMM hub instr)
jmp #LmmLoop ' loop
''-------[ LMM return address ]-------------------------
LmmFun_ret
LmmRx_ret
LmmTx_ret nop ' stores user cog return addr + Z & C flags (11 bits)
''-------[ LMM parameters ]-----------------------------
lmm_f long 0 ' parameter passed to LMM routine (function options; returns unchanged)
lmm_x long 0 ' parameter passed to/from LMM routine (typically a value)
lmm_c long 0 ' parameter passed to/from LMM routine (typically a count)
lmm_p long 0 ' parameter passed to/from LMM routine (typically a hub pointer)
''-------[ LMM workareas ]------------------------------
' Internal workareas used by the LMM routines.
lmm_pc long @_LmmCogReturn + 4 ' LMM PC (program counter)
lmm_sp long @_hub_stack ' LMM SP (stack pointer)
lmm_w long 0 ' workarea for LMM_call
lmm_mode long 0 ' saved in dump
'------------------------------------------------------------------------------
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''###############################################################################################
long LMM_Pos
long 0 ''Spare Long
count long 0 'I_countL
''' --------------------------------------------------------
Vars_P org $ '
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
''-----------------------------------------------------------------------------------------------
I_Start long $0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
' long 0 ''Spare Long
' long 0 ''Spare Long
' long 0 ''Spare Long
' long 0 ''Spare Long
BYTE "INDA" ''Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' I tested both with FIT and RES and it NOT function
''-----------------------------------------------------------------------------------------------
' res 1
' fit $1F8 ' The P2 registers
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
byte "%"[(_HUB_BASE-(_COG_BASE+_COG_SIZE))-16] ' filler to _HUB_BASE
''===============================================================================================
The above fills the entire cog space and allows for the P2 registers $1F8-$1FF,
Maybe we can simplify this a little - combine my extra 2 registers and the two spare together?
So, I can move these
''=======[ Cog LMM execution unit & parameter(s) ]=============================
''
'' Calls save & restore Z & C flags
'' Currently 16+4=20 longs. (2 longs used further down)
''-------[ LMM entry points ]---------------------------
LmmFun add lmm_pc, #4 ' inc PC (skips _LmmRx jump instr)
LmmRx add lmm_pc, #4 ' inc PC (skips _LmmTx jump instr)
LmmTx '
''-------[ LMM execution loop ]-------------------------
LmmLoop rdlong lmm_opcode, lmm_pc ' rdlong (read LMM hub instr into OPCODE using PC)
add lmm_pc, #4 ' PC++ (inc PC to next LMM hub instr)
lmm_op2 nop ' rdlong delay (optional 2nd instruction execution)
lmm_opcode nop ' rdlong result (execute the LMM hub instr)
jmp #LmmLoop ' loop
''-------[ LMM return address ]-------------------------
LmmFun_ret
LmmRx_ret
LmmTx_ret nop ' stores user cog return addr + Z & C flags (11 bits)
''-------[ LMM parameters ]-----------------------------
lmm_f long 0 ' parameter passed to LMM routine (function options; returns unchanged)
lmm_x long 0 ' parameter passed to/from LMM routine (typically a value)
lmm_c long 0 ' parameter passed to/from LMM routine (typically a count)
lmm_p long 0 ' parameter passed to/from LMM routine (typically a hub pointer)
''-------[ LMM workareas ]------------------------------
' Internal workareas used by the LMM routines.
lmm_pc long @_LmmCogReturn + 4 ' LMM PC (program counter)
lmm_sp long @_hub_stack ' LMM SP (stack pointer)
lmm_w long 0 ' workarea for LMM_call
lmm_mode long 0 ' saved in dump
'------------------------------------------------------------------------------
''-------[ LMM workareas ]------------------------------
'' Additional internal workareas (may not be required in a later revision)
lmm_v long 0 ' workarea value
lmm_bittime long _bitrate ' bit rate for baud
lmm_spare1 long 0
lmm_spare2 long 0
''===============================================================================================
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''###############################################################################################
long LMM_Pos
long 0 ''Spare Long
count long 0 'I_countL
''' --------------------------------------------------------
Vars_P org $ '
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
''-----------------------------------------------------------------------------------------------
I_Start long $0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
spare1 long 0
spare2 long 0
BYTE "INDA" ''Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' I tested both with FIT and RES and it DOES NOT function
''-----------------------------------------------------------------------------------------------
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
Sapieha,
What am I missing here?
There should be 2 longs between Vars_c and the byte "INDA" & "INDB" longs???
Could the long LMM_Pos & count go here???
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''###############################################################################################
long LMM_Pos
long 0 ''Spare Long
count long 0 'I_countL
''' --------------------------------------------------------
Vars_P org $ '
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
''-----------------------------------------------------------------------------------------------
I_Start long $0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP")
' long 0 ''Spare Long
' long 0 ''Spare Long
' long 0 ''Spare Long
' long 0 ''Spare Long
BYTE "INDA" '' Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' Sapieha tested both with FIT and RES and DOES NOT function
''-----------------------------------------------------------------------------------------------
' fit $1F8 ' The P2 registers
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
becomes...
''###############################################################################################
''# The following is required by Sapieha for his testing - it may be removed #
''# Uses cog $1F0-$1FF ($1F8-$1FF are placeholders for the registers) #
''###############################################################################################
'' FIT $1F0 'fit does not work!
'' --------------------------------------------------------
'' |Change and to show diferent part of COG |
'' | COG IStart List_Count Var_s_Start Var_Count |
'' --------------------------------------------------------
'' 1F0- 00000000 0000000A 000001E4 00000008
Vars_P org $ '
I_Start long $0 '' IStart
I_countL long 5 '' (@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long Vars_P '' Have same position as BYTE "INDA" ???
Vars_C long 8 '' hub address to dump (executes as "NOP") ???
what long LMM_Pos '' where is this used???
count long 0 '' I_countL
BYTE "INDA" '' Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' FIT and RES and DO NOT function
byte "== $1F8 CODE ===" '' Place holders for $1F8 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" '' Place holders for $1FC (COG I/O registers) Don't remove
''###############################################################################################
I chat on E-MAIL page in Google - Them ahve inbuild CHAT.
As I write in previous post --- It is still 2 free long's ---- BUT don't move my Variables -- That will disturb my entire (Future) work
Use instead positions I marked in code section: But in same position
Move LMM_Pos this to place I mark in code section
1. part 1
Yors Part
[B]..........[/B]
[B]..........[/B]
[B]..........[/B]
lmm_mode long 0 ' saved in dump
'------------------------------------------------------------------------------
[COLOR=#00ff00][B]long [/B][/COLOR][COLOR=#ff0000][B]LMM_Pos[/B][/COLOR] ''Spare Long
[B][COLOR=#00ff00]long [/COLOR][/B]0 ''Spare Long
count long 0 'I_countL
2. part 2
''##################################################################################################
''# The following is required by Sapieha for use in [B]FLASH[/B] - it can't [B][COLOR=#ff0000]NOT [/COLOR][/B]be Moved - removed #
''##################################################################################################
I_Start long $0 ''IStart
I_countL long 5 ''(@I_End - @I_Start+1) ''IEnd - IStart
Vars_PL long [B][COLOR=#ff0000]LMM_Pos[/COLOR][/B] ''Have same position as BYTE "INDA"
Vars_C long 8 ' hub address to dump (executes as "NOP") '
BYTE "INDA" ''Important that 2 BYTE fill position's are in this place
BYTE "INDB" '' I tested both with FIT and RES and it NOT function
''-----------------------------------------------------------------------------------------------
''-----------------------------------------------------------------------------------------------
byte "== $1F8 CODE ===" ' Place holders for $1F6 (COG I/O registers) Don't remove
byte "== $1FC CODE ===" ' Place holders for $1F7 (COG I/O registers) Don't remove
''###############################################################################################
long 0 ''Spare Long '
long 0 ''Spare Long '
long 0 ''Spare Long [B][COLOR=#ff8c00]REMOVE[/COLOR][/B] this 4 lines I forgot that '
long 0 ''Spare Long
Sapieha,
Here is v0.63 that incorporates your code.
However, I am unsure about your modifications to the L command. I need to think some more on this as it removes some flexibility that I require.
Perhaps I can put in an M4 command specifically for you?
Others:
I suggest for now, until I make Sapieha's code easily removed, I suggest you try v0.62 a few posts back.
Comments
You can place it in that position - BUT as You maybe see I use some more LONG's after Yours and before END of COG - 8 Longs
It is why I fixed it to position I use
long "C"[$1D8-$]
$1D4 + 16 byte identifier (maybe removed to save space)
Currently I am using 19 longs although I am hoping to reduce this to 16 longs. Would it help if I started the LmmFun at cog $1E0 for the time being???
I use that 4 longs after COG_LMM to that.
1. Part 1 .
4 Long's after it are 2 spare ones
And 2 placeholder for INDA, INDB
I remade now Yours DUMP to use --->
1. Part 1 as counter of Longs to show in dump.
So I dont use Yours ";" parameter in Dump comand only xxxx,yyyyL
If xxxxL ---- It use Counter in --- 1. Part 1
It is change in Yours ":cmd03" --- I made to use my own Counter
I will look at putting in the cmd03 bits in, but commented out, so its easy for you to enable.
I will drop out the identifier in cog ram. No need for it any more.
I will post an update shortly and you can comment on what I've done.
I made on more Change.
L<cr> dump now last address used with xxxL ---
My Variables after LMM: --->
.
.
Change in:
>
It function now for me. If Yo will I can send all changes.
It uses MY 2 variables after LMM
--- I_Start ---- I_countL
Here is what I have now. I see you added another. But is this what you are after???
BTW I have changed command M to L = List. I will change the call to _LIST instead of _DUMP later as well to be consistent.
LSD_062.spin
Thanks.
NEXT correct.
But it don't function as wanted with FIT else RES
So I now work on version that will be corect with Yours new variables
.
With that remove this as it is not longer used
Minor update to previous post
With LMM in COG mods I posted in previous 2 thread's
([ Be aware that no other form of specify place for COG_LMM don't function correctly])
It is all Mods needed in lmm code LIST code
For that MODE to function.
Very nice and useful tool. I am certain it will be very handy for my experiments
Now after all test's.
Function correctly and place all LMM longs in correct place with special REGISTER's uninitialised.
As You can see I moved out that longs from PROTECTED area as them are not necessary in that place.
'count is moved to one of spare longs after My Variables
Send Modified SPIN file.
Look in List commands description WHAT modes are supported.
It was to much changes to send as separate parts.
--- Both that List and LMM placement in FIXED position ---- Tested and function correctly
Edit:
Attachment updated -- Removed some minor errors on LIST command.
And edited some HDG string's
for modes look in:
''
List modes suported
Small addition(correction) to supported LIST modes.
Screen dump for LIST modes and LMM part placement
Post updated.
http://forums.parallax.com/showthread.php/146688-LMM_SerialDebug-Simple-Serial-Tx-amp-Rx-for-debugging-single-cog-programs?p=1179330&viewfull=1#post1179330
Now only this shall function before I can made -- FLASH -- version of Debugger.
If possible entire line with skip of TEXT part
000- 0D 40 FC 0C 21 40 BC 80 00 40 BC FC DB 3E FC 0C '.@..!@...@...>..'
PNut version
Part toskip
000- 0D 40 FC 0C 21 40 BC 80 00 40 BC FC DB 3E FC 0C .@..!@...@...>..
I need this to debug my version of the spin interpreter for P2. I am just going to port it without any changes required for existing P1 spin code (well mostly none as there probably will be some gotchas).
I also had a quick shot at running it on the P1 yesterday - only need to make it work with FDX.
I will take a look at your reposted file shortly and incorporate it. Thanks for posting the file.
Yes, I can skip the ascii bits on loading hub/cog. I have thought about the problem of loading cog memory with the byte structure of both my byte outputs from cog and pnut output. I think that if the load is being done to cog, then I should get a whole long first (whether it is in byte/word/long mode), and then copy to cog. This will resolve your problem and makes sense to users too.
I will change _DUMP to _LIST shortly as well, to keep consistency.
I think I will do M for move next...
xxxxx.yyyyy,ccMz<cr>
where xxxxx = from cog/hub address; yyyyy = to cog/hub address; cc = decimal count; z = "B"/"W"/"L"
To accommodate fill/clear, just set the first location (byte/word/long) and then move for a "length-1"
Thanks
In one of my previous post I posted that example.
Look at entire Code I posted --- If possible don't Remove: only rename to new version this ---- LSD_0xx_c
This parts. As I use them in p2load dos window CUT from edited code and PASTE in p2load window.
( I never type more that necessary )
In code LSD_062_c.spin -- You will find all info that I have be thinking You need.
For MOVE if possible use same conventions as I use in DUMP for xxxxx and cc.
Cluso if needed You have still 2 free LONG's betwen Yours LMM variables and my ones
The above fills the entire cog space and allows for the P2 registers $1F8-$1FF,
Maybe we can simplify this a little - combine my extra 2 registers and the two spare together?
So, I can move these Can you chat on msn?
What am I missing here?
There should be 2 longs between Vars_c and the byte "INDA" & "INDB" longs???
Could the long LMM_Pos & count go here??? becomes...
I chat on E-MAIL page in Google - Them ahve inbuild CHAT.
As I write in previous post --- It is still 2 free long's ---- BUT don't move my Variables -- That will disturb my entire (Future) work
Use instead positions I marked in code section: But in same position
Move LMM_Pos this to place I mark in code section
Cluso -- I don't think You need that: I forgot Remove that lines.
I_countL long 5 <--- is only temporary value for first start
Next time You use [,cc] in L command it will hold that value to next use of [,cc]
So your Part2 starts at $1F2 and not at $1F0 ???
And in Part 1, what are these for??
long LMM_Pos ''Spare Long
long 0 ''Spare Long
count long 0 'I_countL
Are the 2 longs really spare because you have one with a value of LMM_Pos in it???
So therefore, are youreally starting at $1F1 ???
Here is v0.63 that incorporates your code.
However, I am unsure about your modifications to the L command. I need to think some more on this as it removes some flexibility that I require.
Perhaps I can put in an M4 command specifically for you?
Others:
I suggest for now, until I make Sapieha's code easily removed, I suggest you try v0.62 a few posts back.
LSD_064.spin