To that: I use Windows CUT by ctrl-C from that TXT file.
Then PASTE it in DEBUGER window by pushing RHGHT mouse button.
In this zip file You can find shortcut that starts DEBUGER with all needed option's SET For that PASTE option
Sapieha,
Are you trying to paste all the lines at once? If so, that will not work as I execute one line at a time, and so I will miss some of the following characters because my receive routine is not buffered - it is truly half-duplex and worse because when I am doing something I do not look at the receive line.
As for your following post...
I have work to do to incorporate string inputs to memory. Also I need to fix the inputting just <cr> that I broke.
The last couple of days were to re-do the dump command completely, particularly now you/we wanted a few display options. You will note the short dump that does not display the ascii characters at the end.
INPUT end's only if else NUL (Maybe 3xNUL-$0D) string entered ---> That give PASTE of any text to Starting position $2000.
Do you mean terminate with <cr> or terminate with <nul> or both?
I will strip <lf> on input as you suggest. I normally do this in other programs.
I found why it give problem. !!
> Look on first dump line --- for at it shall function You need after "-" test if it is number else " " and if " " skip it before Collecting rest of line.
My Input format:
000- aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd
Yours Input format:
010-aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd
Here is the latest code. It complies with the new calling conventions as stated in post #151.
Note that TxString and RxString now use the lmm_p parameter for the hub address pointer, and that lmm_c returns the count of chars entered in RxString (excluding the <nul>).
Two new options exist for RXSTRING and are _ADDR = address of string buffer in hub supplied, and _NOLF = strips any <lf> characters. Bounds checking are now also done, such that <bs> is prevented from backspacing beyond the initial address of the string, and characters are ignored beyond the default buffer size _HUBBUFSIZE=80. In fact it is limited to 78 to permit the <cr> and <nul>.
Sapieha's request for inputting (cut & paste) data to hub is not yet done (needs to ignore " " after the xxx- address). This is now next on my list.
Sapieha's request for inputting (cut & paste) data to hub is now done (needs to ignore " " after the xxx- address).
However, I think this will cause problems because my code is half duplex and the input is for multiple lines is sent too fast. Perhaps a lower baud will fix this.
Note, cog does not work as expected because each hex pair (byte) is placed into a cog long. It does place into hub correctly.
Here is the latest code. It complies with the new calling conventions as stated in post #151.
Note that TxString and RxString now use the lmm_p parameter for the hub address pointer, and that lmm_c returns the count of chars entered in RxString (excluding the <nul>).
Two new options exist for RXSTRING and are _ADDR = address of string buffer in hub supplied, and _NOLF = strips any <lf> characters. Bounds checking are now also done, such that <bs> is prevented from backspacing beyond the initial address of the string, and characters are ignored beyond the default buffer size _HUBBUFSIZE=80. In fact it is limited to 78 to permit the <cr> and <nul>.
Sapieha's request for inputting (cut & paste) data to hub is not yet done (needs to ignore " " after the xxx- address). This is now next on my list.
Thanks for place me in.
That was not wanted -- But appreciated.
.
'' +--------------------------------------------------------------------------+
'' | Cluso's LMM_SerialDebugger for Propeller II (DE0-Nano Emulator) v0.xx |
'' +--------------------------------------------------------------------------+
'' | Authors: (c)2013 "Cluso99" (Ray Rodrick) |
'' | License: MIT License - See end of file for terms of use |
'' +--------------------------------------------------------------------------+
'' | Acknowledgements: Bill Henning - original LMM methodology |
'' | Andy (Ariba) - help with LMM call format |
'' | Chip Gracey - original P2 ROM Monitor |
'' | Chip & Parallax - P2 and DE0 emulation & expansion pcb|
'' | Chris (Sapieha) - help with features & testing |
'' +--------------------------------------------------------------------------+
xxxxxM<cr> displays memory as per the rom monitor, xxxxx is the cog or hub address - same as _DUMP_MON call
xxxxxM1<cr> displays short mode (without ascii) - same as _DUMP+_SMON call
xxxxxM2<cr> displays code mode - same as _DUMP+_CODE call
xxxxxM3<cr> displays long mode - same as _DUMP+_LONG
command L is no longer required and is removed.
xxxxx- xx xx....<cr> input to hub or cog
any extra spaces no longer cause an error.
Note that 1-2 hex chars are treated as bytes, 3-4 hex chars are treated as words, 5-8 hex chars are treated as longs for inputting to cog/hub
There is still an error in cog mode.
Sapieha: Hub mode should be correct and you can also paste in a dump from long mode. But, as I said it is half ducplex so overun is likely - may have to lower the baud.
xxxxxM<cr> displays memory as per the rom monitor, xxxxx is the cog or hub address - same as _DUMP_MON call
xxxxxM1<cr> displays short mode (without ascii) - same as _DUMP+_SMON call
xxxxxM2<cr> displays code mode - same as _DUMP+_CODE call
xxxxxM3<cr> displays long mode - same as _DUMP+_LONG
command L is no longer required and is removed.
xxxxx- xx xx....<cr> input to hub or cog
any extra spaces no longer cause an error.
Note that 1-2 hex chars are treated as bytes, 3-4 hex chars are treated as words, 5-8 hex chars are treated as longs for inputting to cog/hub
There is still an error in cog mode.
Sapieha: Hub mode should be correct and you can also paste in a dump from long mode. But, as I said it is half ducplex so overun is likely - may have to lower the baud.
.
' lmm_w = addr, lmm_x = hex-data, lmm_c=digits lmm_f = _HUB/_COG
cmp lmm_w, #$1FF wz,wc ' z+c if =<$1FF = cog mode?
if_be add lmm_pc, #(:wrcog-($+1))*4 '> br fwd (y: write to cog) -----------------------
' write byte/word/long in lmm_x to hub addr in lmm_w -------------------------------- Sample 1 - 4 longs to temp_buffer
'-----------------------------------------------------------------------------------> if end of line --- Go Move it in place
cmp lmm_c, #3 wc ' c if 1-2 digits
if_c wrbyte lmm_x, lmm_w ' write byte to hub
if_c add lmm_w, #1 ' W++
if_c add lmm_pc, #(:more-($+1))*4 '> br fwd
cmp lmm_c, #5 wc ' c if 3-4 digits
if_c wrword lmm_x, lmm_w ' write word to hub
if_c add lmm_w, #2 ' W++
if_c add lmm_pc, #(:more-($+1))*4 '> br fwd
wrlong lmm_x, lmm_w ' write a long to hub
add lmm_w, #4 ' W++
''-----------------------------------------------------------------> It is in this phase it need test
'------------------------------------------------------------------> then if COG addres ---- MOVE x longs from HUB_buffer to COG
'------------------------------------------------------------------> then if HUB addres ---- MOVE x longs from HUB_buffer to HUB destination address
add lmm_pc, #(:more-($+1))*4 '> br fwd
''00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
' write long in lmm_x to cog addr in lmm_w
:wrcog rdlong lmm_op2, lmm_pc '\ store the following instr in lmm_op2
mov lmm_x, lmm_x '| initially has no effect
movd lmm_op2, lmm_w '| movd lmm_x(srce)into lmm_op2(dest) - "the cog addr"
' now lmm_op2 moves the value in lmm_x to the addr pointed to by lmm_w between each instruction...
mov lmm_op2, #0 '/ disable instr at lmm_op2 (make a "nop")
add lmm_w, #1 ' W++
''000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
:more
Next installment..
The M command has been extended...
xxxxx[.yyyyy][,cc]M[n]<cr> Display (DUMP) from cog/hub
xxxxx is 'from addr'
yyyyy is optional 'to addr'
cc is optional 'count'
n is optional n=1/2/3 for smon/code/long else mon
If you select either the .yyyyy or ,cc then a heading will automatically be added.
and the DUMP command has been extended...
'' _DUMP = 3 << 5 ' dump a line (1/4 longs) from cog/hub
'' _ADDR2 = 1 << 4 ' 1= use lmm_c as a to-adress
'' _COUNT = 1 << 3 ' 1= use lmm_c to display 'n' lines (counter)
'' _HDG = 1 << 2 ' 1=display heading for opcode format
'' _MON = 00 ' \ Format 0: 4 longs, rom "MON"itor format
'' _SMON = 01 ' | 1: 4 longs, "S"hort rom "MON"itor format (no ascii)
'' _CODE = 10 ' | 2: 1 long, code format
'' _LONG = 11 ' / 3: 4 longs, xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx (Sapieha)
so there are 2 methods to display multiple lines, either by setting lmm_c to a count or to a to-address.
Next installment..
The M command has been extended...
xxxxx[.yyyyy][,cc]M[n]<cr> Display (DUMP) from cog/hub
xxxxx is 'from addr'
yyyyy is optional 'to addr'
cc is optional 'count'
n is optional n=1/2/3 for smon/code/long else mon
If you select either the .yyyyy or ,cc then a heading will automatically be added.
and the DUMP command has been extended...
'' _DUMP = 3 << 5 ' dump a line (1/4 longs) from cog/hub
'' _ADDR2 = 1 << 4 ' 1= use lmm_c as a to-adress
'' _COUNT = 1 << 3 ' 1= use lmm_c to display 'n' lines (counter)
'' _HDG = 1 << 2 ' 1=display heading for opcode format
'' _MON = 00 ' \ Format 0: 4 longs, rom "MON"itor format
'' _SMON = 01 ' | 1: 4 longs, "S"hort rom "MON"itor format (no ascii)
'' _CODE = 10 ' | 2: 1 long, code format
'' _LONG = 11 ' / 3: 4 longs, xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx (Sapieha)
so there are 2 methods to display multiple lines, either by setting lmm_c to a count or to a to-address.
I started with M for memory and L came later. I might have a look around again and see what some debuggers are using. It is simple enough to change. And I probably want a move/fill command anyway.
BTW your example in #169 is missing the _COUNT option
------------------------------------------------------------------------------------
MOV LMM_c, #(IEnd-IStart) ' set n lines
mov lmm_f, #_DUMP+_COUNT+_CODE '\ set dump cog code
mov lmm_p, #IStart '| set cog address
-------------------------------------------------------------------------------------
can also be done like this
------------------------------------------------------------------------------------
mov lmm_f, #_DUMP+_ADDR2+_CODE '\ set dump cog code
mov lmm_p, #IStart '| set cog start address
MOV LMM_c, #IEnd '/ set cog end address
-------------------------------------------------------------------------------------
As I added some extra Variables at end of LMM.
I use it in little other way.
My LMM looks like that: - That give me LMM always in same place in COG and some extra Variables I need for automated Displaing of DATA
''================================================================================================
''################################################################################################
''
'' COG LMM hard coded to $1D4 + 16 byte identifier (maybe removed to save space)
''
''
long "C"[$1D8-$] ''Hard coded COG LMM position -------- Chj filler for cog size
''
' '' byte "*"[(($+3)/4*4-$)*4]
' ' fill to next quad long
''
byte "=== COG LMM ====" ' 16 byte identifier (maybe removed to save space)
''
''########### the above "=== COG LMM ====" may be deleted to save space ##########################
''###############################################################################################
''===============================================================================================
''############# the above is example code and may be deleted ####################################
''# #
LMM_Pos org $ 'LMM_Pos-1 Points to last COG long that can be used #
''# #
''###############################################################################################
''=======[ Cog LMM execution unit & parameter(s) ]=============================
' saves & restores Z & C flags
' must be in users cog (16++ longs) - Note: cog requirements will be reduced in a later version
''-------[ 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)
''
''====11========================== Pointer to User Variables =========================================
''====11==================== Place it at start of Yours Variables area ===============================
''
Vars_P org $ ' --- After RUN user can Change to Theirs own
'' ' by modify COG position for it else use -
'' ' --- MOV Vars_PL,XXX "First Var position to show
''====================================================================================================
''
''====00========================== LMM_Variables ====================================================
''
''-------[ LMM parameters ]------- $1E4 --------------------------------------------------------------------------------------------
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 ]-------- $1E8 --------------------------------------------------------------------------------------------
' Following are workareas used by the LMM routines. Later, many of these will 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_v long 0 ' workarea value
lmm_w long 0 ' workarea for LMM_call
lmm_z long 0 ' workarea for DumpCode
lmm_mode long 0 ' saved in dump
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"
''
.
.
I now temporary re-edited Your's :cmd3 to that. ---> And it function.
So now I need only incorporate in it Yours "," option to have both possibilitys
I started with M for memory and L came later. I might have a look around again and see what some debuggers are using. It is simple enough to change. And I probably want a move/fill command anyway.
I have just been having a little play with getting my debugger to work on P1. Apart from requiring FullDuplexSerial, it is fairly straight forward. I tried not to use any P2 instructions in my code, with the main exception being the serial driver in Tx and Rx. Found I left one cmpr in the code, so I will fix that.
I have just been having a little play with getting my debugger to work on P1. Apart from requiring FullDuplexSerial, it is fairly straight forward. I tried not to use any P2 instructions in my code, with the main exception being the serial driver in Tx and Rx. Found I left one cmpr in the code, so I will fix that.
Sapieha:
Here is my testing with cut & paste for cog memory - uses xxxM3<cr> to display in longs. Then that can be copied and pasted to the debug input
Sapieha:
Here is my testing with cut & paste for cog memory - uses xxxM3<cr> to display in longs. Then that can be copied and pasted to the debug input
That You decide.
> BUT I will in time all functions work place LMM_Debuger in Flash.
That needs COG_LMM in fixed space ----> Else I can't CUT and paste snippets to COG as that will overwrite COG_LMM itself if snippet are more LONGS that place of COG_LMM
With FAST place of COG_LMM I always know how many free LONG's I have for MY program to test
Comments
Are you trying to paste all the lines at once? If so, that will not work as I execute one line at a time, and so I will miss some of the following characters because my receive routine is not buffered - it is truly half-duplex and worse because when I am doing something I do not look at the receive line.
As for your following post...
I have work to do to incorporate string inputs to memory. Also I need to fix the inputting just <cr> that I broke.
The last couple of days were to re-do the dump command completely, particularly now you/we wanted a few display options. You will note the short dump that does not display the ascii characters at the end.
Do you mean terminate with <cr> or terminate with <nul> or both?
I will strip <lf> on input as you suggest. I normally do this in other programs.
Are you trying to paste all the lines at once?
Yes
I can't input one line in that mode
But that is later problem.
If You look in dump I provide
> It don't input that single line to.
== Cluso's P2 Debugger v0.57 == Chj ==
*010- aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd
?*010L
010- 80 C0 FF A0 3A C2 BF A0 D8 BF FF 1F 73 C0 FF A0 '....:.......s...'
*
I found why it give problem. !!
> Look on first dump line --- for at it shall function You need after "-" test if it is number else " " and if " " skip it before Collecting rest of line.
My Input format:
000- aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd
Yours Input format:
010-aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd
Both formats need be suported.
Now as I found what give problems.
I can say to You.
> INPUT multiple line function correctly.
== Cluso's P2 Debugger v0.57 == Chj ==
*0- aa bb cc dd
?*0l
000- 0D 78 FC 0C 3D 78 BC 80 00 78 BC FC 0D C2 FF A0 '.x..=x...x......'
*0- 11 22 33 44
?*0- 1122 3344
?*010-aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd
*000-0D A4 FF 0C D3 A5 BF 80 00 A4 BF FC 9B 01 7C 1C
*010-43 43 43 43 43 43 43 43 43 43 43 43 43 43 43 43
*020-43 43 43 43 43 43 43 43 43 43 43 43 43 43 43 43
*030-43 43 43 43 43 43 43 43 43 43 43 43 43 43 43 43
*040-43 43 43 43 43 43 43 43 43 43 43 43 43 43 43 43
*050-43 43 43 43 43 43 43 43 43 43 43 43 43 43 43 43
*
NOW only that even support my format with <space> betwen $00- and first Number
And collect 4 11 22 33 44 to one long
Note that TxString and RxString now use the lmm_p parameter for the hub address pointer, and that lmm_c returns the count of chars entered in RxString (excluding the <nul>).
Two new options exist for RXSTRING and are _ADDR = address of string buffer in hub supplied, and _NOLF = strips any <lf> characters. Bounds checking are now also done, such that <bs> is prevented from backspacing beyond the initial address of the string, and characters are ignored beyond the default buffer size _HUBBUFSIZE=80. In fact it is limited to 78 to permit the <cr> and <nul>.
Sapieha's request for inputting (cut & paste) data to hub is not yet done (needs to ignore " " after the xxx- address). This is now next on my list.
LSD_058.spin
However, I think this will cause problems because my code is half duplex and the input is for multiple lines is sent too fast. Perhaps a lower baud will fix this.
Note, cog does not work as expected because each hex pair (byte) is placed into a cog long. It does place into hub correctly.
LSD_059.spin
Thanks -- For update
And for pointer and Char-count in RXSTRING
But it is possible You remade Input HEX-groups so them function as in code example
Sorry.
I think previous post are --- cross post.
Will test LSD_058.spin to see
Thanks
For give rid of Leading Space.
But look in this post.
http://forums.parallax.com/showthread.php/146688-LMM_SerialDebug-Simple-Serial-Tx-amp-Rx-for-debugging-single-cog-programs?p=1178995&viewfull=1#post1178995
Groups of HEX are not colected correctly.
Thanks for place me in.
That was not wanted -- But appreciated.
New/updated debug commands..
xxxxxM<cr> displays memory as per the rom monitor, xxxxx is the cog or hub address - same as _DUMP_MON call
xxxxxM1<cr> displays short mode (without ascii) - same as _DUMP+_SMON call
xxxxxM2<cr> displays code mode - same as _DUMP+_CODE call
xxxxxM3<cr> displays long mode - same as _DUMP+_LONG
command L is no longer required and is removed.
xxxxx- xx xx....<cr> input to hub or cog
any extra spaces no longer cause an error.
Note that 1-2 hex chars are treated as bytes, 3-4 hex chars are treated as words, 5-8 hex chars are treated as longs for inputting to cog/hub
There is still an error in cog mode.
Sapieha: Hub mode should be correct and you can also paste in a dump from long mode. But, as I said it is half ducplex so overun is likely - may have to lower the baud.
LSD_060.spin
Nice ditions to Dump mode.
But that need be one long
000- 0D A4 FF 0C
Not 4 longs as Yours input routine remade it to -->
*0m
000- 0D 00 00 00 A4 00 00 00 FF 00 00 00 0C 00 00 00 '................'
I traced problem to this routine.
It is possible to add one more parameter to this command.
The M command has been extended... If you select either the .yyyyy or ,cc then a heading will automatically be added.
and the DUMP command has been extended... so there are 2 methods to display multiple lines, either by setting lmm_c to a count or to a to-address.
LSD_061.spin
Sapieha: I am aware that the cog input is not what you require - I am still thinking about this since there is really no byte/word in cog address.
That answer my Questions.
Like new Dump mode
Can that use now new DUMP to show.
Why You renamed "L" to "M"
In most of debugers
"L" ---- stand for LIST
"M" --- stands for MOVE from - to
BTW your example in #169 is missing the _COUNT option can also be done like this You can also include a heading with +_HDG
As I added some extra Variables at end of LMM.
I use it in little other way.
My LMM looks like that: - That give me LMM always in same place in COG and some extra Variables I need for automated Displaing of DATA .
.
I now temporary re-edited Your's :cmd3 to that. ---> And it function.
So now I need only incorporate in it Yours "," option to have both possibilitys
Ps. to previous post.
Changes to part after LMM ---- That made correct place for HUB part
NICE
Here is my testing with cut & paste for cog memory - uses xxxM3<cr> to display in longs. Then that can be copied and pasted to the debug input
Look's Very good !!!
But that input need 4 groups as LONG's.
I need it to collect instead --- 4 group's 4x2 -- AA BB CC DD ---
As It is not CUT from debuger I use
But CUT from PNut
using option Ctrl-L in PNut
I am not sure what you mean with your posts. Would you prefer that I make the cog lmm code fixed at the end of the cog?
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???
In PNut use option ---- Ctrl-L
And then look at end of file
That You decide.
> BUT I will in time all functions work place LMM_Debuger in Flash.
That needs COG_LMM in fixed space ----> Else I can't CUT and paste snippets to COG as that will overwrite COG_LMM itself if snippet are more LONGS that place of COG_LMM
With FAST place of COG_LMM I always know how many free LONG's I have for MY program to test