'' +--------------------------------------------------------------------------+ '' | Cluso's LMM_SerialDebugger for Propeller II (BeMicro CVA9 FPGA) v0.xx | '' +--------------------------------------------------------------------------+ '' | Author : (c)2013-2018 "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 | '' +--------------------------------------------------------------------------+ '' RR20160627 101b P2v10a (prepare from LSD_101a - history removed) '' RR20160628 102a _hubTx, _hubHex & _hubString working (release) '' RR20160705 105 _hubList incl lut (excludes _code ie disassem) '' RR20160706 106 a lot of disassembler working (incomplete) '' RR20160709 106a disassembler more opcode2 '' RR20160710 107 disassembler almost complete '' 107a complete ALTx/DECOD/xxxONE/xxxMOD/MUL..SCL '' RR20160711 108 to do: PTRx for WR/WM/RDxxxx instructions '' RR20160712 109 All disassembling s/be complete '' RR20160712 110 add _hubRx, _hubRxString '' a add monitor '' RR20160713 111 rethink monitor '' monitor saves stack; _hubList if c=0 then c=1; add _parseChar '' +--------------------------------------------------------------------------+ '' RR20180419 112a P2v32 '' bcd add-in SD debugging (from Hubexec_Debugger_001a.spin2) wkg '' efg add-in _RxChar, _RxString wkg '' hi rework _Send & _Recv into _HubTX & _HubRx wkg '' RR20180419 113a '' _HubList count does not work !!! '' 114a-j add-in some monitor commands '' RR20180422 115a ?,L,Q wkg ,-,M,G to do (no save/restore stack yet) ''============================[ CON ]============================================================ CON _clockfreq = 80_000_000 _freq = _clockfreq ' constants for serial driver _rxpin = 63 ' P63=SI _txpin = 62 ' P62=SO _baud = 115_200 _bitper = (_clockfreq / _baud) << 16 + 7 ' 115200 baud, 8 bits _txmode = %0000_0000_000_0000000000000_01_11110_0 'async tx mode, output enabled for smart output _rxmode = %0000_0000_000_0000000000000_00_11111_0 'async rx mode, input enabled for smart input '------------------------------------------------------------------------------------------------ ' HUB ADDRESSES '------------------------------------------------------------------------------------------------ _LMM_HUB_BUF = $0_2000'[128] ' hub buffer[128] used by _HubRxString (in writable hub ram!!) _HUBBUFSIZE = 80 ' RxString default size _HUBBUFWORK = 128-80 ' used by _HubMonitor as workarea _HUBEXEC_code = $0_4000 ' hubexec code in hub (can be in hub rom) ' _LMM_HUB_BASE = _HUBEXEC_code ' start of Cluso's LMM Serial Debugger - hubexec code ' _LMM_COG_BASE = $1E0 ' " - cog code/registers '------------------------------------------------------------------------------------------------ ' COG REGISTERS '------------------------------------------------------------------------------------------------ _IJMP3 = $1F0 '' COG Interrupt Jump 3 _IRET3 = $1F1 '' COG Interrupt Return 3 _IJMP2 = $1F2 '' COG Interrupt Jump 2 _IRET2 = $1F3 '' COG Interrupt Return 2 _IJMP1 = $1F4 '' COG Interrupt Jump 1 _IRET1 = $1F5 '' COG Interrupt Return 1 _ADDRA = $1F6 '' COG ADDR A _ADDRB = $1F7 '' COG ADDR B _PTRA = $1F8 '' COG PTR A _PTRB = $1F9 '' COG PTR B _DIRA = $1FA '' COG DIR A _DIRB = $1FB '' COG DIR B _OUTA = $1FC '' COG OUT A _OUTB = $1FD '' COG OUT B _INA = $1FE '' COG IN A / Debug JMP _INB = $1FF '' COG IN B / Debug RET '------------------------------------------------------------------------------------------------ ' LMM DEBUGGER '------------------------------------------------------------------------------------------------ ' LMM Call Modes... ' order must match _hubtable _MODE = $F << 5 ' mode bits defining the call b8..b5 (b4..b0 are modifier options) _SHIFT = 5 ' shr # to extract mode bits ' _CHAR = 0 << 5 ' tx char ' _ASCII = 1 << 5 ' ascii <00>..<1F>," ".."~",<7F>.. (removed v0.70) _HEX = 2 << 5 ' hex... _REV = 1 << 4 ' - reverse byte order _SP = 1 << 3 ' - space between hex output pairs '_DIGITS = 7..0 where 8->0 ' - no. of digits to display _LIST = 3 << 5 ' LIST memory line (1/4 longs) from cog/hub _ADDR2 = 1 << 4 ' 1= use lmm_p2 as to-address _COUNT = 1 << 3 ' 1= use lmm_c to display 'n' lines (counter) ' ^^^ note only _ADDR2 or _COUNT may be specified, not both! _HDG = 1 << 2 ' 1=display heading for opcode format _MON = 0 ' \ Format 0: 4 longs, rom "MON"itor format _SMON = 1 ' | 1: 4 longs, "S"hort rom "MON"itor format (no ascii) ' _CODE = 2 ' | 2: 1 long, code format _LONG = 3 ' / 3: 4 longs, xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx (Sapieha) _TXSTRING = 4 << 5 ' tx string (nul terminated) from hub _RXSTRING = 5 << 5 ' rx string _ECHO = 1 << 4 ' - echo char _PROMPT = 1 << 3 ' - prompt (lmm_x) _ADDR = 1 << 2 ' - addr of string buffer supplied _NOLF = 1 << 1 ' - strip _DEBUG = 6 << 5 ' debug/monitor _MONITOR = 7 << 5 ' goto rom monitor _MOVE = 8 << 5 ' MOVE memory _UNKNOWN = 9 << 5 ' this and above are invalid/unknown ' in DEBUG input parse, the following are used... _HASH = 1 << 0 ' "#" in param 1 _DOT = 1 << 1 ' "." in param 2 _COMMA = 1 << 2 ' "," in param 3 _DEC = 1 << 8 ' decimal (vs hex) ' ASCII equates BS = $08 CR = $0D LF = $0A TAB = $09 CTRLC = $03 CTRLH = $08 CTRLS = $13 CTRLX = $18 CLS = $00 ' clear screen '------------------------------------------------------------------------------------------------ ''============================[ DAT ]============================================================ DAT orgh 0 ''=======[ vvvvv Start of User Code vvvvv ]====================================================== org 0 user_entry hubset #$FF 'set clock to 80MHz nop ''--------------------------------------------------------------------------------------------------- '' display debug SD info to PST... ''--------------------------------------------------------------------------------------------------- 'a 5 sec delay mechanism only (allows PST to start) getct delay addct1 delay, ##_clockfreq*5 ' 5s waitct1 ''--------------------------------------------------------------------------------------------------- 'this call is required to start the serial driver (note a is sent to kick off the smart pin) mov lmm_x, ##_bitper ' 115200 baud, 8 bits call #_serialinit ' init serial P63/P62 & send ''--------------------------------------------------------------------------------------------------- mov lmm_x, #cls ' clear screen call #_hubTx mov lmm_f, #_TXSTRING+0 ' send string, $00 terminated mov lmm_p, ##_str_vers ' (uses 2 instructions) call #_hubTxString ''--------------------------------------------------------------------------------------------------- ' COG: mov lmm_x, ##(cr + "C"<<8 + "O"<<16 + "G"<<24) call #_hubTx mov lmm_f, #_LIST+_ADDR2+_HDG+_MON ' list count w heading monitor mov lmm_p, ##$000 ' fm addr (uses 2 instructions) mov lmm_p2, ##$01F ' to addr call #_HubList ''--------------------------------------------------------------------------------------------------- ' call the monitor/debugger call #_HubMonitor ' to the monitor/debugger ''--------------------------------------------------------------------------------------------------- ' LUT: mov lmm_x, ##(cr + "L"<<8 + "U"<<16 + "T"<<24) call #_hubTx mov lmm_f, #_LIST+_ADDR2+_HDG+_MON ' list count w heading monitor mov lmm_p, ##$200 ' fm addr (uses 2 instructions) mov lmm_p2, ##$21F ' to addr call #_HubList ''--------------------------------------------------------------------------------------------------- ' HUB: mov lmm_x, ##(cr + "H"<<8 + "U"<<16 + "B"<<24) call #_hubTx mov lmm_f, #_LIST+_ADDR2+_HDG+_MON ' list count w heading monitor ' $1_xxxxx tricks to force hub :) mov lmm_p, ##$1_00000 ' fm addr (uses 2 instructions) mov lmm_p2, ##$1_0007F ' to addr call #_HubList ''--------------------------------------------------------------------------------------------------- ' HUB: mov lmm_x, ##(cr + "H"<<8 + "U"<<16 + "B"<<24) call #_hubTx mov lmm_f, #_LIST+_ADDR2+_HDG+_MON ' list count w heading monitor mov lmm_p, ##$04000 ' fm addr (uses 2 instructions) mov lmm_p2, ##$0407F ' to addr call #_HubList ''--------------------------------------------------------------------------------------------------- mov lmm_x, #cr call #_hubTx ''--------------------------------------------------------------------------------------------------- ' test receive string... mov lmm_f, #_RXSTRING+_PROMPT+_ECHO+{_ADDR+}_NOLF '\ call input routine mov lmm_x, #"*" '| prompt ''' mov lmm_p, ##_HUBBUF '| (buffer address optional) .loop CALL #_HubRxString '/ CALL #_HubTxString ' echo the string again! jmp #.loop ''--------------------------------------------------------------------------------------------------- .here jmp #.here ''--------------------------------------------------------------------------------------------------- delay long 0 ''=======[ ^^^^^ End of User Code ^^^^^ ]========================================================= ''=======[ Cog LMM parameter(s) ]================================================================= {{ ''################################################################################################ ''## COG LMM hard coded to $xxx ' (Location is fixed)) ## ''################################################################################################ ''-------[ LMM internal workareas ]--------------------------------------------------------------- lmm_w2 res 1 ' workarea2 (never saved - short term use between calls) lmm_y res 1 ' workarea3 (never saved - short term use between calls) '------------------------ lmm_t0 res 1 ' more temporary workareas... lmm_t1 res 1 lmm_s0 res 1 lmm_s1 res 1 lmm_s2 res 1 lmm_lx res 1 lmm_lf res 1 lmm_lp res 1 '------------------------ lmm_lp2 res 1 lmm_lc res 1 lmm_c2 res 1 lmm_x2 res 1 lmm_dp res 1 lmm_dc res 1 lmm_o2 res 1 lmm_r0 res 1 '------------------------ lmm_zzzzz res 8 '------------------------ }} ''################################################################################################ ''## COG LMM hard coded to $1E0-$1EF ' (Location is fixed)) ## ''################################################################################################ fit $1E0 long $3D3D3D3D[$1E0-$] ' fill with "====" (if any) ''-------[ LMM parameters, etc ]----------------------------------------------------------------- lmm_x long 0 ' parameter passed to/from LMM routine (typically a value) lmm_f long 0 ' parameter passed to LMM routine (function options; returns unchanged) lmm_p long 0 ' parameter passed to/from LMM routine (typically a hub/cog ptr/addr) lmm_p2 long 0 ' parameter passed to/from LMM routine (typically a 2nd hub/cog address) lmm_c long 0 ' parameter passed to/from LMM routine (typically a count) ''-------[ LMM additional workareas ]------------------------------------------------------------ lmm_w long 0 ' workarea (never saved - short term use between calls, except _HubTx) lmm_tx long 0 ' _HubTx lmm_hx long 0 ' _HubHex/_HubString lmm_hx2 long 0 ' _HubHex lmm_hc long 0 ' " lmm_lx long 0 ' _HubList lmm_lf long 0 ' " lmm_lp long 0 ' " lmm_lp2 long 0 ' " lmm_lc long 0 ' " lmm_lc2 long 0 ' " ''----------------------------------------------------------------------------------------------- fit $1F0 ''=======[ End of Cog LMM parameter(s) ]========================================================== ''------------------------------------------------------------------------------------------------ DAT ''################################################################################################ ''## HUB RX BUFFER ## ''################################################################################################ orgh _LMM_HUB_BUF _HUBBUF byte 0[_HUBBUFSIZE+_HUBBUFWORK] ' hub buffer+workarea (_HubRxString & _HubMonitor) ''################################################################################################ ''## HUB LMM hard coded to $xxxxx ## ''################################################################################################ ''=======[ Hub Resident LMM Routines ]============================================================ orgh _HUBEXEC_CODE ' $xxxxx Lmm Serial Debugger hubexec code {{ '-------------------------------------------------------------------------------------------------- ' Jump Table Entry Points '-------------------------------------------------------------------------------------------------- jmp #_SerialInit ' Initialise P30/31 serial port at 115,200 and send jmp #_Send ' Send a serial char from lmm_x jmp #_Recv ' Wait to receive a serial char and place in lmm_x jmp #_HubMonitor ' Debug Monitor jmp #_HubTx ' Transmit a char(s) in lmm_x jmp #_HubTxString ' Transmit a string pointed to by lmm_p jmp #_HubHex ' Send hex digits in lmm_x, format type in lmm_f jmp #_HubList ' List cog/lut/hub using lmm_p, lmm_p2, lmm_c, format in lmm_f jmp #_HubRx ' Receive a char into lmm_x (waits) jmp #_HubRxString ' Receives a string terminated by into hub buffer ' pointed to lmm_p with format options in lmm_f ' returns char count in lmm_c ' optionally uses internal hub buffer pointed to by lmm_p '-------------------------------------------------------------------------------------------------- }} ''===================================================================================================================== ''-------[ Serial Routines (uses SmartPins) ]---------------------------------- <--- serial initialise ---> ''_SerialInit '' On Entry: '' lmm_x = _bitper ' tx & rx bit period + #(bits-1) '' Call Format: '' CALL #_SerialInit ' < call: serial initilise> '' On Return: '' lmm_x = #CR ' (changed) ''-------------------------------------------------------------------------------------------------- _SerialInit wrpin ##_txmode, #_txpin ' set asynchronous tx mode in smart pin tx wxpin lmm_x, #_txpin ' set tx bit period + #(bits-1) dirh #_txpin ' enable smart pin tx wrpin ##_rxmode, #_rxpin ' set asynchronous rx mode in smart pin rx wxpin lmm_x, #_rxpin ' set rx bit period + #(bits-1) dirh #_rxpin ' enable smart pin rx mov lmm_x, #CR ' we have to prime send buffer empty flag, wypin lmm_x, #_txpin ' ... so send to tx pin RET wcz ' <--- return to calling routine ---> ''-------------------------------------------------------------------------------------------------- ''-------[ Display Char(s) ]--------------------------------------------------- <--- display char(s) ---> ''_HubTx ' '' On Entry: '' lmm_x = char(s) ' char(s): up to 4 chars; B0 first; terminates '' ' if =$0, tx one '' Call Format: '' CALL #_HubTx ' < call: display char(s)> '' On Return: '' lmm_x = -same- ' char(s): (unchanged) ''-------------------------------------------------------------------------------------------------- _HubTx ' <--- display char(s) ---> MOV lmm_w, lmm_x ' < push: 'x' #0 > ' ---------------------------------------- .send testp #_txpin wc ' wait for buffer empty on tx pin if_nc jmp #.send ' wypin lmm_x, #_txpin ' send byte (bits7:0) to tx pin shr lmm_x, #8 wz ' any more chars to send? if_nz jmp #.send '> br back: (nz = another char in lmm_x) ' ---------------------------------------- MOV lmm_x, lmm_w ' < pop: 'x' #0 > RET wcz ' <--- return to calling routine ---> '--------------------------------------------------------------------------------------------------- ''-------[ Rx: Receive a char ]------------------------------------------------ <--- receive char ---> ''_HubRx '' On Entry: '' lmm_x = -anything- ' value: '' Call Format: '' CALL #_HubRx ' < call: receive char> '' On Return: '' lmm_x = char ' char: input char ''-------------------------------------------------------------------------------------------------- _HubRx ' <--- receive char ---> .recv testp #_rxpin wc ' char ready? if_nc jmp #.recv ' rdpin lmm_x, #_rxpin ' recv byte (bits31:24) from rx pin shr lmm_x, #24 ' shift rx bits RET wcz ' <--- return to calling routine ---> '--------------------------------------------------------------------------------------------------- ''-------[ Display Hex ]------------------------------------------------------- <--- display hex ---> ''_HubHex ' '' On Entry: '' lmm_f = _HEX [+options] ' mode: #_HEX[+_REV][+_SP][+_ndigits] '' ' 'n' digits = 7..0 where 0 = 8 digits '' lmm_x = char(s) ' char(s): '' Call Format: '' CALL #_HubHex ' < call: display hex > '' On Return: '' lmm_f = -same- ' mode: (unchanged) '' lmm_x = -same- ' char(s): (unchanged) ''-------------------------------------------------------------------------------------------------- _HubHex ' <--- display hex ---> MOV lmm_hx, lmm_x ' < push: 'x' #0 > MOV lmm_hc, lmm_c ' < push: 'c' #1 > ' ---------------------------------------- test lmm_f, #_REV wz ' reverse mode? if_nz movbyts lmm_x, #%%0123 ' y: reverse bytes mov lmm_c, lmm_f '\ CTR = ... and lmm_c, #7 wz '| ... 'n' digits ... if_z mov lmm_c, #8 '/ ... if 0, then 8 mov lmm_w, #8 '\ nibbles to... sub lmm_w, lmm_c wz '| ... ... if_nz shl lmm_w, #2 '| ... *4 ... if_nz rol lmm_x, lmm_w '/ ... discard ' ---------------------------------------- .next rol lmm_x, #4 '\ next nibble ... MOV lmm_hx2, lmm_x '| ... save ... < push: 'x' #2 > and lmm_x, #$0F '| ... extract ... or lmm_x, #"0" '| ... convert ... cmp lmm_x, #":" wc '| ... ... if_nc add lmm_x, #("A"-"9"-1) '/ ... now 0-9,A-F CALL #_HubTx ' < call: display char(s)> ' ---------------------------------------- test lmm_f, #_SP wz ' hex space mode? test lmm_c, #1 wc ' c if odd count if_z_or_nc jmp #.nospace '> br: (no space reqd) mov lmm_x, #" " ' " " CALL #_HubTx ' < call: transmit char(s)> ' ---------------------------------------- .nospace MOV lmm_x, lmm_hx2 ' ... restore ... < pop: 'x' #2 > djnz lmm_c, #.next '> CTR-- ' ---------------------------------------- MOV lmm_c, lmm_hc ' < pop: 'c' #1 > MOV lmm_x, lmm_hx ' < pop: 'x' #0 > RET wcz ' <--- return to calling routine ---> '------------------------------------------------------------------------------ ''-------[ Display String, terminated ]---------------------------------- <--- display string ---> ''_HubTxString ' '' On Entry: '' lmm_f = #_TXSTRING [+options] ' mode: #_TXSTRING '' lmm_p = 'addr' ' addr: string (hub ptr) '' Call Format: '' CALL #_HubTxString ' < call: display string> '' On Return: '' lmm_f = -same- ' mode: (unchanged) '' lmm_p = 'addr' (next string) ' addr: (hub ptr to next string) ''-------------------------------------------------------------------------------------------------- _HubTxString ' <--- display string ---> MOV lmm_hx, lmm_x ' < push: 'x' #0 > ' ---------------------------------------- .loop rdbyte lmm_x, lmm_p wz ' get char from string: nul? add lmm_p, #1 ' PTR++ if_z jmp #.return '> br fwd: (returns to calling program) CALL #_HubTx ' < call: transmit char(s)> jmp #.loop ' br back ' ---------------------------------------- .return MOV lmm_x, lmm_hx ' < pop: 'x' #0 > RET wcz ' <--- return to calling routine ---> '------------------------------------------------------------------------------ ''-------[ LIST a line ]------------------------------------------------------- <--- LIST a line ---> ''_HubList '' On Entry: '' lmm_f = #_LIST [+options] ' mode: _LIST[+_{ADDR2|COUNT}][+_HDG][+_{MON|SMON|CODE|LONG}] '' lmm_p = 'addr' (from) ' addr: from cog addr / hub ptr '' lmm_p2 = 'addr2' (to) (optional) ' addr2: to cog addr / hub ptr (if _ADDR2 specified) '' lmm_c = 'count' (count) (optional) ' count: 'n' lines (hex) (if _COUNT specified) '' ' Note: only addr2 or count may be specified, not both! '' Call Format: '' CALL #_HubList ' < call: LIST a line > '' On Return: '' lmm_f = same except _HDG off ' mode: same except _HDG will be off '' lmm_p = addr++ (from) ' addr: next from cog addr / hub ptr '' lmm_p2 = addr2++/same (to) ' addr2: next to addr -OR- unchanged '' lmm_c = -same- (count) ' count: (unchanged) ''--------------------------------------------------------------------------------------------------- '' RR20180108 Bug: count doesn't work _HubList ' <--- LIST a line ---> ' ===LIST LINE(S)=== MOV lmm_lx, lmm_x '\ save all params MOV lmm_lf, lmm_f '| MOV lmm_lp, lmm_p '| MOV lmm_lp2,lmm_p2 '| MOV lmm_lc, lmm_c '/ ' count mode ? test lmm_f, #_COUNT wz ' nz if count mode if_nz cmp lmm_c, #33 wc ' y: validate count (max 32 lines, else 1) if_nz_and_nc mov lmm_c, #1 ' y: override!! if_nz MOV lmm_lc2, lmm_c ' y: save a copy for line counting ' addr2 mode ? test lmm_f, #_ADDR2 wz ' nz if addr2 mode if_nz MOV lmm_lc2, lmm_p ' y: save a copy for addr counting ' ---------------------------------------- ' ===DISPLAY HDG ?=== test lmm_f, #_HDG wz ' heading? if_z jmp #.nohdg '> br fwd: (no) ' determine data display mode... test lmm_f, #2 wz ' z if MON /SMON else CODE/LONG test lmm_f, #1 wc ' c if SMON/LONG else MON /CODE if_z_and_nc mov lmm_p, ##_str_hmon ' set addr of MON hdg if_z_and_c mov lmm_p, ##_str_hsmon ' set addr of SMON hdg if_nz_and_nc mov lmm_p, ##_str_hcode ' set addr of CODE hdg if_z_or_nc jmp #.hdg '> br fwd: (mon/smon/long) cmp lmm_p, ##$3FF wcz ' z|c if =<$3FF = cog/lut mode ? if_be mov lmm_p, ##_str_hlongc ' set addr of COG/LUT LONG hdg if_a mov lmm_p, ##_str_hlong ' set addr of HUB LONG hdg .hdg mov lmm_f, #_TXSTRING CALL #_HubTxString ' < call: tx string > MOV lmm_f, lmm_lf ' restore 'f' MOV lmm_p, lmm_lp ' restore 'p' .nohdg ' ---------------------------------------- ' ===LOOPS HERE FOR MULTIPLE LINES=== _HubListLoop ' ---------------------------------------- ' ===DISPLAY LINE: ADDR=== cmp lmm_p, ##$3FF wcz ' z|c if =<$3FF = cog/lut mode? ' cog: if_be mov lmm_x, ##(" "+" "<<8) ' " " if_be CALL #_HubTx ' < call: transmit char(s) > if_be mov lmm_f, #_HEX+3 ' set hex mode with 3 digits ' hub: if_a mov lmm_f, #_HEX+5 ' set hex mode with 5 digits ' display address mov lmm_x, lmm_p ' set cog/hub address (for displaying) CALL #_HubHex ' < call: display hex > mov lmm_x, ##("-"+" "<<8) ' "- " CALL #_HubTx ' < call: transmit char(s) > MOV lmm_f, lmm_lf ' restore 'f' ' ---------------------------------------- ' determine data display mode... test lmm_f, #2 wz ' z if MON /SMON else CODE/LONG test lmm_f, #1 wc ' c if SMON/LONG else MON /CODE ' if_nz_and_nc JMP #_ListCode ' j if CODE <---?????? code not done!!! NOP ' <----- space for later patch ' ---------------------------------------- ' ===DISPLAY 4x HEX LONGS=== ' MON/SMON/LONG: lmm_p = ptr to 1st long '**done** test lmm_f, #2 wz ' z if MON /SMON else CODE/LONG '**done** test lmm_f, #1 wc ' c if SMON/LONG else MON /CODE if_nz_and_c mov lmm_f, #_HEX+0 ' long: set hex with 8(=0) digits if_z mov lmm_f, #_HEX+_REV+_SP+0 ' mon/smon: set hex reversed space mode with 8(=0) digits mov lmm_c, #4 ' set 4 longs ' read a long from cog/hub into lmm_x pointed to by lmm_p and inc lmm_p .long4 CALL #_RdLongCogHub ' < call: read cog/hub long > CALL #_HubHex ' < call: display hex> if_nz_and_c mov lmm_x, ##$20202020 ' long: " " if_nz_and_c CALL #_HubTx ' long: < call: transmit char(s) > djnz lmm_c, #.long4 ' (4 longs)-- MOV lmm_f, lmm_lf ' restore 'f' MOV lmm_c, lmm_lc ' restore 'c' ' ---------------------------------------- ' ===DISPLAY ASCII=== '**done** test lmm_f, #2 wz ' z if MON /SMON else CODE/LONG '**done** test lmm_f, #1 wc ' c if SMON/LONG else MON /CODE if_c jmp #.noascii '> br fwd: (smon/long) if_z mov lmm_c, #4 ' MON = 4 longs if_nz mov lmm_c, #1 ' CODE = 1 long MOV lmm_p, lmm_lp ' restore 'addr' ' ------------------------ 'xxxx' or 'xxxxxxxxxxxxxxxx' (MON/CODE): lmm_p = ptr to 1st long mov lmm_x, ##(" "+"'"<<8) ' " '" CALL #_HubTx ' < call: transmit char(s) > ' ------------------------ ' read a long from cog/hub into lmm_x pointed to by lmm_p and inc lmm_p .asciiloop CALL #_RdLongCogHub ' < call: read cog/hub long > ' convert 4 bytes to visible mov lmm_f, #4 ' (lmm_f as temp byte counter) .convert mov lmm_w, lmm_x ' duplicate andn lmm_x, #$FF ' clear lower byte and lmm_w, #$FF ' extract lower byte cmp lmm_w, #" " wc ' c if <$20: invisible? if_c mov lmm_w, #"." ' y: replace cmp lmm_w, #$7F wc ' c if <$7F: visible? if_nc mov lmm_w, #"." ' n: replace or lmm_x, lmm_w ' replace lower byte ror lmm_x, #8 ' next byte djnz lmm_f, #.convert ' (lmm_f as temp byte counter) MOV lmm_f, lmm_lf ' restore 'f' CALL #_HubTx ' 4 ascii bytes < call: transmit char(s)> djnz lmm_c, #.asciiloop ' (longs count)-- mov lmm_x, #"'" ' "'" CALL #_HubTx ' < call: transmit char(s)> .NoAscii ' ---------------------------------------- ' ===END OF LINE=== mov lmm_x, #$0D ' CALL #_HubTx ' < call: transmit char(s)> MOV lmm_lp, lmm_p ' save new 'addr' ' ---------------------------------------- ' ===MULTIPLE LINES ?=== MOV lmm_f, lmm_lf ' restore 'f' MOV lmm_c, lmm_lc ' restore 'c' ' count/addr2 mode ? test lmm_f, #_COUNT wz ' nz if count mode if_nz jmp #.count ' y: test lmm_f, #_ADDR2 wz ' nz if addr2 mode if_nz jmp #.addr2 ' y: jmp #.return ' else: (done) ' ---------------------------------------- .count djz lmm_lc2, #.return ' (line count)-- b if =0 jmp #_HubListLoop ' another line ' ---------------------------------------- .addr2 cmp lmm_p, lmm_p2 wc ' c|z if addr =< addr2 if_be jmp #_HubListLoop ' n: another line ' we need to calculate how far 'addr' advanced and advance 'addr2' by the same amount sub lmm_p, lmm_lc2 ' final 'addr' - initial 'addr' = diff add lmm_p2, lmm_p ' 'addr2' + diff MOV lmm_lp2, lmm_p2 ' save new 'addr2' ' ---------------------------------------- ' recover the original 'x' & 'c' values .return MOV lmm_x, lmm_lx '\ restore all params MOV lmm_f, lmm_lf '| MOV lmm_p, lmm_lp '| MOV lmm_p2,lmm_lp2 '| MOV lmm_c, lmm_lc '/ andn lmm_f, #_HDG ' & turn _HDG off ' ---------------------------------------- RET wcz ' <--- return to calling routine ---> ''-------------------------------------------------------------------------------------------------- ''-------[ Read Cog/Hub Long ]------------------------------------------------- <--- read: cog/hub long ---> ''_RdLongCogHub '' On Entry: '' lmm_x = -anything- ' 'long': '' lmm_p = 'addr' ' 'addr': cog addr / hub ptr '' Call Format: '' CALL #_RdLongCogHub ' < call: read cog/hub long > '' On Return: '' lmm_x = 'long' ' 'long': read from cog/hub '' lmm_p = 'addr++' ' 'addr++' cog addr++ / hub ptr++ '--------------------------------------------------------------------------------------------------- _RdLongCogHub ' <--- read: cog/hub long ---> cmp lmm_p, ##$3FF wcz ' z|c if =<$3FF = cog/lut mode? ' read the 'long' into lmm_x from hub 'addr' in lmm_p if_a rdlong lmm_x, lmm_p '\ read a long (hub) if_a add lmm_p, #4 '/ PTR++ if_a jmp #.rdlongcoghub cmp lmm_p, #$1FF wcz ' z|c if =<$3FF = cog mode? ' read the 'long' into lmm_x from lut 'addr' in lmm_p if_a rdlut lmm_x, lmm_p '\ read a long (lut) if_a add lmm_p, #1 '/ PTR++ if_a jmp #.rdlongcoghub ' read the 'long' into lmm_x from cog 'addr' in lmm_p.. ' don't forget we are executing from hub (hubexec) if_be alts lmm_p '\ set PTR if_be mov lmm_x, 0-0 '| read a long (cog) if_be add lmm_p, #1 '/ PTR++ ' ---------------------------------------- .rdlongcoghub RET wcz ' ''-------------------------------------------------------------------------------------------------- ''===================================================================================================================== ''-------[ Receive String ]---------------------------------------------------- <--- receive string ---> ''_HubRxString '' On Entry: '' lmm_f = #_RXSTRING [+options] ' mode: #_RXSTRING[+_ECHO][+_PROMPT][+_ADDR][+_NOLF] '' lmm_x = char(s) (optional) ' prompt: char(s) '' lmm_p = 'addr' (optional) ' addr: input string (hub ptr) '' Call Format: '' CALL #_HubRxString ' \ < call: receive string > '' On Return: '' lmm_f = -same- ' mode: (unchanged) '' lmm_x = -same- ' '' lmm_p = 'addr' ' addr: input string (hub ptr) '' lmm_c = 'count' ' count: char(s) entered (incl , excl ) ''-------------------------------------------------------------------------------------------------- _HubRxString ' <--- receive string ---> MOV lmm_hx, lmm_x ' < push: 'x' #0 > ' ---------------------------------------- test lmm_f, #_PROMPT wz ' prompt ? if_z jmp #.noprompt ' n: ' Display prompt char(s) in lmm_x CALL #_HubTx ' < call: transmit char(s) > ' setup the hub string address ptr .noprompt test lmm_f, #_ADDR wz ' addr supplied option ? if_z mov lmm_p, ##@_HUBBUF ' n: use internal hub buffer ' receive char(s) terminated in mov lmm_c, #0 ' set char count=0 .loop CALL #_HubRx ' < call: receive char > cmp lmm_x, #BS wz ' ? if_z cmp lmm_c, #0 wz ' start of input ? if_z jmp #.loop ' y: skip cmp lmm_c, #_HUBBUFSIZE-2 wc ' c if < end-of-buf ? if_nc cmp lmm_x, #BS wz ' ? if_nc_and_nz cmp lmm_x, #CR wz ' ? if_nc_and_nz jmp #.loop ' j if buf full + not not (ignore) wrbyte lmm_x, lmm_p ' push input char to buf (don't inc ptr yet) test lmm_f, #_ECHO wz ' echo? if_z jmp #.noecho ' n: cmp lmm_x, #BS wz ' ? if_z mov lmm_x, ##(BS+" "<<8+BS<<16) ' y: echo " " CALL #_HubTx ' < call: transmit char(s) > rdbyte lmm_x, lmm_p ' restore input char .noecho cmp lmm_x, #LF wz ' ? if_nz jmp #.notlf ' n: test lmm_f, #_NOLF wz ' strip ? if_nz jmp #.loop ' j if strip .notlf cmp lmm_x, #BS wz ' ? if_z sub lmm_p, #1 ' y: PTR-- if_z sub lmm_c, #1 ' y: CTR-- if_z jmp #.loop ' y: j .notbs add lmm_p, #1 ' PTR++ add lmm_c, #1 ' CTR++ cmp lmm_x, #CR wz ' ? if_nz jmp #.loop ' n: if not ' have a buffer with followed by terminated mov lmm_x, #0 '\ load $0 (nul) wrbyte lmm_x, lmm_p '/ push to buf sub lmm_p, lmm_c ' reset PTR to start of string ' ---------------------------------------- MOV lmm_x, lmm_hx ' < pop: 'x' #0 > RET wcz ' <--- return to calling routine ---> '--------------------------------------------------------------------------------------------------- ''=========================================================================================================== ''=========================================================================================================== ''=========================================================================================================== ''-------[ Monitor: DebugMonitor]---------------------------------------------- <--- monitor/debug ---> ''_HubMonitor '' Call Format: ' '' CALL #_HubMonitor ' < call: monitor/debug> ''-------------------------------------------------------------------------------------------------- _HubMonitor '--------------------------------------- _GetCommand mov lmm_f, #_RXSTRING+_PROMPT+_ECHO+_NOLF '\ call input routine mov lmm_x, #"*" '| prompt CALL #_hubRxString '/ < call: recv string > '--------------------------------------------------------------- ' returns: lmm_p =str ptr, lmm_c=count of chars '--------------------------------------------------------------- CALL #_ParseCommand ' parse the input < call: parse command > '--------------------------------------------------------------- ' returns: lmm_f[31..0] = %0000000f ffffffff mmmmmmmm zzzzzzzz ' lmm_x=hex, lmm_c=digitcount, lmm_p=ptrnextchar ' _parse_new: 'x','f','p','p2','c' contain updated values '--------------------------------------------------------------- {{ '=====debug============================================================================================ mov lmm_x, lmm_f 'display return parameters first mov lmm_f, #_HEX+0 CALL #_hubHex mov lmm_x, #" " CALL #_hubTx mov lmm_w, ##_parse_p '\ get saved value rdlong lmm_x, lmm_w '/ CALL #_hubHex mov lmm_x, #" " CALL #_hubTx mov lmm_w, ##_parse_p2 '\ get saved value rdlong lmm_x, lmm_w '/ CALL #_hubHex mov lmm_x, #" " CALL #_hubTx mov lmm_w, ##_parse_c '\ get saved value rdlong lmm_x, lmm_w '/ CALL #_hubHex mov lmm_x, #" " CALL #_hubTx mov lmm_x, #CR CALL #_hubTx jmp #_GetCommand ' '=====end debug============================================================================================ }} mov lmm_w, lmm_f '\ extract command char (ucase) and lmm_w, #$FF '/ '--------------------------------------------------------------- ' decode the command... '--------------------------------------------------------------- ' ' ? ' Q ' L/LS/LL/LX/LO ' /# [[$/N]addr] (updates lmm_p) ' . [[$/N]addr2] (updates lmm_p2) ' , [[$/N]count] (updates lmm_c) ' :/- store ' ? ' if_e jmp #_Cmd_CR ' y: LIST (using prev params) cmp lmm_w, #"-" wz ' "-" ? STORE ' if_e jmp #_Cmd_Store ' cmp lmm_w, #"?" wz ' "?" ? HELP if_e jmp #_Cmd_Help ' cmp lmm_w, #"Q" wz ' "Q" ? QUIT if_e jmp #_Cmd_Quit ' '--------------------------------------------------------------- ' other commands require the parsed params {addr} {addr2} {count} '--------------------------------------------------------------- mov lmm_x, ##_parse_p '\ set PTR = ##parse_p setq #3 '| loadup 'p','p2','c' rdlong lmm_p, lmm_x '/ '--------------------------------------- mov lmm_w, lmm_f '\ extract command char (ucase) and lmm_w, #$FF '/ mov lmm_x, lmm_f '\ extract command modifier shr lmm_x, #8 '| and lmm_x, #$FF '/ shr lmm_f, #16 '> extract mode bits ' ---------------------------------------- cmp lmm_w, #"G" wz ' "G" ? GOTO ' if_e jmp #_Cmd_G ' cmp lmm_w, #"L" wz ' "L" ? LIST if_e jmp #_Cmd_L ' cmp lmm_w, #"M" wz ' "M" ? MOVE ' if_e jmp #_Cmd_M ' '------------------------------------------------------- _Cmd_What add lmm_c, #1 '\ try to indicate unknown mov lmm_x, #" " '| .loop CALL #_HubTx '| djnz lmm_c, #.loop '| mov lmm_x, #"^" '| CALL #_HubTx '/ mov lmm_p, ##_str_unknown ' addr of unknown string CALL #_HubTxString ' < call: tx string > jmp #_GetCommand ' '------------------------------------------------------- _Cmd_Quit ' Q Return to user program {{ mov lmm_w, ##_param_mx '\ set PTR = ##param_mx setq #5 '| restore 'x','f','p','p2','c' rdlong lmm_x, lmm_w '/ mov lmm_w, ##_param_stack '\ set PTR = ##param_stack rep #3, #8-1 '| repeat 3 instr * 8 times rdlong lmm_w2, lmm_w '| restore internal stack (8 levels) push lmm_w2 '| add lmm_w, #1 '/ PTR++ }} RET wcz ' <--- return to calling routine ---> '------------------------------------------------------- _Cmd_Help ' ? Display help message mov lmm_f, #_TXSTRING mov lmm_p, ##_str_vers ' addr of vers string CALL #_HubTxString ' < call: tx string > mov lmm_p, ##_str_help ' addr of help string CALL #_HubTxString ' < call: tx string > jmp #_GetCommand ' '------------------------------------------------------- _Cmd_G ' G Return to user program ' xxxG Goto cog address xxx {{ cmp lmm_c, #0 wz ' z = G if_nz POP lmm_w '\ nz = xxxG replace return address with goto address if_nz PUSH lmm_x '/ }} jmp #_GetCommand ' '------------------------------------------------------- ' LIST memory: lmm_p='addr', lmm_p2='addr2' -or- lmm_c='count' ' lmm_x=mmmmmmmm, lmm_f=f_ffffffff _Cmd_L ' [xxxxx][.yyyyy][,[$]cccc]L[m] ' $1_xxxxx tricks to force hub :) mov lmm_f, #_LIST+_ADDR2+_HDG+_MON ' list addr2 w heading monitor {{ test lmm_f, #_DOT wz ' [.yyyyy] = {addr2} parameter? if_z mov lmm_f, #_LIST+_ADDR2+_HDG+_MON ' list addr2 w heading monitor ''' if_nz mov lmm_f, #_LIST+_COUNT+_HDG+_MON ' list count w heading monitor if_nz jmp #_GetCommand ' count does not work!!! }} CALL #_HubList jmp #_GetCommand ' '------------------------------------------------------------------------------------------------------------------ ''-------[ Parse Command Line ]------------------------------------------------ <--- parse command line ---> ''_ParseCommand '' On Entry: '' lmm_c = 'count' ' count: count of chars in string (less 0 terminator) '' lmm_p = 'addr' ' addr: ptr to string (hub) '' Call Format: '' CALL #_ParseCommand ' < call: parse command > '' On Return: '' lmm_f = 'mode/cmd' ' cmd: lmm_f[31..0] = %0000000f ffffffff mmmmmmmm zzzzzzzz '' lmm_p = 'addr++' ??? ' addr: ptr to string (hub) - next char '' lmm_p2 = 'addr2' ??? ' addr2: .yyyyy addr2 '' lmm_c = 'count' ??? ' count: ,cc count '' Updates prior to return: '' parse_p = 'addr' if {[#]addr} entered '' parse_p2 = 'addr2' if {.addr2} entered '' parse_c = 'count' if {,count} entered ''-------------------------------------------------------------------------------------------------- '' [[#]xxxxxxxx][.yyyyy][,[$]ccccc]z[m] '' '' lmm_f[31..0] = %0000000f ffffffff mmmmmmmm zzzzzzzz '' f_ffffffff = bit definitions of sub commands '' mmmmmmmm = ascii command modifier '' zzzzzzzz = ascii command (upper case) '--------------------------------------------------------------------------------------------------- _ParseCommand ' <--- parse command line ---> mov lmm_f, #0 ' clear lmm_f mode ' ---------------------------------------- ' get 1st param: [[#]xxxxx] hex/addr {addr} .par1 CALL #_ParseSpaces ' skip ' now check if follows... cmp lmm_w, #CR wz ' ? if_e jmp #.return ' y: ' now check if "#" follows... cmp lmm_w, #"#" wz ' "#" ? (immediate?) if_e or lmm_f, #_HASH ' set immediate mode if_e add lmm_p, #1 ' PTR++ CALL #_ParseHex ' < call: parse hex > '--------------------------------------------------------------- ' returns: lmm_x=addr(hex), lmm_c=digitcount, lmm_p=ptrnextchar '--------------------------------------------------------------- cmp lmm_c, #0 wz ' any input? if_nz mov lmm_w, ##_parse_p '\ y: overwrite previous if_nz wrlong lmm_x, lmm_w '/ ...saved value ' ---------------------------------------- ' get 2nd param: [.yyyyy] {addr2} .par2 CALL #_ParseSpaces ' skip ' now check if "-" follows... cmp lmm_w, #"-" wz ' "-" ? if_e jmp #.return ' y: ' now check if "." follows... cmp lmm_w, #"." wz ' z if "." if_ne jmp #.par31 ' n: add lmm_p, #1 ' PTR++ or lmm_f, #_DOT ' set address2 mode CALL #_ParseHex ' < call: parse hex > '--------------------------------------------------------------- ' returns: lmm_x=addr2(hex), lmm_c=digitcount, lmm_p=ptrnextchar '--------------------------------------------------------------- cmp lmm_c, #0 wz ' any input? if_nz mov lmm_w, ##_parse_p2 '\ y: overwrite previous if_nz wrlong lmm_x, lmm_w '/ ...saved value ' ---------------------------------------- ' get 3rd param: [,[$]cc] count .par3 CALL #_ParseSpaces ' skip ' now check if "," follows... .par31 cmp lmm_w, #"," wz ' z if "," if_ne jmp #.par4 ' n: add lmm_p, #1 ' PTR++ or lmm_f, #_COMMA ' set count mode ' now check if "$" follows rdbyte lmm_w, lmm_p ' read next char cmp lmm_w, #"$" wz ' z if "$" if_e add lmm_p, #1 ' PTR++ if_ne or lmm_f, #_DEC ' set decimal CALL #_ParseDecHex ' < call: parse dec/hex > '--------------------------------------------------------------- ' returns: lmm_x=count(hex), lmm_c=digitcount, lmm_p=ptrnextchar '--------------------------------------------------------------- cmp lmm_c, #0 wz ' any input? if_nz mov lmm_w, ##_parse_c '\ y: overwrite previous if_nz wrlong lmm_x, lmm_w '/ ...saved value ' ---------------------------------------- ' get 4th param: [Z] command ' now check if/what command follows... .par4 CALL #_ParseSpaces ' skip shl lmm_f, #16 ' lmm_f[31..0] = %0000000f ffffffff 00000000 00000000 '' cmp lmm_w, #CR wz ' ? '' if_z jmp #.return ' y: add lmm_p, #1 ' PTR++ ' convert lower case a-z to uppercase A-Z cmp lmm_w, #"a" wc '\ c if <"a" if_b jmp #.par40 '| y: cmp lmm_w, #"z"+1 wc '| c if <"z"+1 (ie a-z?) if_b sub lmm_w, #$20 '/ convert to uppercase .par40 or lmm_f, lmm_w ' lmm_f[31..0] = %0000000f ffffffff 00000000 zzzzzzzz ' ---------------------------------------- ' get 5th param: [m] command modifier .par5 rdbyte lmm_w, lmm_p ' read a char from string ' convert lower case a-z to uppercase A-Z cmp lmm_w, #"a" wc '\ c if <"a" if_b jmp #.par50 '| y: cmp lmm_w, #"z"+1 wc '| c if <"z"+1 (ie a-z?) if_b sub lmm_w, #$20 '/ convert to uppercase .par50 ror lmm_f, #8 '\ or lmm_f, lmm_w '| add in modifier char (exists or not) rol lmm_f, #8 '/ lmm_f[31..0] = %0000000f ffffffff mmmmmmmm zzzzzzzz ' ---------------------------------------- ' just ignore any other chars! .return RET wcz ' <--- return to calling routine ---> ''-------------------------------------------------------------------------------------------------- ''-------[ Parse dec/hex input ]----------------------------------------------- <--- parse dec/hex input ---> ''_ParseDecHex '' On Entry: '' lmm_x = -anything-/'hex' ' 'hex': ---/prev hex value '' lmm_c = -anything-/'count' ' 'count': ---/prev count '' lmm_p = 'addr' ' 'addr': ptr to string (hub) '' Call Format: '' CALL #_ParseDecHex ' < call: parse dec/hex > '' On Return: '' lmm_x = 'hex' ' 'hex': hex value '' lmm_c = 'count' ' 'count': of hex digits '' lmm_p = 'addr++' ' 'addr': ptr to next non-hex char ''-------------------------------------------------------------------------------------------------- _ParseHex _ParseDecHex ' <--- parse dec/hex input ---> mov lmm_x, #0 ' preset hex=0 mov lmm_c, #0 ' preset count=0 CALL #_ParseSpaces ' skip .loop rdbyte lmm_w, lmm_p ' read a char from string cmp lmm_w, #"0" wc ' c if <"0" if_b jmp #.done ' j if not dec/hex cmp lmm_w, #"9"+1 wc ' c if "0"-"9" ' check for decimal test lmm_f, #_DEC wz ' z if decimal if_z jmp #.hex ' n: then hex ' ---------------------------------------- .dec ''' cmp lmm_w, #"9"+1 wc ' c if "0"-"9" (checked above) if_nc jmp #.done ' n: not 0-9 and lmm_w, #$0F ' extract valid digit ' multiply lmm_x by 10 and add lmm_w shl lmm_x, #1 ' *2 add lmm_w, lmm_x ' shl lmm_x, #2 ' *8 add lmm_x, lmm_w ' +new jmp #.both ' ---------------------------------------- .hex ''' cmp lmm_w, #"9"+1 wc ' c if "0"-"9" (checked above) if_b jmp #.num ' y: 0-9 or lmm_w, #$20 ' force lower case a-z cmp lmm_w, #"a" wc ' c if <"a" if_b jmp #.done ' j if not hex cmp lmm_w, #"f"+1 wc ' c if <"g" if_nc jmp #.done ' j if not hex sub lmm_w, #("A"-"9"-1) ' convert from A-F/a-f .num and lmm_w, #$0F ' extract valid nibble shl lmm_x, #4 ' shift nibbles or lmm_x, lmm_w ' and add nibble ' ---------------------------------------- .both add lmm_p, #1 ' PTR++ add lmm_c, #1 ' CTR++ jmp #.loop ' ' ---------------------------------------- .done RET wcz ' <--- return to calling routine ---> ''-------------------------------------------------------------------------------------------------- ''-------[ Parse (skip) Space(s) ]--------------------------------------------- <--- parse skip spaces ---> _ParseSpaces rdbyte lmm_w, lmm_p ' read a char from string cmp lmm_w, #" " wz ' " " ? if_e add lmm_p, #1 ' y: PTR++ if_e jmp #_ParseSpaces ' skip RET wcz ' <--- return to calling routine ---> ''-------------------------------------------------------------------------------------------------- ' variables for Monitor Command... '\ Do not change order!! _parse_x long $0000_4C00 '| defaults: "---L" command _parse_f long _LIST+_COUNT+_HDG+_MON '| _parse_p long 0 '| _parse_p2 long 0 '| _parse_c long 4 '/ count=4 _param_mx long 0[5] '> monitor: saves x,f,p,p2,c '_param_mlf long _LIST+_COUNT+_HDG+_MON,0,0,4 '> monitor-list: saves f,p,p2,c _param_stack long 0[8] ' monitor: save/restore internal stack ''=========================================================================================================== ''_str_mon byte "To Rom Monitor - hit ",$0D,0 ''_str_msg1 byte "Successfully returned from debugger",$0D,0 _str_unknown byte " ('?' for help)",$0D,0 _str_help byte $0D byte " ------------ Help -----------------------------------------------------------",$0D byte " [[#]xxxxxxxx][-][.yyyyy][,[$]ccccc]z[m] <-- command format ",$0D byte " -----1----- 4 ---2-- -----3--- 4 5 --6- <-- parameter no. ",$0D byte "...where... ",$0D byte " 1: # xx xx xx xx = an immediate byte/word/long value (spaces optional) ",$0D byte " # xxxxxxxx = stored as a long (spaces mean little endian order) ",$0D byte " xxxxx[-] = from address (hex) where <$200 is in cog, else hub ",$0D byte " 2: . yyyyy = to address (hex) where <$200 is in cog, else hub ",$0D byte " 3: , $ ccccc = (hex) count/length ",$0D byte " , ccccc = (decimal) count/length ",$0D byte " 4: z = (single char) command ( ? - G L M P Q V ) ",$0D byte " 5: m = (single char) command modifier (command specific) ",$0D byte " 6: = key ",$0D byte $0D byte " ? HELP: Show this text ",$0D byte " - STORE: to {addr1} the following {byte(s)}|{word(s)}|{long(s)} ",$0D byte " G GOTO: Goto cog {addr1} (if {addr1} omitted, return to user program) ",$0D byte " COGINIT {addr1}:{par2} for COGID {m5} ",$0D byte " {m5} omitted = this cog; 0..7 = cog 0..7; * = next avail cog ",$0D byte " L LIST: from cog/hub {addr1} to {addr2} ",$0D byte " from cog/hub {addr1} for {count3}|{length3} ",$0D byte " L = L0 = bytes + ascii; L1 = bytes; L2 = code; L3 = long ",$0D byte " M MOVE: from cog/hub {addr1} to cog/hub {addr2} for {Count3}|{length3} ",$0D byte " FILL #{immediate1} to cog/hub {addr2} for {count3}|{length3} ",$0D byte " Q QUIT: Quit the Rom Monitor and return to the User Program ",$0D byte "------------------------------------------------------------------------------",$0D byte $0D,0 _str_hsmon ' same as _str_hmon _str_hmon byte $0D byte " addr- 0 1 2 3 4 5 6 7 8 9 A B C D E F",$0D byte " -----------------------------------------------------",$0D,0 _str_hcode byte $0D byte " addr- cccc instr cz i dst src - conds opcode operands flags",$0D byte " ------------------------------------------------------------------------------",$0D,0 _str_hlong byte $0D byte " addr- +3+2+1+0 - +$4 -- - +$8 -- - +$C --",$0D,0 ' L3 from HUB _str_hlongc byte $0D byte " addr- +3+2+1+0 -- +1 -- -- +2 -- -- +3 --",$0D,0 ' L3 from COG _str_vers long byte "=== Cluso's P2v10a Debugger v.115a ===",$0D,0 ''=========================================================================================================== {{ +------------------------------------------------------------------------------------------------------------------------------+ | TERMS OF USE: MIT License | +------------------------------------------------------------------------------------------------------------------------------+ |Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation | |files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, | |modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software| |is furnished to do so, subject to the following conditions: | | | |The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.| | | |THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | |WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | |COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | +------------------------------------------------------------------------------------------------------------------------------+ }}