I'm compiling the DE0-Nano now. I had to remove the PIX, CORDIC, CTRB, SERB, and waveform output from CTRA to get things to fit. If this compile works, I'll try putting the waveform output back in for CTRA. Anyway, you need the VID and XFR blocks to do multithreaded VGA w/SDRAM, and those blocks are both in the DE0-Nano compile. For the SDRAM writing/reading, you'll need to be single-tasking because that requires exact timing.
I don't need the waveform output in CTRA (not the others you have removed). Not sure about the other DE0 users.
While we are waiting, what did you add to the monitor Chip?
I think it's high time to update the monitor document.
I added a hub exec mode, where you see addresses (divided by four, four digits) and data (32 bits) as a cog does when executing in hub mode.
I also added another cog-start command to handle initial-hub-exec. As well, a lot of little details were improved.
Here's the new ROM_Monitor.spin program. Note that most of the code now lives outside of the cog. This allowed a maximum-sized data/string buffer in cog register space, so that it never runs out before the input-line length of 128 characters. Also see how strings are handled from hub memory:
'********************************************************'* *'* Propeller II ROM Monitor *'* *'* Version 0.5 *'* *'********************************************************'' Version 0.1 - 2012/11/01 - original' Version 0.2 - 2013/09/22 - added semicolon comments' Version 0.3 - 2013/11/13 - began using SERA' Version 0.4 - 2013/12/03 - expanded to 256KB hub memory' Version 0.5 - 2014/03/15 - added cog view mode''' Usage: cognew($52C, rx_pin << 10 + tx_pin << 2) 'start monitor in new cog'' rx_pin bit 7 can be set for rx inversion' tx_pin bit 7 can be set for tx inversionCON datasize = 128DAT orgh ($52C)>>2'*************'* Cog Entry *'*************org'ptra = %rrrrrrrr_tttttttt_00
entry reps #$1F2-reserves,#1'clear reserves
setinda #reserves
mov inda++,#0
getptra ctra 'get rx pin into ctra configurationtestb ctra,#17wc'handle !rxshl ctra,#32-10-7'clear high bitsshr ctra,#32-9-7'position rx pin in dsets ctra,#%1_100_01001'ready state-time mode
setbnc ctra,#5'handle !rx
getptra x 'get rx/tx pins into sera setupror x,#10or x,#$100'ready rx 8T/8Nsetd sera,x
shr x,#32-8or x,#$100'ready tx 8T/8Nsets sera,x
setp sera 'tx high
jmpt1 #baud_task 'enable baud detector task
settask #%%1010
thalt space,#1'wait for <space> to set period
clrp sera 'release tx
jmpt2 #rx_task 'enable serial receiver task
settask #%%1210mov wsize,#1'init word size to bytecall @set_size
wraux #0,#0'init input line to <enter>
locptra @hello 'ready to print hello message'*****************'* Cog Main Task *'*****************
message call @tx_string 'print hello/error message
cmd_new call @rx_line 'get input linecall @parse 'parse first termif_z jz x,@cmd_viewl 'if no hex and eol, view datajmp @cmd_go 'else, process command
cmd_next_crlf call @tx_crlf 'print cr/lf
cmd_next addptrx #1'skip chr
cmd_loop call @parse 'parse next term
cmd_go if_nzjmp @cmd_hex 'if hex, branchsetd pinx,#w 'pin update redirected to w
locptra @branch1 'not hex, vector by chrcall @vector 'if returns, no match
cmd_error locptra @error 'print error messagejmp @message
cmd_hex mov v1,value 'hex, save v1setd pinx,#pin 'pin update okay
locptra @branch2 'vector by chrcall @vector 'if returns, no matchjmp @cmd_view2 'view data
cmd_range shl v1,shiftx 'handle exec modecall @parse_next 'hex., get hexshl value,shiftx 'handle exec modeif_zjmp @cmd_viewp2 'if no hex, view datamov v2,value 'hex.hex, save v2
locptra @branch3 'vector by chrcall @vector 'if returns, no matchjmp @cmd_view3 'view data''' Byte/word/long/cog data'
cmd_byte mov wsize,#1wz'set byte mode, z=0
cmd_word if_zmov wsize,#2wz'set word mode, z=0
cmd_long if_zmov wsize,#4wz'set long mode, z=0
cmd_exec if_zmov wsize,#4'set exec mode, z=1
setbz shiftx,#1'for exec mode, shiftx=2call @set_size
jmp @cmd_next 'next command''' View data'
cmd_viewl mov v2,#$F'<enter> (eol), show line of datacall @tx_range1
jmp @cmd_new
cmd_viewp mov v2,#$FF'. (more), show page of datacall @tx_range1
jmp @cmd_next
cmd_viewp2 mov v2,#$FF'adr. (more), show page of datacall @tx_range2
jmp @cmd_loop
cmd_view2 shl v1,shiftx 'adr, show unit of data, handle exec modemov v2,v1
cmd_view3 call @tx_range 'adr.adr, show range of datajmp @cmd_loop
''' Search'
cmd_search mov v1,view '/, search from view to endjmp @cmd_search2x
cmd_search2 shl v1,shiftx 'adr/, search from address to end, handle exec mode
cmd_search2x mov v2,amask 'set end address
cmd_search3 call @check_range 'adr.adr/, search rangecall @parse_data 'parse data string
:start setptra v1 'start search, point to search address
setinda #data 'point to search datamov x,#0'reset word match counter
:wordcall @rdxxxx 'get memory wordcmp value,inda++ wz'compare against search data wordif_zjmp @:match 'if word match, check if string matchadd v1,wsize 'word mismatch, advance search addresscmp v1,v2 wz,wc'at end of range?if_bejmp @:start 'if not, start next searchmov view,v1 'else, update viewand view,amask
jmp @cmd_loop 'next command
:match incmod x,dsize wc'word match, increment match counterif_ncjmp @:word'if more words to match, compare next wordmov v2,dsize 'got string matchshl v2,shift 'v1 = start of found dataadd v2,v1 'v2 = end of found datajmp @cmd_view3 'show found data''' Enter data'
cmd_enter3 call @check_range 'adr.adr:, check range, w=words to fill, z=0
cmd_enter2 if_zshl v1,shiftx 'adr:, handle exec modemov enter,v1 'set enter addressand enter,amask 'trim enter address (in case cmd_enter2)
cmd_enter call @parse_data ':, parse data (preserves z)if_zmov w,dsize 'if not fill, set w to data sizeif_zadd w,#1
setptrb enter 'get pointer
:loop mov value,inda++ 'get word from string datacall @wrxxxx 'store value in memorydjnz w,@:loop 'loop until enter done
getptrb enter 'update pointerjmp @cmd_loop 'next command''' Move data'
cmd_move mov y,x 'save ">"/"<"call @check_range 'check 1st address range, get number of wordscall @parse_hex 'get 2nd addressshl value,shiftx 'handle exec mode
max value,amask 'v1=1st, value=2nd, w=words, y=">"/"<"and value,amask
cmp y,#"<"wz'if "<", swap v1 and valueif_zmov x,v1
if_zmov v1,value
if_zmov value,x 'v1=from, value=to, w=wordscmp v1,value wc'if from < to, downward moveif_cmov x,w
if_cshl x,shift
if_cadd v1,x
if_cadd value,x
if_cxor rdxxxx,#%001_111110'modify 'rdxxxx value,--ptra'if_cxor wrxxxx,#%001_111110'modify 'wrxxxx value,--ptrb'
setptra v1 'set pointers
setptrb value
:loop call @rdxxxx 'move datacall @wrxxxx
djnz w,@:loop
if_cxor rdxxxx,#%001_111110'restore 'rdxxxx value,ptra++'if_cxor wrxxxx,#%001_111110'restore 'wrxxxx value,ptrb++'jmp @cmd_loop 'next command''' Checksum'
cmd_checksum call @check_range 'check range
setptra v1 'sum bytes/words/longs
:loop call @rdxxxx
add y,value
djnz w,@:loop
mov value,y 'print summov x,#8call @tx_hex
jmp @cmd_next_crlf 'next command''' Watch'
cmd_watchp mov y,#1'pin#, set pin modemov v2,#1wz'set single hex digit, z=0
cmd_watch if_zshl v1,shiftx 'adr@, handle exec modeif_zmov v2,wsize 'set hex size by word sizeif_zshl v2,#1call @rdxxxp 'get initial value
:loop mov w,value 'preserve valuemov x,v2 'set hex sizecall @tx_hex 'print value
serouta #" "'print space
:wait call @rx_check 'if key hit, exitif_nzjmp @cmd_next_crlf
call @rdxxxp 'get current valuecmp value,w wz'if same, check againif_zjmp @:wait
jmp @:loop 'new value, loop
rdxxxp setptra v1 'if not pin mode, read memory
jz y,@rdxxxx
getp v1 wc'read pinif_ncmov value,#0if_cmov value,#1ret''' Clkset'
cmd_clkset locptra @hitspace 'print hit-space messagecall @tx_string
passtxa 'wait for tx doneclkset v1 'set clk
thalt space,#1'wait for recalibrating spacecall @rx_chr 'throw away garbage characterjmp @cmd_next_crlf 'next command''' Start cog'
cmd_cogrun mov x,#1wz'z=0
cmd_cogrunx call @parse_hex 'z=1, get program address (preserves z)if_nz cogrun value,v1 'start in cogif_z cogrunx value,v1 'start in hubjmp @cmd_loop 'next command''' Stop cog' Quit'
cmd_quit cogid v1 'quit
cmd_cogstop cogstop v1 'stop cogjmp @cmd_next 'next command''' Map'
cmd_map mov y,#7'ready for 7..0
cmd_map_loop serouta #" "'print spacecogid x 'get cog idcogid y wc'get cog y status
cmd_map_c cmp x,y wzif_ncmov x,#"0"'get 0/1/M chrif_cmov x,#"1"if_zmov x,#"M"
serouta x 'print chrsub y,#1wcif_ncjmp @cmd_map_loop 'loop until donejmp @cmd_next_crlf 'next command''' Pin writes setp/clrp/notp/offp' Pin read'
cmd_setp mov x,#$ABwz'setp, z=0
cmd_clrp if_zmov x,#$AAwz'clrp, z=0
cmd_notp if_zmov x,#$A9wz'notp, z=0
cmd_offp if_zmov x,#$A8wz'offp, z=0
cmd_getp if_zmov x,#$88'getp, z=1sets pinop,x 'set pin opcode
pinx mov pin,v1 'if hex, get pin (d = pin/w)
pinop getp pin wc'becomes setp/clrp/notp/offp/getpif_zjmp @cmd_map_c 'if getp, show pin valuejmp @cmd_next 'next command''' Pin configuration'
cmd_cfgp call @parse_hex 'get configuration
decod5 x,v1 wz,wc'get pin mask
setbz :i,#25'set pin port
setbc :i,#24
:i if_nz_or_nc cfgpins x,value,#0'configure pin if $00..$5Fjmp @cmd_loop 'next command''' Setdacs'
cmd_setdacs setdacs v1 'set all four dacs with 8-bit valuesjmp @cmd_next 'next command''' Help'
cmd_help locptra @help 'print help messagecall @tx_string
jmp @cmd_next_crlf 'next command''' Self-modifying code'
rdxxxx rdbyte value,ptra++ 'rdbyte/rdword/rdlongret
wrxxxx wrbyte value,ptrb++ 'wrbyte/wrword/wrlongret
rdstring rdbyte x,ptra++ wz,wc'read string byteret
hublimit long$0003FFFF'hub memory limit'****************************'* Cog Serial Receiver Task *'****************************
rx_task serina rx_data 'wait for character
wrauxr rx_data,rx_head 'store byte at headincmod rx_head,#$7F'inc headjmp @rx_task 'wait for next byte'**************************'* Cog Baud Detector Task *'**************************
baud_task notb ctra,#8wc'if 1,0 sample set, c=0 (bit8 is not used by ctra)
notb ctra,#5'toggle state to measure ($20 -> 10000001001 -> 1, 6x 0, 1x 1, 2x 0, 1)
setctra ctra 'ctra measures rx pin statesif_ncmov limh,buf0 'if 1,0 sample set,if_ncshr limh,#4'..make window from 1st 0 (6x if $20)if_ncneg liml,limh
if_ncadd limh,buf0
if_ncadd liml,buf0
if_ncmov comp,buf1 'if 1,0 sample set,if_ncmul comp,#6'..normalize 2nd 1 (1x if $20) to 6xif_nccmpr comp,limh wc'..check if within windowif_nccmp comp,liml wcif_ncmov comp,buf2 'if 1,0 sample set,if_ncmul comp,#3'..normalize 2nd 0 (2x if $20) to 6xif_nccmpr comp,limh wc'..check if within windowif_nccmp comp,liml wcif_ncadd buf0,buf2 'if $20,if_ncshr buf0,#3'..compute period from 6x 0 and 2x 0if_nc setsera sera,buf0 '..(re)initialize serialif_ncmov space,#0'..flag $20mov buf0,buf1 'scroll sample buffermov buf1,buf2
:wait getcosa buf2 'wait for next sample
jnz buf2,@baud_task
jmp @:wait
'*****************'* Cog Variables *'*****************
reserves
v res1'main task
w res1
x res1
y res1
v1 res1
v2 res1
value res1
view res1
enter res1
pin res1
dsize res1
shiftx res1
wsize res1
shift res1
amask res1
data res datasize
rx_data res1'serial receiver task
rx_head res1
rx_tail res1
ctra res1'baud detector task
sera res1
buf0 res1
buf1 res1
buf2 res1
limh res1
liml res1
comp res1
space res1'*******************'* Hub Subroutines *'*******************
orgh
''' Vector branch'
vector rdbyte w,ptra++ wz'get jump addressif_zret'if 0, no match found, returnrdbyte y,ptra++ 'get targetxor y,x wz'compare to xif_nzjmp @vector 'if no match, loopjmp w 'match found, jump, y=0, z=1''' Check address range (v1..v2)'
check_range max v1,amask 'trim v1and v1,amask
max v2,amask 'trim v2and v2,amask
cmp v2,v1 wc'make sure v2 => v1if_cjmp @cmd_error
mov w,v2 'get number of wordssub w,v1
shr w,shift
add w,#1wz'z=0ret''' Set rdxxxx/wrxxxx and others by word size'
set_size test wsize,#%010wc'set rdxxxx/wrxxxx by word size
setbc rdxxxx,#26
setbc wrxxxx,#24test wsize,#%100wc
setbc rdxxxx,#27
setbc wrxxxx,#25mov shift,wsize 'set shift by word sizeshr shift,#1neg amask,wsize 'set amask by word sizeand amask,hublimit
and view,amask 'trim viewand enter,amask 'trim enterret''' Input line'
rx_line setptrx #0'point to start of line
serouta #">"'show promptcall @rx_chr 'get first chrcmp x,#"'"wz'check for repeatif_nzjmp @:first 'if not repeat, first chr
:show rdaux x,ptrx++ wz'repeat, show lineif_nz serouta x
if_nzjmp @:show
jmp @:done
:back chkptrx wz'backspace, line empty? if not,if_nz serouta x '..print backspaceif_nz serouta #" "'..print spaceif_nz serouta x '..print backspaceif_nz subptrx #1'..back up
:loop call @rx_chr 'get next chr
:first cmp x,#13wz'cr?if_zjmp @:cr
cmp x,#8wz'backspace?if_nzcmp x,#127wzif_zjmp @:back
cmp x,#" "wc'invisible chr?if_nccmpr x,#"~"wcif_cjmp @:loop
wraux x,ptrx++ 'visible chr, append to line
chkptrx wc'overflow?if_c subptrx #1'if overflow, back upif_c serouta #7'..and output bellif_nc serouta x 'if not overflow, print chrjmp @:loop
:cr wraux #0,ptrx 'cr, end line with 0
:done setptrx #0'point to start of line
tx_crlf serouta #$0D'print cr/lf
serouta #$0Aret''' Parse hex/text data'
parse_data mov v,#0'reset data count
setinda #data 'point to string data
:hex call @parse_next 'hex loop, check hexif_nzcall @enter_data 'if hex, enter valuecmp x,#" "wz'check for space (more hex)if_zjmp @:hex 'if more hex, loopcmp x,#"'"wz'not hex, "'"?if_nzjmp @:done 'if not "'", done
:text rdaux x,++ptrx 'text loop, get and point to next chrcmp x,#"'"wz'check for "'"if_zjmp @:hex 'if "'", back to hex
jz x,@:done 'if eol, donemov value,x 'text chrcall @enter_data 'enter chrjmp @:text 'loop
:done sub v,#1wc'get data countif_ncmov dsize,v 'if 0, reuse old data
cirinda dsize,#data 'form circular bufferretwz'restore z
enter_data incmod v,#datasize wc'check if data limit exceededif_cjmp @cmd_error 'if data limit exceeded, errormov inda++,value 'store value in dataret''' Parse hex'
parse_hex call @parse_next 'try to parse hexif_zjmp @cmd_error 'if no hex, errorretwz'restore z''' Parse line (@ptrx), z=0 if hex (value)'
parse_next addptrx #1'advance to next chr
parse mov value,#0wz'z=1call @skip_spaces 'skip any spaces (preserve z)
:loop rdaux x,ptrx++ 'get chr
chkhex x wc'check hexif_crolnib value,x 'if hex, append nibble and loopif_ccmp x,#16wz'z=0if_cjmp @:loop
subptrx #1'repoint to non-hex chrcall @skip_spaces 'skip any post-hex spaces (preserves z)
chkhex x wc'check hexif_c rdaux x,--ptrx 'if hex, back up to space chr
chklet x 'make alpha chr uppercaseret''' Skip spaces (@ptrx)'
skip_spaces rdaux x,ptrx++ 'skip space chr(s)cmp x,#" "wzif_zjmp @skip_spaces
subptrx #1'back up to non-space chrretwz'restore z''' Print range (v1..v2)'
tx_range1 mov v1,view 'view..view + v2
tx_range2 and v2,amask 'v1..v1 + v2add v2,v1
tx_range call @check_range 'check rangemov view,v1 'set address
:line mov value,view 'print addressshr value,shiftx 'handle exec modemov x,shiftx '4 digits in exec modeshr x,#1subr x,#5'5 digits in other modescall @tx_hex
serouta #"-"'print "- "
serouta #" "mov x,wsize 'get number of words on linerev x,#32-5mov v1,w
max v1,x
mov v2,v1 'get number of ascii bytes on lineshl v2,shift
sub w,v1 'update number of words left
setptra view 'print hex words
:hex call @rdxxxx
mov x,wsize
shl x,#1call @tx_hex
serouta #" "djnz v1,@:hex
serouta #" "'print " '"
serouta #" "
serouta #"'"
setptra view 'print ascii bytes
:ascii rdbyte x,ptra++
cmp x,#" "wc'visible chr?if_nccmpr x,#"~"wcif_cmov x,#"."'substitute "." for non-visible chrs
serouta x
djnz v2,@:ascii
getptra view 'update address
serouta #"'"'print "'"call @tx_crlf 'print crcall @rx_check 'check key hitif_z jnz w,@:line 'if no key hit and more words left, print another lineret''' Print string (@ptra)'
tx_string call @rdstring 'read string byteif_zret'if 0, doneif_c notb rdstring,#8'if substring, toggle ptra/ptrbif_c locptrb @db 'ptrb points to substringif_c addptrb x
if_cjmp @tx_string 'start substring or resume stringcmp x,#"`"wz'long tab?if_zsubr y,#32-16if_nzcmp x,#"~"wz'short tab?if_zadd y,#16
:tab if_z serouta #" "if_zdjnz y,@:tab
if_z serouta #"-"if_z serouta #" "if_zjmp @tx_string
cmp x,#13wz'cr?if_zcall @tx_crlf
if_zmov y,#0if_nz serouta x 'other?if_nzadd y,#1jmp @tx_string
''' Print hex (value,x)'
tx_hex shl x,#2'position first nibbleror value,x
shr x,#2
:loop getnib v,value,#7'print nibblescmp v,#$Awc'alpha or numeric?if_cadd v,#"0"'numericif_ncadd v,#"A"-$A'alpha
serouta v
rol value,#4djnz x,@:loop
ret''' Receive chr (x)'
rx_chr call @rx_check 'wait for rx chrif_zjmp @rx_chr
ret''' Check receiver, z=0 if chr (x)'
rx_check cmp rx_head,rx_tail wzif_nz rdauxr x,rx_tail
if_nzincmod rx_tail,#$7Fret'************'* Hub Data *'************
db
branch1 longbyte cmd_new, 0byte cmd_new, ";"byte cmd_byte, "Y"byte cmd_word, "W"byte cmd_long, "N"byte cmd_exec, "X"byte cmd_viewp, "."byte cmd_search, "/"byte cmd_enter, ":"byte cmd_map, "M"byte cmd_setp, "H"byte cmd_clrp, "L"byte cmd_notp, "T"byte cmd_offp, "Z"byte cmd_getp, "R"byte cmd_quit, "Q"byte cmd_help, "?"byte0
branch2 longbyte cmd_view2, 0byte cmd_view2, " "byte cmd_range, "."byte cmd_search2, "/"byte cmd_enter2, ":"byte cmd_watch, "@"byte cmd_clkset, "*"byte cmd_cogrun, "+"byte cmd_cogrunx, "-"byte cmd_cogstop, "!"byte cmd_setp, "H"byte cmd_clrp, "L"byte cmd_notp, "T"byte cmd_offp, "Z"byte cmd_getp, "R"byte cmd_watchp, "#"byte cmd_cfgp, "|"byte cmd_setdacs, "\"byte0
branch3 longbyte cmd_view3, 0byte cmd_view3, " "byte cmd_search3, "/"byte cmd_enter3, ":"byte cmd_move, ">"byte cmd_move, "<"byte cmd_checksum, "^"byte0
error longbyte"? - Help",13,7,0
hitspace longbyte"Hit SPACE ",0
hello longbyte13,13,"=== Propeller 2.0 Monitor ===",13,13,0
sub0 byte" -",13,$80'@sub0-@db must be >= $80
sub1 byte"{adr{.adr}}",$80
sub2 byte"{dat{ dat}}",$80
sub3 byte"adr",$80
sub4 byte"pin",$80
sub5 byte"dat",$80
sub6 byte"`Watch",13,$80
sub7 byte"`Set ",$80
help longbyte13, "~HUB",@sub0-@db
byte @sub1-@db, "`View",13byte @sub1-@db,"/",@sub2-@db, "`Search",13byte @sub1-@db,":",@sub2-@db, "`Enter",13byte @sub3-@db,".",@sub3-@db,"[</>]",@sub3-@db, "`Move",13byte @sub3-@db,".",@sub3-@db,"^", "`Checksum",13byte @sub3-@db,"@", @sub6-@db
byte"[Y/W/N/X]", "`Byte/Word/Long/Exec",13byte"~COGS",@sub0-@db
byte"cog[+/-]",@sub3-@db, "`Start in Cog/Hub",13byte"cog!", "`Stop",13byte"M", "`Map",13byte"~PINS",@sub0-@db
byte"{",@sub4-@db,"}[H/L/T/Z/R]", "`High/Low/Toggle/Float/Read",13byte @sub4-@db,"#", @sub6-@db
byte @sub4-@db,"|",@sub5-@db, @sub7-@db,"CFG",13byte @sub5-@db,"\", @sub7-@db,"DACs",13byte"~MISC",@sub0-@db
byte @sub5-@db,"*", @sub7-@db,"CLK",13byte"'", "`Repeat",13byte"Q", "`Quit",13,0
Here's what it looks like when it comes up. It also shows eXec mode:
I support David's efforts in SpinWrap, but he would acknowledge that this is not an optimal way to integrate PASM objects (as opposed to Spin objects).
It is too slow for some purposes, costs an unnecessary cog, and some unnecessary Hub RAM space. I'm not claiming Catalina's method is optimal, but it does everything SpinWrap does, and much more (e.g. locking, cog management etc).
And it is more efficient in both cog usage and hub ram usage.
Ross.
Except that you can't call a Spin function directly from C right? Maybe you've added that recently?
I get the limitations of SpinWrap. I'm sure that whatever you do with your product is good within your definition.
I believe he has a DE2. I will give him a quick phone call to verify.
Postedit: I have left a msg, so sent an email too.
Great! I just got a good compile for the DE0-Nano with the waveform output in the CTR. It was a little slow in Fmax, though, so I'm changing the fitter seed value and trying again. I think we'll get a faster one this time (or next) and we'll have images for both boards.
I added a hub exec mode, where you see addresses (divided by four, four digits) and data (32 bits) as a cog does when executing in hub mode.
I also added another cog-start command to handle initial-hub-exec. As well, a lot of little details were improved.
Here's the new ROM_Monitor.spin program. Note that most of the code now lives outside of the cog. This allowed a maximum-sized data/string buffer in cog register space, so that it never runs out before the input-line length of 128 characters. Also see how strings are handled from hub memory:
'********************************************************'* *'* Propeller II ROM Monitor *'* *'* Version 0.5 *'* *'********************************************************'' Version 0.1 - 2012/11/01 - original' Version 0.2 - 2013/09/22 - added semicolon comments' Version 0.3 - 2013/11/13 - began using SERA' Version 0.4 - 2013/12/03 - expanded to 256KB hub memory' Version 0.5 - 2014/03/15 - added cog view mode''' Usage: cognew($52C, rx_pin << 10 + tx_pin << 2) 'start monitor in new cog'' rx_pin bit 7 can be set for rx inversion' tx_pin bit 7 can be set for tx inversionCON datasize = 128DAT orgh ($52C)>>2'*************'* Cog Entry *'*************org'ptra = %rrrrrrrr_tttttttt_00
entry reps #$1F2-reserves,#1'clear reserves
setinda #reserves
mov inda++,#0
getptra ctra 'get rx pin into ctra configurationtestb ctra,#17wc'handle !rxshl ctra,#32-10-7'clear high bitsshr ctra,#32-9-7'position rx pin in dsets ctra,#%1_100_01001'ready state-time mode
setbnc ctra,#5'handle !rx
getptra x 'get rx/tx pins into sera setupror x,#10or x,#$100'ready rx 8T/8Nsetd sera,x
shr x,#32-8or x,#$100'ready tx 8T/8Nsets sera,x
setp sera 'tx high
jmpt1 #baud_task 'enable baud detector task
settask #%%1010
thalt space,#1'wait for <space> to set period
clrp sera 'release tx
jmpt2 #rx_task 'enable serial receiver task
settask #%%1210mov wsize,#1'init word size to bytecall @set_size
wraux #0,#0'init input line to <enter>
locptra @hello 'ready to print hello message'*****************'* Cog Main Task *'*****************
message call @tx_string 'print hello/error message
cmd_new call @rx_line 'get input linecall @parse 'parse first termif_z jz x,@cmd_viewl 'if no hex and eol, view datajmp @cmd_go 'else, process command
cmd_next_crlf call @tx_crlf 'print cr/lf
cmd_next addptrx #1'skip chr
cmd_loop call @parse 'parse next term
cmd_go if_nzjmp @cmd_hex 'if hex, branchsetd pinx,#w 'pin update redirected to w
locptra @branch1 'not hex, vector by chrcall @vector 'if returns, no match
cmd_error locptra @error 'print error messagejmp @message
cmd_hex mov v1,value 'hex, save v1setd pinx,#pin 'pin update okay
locptra @branch2 'vector by chrcall @vector 'if returns, no matchjmp @cmd_view2 'view data
cmd_range shl v1,shiftx 'handle exec modecall @parse_next 'hex., get hexshl value,shiftx 'handle exec modeif_zjmp @cmd_viewp2 'if no hex, view datamov v2,value 'hex.hex, save v2
locptra @branch3 'vector by chrcall @vector 'if returns, no matchjmp @cmd_view3 'view data''' Byte/word/long/cog data'
cmd_byte mov wsize,#1wz'set byte mode, z=0
cmd_word if_zmov wsize,#2wz'set word mode, z=0
cmd_long if_zmov wsize,#4wz'set long mode, z=0
cmd_exec if_zmov wsize,#4'set exec mode, z=1
setbz shiftx,#1'for exec mode, shiftx=2call @set_size
jmp @cmd_next 'next command''' View data'
cmd_viewl mov v2,#$F'<enter> (eol), show line of datacall @tx_range1
jmp @cmd_new
cmd_viewp mov v2,#$FF'. (more), show page of datacall @tx_range1
jmp @cmd_next
cmd_viewp2 mov v2,#$FF'adr. (more), show page of datacall @tx_range2
jmp @cmd_loop
cmd_view2 shl v1,shiftx 'adr, show unit of data, handle exec modemov v2,v1
cmd_view3 call @tx_range 'adr.adr, show range of datajmp @cmd_loop
''' Search'
cmd_search mov v1,view '/, search from view to endjmp @cmd_search2x
cmd_search2 shl v1,shiftx 'adr/, search from address to end, handle exec mode
cmd_search2x mov v2,amask 'set end address
cmd_search3 call @check_range 'adr.adr/, search rangecall @parse_data 'parse data string
:start setptra v1 'start search, point to search address
setinda #data 'point to search datamov x,#0'reset word match counter
:wordcall @rdxxxx 'get memory wordcmp value,inda++ wz'compare against search data wordif_zjmp @:match 'if word match, check if string matchadd v1,wsize 'word mismatch, advance search addresscmp v1,v2 wz,wc'at end of range?if_bejmp @:start 'if not, start next searchmov view,v1 'else, update viewand view,amask
jmp @cmd_loop 'next command
:match incmod x,dsize wc'word match, increment match counterif_ncjmp @:word'if more words to match, compare next wordmov v2,dsize 'got string matchshl v2,shift 'v1 = start of found dataadd v2,v1 'v2 = end of found datajmp @cmd_view3 'show found data''' Enter data'
cmd_enter3 call @check_range 'adr.adr:, check range, w=words to fill, z=0
cmd_enter2 if_zshl v1,shiftx 'adr:, handle exec modemov enter,v1 'set enter addressand enter,amask 'trim enter address (in case cmd_enter2)
cmd_enter call @parse_data ':, parse data (preserves z)if_zmov w,dsize 'if not fill, set w to data sizeif_zadd w,#1
setptrb enter 'get pointer
:loop mov value,inda++ 'get word from string datacall @wrxxxx 'store value in memorydjnz w,@:loop 'loop until enter done
getptrb enter 'update pointerjmp @cmd_loop 'next command''' Move data'
cmd_move mov y,x 'save ">"/"<"call @check_range 'check 1st address range, get number of wordscall @parse_hex 'get 2nd addressshl value,shiftx 'handle exec mode
max value,amask 'v1=1st, value=2nd, w=words, y=">"/"<"and value,amask
cmp y,#"<"wz'if "<", swap v1 and valueif_zmov x,v1
if_zmov v1,value
if_zmov value,x 'v1=from, value=to, w=wordscmp v1,value wc'if from < to, downward moveif_cmov x,w
if_cshl x,shift
if_cadd v1,x
if_cadd value,x
if_cxor rdxxxx,#%001_111110'modify 'rdxxxx value,--ptra'if_cxor wrxxxx,#%001_111110'modify 'wrxxxx value,--ptrb'
setptra v1 'set pointers
setptrb value
:loop call @rdxxxx 'move datacall @wrxxxx
djnz w,@:loop
if_cxor rdxxxx,#%001_111110'restore 'rdxxxx value,ptra++'if_cxor wrxxxx,#%001_111110'restore 'wrxxxx value,ptrb++'jmp @cmd_loop 'next command''' Checksum'
cmd_checksum call @check_range 'check range
setptra v1 'sum bytes/words/longs
:loop call @rdxxxx
add y,value
djnz w,@:loop
mov value,y 'print summov x,#8call @tx_hex
jmp @cmd_next_crlf 'next command''' Watch'
cmd_watchp mov y,#1'pin#, set pin modemov v2,#1wz'set single hex digit, z=0
cmd_watch if_zshl v1,shiftx 'adr@, handle exec modeif_zmov v2,wsize 'set hex size by word sizeif_zshl v2,#1call @rdxxxp 'get initial value
:loop mov w,value 'preserve valuemov x,v2 'set hex sizecall @tx_hex 'print value
serouta #" "'print space
:wait call @rx_check 'if key hit, exitif_nzjmp @cmd_next_crlf
call @rdxxxp 'get current valuecmp value,w wz'if same, check againif_zjmp @:wait
jmp @:loop 'new value, loop
rdxxxp setptra v1 'if not pin mode, read memory
jz y,@rdxxxx
getp v1 wc'read pinif_ncmov value,#0if_cmov value,#1ret''' Clkset'
cmd_clkset locptra @hitspace 'print hit-space messagecall @tx_string
passtxa 'wait for tx doneclkset v1 'set clk
thalt space,#1'wait for recalibrating spacecall @rx_chr 'throw away garbage characterjmp @cmd_next_crlf 'next command''' Start cog'
cmd_cogrun mov x,#1wz'z=0
cmd_cogrunx call @parse_hex 'z=1, get program address (preserves z)if_nz cogrun value,v1 'start in cogif_z cogrunx value,v1 'start in hubjmp @cmd_loop 'next command''' Stop cog' Quit'
cmd_quit cogid v1 'quit
cmd_cogstop cogstop v1 'stop cogjmp @cmd_next 'next command''' Map'
cmd_map mov y,#7'ready for 7..0
cmd_map_loop serouta #" "'print spacecogid x 'get cog idcogid y wc'get cog y status
cmd_map_c cmp x,y wzif_ncmov x,#"0"'get 0/1/M chrif_cmov x,#"1"if_zmov x,#"M"
serouta x 'print chrsub y,#1wcif_ncjmp @cmd_map_loop 'loop until donejmp @cmd_next_crlf 'next command''' Pin writes setp/clrp/notp/offp' Pin read'
cmd_setp mov x,#$ABwz'setp, z=0
cmd_clrp if_zmov x,#$AAwz'clrp, z=0
cmd_notp if_zmov x,#$A9wz'notp, z=0
cmd_offp if_zmov x,#$A8wz'offp, z=0
cmd_getp if_zmov x,#$88'getp, z=1sets pinop,x 'set pin opcode
pinx mov pin,v1 'if hex, get pin (d = pin/w)
pinop getp pin wc'becomes setp/clrp/notp/offp/getpif_zjmp @cmd_map_c 'if getp, show pin valuejmp @cmd_next 'next command''' Pin configuration'
cmd_cfgp call @parse_hex 'get configuration
decod5 x,v1 wz,wc'get pin mask
setbz :i,#25'set pin port
setbc :i,#24
:i if_nz_or_nc cfgpins x,value,#0'configure pin if $00..$5Fjmp @cmd_loop 'next command''' Setdacs'
cmd_setdacs setdacs v1 'set all four dacs with 8-bit valuesjmp @cmd_next 'next command''' Help'
cmd_help locptra @help 'print help messagecall @tx_string
jmp @cmd_next_crlf 'next command''' Self-modifying code'
rdxxxx rdbyte value,ptra++ 'rdbyte/rdword/rdlongret
wrxxxx wrbyte value,ptrb++ 'wrbyte/wrword/wrlongret
rdstring rdbyte x,ptra++ wz,wc'read string byteret
hublimit long$0003FFFF'hub memory limit'****************************'* Cog Serial Receiver Task *'****************************
rx_task serina rx_data 'wait for character
wrauxr rx_data,rx_head 'store byte at headincmod rx_head,#$7F'inc headjmp @rx_task 'wait for next byte'**************************'* Cog Baud Detector Task *'**************************
baud_task notb ctra,#8wc'if 1,0 sample set, c=0 (bit8 is not used by ctra)
notb ctra,#5'toggle state to measure ($20 -> 10000001001 -> 1, 6x 0, 1x 1, 2x 0, 1)
setctra ctra 'ctra measures rx pin statesif_ncmov limh,buf0 'if 1,0 sample set,if_ncshr limh,#4'..make window from 1st 0 (6x if $20)if_ncneg liml,limh
if_ncadd limh,buf0
if_ncadd liml,buf0
if_ncmov comp,buf1 'if 1,0 sample set,if_ncmul comp,#6'..normalize 2nd 1 (1x if $20) to 6xif_nccmpr comp,limh wc'..check if within windowif_nccmp comp,liml wcif_ncmov comp,buf2 'if 1,0 sample set,if_ncmul comp,#3'..normalize 2nd 0 (2x if $20) to 6xif_nccmpr comp,limh wc'..check if within windowif_nccmp comp,liml wcif_ncadd buf0,buf2 'if $20,if_ncshr buf0,#3'..compute period from 6x 0 and 2x 0if_nc setsera sera,buf0 '..(re)initialize serialif_ncmov space,#0'..flag $20mov buf0,buf1 'scroll sample buffermov buf1,buf2
:wait getcosa buf2 'wait for next sample
jnz buf2,@baud_task
jmp @:wait
'*****************'* Cog Variables *'*****************
reserves
v res1'main task
w res1
x res1
y res1
v1 res1
v2 res1
value res1
view res1
enter res1
pin res1
dsize res1
shiftx res1
wsize res1
shift res1
amask res1
data res datasize
rx_data res1'serial receiver task
rx_head res1
rx_tail res1
ctra res1'baud detector task
sera res1
buf0 res1
buf1 res1
buf2 res1
limh res1
liml res1
comp res1
space res1'*******************'* Hub Subroutines *'*******************
orgh
''' Vector branch'
vector rdbyte w,ptra++ wz'get jump addressif_zret'if 0, no match found, returnrdbyte y,ptra++ 'get targetxor y,x wz'compare to xif_nzjmp @vector 'if no match, loopjmp w 'match found, jump, y=0, z=1''' Check address range (v1..v2)'
check_range max v1,amask 'trim v1and v1,amask
max v2,amask 'trim v2and v2,amask
cmp v2,v1 wc'make sure v2 => v1if_cjmp @cmd_error
mov w,v2 'get number of wordssub w,v1
shr w,shift
add w,#1wz'z=0ret''' Set rdxxxx/wrxxxx and others by word size'
set_size test wsize,#%010wc'set rdxxxx/wrxxxx by word size
setbc rdxxxx,#26
setbc wrxxxx,#24test wsize,#%100wc
setbc rdxxxx,#27
setbc wrxxxx,#25mov shift,wsize 'set shift by word sizeshr shift,#1neg amask,wsize 'set amask by word sizeand amask,hublimit
and view,amask 'trim viewand enter,amask 'trim enterret''' Input line'
rx_line setptrx #0'point to start of line
serouta #">"'show promptcall @rx_chr 'get first chrcmp x,#"'"wz'check for repeatif_nzjmp @:first 'if not repeat, first chr
:show rdaux x,ptrx++ wz'repeat, show lineif_nz serouta x
if_nzjmp @:show
jmp @:done
:back chkptrx wz'backspace, line empty? if not,if_nz serouta x '..print backspaceif_nz serouta #" "'..print spaceif_nz serouta x '..print backspaceif_nz subptrx #1'..back up
:loop call @rx_chr 'get next chr
:first cmp x,#13wz'cr?if_zjmp @:cr
cmp x,#8wz'backspace?if_nzcmp x,#127wzif_zjmp @:back
cmp x,#" "wc'invisible chr?if_nccmpr x,#"~"wcif_cjmp @:loop
wraux x,ptrx++ 'visible chr, append to line
chkptrx wc'overflow?if_c subptrx #1'if overflow, back upif_c serouta #7'..and output bellif_nc serouta x 'if not overflow, print chrjmp @:loop
:cr wraux #0,ptrx 'cr, end line with 0
:done setptrx #0'point to start of line
tx_crlf serouta #$0D'print cr/lf
serouta #$0Aret''' Parse hex/text data'
parse_data mov v,#0'reset data count
setinda #data 'point to string data
:hex call @parse_next 'hex loop, check hexif_nzcall @enter_data 'if hex, enter valuecmp x,#" "wz'check for space (more hex)if_zjmp @:hex 'if more hex, loopcmp x,#"'"wz'not hex, "'"?if_nzjmp @:done 'if not "'", done
:text rdaux x,++ptrx 'text loop, get and point to next chrcmp x,#"'"wz'check for "'"if_zjmp @:hex 'if "'", back to hex
jz x,@:done 'if eol, donemov value,x 'text chrcall @enter_data 'enter chrjmp @:text 'loop
:done sub v,#1wc'get data countif_ncmov dsize,v 'if 0, reuse old data
cirinda dsize,#data 'form circular bufferretwz'restore z
enter_data incmod v,#datasize wc'check if data limit exceededif_cjmp @cmd_error 'if data limit exceeded, errormov inda++,value 'store value in dataret''' Parse hex'
parse_hex call @parse_next 'try to parse hexif_zjmp @cmd_error 'if no hex, errorretwz'restore z''' Parse line (@ptrx), z=0 if hex (value)'
parse_next addptrx #1'advance to next chr
parse mov value,#0wz'z=1call @skip_spaces 'skip any spaces (preserve z)
:loop rdaux x,ptrx++ 'get chr
chkhex x wc'check hexif_crolnib value,x 'if hex, append nibble and loopif_ccmp x,#16wz'z=0if_cjmp @:loop
subptrx #1'repoint to non-hex chrcall @skip_spaces 'skip any post-hex spaces (preserves z)
chkhex x wc'check hexif_c rdaux x,--ptrx 'if hex, back up to space chr
chklet x 'make alpha chr uppercaseret''' Skip spaces (@ptrx)'
skip_spaces rdaux x,ptrx++ 'skip space chr(s)cmp x,#" "wzif_zjmp @skip_spaces
subptrx #1'back up to non-space chrretwz'restore z''' Print range (v1..v2)'
tx_range1 mov v1,view 'view..view + v2
tx_range2 and v2,amask 'v1..v1 + v2add v2,v1
tx_range call @check_range 'check rangemov view,v1 'set address
:line mov value,view 'print addressshr value,shiftx 'handle exec modemov x,shiftx '4 digits in exec modeshr x,#1subr x,#5'5 digits in other modescall @tx_hex
serouta #"-"'print "- "
serouta #" "mov x,wsize 'get number of words on linerev x,#32-5mov v1,w
max v1,x
mov v2,v1 'get number of ascii bytes on lineshl v2,shift
sub w,v1 'update number of words left
setptra view 'print hex words
:hex call @rdxxxx
mov x,wsize
shl x,#1call @tx_hex
serouta #" "djnz v1,@:hex
serouta #" "'print " '"
serouta #" "
serouta #"'"
setptra view 'print ascii bytes
:ascii rdbyte x,ptra++
cmp x,#" "wc'visible chr?if_nccmpr x,#"~"wcif_cmov x,#"."'substitute "." for non-visible chrs
serouta x
djnz v2,@:ascii
getptra view 'update address
serouta #"'"'print "'"call @tx_crlf 'print crcall @rx_check 'check key hitif_z jnz w,@:line 'if no key hit and more words left, print another lineret''' Print string (@ptra)'
tx_string call @rdstring 'read string byteif_zret'if 0, doneif_c notb rdstring,#8'if substring, toggle ptra/ptrbif_c locptrb @db 'ptrb points to substringif_c addptrb x
if_cjmp @tx_string 'start substring or resume stringcmp x,#"`"wz'long tab?if_zsubr y,#32-16if_nzcmp x,#"~"wz'short tab?if_zadd y,#16
:tab if_z serouta #" "if_zdjnz y,@:tab
if_z serouta #"-"if_z serouta #" "if_zjmp @tx_string
cmp x,#13wz'cr?if_zcall @tx_crlf
if_zmov y,#0if_nz serouta x 'other?if_nzadd y,#1jmp @tx_string
''' Print hex (value,x)'
tx_hex shl x,#2'position first nibbleror value,x
shr x,#2
:loop getnib v,value,#7'print nibblescmp v,#$Awc'alpha or numeric?if_cadd v,#"0"'numericif_ncadd v,#"A"-$A'alpha
serouta v
rol value,#4djnz x,@:loop
ret''' Receive chr (x)'
rx_chr call @rx_check 'wait for rx chrif_zjmp @rx_chr
ret''' Check receiver, z=0 if chr (x)'
rx_check cmp rx_head,rx_tail wzif_nz rdauxr x,rx_tail
if_nzincmod rx_tail,#$7Fret'************'* Hub Data *'************
db
branch1 longbyte cmd_new, 0byte cmd_new, ";"byte cmd_byte, "Y"byte cmd_word, "W"byte cmd_long, "N"byte cmd_exec, "X"byte cmd_viewp, "."byte cmd_search, "/"byte cmd_enter, ":"byte cmd_map, "M"byte cmd_setp, "H"byte cmd_clrp, "L"byte cmd_notp, "T"byte cmd_offp, "Z"byte cmd_getp, "R"byte cmd_quit, "Q"byte cmd_help, "?"byte0
branch2 longbyte cmd_view2, 0byte cmd_view2, " "byte cmd_range, "."byte cmd_search2, "/"byte cmd_enter2, ":"byte cmd_watch, "@"byte cmd_clkset, "*"byte cmd_cogrun, "+"byte cmd_cogrunx, "-"byte cmd_cogstop, "!"byte cmd_setp, "H"byte cmd_clrp, "L"byte cmd_notp, "T"byte cmd_offp, "Z"byte cmd_getp, "R"byte cmd_watchp, "#"byte cmd_cfgp, "|"byte cmd_setdacs, "\"byte0
branch3 longbyte cmd_view3, 0byte cmd_view3, " "byte cmd_search3, "/"byte cmd_enter3, ":"byte cmd_move, ">"byte cmd_move, "<"byte cmd_checksum, "^"byte0
error longbyte"? - Help",13,7,0
hitspace longbyte"Hit SPACE ",0
hello longbyte13,13,"=== Propeller 2.0 Monitor ===",13,13,0
sub0 byte" -",13,$80'@sub0-@db must be >= $80
sub1 byte"{adr{.adr}}",$80
sub2 byte"{dat{ dat}}",$80
sub3 byte"adr",$80
sub4 byte"pin",$80
sub5 byte"dat",$80
sub6 byte"`Watch",13,$80
sub7 byte"`Set ",$80
help longbyte13, "~HUB",@sub0-@db
byte @sub1-@db, "`View",13byte @sub1-@db,"/",@sub2-@db, "`Search",13byte @sub1-@db,":",@sub2-@db, "`Enter",13byte @sub3-@db,".",@sub3-@db,"[</>]",@sub3-@db, "`Move",13byte @sub3-@db,".",@sub3-@db,"^", "`Checksum",13byte @sub3-@db,"@", @sub6-@db
byte"[Y/W/N/X]", "`Byte/Word/Long/Exec",13byte"~COGS",@sub0-@db
byte"cog[+/-]",@sub3-@db, "`Start in Cog/Hub",13byte"cog!", "`Stop",13byte"M", "`Map",13byte"~PINS",@sub0-@db
byte"{",@sub4-@db,"}[H/L/T/Z/R]", "`High/Low/Toggle/Float/Read",13byte @sub4-@db,"#", @sub6-@db
byte @sub4-@db,"|",@sub5-@db, @sub7-@db,"CFG",13byte @sub5-@db,"\", @sub7-@db,"DACs",13byte"~MISC",@sub0-@db
byte @sub5-@db,"*", @sub7-@db,"CLK",13byte"'", "`Repeat",13byte"Q", "`Quit",13,0
Here's what it looks like when it comes up. It also shows eXec mode:
I believe he has a DE2. I will give him a quick phone call to verify.
Postedit: I have left a msg, so sent an email too.
Hi Ray. Thanks for checking in, sorry was in the middle of cooking tea and given how much we need to catch up on it surely would have burnt!
Yes I have a DE2 for development but am using DE0's plugged into a custom motherboard currently, as I have found to my amazement all the essentials can be made to fit (just) into a single cog. The hardware task slicing is brilliant. Hub execution will take it a whole lot further.
If CTRA waveform gen can be included, great, if not I will either craft a soft DDS with R2R DAC, can probably use existing dac pins, or migrate asap to parallax's Altera board.
Wow, the Rom Monitor is interesting using the new instructions such as
locptra @somewhere
Some of the hubexec routines such as rx_line (input line), tx_crlf, tx_string, tx_hex, rx_chr should all be usable from other programs
Yes, we need to determine if our addressing instructions are adequate. There are some things the assembler must do to help out, too. For now, when doing absolute hub branches, use #address>>2, instead of #address.
Okay. Here is the intermediate release. Its documentation will be getting updated over the next few days. So, at first, you are on your own, needing to infer things from the instruction list in Prop2_Docs.txt, which IS accurate. Of course, you can ask any questions here on the forum and I'll answer them.
The DE0-Nano FPGA configuration lacks the following, in order to make one cog fit:
CTRB - 2nd counter (CTRA is complete, including waveform output)
SERB - 2nd serial port
CORDIC - qsincos/qarctan/qrotate/qlog/qexp
PIX - texture mapping, pixel blending
Thank you. A most generous offer. I'm sure I will arrive at a subset of instructions that I can hold in my sponge brain
Remember, they're just friends that you haven't met yet. They all want to help you. Some are even waiting to do things that you'd be embarrassed to ask for, like convert English characters to upper-case, or tell you if you have a decimal digit, or not. And SEUSSF/SEUSSR are there to entertain you, should the need arise.
Thank you. A most generous offer. I'm sure I will arrive at a subset of instructions that I can hold in my sponge brain
You're quite welcome but this was more an offer to those that might be feeling a bit 'off' at work today and need some time at home to take care of the new release.
Chip, I like the 'new friends' approach, my only problem is I'm really bad with names (both people and instructions) so most of my time is spent with "that guy looks familiar..dang, what was his name?"
Now, the little tease about SEUSSF/SEUSSR has made me curious!
Sorry, yes, now I'm with you. You know, I not feeling so good myself, perhaps I should go home and take some Parallaxetamol.
Be careful, it kind of sneaks up on you in 459 different ways. Next thing you know, you have pre-emptive threads! You don't want coworkers to see that!
Comments
I added a hub exec mode, where you see addresses (divided by four, four digits) and data (32 bits) as a cog does when executing in hub mode.
I also added another cog-start command to handle initial-hub-exec. As well, a lot of little details were improved.
Here's the new ROM_Monitor.spin program. Note that most of the code now lives outside of the cog. This allowed a maximum-sized data/string buffer in cog register space, so that it never runs out before the input-line length of 128 characters. Also see how strings are handled from hub memory:
'******************************************************** '* * '* Propeller II ROM Monitor * '* * '* Version 0.5 * '* * '******************************************************** ' ' Version 0.1 - 2012/11/01 - original ' Version 0.2 - 2013/09/22 - added semicolon comments ' Version 0.3 - 2013/11/13 - began using SERA ' Version 0.4 - 2013/12/03 - expanded to 256KB hub memory ' Version 0.5 - 2014/03/15 - added cog view mode ' ' ' Usage: cognew($52C, rx_pin << 10 + tx_pin << 2) 'start monitor in new cog ' ' rx_pin bit 7 can be set for rx inversion ' tx_pin bit 7 can be set for tx inversion CON datasize = 128 DAT orgh ($52C)>>2 '************* '* Cog Entry * '************* org 'ptra = %rrrrrrrr_tttttttt_00 entry reps #$1F2-reserves,#1 'clear reserves setinda #reserves mov inda++,#0 getptra ctra 'get rx pin into ctra configuration testb ctra,#17 wc 'handle !rx shl ctra,#32-10-7 'clear high bits shr ctra,#32-9-7 'position rx pin in d sets ctra,#%1_100_01001 'ready state-time mode setbnc ctra,#5 'handle !rx getptra x 'get rx/tx pins into sera setup ror x,#10 or x,#$100 'ready rx 8T/8N setd sera,x shr x,#32-8 or x,#$100 'ready tx 8T/8N sets sera,x setp sera 'tx high jmpt1 #baud_task 'enable baud detector task settask #%%1010 thalt space,#1 'wait for <space> to set period clrp sera 'release tx jmpt2 #rx_task 'enable serial receiver task settask #%%1210 mov wsize,#1 'init word size to byte call @set_size wraux #0,#0 'init input line to <enter> locptra @hello 'ready to print hello message '***************** '* Cog Main Task * '***************** message call @tx_string 'print hello/error message cmd_new call @rx_line 'get input line call @parse 'parse first term if_z jz x,@cmd_viewl 'if no hex and eol, view data jmp @cmd_go 'else, process command cmd_next_crlf call @tx_crlf 'print cr/lf cmd_next addptrx #1 'skip chr cmd_loop call @parse 'parse next term cmd_go if_nz jmp @cmd_hex 'if hex, branch setd pinx,#w 'pin update redirected to w locptra @branch1 'not hex, vector by chr call @vector 'if returns, no match cmd_error locptra @error 'print error message jmp @message cmd_hex mov v1,value 'hex, save v1 setd pinx,#pin 'pin update okay locptra @branch2 'vector by chr call @vector 'if returns, no match jmp @cmd_view2 'view data cmd_range shl v1,shiftx 'handle exec mode call @parse_next 'hex., get hex shl value,shiftx 'handle exec mode if_z jmp @cmd_viewp2 'if no hex, view data mov v2,value 'hex.hex, save v2 locptra @branch3 'vector by chr call @vector 'if returns, no match jmp @cmd_view3 'view data ' ' ' Byte/word/long/cog data ' cmd_byte mov wsize,#1 wz 'set byte mode, z=0 cmd_word if_z mov wsize,#2 wz 'set word mode, z=0 cmd_long if_z mov wsize,#4 wz 'set long mode, z=0 cmd_exec if_z mov wsize,#4 'set exec mode, z=1 setbz shiftx,#1 'for exec mode, shiftx=2 call @set_size jmp @cmd_next 'next command ' ' ' View data ' cmd_viewl mov v2,#$F '<enter> (eol), show line of data call @tx_range1 jmp @cmd_new cmd_viewp mov v2,#$FF '. (more), show page of data call @tx_range1 jmp @cmd_next cmd_viewp2 mov v2,#$FF 'adr. (more), show page of data call @tx_range2 jmp @cmd_loop cmd_view2 shl v1,shiftx 'adr, show unit of data, handle exec mode mov v2,v1 cmd_view3 call @tx_range 'adr.adr, show range of data jmp @cmd_loop ' ' ' Search ' cmd_search mov v1,view '/, search from view to end jmp @cmd_search2x cmd_search2 shl v1,shiftx 'adr/, search from address to end, handle exec mode cmd_search2x mov v2,amask 'set end address cmd_search3 call @check_range 'adr.adr/, search range call @parse_data 'parse data string :start setptra v1 'start search, point to search address setinda #data 'point to search data mov x,#0 'reset word match counter :word call @rdxxxx 'get memory word cmp value,inda++ wz 'compare against search data word if_z jmp @:match 'if word match, check if string match add v1,wsize 'word mismatch, advance search address cmp v1,v2 wz,wc 'at end of range? if_be jmp @:start 'if not, start next search mov view,v1 'else, update view and view,amask jmp @cmd_loop 'next command :match incmod x,dsize wc 'word match, increment match counter if_nc jmp @:word 'if more words to match, compare next word mov v2,dsize 'got string match shl v2,shift 'v1 = start of found data add v2,v1 'v2 = end of found data jmp @cmd_view3 'show found data ' ' ' Enter data ' cmd_enter3 call @check_range 'adr.adr:, check range, w=words to fill, z=0 cmd_enter2 if_z shl v1,shiftx 'adr:, handle exec mode mov enter,v1 'set enter address and enter,amask 'trim enter address (in case cmd_enter2) cmd_enter call @parse_data ':, parse data (preserves z) if_z mov w,dsize 'if not fill, set w to data size if_z add w,#1 setptrb enter 'get pointer :loop mov value,inda++ 'get word from string data call @wrxxxx 'store value in memory djnz w,@:loop 'loop until enter done getptrb enter 'update pointer jmp @cmd_loop 'next command ' ' ' Move data ' cmd_move mov y,x 'save ">"/"<" call @check_range 'check 1st address range, get number of words call @parse_hex 'get 2nd address shl value,shiftx 'handle exec mode max value,amask 'v1=1st, value=2nd, w=words, y=">"/"<" and value,amask cmp y,#"<" wz 'if "<", swap v1 and value if_z mov x,v1 if_z mov v1,value if_z mov value,x 'v1=from, value=to, w=words cmp v1,value wc 'if from < to, downward move if_c mov x,w if_c shl x,shift if_c add v1,x if_c add value,x if_c xor rdxxxx,#%001_111110 'modify 'rdxxxx value,--ptra' if_c xor wrxxxx,#%001_111110 'modify 'wrxxxx value,--ptrb' setptra v1 'set pointers setptrb value :loop call @rdxxxx 'move data call @wrxxxx djnz w,@:loop if_c xor rdxxxx,#%001_111110 'restore 'rdxxxx value,ptra++' if_c xor wrxxxx,#%001_111110 'restore 'wrxxxx value,ptrb++' jmp @cmd_loop 'next command ' ' ' Checksum ' cmd_checksum call @check_range 'check range setptra v1 'sum bytes/words/longs :loop call @rdxxxx add y,value djnz w,@:loop mov value,y 'print sum mov x,#8 call @tx_hex jmp @cmd_next_crlf 'next command ' ' ' Watch ' cmd_watchp mov y,#1 'pin#, set pin mode mov v2,#1 wz 'set single hex digit, z=0 cmd_watch if_z shl v1,shiftx 'adr@, handle exec mode if_z mov v2,wsize 'set hex size by word size if_z shl v2,#1 call @rdxxxp 'get initial value :loop mov w,value 'preserve value mov x,v2 'set hex size call @tx_hex 'print value serouta #" " 'print space :wait call @rx_check 'if key hit, exit if_nz jmp @cmd_next_crlf call @rdxxxp 'get current value cmp value,w wz 'if same, check again if_z jmp @:wait jmp @:loop 'new value, loop rdxxxp setptra v1 'if not pin mode, read memory jz y,@rdxxxx getp v1 wc 'read pin if_nc mov value,#0 if_c mov value,#1 ret ' ' ' Clkset ' cmd_clkset locptra @hitspace 'print hit-space message call @tx_string passtxa 'wait for tx done clkset v1 'set clk thalt space,#1 'wait for recalibrating space call @rx_chr 'throw away garbage character jmp @cmd_next_crlf 'next command ' ' ' Start cog ' cmd_cogrun mov x,#1 wz 'z=0 cmd_cogrunx call @parse_hex 'z=1, get program address (preserves z) if_nz cogrun value,v1 'start in cog if_z cogrunx value,v1 'start in hub jmp @cmd_loop 'next command ' ' ' Stop cog ' Quit ' cmd_quit cogid v1 'quit cmd_cogstop cogstop v1 'stop cog jmp @cmd_next 'next command ' ' ' Map ' cmd_map mov y,#7 'ready for 7..0 cmd_map_loop serouta #" " 'print space cogid x 'get cog id cogid y wc 'get cog y status cmd_map_c cmp x,y wz if_nc mov x,#"0" 'get 0/1/M chr if_c mov x,#"1" if_z mov x,#"M" serouta x 'print chr sub y,#1 wc if_nc jmp @cmd_map_loop 'loop until done jmp @cmd_next_crlf 'next command ' ' ' Pin writes setp/clrp/notp/offp ' Pin read ' cmd_setp mov x,#$AB wz 'setp, z=0 cmd_clrp if_z mov x,#$AA wz 'clrp, z=0 cmd_notp if_z mov x,#$A9 wz 'notp, z=0 cmd_offp if_z mov x,#$A8 wz 'offp, z=0 cmd_getp if_z mov x,#$88 'getp, z=1 sets pinop,x 'set pin opcode pinx mov pin,v1 'if hex, get pin (d = pin/w) pinop getp pin wc 'becomes setp/clrp/notp/offp/getp if_z jmp @cmd_map_c 'if getp, show pin value jmp @cmd_next 'next command ' ' ' Pin configuration ' cmd_cfgp call @parse_hex 'get configuration decod5 x,v1 wz,wc 'get pin mask setbz :i,#25 'set pin port setbc :i,#24 :i if_nz_or_nc cfgpins x,value,#0 'configure pin if $00..$5F jmp @cmd_loop 'next command ' ' ' Setdacs ' cmd_setdacs setdacs v1 'set all four dacs with 8-bit values jmp @cmd_next 'next command ' ' ' Help ' cmd_help locptra @help 'print help message call @tx_string jmp @cmd_next_crlf 'next command ' ' ' Self-modifying code ' rdxxxx rdbyte value,ptra++ 'rdbyte/rdword/rdlong ret wrxxxx wrbyte value,ptrb++ 'wrbyte/wrword/wrlong ret rdstring rdbyte x,ptra++ wz,wc 'read string byte ret hublimit long $0003FFFF 'hub memory limit '**************************** '* Cog Serial Receiver Task * '**************************** rx_task serina rx_data 'wait for character wrauxr rx_data,rx_head 'store byte at head incmod rx_head,#$7F 'inc head jmp @rx_task 'wait for next byte '************************** '* Cog Baud Detector Task * '************************** baud_task notb ctra,#8 wc 'if 1,0 sample set, c=0 (bit8 is not used by ctra) notb ctra,#5 'toggle state to measure ($20 -> 10000001001 -> 1, 6x 0, 1x 1, 2x 0, 1) setctra ctra 'ctra measures rx pin states if_nc mov limh,buf0 'if 1,0 sample set, if_nc shr limh,#4 '..make window from 1st 0 (6x if $20) if_nc neg liml,limh if_nc add limh,buf0 if_nc add liml,buf0 if_nc mov comp,buf1 'if 1,0 sample set, if_nc mul comp,#6 '..normalize 2nd 1 (1x if $20) to 6x if_nc cmpr comp,limh wc '..check if within window if_nc cmp comp,liml wc if_nc mov comp,buf2 'if 1,0 sample set, if_nc mul comp,#3 '..normalize 2nd 0 (2x if $20) to 6x if_nc cmpr comp,limh wc '..check if within window if_nc cmp comp,liml wc if_nc add buf0,buf2 'if $20, if_nc shr buf0,#3 '..compute period from 6x 0 and 2x 0 if_nc setsera sera,buf0 '..(re)initialize serial if_nc mov space,#0 '..flag $20 mov buf0,buf1 'scroll sample buffer mov buf1,buf2 :wait getcosa buf2 'wait for next sample jnz buf2,@baud_task jmp @:wait '***************** '* Cog Variables * '***************** reserves v res 1 'main task w res 1 x res 1 y res 1 v1 res 1 v2 res 1 value res 1 view res 1 enter res 1 pin res 1 dsize res 1 shiftx res 1 wsize res 1 shift res 1 amask res 1 data res datasize rx_data res 1 'serial receiver task rx_head res 1 rx_tail res 1 ctra res 1 'baud detector task sera res 1 buf0 res 1 buf1 res 1 buf2 res 1 limh res 1 liml res 1 comp res 1 space res 1 '******************* '* Hub Subroutines * '******************* orgh ' ' ' Vector branch ' vector rdbyte w,ptra++ wz 'get jump address if_z ret 'if 0, no match found, return rdbyte y,ptra++ 'get target xor y,x wz 'compare to x if_nz jmp @vector 'if no match, loop jmp w 'match found, jump, y=0, z=1 ' ' ' Check address range (v1..v2) ' check_range max v1,amask 'trim v1 and v1,amask max v2,amask 'trim v2 and v2,amask cmp v2,v1 wc 'make sure v2 => v1 if_c jmp @cmd_error mov w,v2 'get number of words sub w,v1 shr w,shift add w,#1 wz 'z=0 ret ' ' ' Set rdxxxx/wrxxxx and others by word size ' set_size test wsize,#%010 wc 'set rdxxxx/wrxxxx by word size setbc rdxxxx,#26 setbc wrxxxx,#24 test wsize,#%100 wc setbc rdxxxx,#27 setbc wrxxxx,#25 mov shift,wsize 'set shift by word size shr shift,#1 neg amask,wsize 'set amask by word size and amask,hublimit and view,amask 'trim view and enter,amask 'trim enter ret ' ' ' Input line ' rx_line setptrx #0 'point to start of line serouta #">" 'show prompt call @rx_chr 'get first chr cmp x,#"'" wz 'check for repeat if_nz jmp @:first 'if not repeat, first chr :show rdaux x,ptrx++ wz 'repeat, show line if_nz serouta x if_nz jmp @:show jmp @:done :back chkptrx wz 'backspace, line empty? if not, if_nz serouta x '..print backspace if_nz serouta #" " '..print space if_nz serouta x '..print backspace if_nz subptrx #1 '..back up :loop call @rx_chr 'get next chr :first cmp x,#13 wz 'cr? if_z jmp @:cr cmp x,#8 wz 'backspace? if_nz cmp x,#127 wz if_z jmp @:back cmp x,#" " wc 'invisible chr? if_nc cmpr x,#"~" wc if_c jmp @:loop wraux x,ptrx++ 'visible chr, append to line chkptrx wc 'overflow? if_c subptrx #1 'if overflow, back up if_c serouta #7 '..and output bell if_nc serouta x 'if not overflow, print chr jmp @:loop :cr wraux #0,ptrx 'cr, end line with 0 :done setptrx #0 'point to start of line tx_crlf serouta #$0D 'print cr/lf serouta #$0A ret ' ' ' Parse hex/text data ' parse_data mov v,#0 'reset data count setinda #data 'point to string data :hex call @parse_next 'hex loop, check hex if_nz call @enter_data 'if hex, enter value cmp x,#" " wz 'check for space (more hex) if_z jmp @:hex 'if more hex, loop cmp x,#"'" wz 'not hex, "'"? if_nz jmp @:done 'if not "'", done :text rdaux x,++ptrx 'text loop, get and point to next chr cmp x,#"'" wz 'check for "'" if_z jmp @:hex 'if "'", back to hex jz x,@:done 'if eol, done mov value,x 'text chr call @enter_data 'enter chr jmp @:text 'loop :done sub v,#1 wc 'get data count if_nc mov dsize,v 'if 0, reuse old data cirinda dsize,#data 'form circular buffer ret wz 'restore z enter_data incmod v,#datasize wc 'check if data limit exceeded if_c jmp @cmd_error 'if data limit exceeded, error mov inda++,value 'store value in data ret ' ' ' Parse hex ' parse_hex call @parse_next 'try to parse hex if_z jmp @cmd_error 'if no hex, error ret wz 'restore z ' ' ' Parse line (@ptrx), z=0 if hex (value) ' parse_next addptrx #1 'advance to next chr parse mov value,#0 wz 'z=1 call @skip_spaces 'skip any spaces (preserve z) :loop rdaux x,ptrx++ 'get chr chkhex x wc 'check hex if_c rolnib value,x 'if hex, append nibble and loop if_c cmp x,#16 wz 'z=0 if_c jmp @:loop subptrx #1 'repoint to non-hex chr call @skip_spaces 'skip any post-hex spaces (preserves z) chkhex x wc 'check hex if_c rdaux x,--ptrx 'if hex, back up to space chr chklet x 'make alpha chr uppercase ret ' ' ' Skip spaces (@ptrx) ' skip_spaces rdaux x,ptrx++ 'skip space chr(s) cmp x,#" " wz if_z jmp @skip_spaces subptrx #1 'back up to non-space chr ret wz 'restore z ' ' ' Print range (v1..v2) ' tx_range1 mov v1,view 'view..view + v2 tx_range2 and v2,amask 'v1..v1 + v2 add v2,v1 tx_range call @check_range 'check range mov view,v1 'set address :line mov value,view 'print address shr value,shiftx 'handle exec mode mov x,shiftx '4 digits in exec mode shr x,#1 subr x,#5 '5 digits in other modes call @tx_hex serouta #"-" 'print "- " serouta #" " mov x,wsize 'get number of words on line rev x,#32-5 mov v1,w max v1,x mov v2,v1 'get number of ascii bytes on line shl v2,shift sub w,v1 'update number of words left setptra view 'print hex words :hex call @rdxxxx mov x,wsize shl x,#1 call @tx_hex serouta #" " djnz v1,@:hex serouta #" " 'print " '" serouta #" " serouta #"'" setptra view 'print ascii bytes :ascii rdbyte x,ptra++ cmp x,#" " wc 'visible chr? if_nc cmpr x,#"~" wc if_c mov x,#"." 'substitute "." for non-visible chrs serouta x djnz v2,@:ascii getptra view 'update address serouta #"'" 'print "'" call @tx_crlf 'print cr call @rx_check 'check key hit if_z jnz w,@:line 'if no key hit and more words left, print another line ret ' ' ' Print string (@ptra) ' tx_string call @rdstring 'read string byte if_z ret 'if 0, done if_c notb rdstring,#8 'if substring, toggle ptra/ptrb if_c locptrb @db 'ptrb points to substring if_c addptrb x if_c jmp @tx_string 'start substring or resume string cmp x,#"`" wz 'long tab? if_z subr y,#32-16 if_nz cmp x,#"~" wz 'short tab? if_z add y,#16 :tab if_z serouta #" " if_z djnz y,@:tab if_z serouta #"-" if_z serouta #" " if_z jmp @tx_string cmp x,#13 wz 'cr? if_z call @tx_crlf if_z mov y,#0 if_nz serouta x 'other? if_nz add y,#1 jmp @tx_string ' ' ' Print hex (value,x) ' tx_hex shl x,#2 'position first nibble ror value,x shr x,#2 :loop getnib v,value,#7 'print nibbles cmp v,#$A wc 'alpha or numeric? if_c add v,#"0" 'numeric if_nc add v,#"A"-$A 'alpha serouta v rol value,#4 djnz x,@:loop ret ' ' ' Receive chr (x) ' rx_chr call @rx_check 'wait for rx chr if_z jmp @rx_chr ret ' ' ' Check receiver, z=0 if chr (x) ' rx_check cmp rx_head,rx_tail wz if_nz rdauxr x,rx_tail if_nz incmod rx_tail,#$7F ret '************ '* Hub Data * '************ db branch1 long byte cmd_new, 0 byte cmd_new, ";" byte cmd_byte, "Y" byte cmd_word, "W" byte cmd_long, "N" byte cmd_exec, "X" byte cmd_viewp, "." byte cmd_search, "/" byte cmd_enter, ":" byte cmd_map, "M" byte cmd_setp, "H" byte cmd_clrp, "L" byte cmd_notp, "T" byte cmd_offp, "Z" byte cmd_getp, "R" byte cmd_quit, "Q" byte cmd_help, "?" byte 0 branch2 long byte cmd_view2, 0 byte cmd_view2, " " byte cmd_range, "." byte cmd_search2, "/" byte cmd_enter2, ":" byte cmd_watch, "@" byte cmd_clkset, "*" byte cmd_cogrun, "+" byte cmd_cogrunx, "-" byte cmd_cogstop, "!" byte cmd_setp, "H" byte cmd_clrp, "L" byte cmd_notp, "T" byte cmd_offp, "Z" byte cmd_getp, "R" byte cmd_watchp, "#" byte cmd_cfgp, "|" byte cmd_setdacs, "\" byte 0 branch3 long byte cmd_view3, 0 byte cmd_view3, " " byte cmd_search3, "/" byte cmd_enter3, ":" byte cmd_move, ">" byte cmd_move, "<" byte cmd_checksum, "^" byte 0 error long byte "? - Help",13,7,0 hitspace long byte "Hit SPACE ",0 hello long byte 13,13,"=== Propeller 2.0 Monitor ===",13,13,0 sub0 byte " -",13,$80 '@sub0-@db must be >= $80 sub1 byte "{adr{.adr}}",$80 sub2 byte "{dat{ dat}}",$80 sub3 byte "adr",$80 sub4 byte "pin",$80 sub5 byte "dat",$80 sub6 byte "`Watch",13,$80 sub7 byte "`Set ",$80 help long byte 13, "~HUB",@sub0-@db byte @sub1-@db, "`View",13 byte @sub1-@db,"/",@sub2-@db, "`Search",13 byte @sub1-@db,":",@sub2-@db, "`Enter",13 byte @sub3-@db,".",@sub3-@db,"[</>]",@sub3-@db, "`Move",13 byte @sub3-@db,".",@sub3-@db,"^", "`Checksum",13 byte @sub3-@db,"@", @sub6-@db byte "[Y/W/N/X]", "`Byte/Word/Long/Exec",13 byte "~COGS",@sub0-@db byte "cog[+/-]",@sub3-@db, "`Start in Cog/Hub",13 byte "cog!", "`Stop",13 byte "M", "`Map",13 byte "~PINS",@sub0-@db byte "{",@sub4-@db,"}[H/L/T/Z/R]", "`High/Low/Toggle/Float/Read",13 byte @sub4-@db,"#", @sub6-@db byte @sub4-@db,"|",@sub5-@db, @sub7-@db,"CFG",13 byte @sub5-@db,"\", @sub7-@db,"DACs",13 byte "~MISC",@sub0-@db byte @sub5-@db,"*", @sub7-@db,"CLK",13 byte "'", "`Repeat",13 byte "Q", "`Quit",13,0
Here's what it looks like when it comes up. It also shows eXec mode:
=== Propeller 2.0 Monitor === >? - HUB - {adr{.adr}} - View {adr{.adr}}/{dat{ dat}} - Search {adr{.adr}}:{dat{ dat}} - Enter adr.adr[</>]adr - Move adr.adr^ - Checksum adr@ - Watch [Y/W/N/X] - Byte/Word/Long/Exec - COGS - cog[+/-]adr - Start in Cog/Hub cog! - Stop M - Map - PINS - {pin}[H/L/T/Z/R] - High/Low/Toggle/Float/Read pin# - Watch pin|dat - Set CFG dat\ - Set DACs - MISC - dat* - Set CLK ' - Repeat Q - Quit >x >0. 0000- 706F7250 20302E32 FE7C0280 FE7C0081 'Prop2.0 ..|...|.' 0004- FAC03FC5 407CE0FA FEBCBC00 FEBCBC00 '.?....|@........' 0008- 507CBC01 B57CBC1F 387CD001 FE280C34 '..|P..|...|84.(.' 000C- FEBCBA00 F6FCB626 FCFD001A 403CEA74 '....&.......t.<@' 0010- FCFD0018 503CEA74 347CEA01 FCFD0015 '....t.<P..|4....' 0014- B57CBE01 FC65001E B4FCBEB2 3A7CBE01 '..|...e.......|:' 0018- AD7CE1FB 407CE102 B77CE008 4068BE8F '..|...|@..|...h@' 001C- B57CBE01 FCFD0011 FE7CB4AA FCFD000F '..|.......|.....' 0020- FE7CB4AF FCFD000D FE7CB4AB FCFD000B '..|.......|.....' 0024- B4FCBEB2 3A7CBE01 AD7CE1F4 FC7D0017 '......|:..|...}.' 0028- FCFD0006 FE3CE804 FCFD0004 FE3CE822 '......<.....".<.' 002C- B6BCE875 FE3C0188 FE3CE604 503CE65C 'u.....<...<.\.<P' 0030- FEFCB68F 127C5800 FE0C0188 407CE004 '.....X|.......|@' 0034- FE7CB2AB FE7CB0AA FAC007C4 FE7CB2AA '..|...|.......|.' 0038- BEFCE001 33CCBA01 FE7CAEAC FE7CB0AB '.......3..|...|.' 003C- FE7CB0AA AD7CE1F7 FC3C0380 867CE009 '..|...|...<...|.' >
This feature is really important to Tubular.
Except that you can't call a Spin function directly from C right? Maybe you've added that recently?
I get the limitations of SpinWrap. I'm sure that whatever you do with your product is good within your definition.
Postedit: I have left a msg, so sent an email too.
Great! I just got a good compile for the DE0-Nano with the waveform output in the CTR. It was a little slow in Fmax, though, so I'm changing the fitter seed value and trying again. I think we'll get a faster one this time (or next) and we'll have images for both boards.
Is there any chance that the Monitor can remain at a fixed address rather than changing in each release ?
Once we get an actual chip out, I would make it stay in the same place if we had a revision, but for now, it's fluid.
Any chance you could post the instruction opcodes (from the bottom of your docs) ?
I'll put it together right now and post it soon.
Hi Ray. Thanks for checking in, sorry was in the middle of cooking tea and given how much we need to catch up on it surely would have burnt!
Yes I have a DE2 for development but am using DE0's plugged into a custom motherboard currently, as I have found to my amazement all the essentials can be made to fit (just) into a single cog. The hardware task slicing is brilliant. Hub execution will take it a whole lot further.
If CTRA waveform gen can be included, great, if not I will either craft a soft DDS with R2R DAC, can probably use existing dac pins, or migrate asap to parallax's Altera board.
Yes, with SpinWrap - which supports Catalina. Do you expect me to do everything myself?
And also according to this definition from Heater - you know ... the one that triggered this discussion?
Ross.
locptra @somewhere
Some of the hubexec routines such as rx_line (input line), tx_crlf, tx_string, tx_hex, rx_chr should all be usable from other programs
Yes, we need to determine if our addressing instructions are adequate. There are some things the assembler must do to help out, too. For now, when doing absolute hub branches, use #address>>2, instead of #address.
So ... no Spin2 compiler yet then?
Ross.
--- Fixed LOCBASE/LOCBYTE/LOCWORD/LOCLONG/LOCINST bug ---
Okay. Here is the intermediate release. Its documentation will be getting updated over the next few days. So, at first, you are on your own, needing to infer things from the instruction list in Prop2_Docs.txt, which IS accurate. Of course, you can ask any questions here on the forum and I'll answer them.
The DE0-Nano FPGA configuration lacks the following, in order to make one cog fit:
CTRB - 2nd counter (CTRA is complete, including waveform output)
SERB - 2nd serial port
CORDIC - qsincos/qarctan/qrotate/qlog/qexp
PIX - texture mapping, pixel blending
Here's the file:
Terasic_Prop2_Emulation_2014_03_24.zip
Here's the new instruction set:
ZCDS (for D column: W=write, M=modify, R=read, L=read/immediate) ---------------------------------------------------------------------------------------------------------------------- ZCWS 0000000 ZC I CCCC DDDDDDDDD SSSSSSSSS RDBYTE D,S/PTRA/PTRB (waits for hub) ZCWS 0000001 ZC I CCCC DDDDDDDDD SSSSSSSSS RDBYTEC D,S/PTRA/PTRB (waits for hub if dcache miss) ZCWS 0000010 ZC I CCCC DDDDDDDDD SSSSSSSSS RDWORD D,S/PTRA/PTRB (waits for hub) ZCWS 0000011 ZC I CCCC DDDDDDDDD SSSSSSSSS RDWORDC D,S/PTRA/PTRB (waits for hub if dcache miss) ZCWS 0000100 ZC I CCCC DDDDDDDDD SSSSSSSSS RDLONG D,S/PTRA/PTRB (waits for hub) ZCWS 0000101 ZC I CCCC DDDDDDDDD SSSSSSSSS RDLONGC D,S/PTRA/PTRB (waits for hub if dcache miss) ZCWS 0000110 ZC I CCCC DDDDDDDDD SSSSSSSSS RDAUX D,S/#0..$FF/PTRX/PTRY ZCWS 0000111 ZC I CCCC DDDDDDDDD SSSSSSSSS RDAUXR D,S/#0..$FF/PTRX/PTRY ZCMS 0001000 ZC I CCCC DDDDDDDDD SSSSSSSSS ISOB D,S/# ZCMS 0001001 ZC I CCCC DDDDDDDDD SSSSSSSSS NOTB D,S/# ZCMS 0001010 ZC I CCCC DDDDDDDDD SSSSSSSSS CLRB D,S/# ZCMS 0001011 ZC I CCCC DDDDDDDDD SSSSSSSSS SETB D,S/# ZCMS 0001100 ZC I CCCC DDDDDDDDD SSSSSSSSS SETBC D,S/# ZCMS 0001101 ZC I CCCC DDDDDDDDD SSSSSSSSS SETBNC D,S/# ZCMS 0001110 ZC I CCCC DDDDDDDDD SSSSSSSSS SETBZ D,S/# ZCMS 0001111 ZC I CCCC DDDDDDDDD SSSSSSSSS SETBNZ D,S/# ZCMS 0010000 ZC I CCCC DDDDDDDDD SSSSSSSSS ANDN D,S/# ZCMS 0010001 ZC I CCCC DDDDDDDDD SSSSSSSSS AND D,S/# ZCMS 0010010 ZC I CCCC DDDDDDDDD SSSSSSSSS OR D,S/# ZCMS 0010011 ZC I CCCC DDDDDDDDD SSSSSSSSS XOR D,S/# ZCMS 0010100 ZC I CCCC DDDDDDDDD SSSSSSSSS MUXC D,S/# ZCMS 0010101 ZC I CCCC DDDDDDDDD SSSSSSSSS MUXNC D,S/# ZCMS 0010110 ZC I CCCC DDDDDDDDD SSSSSSSSS MUXZ D,S/# ZCMS 0010111 ZC I CCCC DDDDDDDDD SSSSSSSSS MUXNZ D,S/# ZCMS 0011000 ZC I CCCC DDDDDDDDD SSSSSSSSS ROR D,S/# ZCMS 0011001 ZC I CCCC DDDDDDDDD SSSSSSSSS ROL D,S/# ZCMS 0011010 ZC I CCCC DDDDDDDDD SSSSSSSSS SHR D,S/# ZCMS 0011011 ZC I CCCC DDDDDDDDD SSSSSSSSS SHL D,S/# ZCMS 0011100 ZC I CCCC DDDDDDDDD SSSSSSSSS RCR D,S/# ZCMS 0011101 ZC I CCCC DDDDDDDDD SSSSSSSSS RCL D,S/# ZCMS 0011110 ZC I CCCC DDDDDDDDD SSSSSSSSS SAR D,S/# ZCMS 0011111 ZC I CCCC DDDDDDDDD SSSSSSSSS REV D,S/# ZCWS 0100000 ZC I CCCC DDDDDDDDD SSSSSSSSS MOV D,S/# ZCWS 0100001 ZC I CCCC DDDDDDDDD SSSSSSSSS NOT D,S/# ZCWS 0100010 ZC I CCCC DDDDDDDDD SSSSSSSSS ABS D,S/# ZCWS 0100011 ZC I CCCC DDDDDDDDD SSSSSSSSS NEG D,S/# ZCWS 0100100 ZC I CCCC DDDDDDDDD SSSSSSSSS NEGC D,S/# ZCWS 0100101 ZC I CCCC DDDDDDDDD SSSSSSSSS NEGNC D,S/# ZCWS 0100110 ZC I CCCC DDDDDDDDD SSSSSSSSS NEGZ D,S/# ZCWS 0100111 ZC I CCCC DDDDDDDDD SSSSSSSSS NEGNZ D,S/# ZCMS 0101000 ZC I CCCC DDDDDDDDD SSSSSSSSS ADD D,S/# ZCMS 0101001 ZC I CCCC DDDDDDDDD SSSSSSSSS SUB D,S/# ZCMS 0101010 ZC I CCCC DDDDDDDDD SSSSSSSSS ADDX D,S/# ZCMS 0101011 ZC I CCCC DDDDDDDDD SSSSSSSSS SUBX D,S/# ZCMS 0101100 ZC I CCCC DDDDDDDDD SSSSSSSSS ADDS D,S/# ZCMS 0101101 ZC I CCCC DDDDDDDDD SSSSSSSSS SUBS D,S/# ZCMS 0101110 ZC I CCCC DDDDDDDDD SSSSSSSSS ADDSX D,S/# ZCMS 0101111 ZC I CCCC DDDDDDDDD SSSSSSSSS SUBSX D,S/# ZCMS 0110000 ZC I CCCC DDDDDDDDD SSSSSSSSS SUMC D,S/# ZCMS 0110001 ZC I CCCC DDDDDDDDD SSSSSSSSS SUMNC D,S/# ZCMS 0110010 ZC I CCCC DDDDDDDDD SSSSSSSSS SUMZ D,S/# ZCMS 0110011 ZC I CCCC DDDDDDDDD SSSSSSSSS SUMNZ D,S/# ZCMS 0110100 ZC I CCCC DDDDDDDDD SSSSSSSSS MIN D,S/# ZCMS 0110101 ZC I CCCC DDDDDDDDD SSSSSSSSS MAX D,S/# ZCMS 0110110 ZC I CCCC DDDDDDDDD SSSSSSSSS MINS D,S/# ZCMS 0110111 ZC I CCCC DDDDDDDDD SSSSSSSSS MAXS D,S/# ZCMS 0111000 ZC I CCCC DDDDDDDDD SSSSSSSSS ADDABS D,S/# ZCMS 0111001 ZC I CCCC DDDDDDDDD SSSSSSSSS SUBABS D,S/# ZCMS 0111010 ZC I CCCC DDDDDDDDD SSSSSSSSS INCMOD D,S/# ZCMS 0111011 ZC I CCCC DDDDDDDDD SSSSSSSSS DECMOD D,S/# ZCMS 0111100 ZC I CCCC DDDDDDDDD SSSSSSSSS CMPSUB D,S/# ZCMS 0111101 ZC I CCCC DDDDDDDDD SSSSSSSSS SUBR D,S/# ZCMS 0111110 ZC I CCCC DDDDDDDDD SSSSSSSSS MUL D,S/# (takes two clocks) ZCMS 0111111 ZC I CCCC DDDDDDDDD SSSSSSSSS SCL D,S/# (takes two clocks) ZCWS 1000000 ZC I CCCC DDDDDDDDD SSSSSSSSS DECOD2 D,S/# ZCWS 1000001 ZC I CCCC DDDDDDDDD SSSSSSSSS DECOD3 D,S/# ZCWS 1000010 ZC I CCCC DDDDDDDDD SSSSSSSSS DECOD4 D,S/# ZCWS 1000011 ZC I CCCC DDDDDDDDD SSSSSSSSS DECOD5 D,S/# Z-WS 1000100 Z0 I CCCC DDDDDDDDD SSSSSSSSS BLSIZE D,S/# Z-WS 1000100 Z1 I CCCC DDDDDDDDD SSSSSSSSS BLMASK D,S/# Z-WS 1000101 Z0 I CCCC DDDDDDDDD SSSSSSSSS ONECNT D,S/# (takes two clocks) Z-WS 1000101 Z1 I CCCC DDDDDDDDD SSSSSSSSS ZERCNT D,S/# (takes two clocks) ZCWS 1000110 0C I CCCC DDDDDDDDD SSSSSSSSS TOPONE D,S/# (takes two clocks) ZCWS 1000110 1C I CCCC DDDDDDDDD SSSSSSSSS TOPZER D,S/# (takes two clocks) ZCWS 1000111 0C I CCCC DDDDDDDDD SSSSSSSSS BOTONE D,S/# (takes two clocks) ZCWS 1000111 1C I CCCC DDDDDDDDD SSSSSSSSS BOTZER D,S/# (takes two clocks) --MS 10010nn n0 I CCCC DDDDDDDDD SSSSSSSSS GETNIB D,S/#,#0..7 --MS 10010nn n1 I CCCC DDDDDDDDD SSSSSSSSS SETNIB D,S/#,#0..7 --MS 1001100 n0 I CCCC DDDDDDDDD SSSSSSSSS GETWORD D,S/#,#0..1 --MS 1001100 n1 I CCCC DDDDDDDDD SSSSSSSSS SETWORD D,S/#,#0..1 --MS 1001101 00 I CCCC DDDDDDDDD SSSSSSSSS ROLNIB D,S/# --MS 1001101 01 I CCCC DDDDDDDDD SSSSSSSSS ROLBYTE D,S/# --MS 1001101 10 I CCCC DDDDDDDDD SSSSSSSSS ROLWORD D,S/# --MS 1001101 11 I CCCC DDDDDDDDD SSSSSSSSS SETS D,S/# --MS 1001110 00 I CCCC DDDDDDDDD SSSSSSSSS SETD D,S/# --MS 1001110 01 I CCCC DDDDDDDDD SSSSSSSSS SETCOND D,S/# --MS 1001110 10 I CCCC DDDDDDDDD SSSSSSSSS SETINST D,S/# --MS 1001110 11 I CCCC DDDDDDDDD SSSSSSSSS THALT D,S/# -CMS 1001111 0C I CCCC DDDDDDDDD SSSSSSSSS WAITCNT D,S/# (waits for CNT, +CNTX if WC) --MS 1001111 10 I CCCC DDDDDDDDD SSSSSSSSS <empty> D,S/# --RS 1001111 11 I CCCC DDDDDDDDD SSSSSSSSS PICKZC D,S/# (always writes Z/C) --MS 101000n n0 I CCCC DDDDDDDDD SSSSSSSSS GETBYTE D,S/#,#0..3 --MS 101000n n1 I CCCC DDDDDDDDD SSSSSSSSS SETBYTE D,S/#,#0..3 --WS 1010010 00 I CCCC DDDDDDDDD SSSSSSSSS SETBYTS D,S/# --MS 1010010 01 I CCCC DDDDDDDDD SSSSSSSSS MOVBYTS D,S/# (move bytes in D, S = %11_10_01_00 = D same) --MS 1010010 10 I CCCC DDDDDDDDD SSSSSSSSS PACKRGB D,S/# (S 8:8:8 -> D 5:5:5 << 16 | D >> 16) --WS 1010010 11 I CCCC DDDDDDDDD SSSSSSSSS UNPKRGB D,S/# (S 5:5:5 -> D 8:8:8) --MS 1010011 00 I CCCC DDDDDDDDD SSSSSSSSS ADDPIX D,S/# (takes two clocks) --MS 1010011 01 I CCCC DDDDDDDDD SSSSSSSSS MULPIX D,S/# (takes two clocks) --MS 1010011 10 I CCCC DDDDDDDDD SSSSSSSSS BLNPIX D,S/# (takes two clocks) --MS 1010011 11 I CCCC DDDDDDDDD SSSSSSSSS MIXPIX D,S/# (takes two clocks) ZCMS 1010100 ZC I CCCC DDDDDDDDD SSSSSSSSS JMPSW D,S/@ ZCMS 1010101 ZC I CCCC DDDDDDDDD SSSSSSSSS JMPSWD D,S/@ --MS 1010110 00 I CCCC DDDDDDDDD SSSSSSSSS DJZ D,S/@ --MS 1010110 01 I CCCC DDDDDDDDD SSSSSSSSS DJZD D,S/@ --MS 1010110 10 I CCCC DDDDDDDDD SSSSSSSSS DJNZ D,S/@ --MS 1010110 11 I CCCC DDDDDDDDD SSSSSSSSS DJNZD D,S/@ --RS 1010111 00 I CCCC DDDDDDDDD SSSSSSSSS JZ D,S/@ --RS 1010111 01 I CCCC DDDDDDDDD SSSSSSSSS JZD D,S/@ --RS 1010111 10 I CCCC DDDDDDDDD SSSSSSSSS JNZ D,S/@ --RS 1010111 11 I CCCC DDDDDDDDD SSSSSSSSS JNZD D,S/@ ZCRS 1011000 ZC I CCCC DDDDDDDDD SSSSSSSSS TESTB D,S/# ZCRS 1011001 ZC I CCCC DDDDDDDDD SSSSSSSSS TESTN D,S/# ZCRS 1011010 ZC I CCCC DDDDDDDDD SSSSSSSSS TEST D,S/# ZCRS 1011011 ZC I CCCC DDDDDDDDD SSSSSSSSS CMP D,S/# ZCRS 1011100 ZC I CCCC DDDDDDDDD SSSSSSSSS CMPX D,S/# ZCRS 1011101 ZC I CCCC DDDDDDDDD SSSSSSSSS CMPS D,S/# ZCRS 1011110 ZC I CCCC DDDDDDDDD SSSSSSSSS CMPSX D,S/# ZCRS 1011111 ZC I CCCC DDDDDDDDD SSSSSSSSS CMPR D,S/# -CRS 110000n nC I CCCC DDDDDDDDD SSSSSSSSS WAITPEQ D,S/#,#0..3 (waits for pins, plus CNT if WC) -CRS 110001n nC I CCCC DDDDDDDDD SSSSSSSSS WAITPNE D,S/#,#0..3 (waits for pins, plus CNT if WC) ---S 110010n nn I CCCC nnnnnnnnn SSSSSSSSS WAITVID #0..$DFF,S/# (waits for vid if single-task, loops if multi-task) --RS 1100101 11 I CCCC DDDDDDDDD SSSSSSSSS WAITVID D,S/# (waits for vid if single-task, loops if multi-task) --LS 1100110 0L I CCCC DDDDDDDDD SSSSSSSSS WRBYTE D/#,S/PTRA/PTRB (waits for hub) --LS 1100110 1L I CCCC DDDDDDDDD SSSSSSSSS WRWORD D/#,S/PTRA/PTRB (waits for hub) --LS 1100111 0L I CCCC DDDDDDDDD SSSSSSSSS WRLONG D/#,S/PTRA/PTRB (waits for hub) --LS 1100111 1L I CCCC DDDDDDDDD SSSSSSSSS WRWIDEM D/#,S/PTRA/PTRB (waits for hub) D = write mask, where 1 bits mean 'don't-write' --LS 1100111 11 I CCCC 000000000 SSSSSSSSS WRWIDE S/PTRA/PTRB (waits for hub) D = constant $00000000, so all bytes written --LS 1101000 0L I CCCC DDDDDDDDD SSSSSSSSS WRAUX D/#,S/#0..$FF/PTRX/PTRY --LS 1101000 1L I CCCC DDDDDDDDD SSSSSSSSS WRAUXR D/#,S/#0..$FF/PTRX/PTRY --LS 1101001 0L I CCCC DDDDDDDDD SSSSSSSSS SETACCA D/#,S/# --LS 1101001 1L I CCCC DDDDDDDDD SSSSSSSSS SETACCB D/#,S/# --LS 1101010 0L I CCCC DDDDDDDDD SSSSSSSSS MACA D/#,S/# --LS 1101010 1L I CCCC DDDDDDDDD SSSSSSSSS MACB D/#,S/# --LS 1101011 0L I CCCC DDDDDDDDD SSSSSSSSS MUL32 D/#,S/# --LS 1101011 1L I CCCC DDDDDDDDD SSSSSSSSS MUL32U D/#,S/# --LS 1101100 0L I CCCC DDDDDDDDD SSSSSSSSS DIV32 D/#,S/# --LS 1101100 1L I CCCC DDDDDDDDD SSSSSSSSS DIV32U D/#,S/# --LS 1101101 0L I CCCC DDDDDDDDD SSSSSSSSS DIV64 D/#,S/# --LS 1101101 1L I CCCC DDDDDDDDD SSSSSSSSS DIV64U D/#,S/# --LS 1101110 0L I CCCC DDDDDDDDD SSSSSSSSS SQRT64 D/#,S/# --LS 1101110 1L I CCCC DDDDDDDDD SSSSSSSSS QSINCOS D/#,S/# --LS 1101111 0L I CCCC DDDDDDDDD SSSSSSSSS QARCTAN D/#,S/# --LS 1101111 1L I CCCC DDDDDDDDD SSSSSSSSS QROTATE D/#,S/# --LS 111000n nL I CCCC DDDDDDDDD SSSSSSSSS CFGPINS D/#,S/#,#0..2 (waits for alt) --LS 1110001 1L I CCCC DDDDDDDDD SSSSSSSSS SETMAP D/#,S/# --LS 1110010 0L I CCCC DDDDDDDDD SSSSSSSSS SETSERA D/#,S/# (config,baud) --LS 1110010 1L I CCCC DDDDDDDDD SSSSSSSSS SETSERB D/#,S/# (config,baud) --LS 1110011 0L I CCCC DDDDDDDDD SSSSSSSSS SETCTRS D/#,S/# (ctrb,ctra) --LS 1110011 1L I CCCC DDDDDDDDD SSSSSSSSS SETWAVS D/#,S/# (ctrb,ctra) --LS 1110100 0L I CCCC DDDDDDDDD SSSSSSSSS SETFRQS D/#,S/# (ctrb,ctra) --LS 1110100 1L I CCCC DDDDDDDDD SSSSSSSSS SETPHSS D/#,S/# (ctrb,ctra) --LS 1110101 0L I CCCC DDDDDDDDD SSSSSSSSS ADDPHSS D/#,S/# (ctrb,ctra) --LS 1110101 1L I CCCC DDDDDDDDD SSSSSSSSS SUBPHSS D/#,S/# (ctrb,ctra) --LS 1110110 0L I CCCC DDDDDDDDD SSSSSSSSS SETXFR D/#,S/# --LS 1110110 1L I CCCC DDDDDDDDD SSSSSSSSS SETMIX D/#,S/# --LS 1110111 0L I CCCC DDDDDDDDD SSSSSSSSS COGRUN D/#,S/# (waits for hub) --LS 1110111 1L I CCCC DDDDDDDDD SSSSSSSSS COGRUNX D/#,S/# (waits for hub) --LS 1111000 0L I CCCC DDDDDDDDD SSSSSSSSS FRAC D/#,S/# --LS 1111000 1L I CCCC DDDDDDDDD SSSSSSSSS LODINDS D/#,S/# --LS 1111001 0L I CCCC DDDDDDDDD SSSSSSSSS CIRINDA D/#,S/# --LS 1111001 1L I CCCC DDDDDDDDD SSSSSSSSS CIRINDB D/#,S/# --LS 1111010 0L I CCCC DDDDDDDDD SSSSSSSSS JP D/#,S/@ (takes two clocks) --LS 1111010 1L I CCCC DDDDDDDDD SSSSSSSSS JPD D/#,S/@ (takes two clocks) --LS 1111011 0L I CCCC DDDDDDDDD SSSSSSSSS JNP D/#,S/@ (takes two clocks) --LS 1111011 1L I CCCC DDDDDDDDD SSSSSSSSS JNPD D/#,S/@ (takes two clocks) --WS 1111100 00 I CCCC DDDDDDDDD SSSSSSSSS LOCBASE D,S/@ (if S: S<<2, if @S: (P+@S)<<2) --MS 1111100 01 I CCCC DDDDDDDDD SSSSSSSSS LOCBYTE D,S/@ (if S: D<<0 + S<<2, if @S: D<<0 + (P+@S)<<2) --MS 1111100 10 I CCCC DDDDDDDDD SSSSSSSSS LOCWORD D,S/@ (if S: D<<1 + S<<2, if @S: D<<1 + (P+@S)<<2) --MS 1111100 11 I CCCC DDDDDDDDD SSSSSSSSS LOCLONG D,S/@ (if S: D<<2 + S<<2, if @S: D<<2 + (P+@S)<<2) --W- 1111101 00 0 CCCC DDDDDDDDD sssssssss LOCINST D,@s (P+s) --R- 1111101 00 1 CCCC DDDDDDDDD sssssssss JMPLIST D,@s (jump to P+s+D) ---- 1111101 01 0 BBAA ddddddddd sssssssss FIXINDA #d,#s / FIXINDB #d,#s / FIXINDS #d,#s / SETINDA #s / SETINDB #d / SETINDS #d,#s ---- 1111101 01 1 nnnn nnnnnnnnn nnniiiiii REPS #1..$10000,#1..64 ---- 1111101 10 n nnnn nnnnnnnnn nnnnnnnnn AUGS #23bits (appends n to upper bits of next immediate S) ---- 1111101 11 n nnnn nnnnnnnnn nnnnnnnnn AUGD #23bits (appends n to upper bits of next immediate D) ---- 1111110 00 0 CCCC 00 nnnnnnnnnnnnnnnn LOCPTRA #abs ---- 1111110 00 0 CCCC 01 nnnnnnnnnnnnnnnn LOCPTRA @rel ---- 1111110 00 0 CCCC 10 nnnnnnnnnnnnnnnn LOCPTRB #abs ---- 1111110 00 0 CCCC 11 nnnnnnnnnnnnnnnn LOCPTRB @rel ---- 1111110 00 1 CCCC 00 nnnnnnnnnnnnnnnn JMP #abs ---- 1111110 00 1 CCCC 01 nnnnnnnnnnnnnnnn JMP @rel ---- 1111110 00 1 CCCC 10 nnnnnnnnnnnnnnnn JMPD #abs ---- 1111110 00 1 CCCC 11 nnnnnnnnnnnnnnnn JMPD @rel ---- wr0 1111110 01 0 CCCC 00 nnnnnnnnnnnnnnnn LINK #abs (jump, write {%00000000000000,Z,C,P} to $000) ---- wr0 1111110 01 0 CCCC 01 nnnnnnnnnnnnnnnn LINK @rel ---- wr0 1111110 01 0 CCCC 10 nnnnnnnnnnnnnnnn LINKD #abs ---- wr0 1111110 01 0 CCCC 11 nnnnnnnnnnnnnnnn LINKD @rel ---- 1111110 01 1 CCCC 00 nnnnnnnnnnnnnnnn CALL #abs ---- 1111110 01 1 CCCC 01 nnnnnnnnnnnnnnnn CALL @rel ---- 1111110 01 1 CCCC 10 nnnnnnnnnnnnnnnn CALLD #abs ---- 1111110 01 1 CCCC 11 nnnnnnnnnnnnnnnn CALLD @rel ---- 1111110 10 0 CCCC 00 nnnnnnnnnnnnnnnn CALLA #abs ---- 1111110 10 0 CCCC 01 nnnnnnnnnnnnnnnn CALLA @rel ---- 1111110 10 0 CCCC 10 nnnnnnnnnnnnnnnn CALLAD #abs ---- 1111110 10 0 CCCC 11 nnnnnnnnnnnnnnnn CALLAD @rel ---- 1111110 10 1 CCCC 00 nnnnnnnnnnnnnnnn CALLB #abs ---- 1111110 10 1 CCCC 01 nnnnnnnnnnnnnnnn CALLB @rel ---- 1111110 10 1 CCCC 10 nnnnnnnnnnnnnnnn CALLBD #abs ---- 1111110 10 1 CCCC 11 nnnnnnnnnnnnnnnn CALLBD @rel ---- 1111110 11 0 CCCC 00 nnnnnnnnnnnnnnnn CALLX #abs ---- 1111110 11 0 CCCC 01 nnnnnnnnnnnnnnnn CALLX @rel ---- 1111110 11 0 CCCC 10 nnnnnnnnnnnnnnnn CALLXD #abs ---- 1111110 11 0 CCCC 11 nnnnnnnnnnnnnnnn CALLXD @rel ---- 1111110 11 1 CCCC 00 nnnnnnnnnnnnnnnn CALLY #abs ---- 1111110 11 1 CCCC 01 nnnnnnnnnnnnnnnn CALLY @rel ---- 1111110 11 1 CCCC 10 nnnnnnnnnnnnnnnn CALLYD #abs ---- 1111110 11 1 CCCC 11 nnnnnnnnnnnnnnnn CALLYD @rel ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000000 COGID D (waits for hub) (doesn't write D if WC) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000001 TASKID D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000010 LOCKNEW D (waits for hub) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000011 GETLFSR D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000100 GETCNT D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000101 GETCNTX D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000110 GETACAL D (waits for mac) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000000111 GETACAH D (waits for mac) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001000 GETACBL D (waits for mac) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001001 GETACBH D (waits for mac) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001010 GETPTRA D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001011 GETPTRB D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001100 GETPTRX D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001101 GETPTRY D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001110 SERINA D (waits for rx if single-task, loops if multi-task, releases if WC) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000001111 SERINB D (waits for rx if single-task, loops if multi-task, releases if WC) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010000 GETMULL D (waits for mul if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010001 GETMULH D (waits for mul if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010010 GETDIVQ D (waits for div if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010011 GETDIVR D (waits for div if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010100 GETSQRT D (waits for sqrt if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010101 GETQX D (waits for cordic if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010110 GETQY D (waits for cordic if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000010111 GETQZ D (waits for cordic if single-task, loops if multi-task) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011000 GETPHSA D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011001 GETPHZA D (clears phsa) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011010 GETCOSA D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011011 GETSINA D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011100 GETPHSB D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011101 GETPHZB D (clears phsb) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011110 GETCOSB D ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000011111 GETSINB D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100000 PUSHZC D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100001 POPZC D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100010 SUBCNT D (subtracts D from CNT, then CNTX if same thread) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100011 GETPIX D (takes 3 clocks, needs 3 clocks in prior two stages, condition only gates writes) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100100 BINBCD D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100101 BCDBIN D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100110 BINGRY D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000100111 GRYBIN D (takes two clocks) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101000 ESWAP4 D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101001 ESWAP8 D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101010 SEUSSF D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101011 SEUSSR D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101100 SPLITB D (also MERGEN) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101101 MERGEB D (also SPLITN) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101110 SPLITW D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000101111 MERGEW D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110000 CHKDEC D (if decimal, makes nibble, c=1) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110001 CHKHEX D (if hexadecimal, makes nibble, c=1) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110010 CHKLET D (if letter/"_", makes uppercase, c=1) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110011 CHKSYM D (if letter/"_"/numeral, makes uppercase, c=1) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110100 INCD D (D += $200) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110101 DECD D (D -= $200) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110110 INCDS D (D += $201) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000110111 DECDS D (D -= $201) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000111000 POPT0 D (pops from task 0's 4-level stack) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000111001 POPT1 D (pops from task 1's 4-level stack) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000111010 POPT2 D (pops from task 2's 4-level stack) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000111011 POPT3 D (pops from task 3's 4-level stack) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000111100 POP D (pops from task's 4-level stack) ZCW- 1111111 ZC 0 CCCC DDDDDDDDD 000111101 <empty> D ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000111110 INCPAT D (takes four clocks) ZCM- 1111111 ZC 0 CCCC DDDDDDDDD 000111111 DECPAT D (takes four clocks) --L- 1111111 00 L CCCC DDDDDDDDD 001iiiiii REPD D/#1..512,#1..64 (REPD $1FF,#1..64 = infinite repeat, can use REPD #i) --L- 1111111 00 L CCCC DDDDDDDDD 010000000 CLKSET D/# (waits for hub) --L- 1111111 00 L CCCC DDDDDDDDD 010000001 COGSTOP D/# (waits for hub) -CL- 1111111 0C L CCCC DDDDDDDDD 010000010 LOCKSET D/# (waits for hub) -CL- 1111111 0C L CCCC DDDDDDDDD 010000011 LOCKCLR D/# (waits for hub) --L- 1111111 00 L CCCC DDDDDDDDD 010000100 LOCKRET D/# (waits for hub) --L- 1111111 00 L CCCC DDDDDDDDD 010000101 RDWIDE D/PTRA/PTRB (waits for hub) --L- 1111111 00 L CCCC DDDDDDDDD 010000110 RDWIDEC D/PTRA/PTRB (waits for hub if dcache miss) --L- 1111111 00 L CCCC DDDDDDDDD 010000111 RDWIDEQ D/PTRA/PTRB (waits for hub, doesn't affect dcache address/valid, waits 3 extra clocks) ZCL- 1111111 ZC L CCCC DDDDDDDDD 010001000 GETP D/# (pin into !Z/C via WZ/WC) ZCL- 1111111 ZC L CCCC DDDDDDDDD 010001001 GETNP D/# (pin into Z/!C via WZ/WC) -CL- 1111111 0C L CCCC DDDDDDDDD 010001010 SEROUTA D/# (waits for tx if single-task, loops if multi-task, releases if WC) -CL- 1111111 0C L CCCC DDDDDDDDD 010001011 SEROUTB D/# (waits for tx if single-task, loops if multi-task, releases if WC) -CL- 1111111 0C L CCCC DDDDDDDDD 010001100 CMPCNT D/# (subtracts D from CNT, then CNTX if same thread) -CL- 1111111 0C L CCCC DDDDDDDDD 010001101 WAITPX D/# (waits for any edge, +CNT if WC) -CL- 1111111 0C L CCCC DDDDDDDDD 010001110 WAITPR D/# (waits for pos edge, +CNT if WC) -CL- 1111111 0C L CCCC DDDDDDDDD 010001111 WAITPF D/# (waits for neg edge, +CNT if WC) --L- wrD 1111111 ZC L CCCC DDDDDDDDD 010010000 COGNEW D/# (waits for hub) --L- wrD 1111111 ZC L CCCC DDDDDDDDD 010010001 COGNEWX D/# (waits for hub) --L- 1111111 00 L CCCC DDDDDDDDD 010010010 SETXCH D/# --L- 1111111 00 L CCCC DDDDDDDDD 010010011 SETTASK D/# --L- 1111111 00 L CCCC DDDDDDDDD 010010100 SETRACE D/# --L- 1111111 00 L CCCC DDDDDDDDD 010010101 SARACCA D/# (waits for mac) --L- 1111111 00 L CCCC DDDDDDDDD 010010110 SARACCB D/# (waits for mac) --L- 1111111 00 L CCCC DDDDDDDDD 010010111 SARACCS D/# (waits for mac) --L- 1111111 00 L CCCC DDDDDDDDD 010011000 SETPTRA D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011001 SETPTRB D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011010 ADDPTRA D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011011 ADDPTRB D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011100 SUBPTRA D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011101 SUBPTRB D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011110 SETWIDE D/# --L- 1111111 00 L CCCC DDDDDDDDD 010011111 SETWIDZ D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100000 SETPTRX D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100001 SETPTRY D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100010 ADDPTRX D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100011 ADDPTRY D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100100 SUBPTRX D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100101 SUBPTRY D/# --L- 1111111 00 L CCCC DDDDDDDDD 010100110 PASSCNT D/# (takes two clocks, loops if (CNT - D) msb set) --L- 1111111 00 L CCCC DDDDDDDDD 010100111 WAIT D/# (waits 1+ clocks, 0 same as 1) --L- 1111111 00 L CCCC DDDDDDDDD 010101000 OFFP D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101001 NOTP D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101010 CLRP D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101011 SETP D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101100 SETPC D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101101 SETPNC D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101110 SETPZ D/# --L- 1111111 00 L CCCC DDDDDDDDD 010101111 SETPNZ D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110000 DIV64D D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110001 SQRT32 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110010 QLOG D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110011 QEXP D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110100 SETQI D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110101 SETQZ D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110110 CFGDACS D/# --L- 1111111 00 L CCCC DDDDDDDDD 010110111 SETDACS D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111000 CFGDAC0 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111001 CFGDAC1 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111010 CFGDAC2 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111011 CFGDAC3 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111100 SETDAC0 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111101 SETDAC1 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111110 SETDAC2 D/# --L- 1111111 00 L CCCC DDDDDDDDD 010111111 SETDAC3 D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000000 SETCTRA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000001 SETWAVA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000010 SETFRQA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000011 SETPHSA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000100 ADDPHSA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000101 SUBPHSA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000110 SETVID D/# --L- 1111111 00 L CCCC DDDDDDDDD 011000111 SETVIDY D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001000 SETCTRB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001001 SETWAVB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001010 SETFRQB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001011 SETPHSB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001100 ADDPHSB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001101 SUBPHSB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001110 SETVIDI D/# --L- 1111111 00 L CCCC DDDDDDDDD 011001111 SETVIDQ D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010000 SETPIX D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010001 SETPIXZ D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010010 SETPIXU D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010011 SETPIXV D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010100 SETPIXA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010101 SETPIXR D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010110 SETPIXG D/# --L- 1111111 00 L CCCC DDDDDDDDD 011010111 SETPIXB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011011000 SETPORA D/# --L- 1111111 00 L CCCC DDDDDDDDD 011011001 SETPORB D/# --L- 1111111 00 L CCCC DDDDDDDDD 011011010 SETPORC D/# --L- 1111111 00 L CCCC DDDDDDDDD 011011011 SETPORD D/# --L- 1111111 00 L CCCC DDDDDDDDD 011011100 RDWIDEA D/#1..512 --L- 1111111 00 L CCCC DDDDDDDDD 011011101 RDWIDEB D/#1..512 --L- 1111111 00 L CCCC DDDDDDDDD 011011110 WRWIDEA D/#1..512 --L- 1111111 00 L CCCC DDDDDDDDD 011011111 WRWIDEB D/#1..512 --L- 1111111 00 L CCCC DDDDDDDDD 011100x00 TARGOFF D/# --L- 1111111 00 L CCCC DDDDDDDDD 011100001 TARG D/# --L- 1111111 00 L CCCC DDDDDDDDD 011100010 TARGP D/# --L- 1111111 00 L CCCC DDDDDDDDD 011100011 TARGN D/# --L- 1111111 00 L CCCC DDDDDDDDD 011100101 TARGX D/# --L- 1111111 00 L CCCC DDDDDDDDD 011100110 TARGPX D/# --L- 1111111 00 L CCCC DDDDDDDDD 011100111 TARGNX D/# --L- 1111111 00 L CCCC DDDDDDDDD 011101000 JMPT0 D/# --L- 1111111 00 L CCCC DDDDDDDDD 011101001 JMPT1 D/# --L- 1111111 00 L CCCC DDDDDDDDD 011101010 JMPT2 D/# --L- 1111111 00 L CCCC DDDDDDDDD 011101011 JMPT3 D/# --L- 1111111 00 L CCCC DDDDDDDDD 011101100 PUSHT0 D/# (pushes into task 0's 4-level stack) --L- 1111111 00 L CCCC DDDDDDDDD 011101101 PUSHT1 D/# (pushes into task 1's 4-level stack) --L- 1111111 00 L CCCC DDDDDDDDD 011101110 PUSHT2 D/# (pushes into task 2's 4-level stack) --L- 1111111 00 L CCCC DDDDDDDDD 011101111 PUSHT3 D/# (pushes into task 3's 4-level stack) --L- 1111111 00 L CCCC DDDDDDDDD 011110000 PUSH D/# (pushes into task's 4-level stack) --L- 1111111 ZC L CCCC DDDDDDDDD 011110001 SETZC D/# --L- 1111111 00 L CCCC DDDDDDDDD 011110010 SETLFSR D/# --R- 1111111 00 x CCCC DDDDDDDDD 100000000 LOCPTRA D (PTRA = {D[15:0],%00}) (D[31:30] into Z/C via WZ/WC for LOCPTRA..CALLYD D) --R- 1111111 00 x CCCC DDDDDDDDD 100000001 LOCPTRB D (PTRB = {D[15:0],%00}) --R- 1111111 ZC x CCCC DDDDDDDDD 100000010 JMP D --R- 1111111 ZC x CCCC DDDDDDDDD 100000011 JMPD D --R- wr0 1111111 ZC x CCCC DDDDDDDDD 100000100 LINK D (jump, write {Z,C,%00000000000000,P} to $000) --R- wr0 1111111 ZC x CCCC DDDDDDDDD 100000101 LINKD D --R- 1111111 ZC x CCCC DDDDDDDDD 100000110 CALL D --R- 1111111 ZC x CCCC DDDDDDDDD 100000111 CALLD D --R- 1111111 ZC x CCCC DDDDDDDDD 100001000 CALLA D --R- 1111111 ZC x CCCC DDDDDDDDD 100001001 CALLAD D --R- 1111111 ZC x CCCC DDDDDDDDD 100001010 CALLB D --R- 1111111 ZC x CCCC DDDDDDDDD 100001011 CALLBD D --R- 1111111 ZC x CCCC DDDDDDDDD 100001100 CALLX D --R- 1111111 ZC x CCCC DDDDDDDDD 100001101 CALLXD D --R- 1111111 ZC x CCCC DDDDDDDDD 100001110 CALLY D --R- 1111111 ZC x CCCC DDDDDDDDD 100001111 CALLYD D --R- 1111111 00 x CCCC DDDDDDDDD 100010000 LODINDA D --R- 1111111 00 x CCCC DDDDDDDDD 100010001 LODINDB D ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000000 RETA ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000001 RETAD ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000010 RETB ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000011 RETBD ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000100 RETX ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000101 RETXD ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000110 RETY ZC-- 1111111 ZC x CCCC xxxxxxxxx 110000111 RETYD ZC-- 1111111 ZC x CCCC xxxxxxxxx 110001000 RET ZC-- 1111111 ZC x CCCC xxxxxxxxx 110001001 RETD ZC-- 1111111 ZC x CCCC xxxxxxxxx 110001010 POLCTRA (ctra-rollover into !Z/C) ZC-- 1111111 ZC x CCCC xxxxxxxxx 110001011 POLCTRB (ctra-rollover into !Z/C) ZC-- 1111111 ZC x CCCC xxxxxxxxx 110001100 POLVID (vid-ready into !Z/C) ---- 1111111 00 x CCCC xxxxxxxxx 110001101 CAPCTRA ---- 1111111 00 x CCCC xxxxxxxxx 110001110 CAPCTRB ---- 1111111 00 x CCCC xxxxxxxxx 110001111 CAPCTRS ---- 1111111 00 x CCCC xxxxxxxxx 110010000 SETPIXW ---- 1111111 00 x CCCC xxxxxxxxx 110010001 CLRACCA ---- 1111111 00 x CCCC xxxxxxxxx 110010010 CLRACCB ---- 1111111 00 x CCCC xxxxxxxxx 110010011 CLRACCS ZC-- 1111111 ZC x CCCC xxxxxxxxx 110010100 CHKPTRX ZC-- 1111111 ZC x CCCC xxxxxxxxx 110010101 CHKPTRY ---- 1111111 00 x CCCC xxxxxxxxx 110010110 SYNCTRA (waits for ctra if single-task, loops if multi-task)) ---- 1111111 00 x CCCC xxxxxxxxx 110010111 SYNCTRB (waits for ctrb if single-task, loops if multi-task)) ---- 1111111 00 x CCCC xxxxxxxxx 110011000 DCACHEX ---- 1111111 00 x CCCC xxxxxxxxx 110011001 ICACHEX ---- 1111111 00 x CCCC xxxxxxxxx 110011010 ICACHEP ---- 1111111 00 x CCCC xxxxxxxxx 110011011 ICACHEN ---- 1111111 00 x 0000 xxxxxxxxx 110011100 TLOCK ---- 1111111 00 x 0000 xxxxxxxxx 110011101 TFREE ---- 1111111 00 x 0000 xxxxxxxxx 110011110 LOADT3 ---- 1111111 00 x 0000 xxxxxxxxx 110011111 SAVET3 ---- 1111111 00 x 0000 xxxxxxxxx 110100x00 TARGOFF ---- 1111111 00 x 0000 xxxxxxxxx 110100001 TARG ---- 1111111 00 x 0000 xxxxxxxxx 110100010 TARGP ---- 1111111 00 x 0000 xxxxxxxxx 110100011 TARGN ---- 1111111 00 x 0000 xxxxxxxxx 110100101 TARGX ---- 1111111 00 x 0000 xxxxxxxxx 110100110 TARGPX ---- 1111111 00 x 0000 xxxxxxxxx 110100111 TARGNX ---- 1111111 00 x 0000 xxxxxxxxx 110101000 PASSTXA ---- 1111111 00 x 0000 xxxxxxxxx 110101001 PASSTXB ---- 0000000 00 0 0000 000000000 000000000 NOP x = don't care, use 0 --------------------------------------------------------------------------------------------------------------------- Z effect ------------------------------------------------------------------------------------------ 0 <none> 1 wz C effect ------------------------------------------------------------------------------------------ 0 <none> 1 wc L DDDDDDDDD destination operand ------------------------------------------------------------------------------------------ 0/na DDDDDDDDD register 1 #DDDDDDDDD immediate, zero-extended I SSSSSSSSS source operand ------------------------------------------------------------------------------------------ 0/na SSSSSSSSS register 1 #SSSSSSSSS immediate, zero-extended CCCC condition (easier-to-read list) ------------------------------------------------------------------------------------------ 0000 never 1111 if_always (default) 0001 nc & nz 1100 if_c if_b if_x1 0010 nc & z 0011 if_nc if_ae if_x0 0011 nc 1010 if_z if_e if_1x 0100 c & nz 0101 if_nz if_ne if_0x 0101 nz 1000 if_c_and_z if_z_and_c if_11 0110 c <> z 0100 if_c_and_nz if_nz_and_c if_01 0111 nc | nz 0010 if_nc_and_z if_z_and_nc if_10 1000 c & z 0001 if_nc_and_nz if_nz_and_nc if_a if_00 1001 c = z 1110 if_c_or_z if_z_or_c if_be if_not_00 1010 z 1101 if_c_or_nz if_nz_or_c if_not_10 1011 nc | z 1011 if_nc_or_z if_z_or_nc if_not_01 1100 c 0111 if_nc_or_nz if_nz_or_nc if_not_11 1101 c | nz 1001 if_c_eq_z if_z_eq_c if_same 1110 c | z 0110 if_c_ne_z if_z_ne_c if_diff 1111 always 0000 if_never CCCC inda/indb - CCCC=1111 after stage 2 of pipeline if inda/indb used (indx=inda/indb) ------------------------------------------------------------------------------------------ xx00 source indx xx01 source indx++ xx10 source indx-- xx11 source ++indx 00xx destination indx 01xx destination indx++ 10xx destination indx-- 11xx destination ++indx
There are actually 12 other instructions which are aliases of certain cases of the main instructions:
SWITCH
SWITCHD
MERGEN D/#
SPLITN D/#
PUSHA D/#
PUSHB D/#
PUSHX D/#
PUSHY D/#
POPA D/#
POPB D/#
POPX D/#
POPY D/#
You can imagine what they are, but these will be getting documented, too.
This, Heater, brings the total instruction count to 459.
Time to play...
I'm cool with that. My brain exploded about two hundred pages back in this thread, I can't count that far any more:)
Feel free to use it if needed.
Thank you. A most generous offer. I'm sure I will arrive at a subset of instructions that I can hold in my sponge brain
Remember, they're just friends that you haven't met yet. They all want to help you. Some are even waiting to do things that you'd be embarrassed to ask for, like convert English characters to upper-case, or tell you if you have a decimal digit, or not. And SEUSSF/SEUSSR are there to entertain you, should the need arise.
You're quite welcome but this was more an offer to those that might be feeling a bit 'off' at work today and need some time at home to take care of the new release.
Chip, I like the 'new friends' approach, my only problem is I'm really bad with names (both people and instructions) so most of my time is spent with "that guy looks familiar..dang, what was his name?"
Now, the little tease about SEUSSF/SEUSSR has made me curious!
Pass # 1 SEUSSF D D=$1234_5678 returns D=$1874_6EDB Pass # 2 SEUSSF D D=$1874_6EDB returns D=$7A7C_61F3 Pass # 3 SEUSSF D D=$7A7C_61F3 returns D=$4D54_61A7 Pass # 4 SEUSSF D D=$4D54_61A7 returns D=$6542_21B0 Pass # 5 SEUSSF D D=$6542_21B0 returns D=$6D47_BD00 Pass # 6 SEUSSF D D=$6D47_BD00 returns D=$27EE_9908 Pass # 7 SEUSSF D D=$27EE_9908 returns D=$86CE_BC4E Pass # 8 SEUSSF D D=$86CE_BC4E returns D=$96BA_BD7D Pass # 9 SEUSSF D D=$96BA_BD7D returns D=$8EB3_775F Pass #10 SEUSSF D D=$8EB3_775F returns D=$883B_13FB Pass #11 SEUSSF D D=$883B_13FB returns D=$6815_127F Pass #12 SEUSSF D D=$6815_127F returns D=$3850_0229 Pass #13 SEUSSF D D=$3850_0229 returns D=$3045_6041 Pass #14 SEUSSF D D=$3045_6041 returns D=$355C_C5C1 Pass #15 SEUSSF D D=$355C_C5C1 returns D=$65FE_64C4 Pass #16 SEUSSF D D=$65FE_64C4 returns D=$F57A_3D86 Pass #17 SEUSSF D D=$F57A_3D86 returns D=$672B_7D2E Pass #18 SEUSSF D D=$672B_7D2E returns D=$0663_9FAE Pass #19 SEUSSF D D=$0663_9FAE returns D=$42E3_9C7B Pass #20 SEUSSF D D=$42E3_9C7B returns D=$9EF5_943B Pass #21 SEUSSF D D=$9EF5_943B returns D=$9CA6_407B Pass #22 SEUSSF D D=$9CA6_407B returns D=$BC16_F2F3 Pass #23 SEUSSF D D=$BC16_F2F3 returns D=$7996_73E9 Pass #24 SEUSSF D D=$7996_73E9 returns D=$E054_7388 Pass #25 SEUSSF D D=$E054_7388 returns D=$600C_2D89 Pass #26 SEUSSF D D=$600C_2D89 returns D=$666C_A705 Pass #27 SEUSSF D D=$666C_A705 returns D=$01EA_A507 Pass #28 SEUSSF D D=$01EA_A507 returns D=$A5E9_B576 Pass #29 SEUSSF D D=$A5E9_B576 returns D=$ADB3_8D6E Pass #30 SEUSSF D D=$ADB3_8D6E returns D=$A6B3_1A62 Pass #31 SEUSSF D D=$A6B3_1A62 returns D=$9317_1E6B Pass #32 SEUSSF D D=$9317_1E6B returns D=$1234_5678
I have one question?
Can't PNut cut filling 0000000 in bin file to first ORGH position --->
That will give simpler make separately loaded modules.
Thanks! for the update
My USB blaster is working away. :cool:
Party pooper!!
Thanks! I was going to do the same thing with your handy dandy tool!
Sorry, yes, now I'm with you. You know, I not feeling so good myself, perhaps I should go home and take some Parallaxetamol.
Be careful, it kind of sneaks up on you in 459 different ways. Next thing you know, you have pre-emptive threads! You don't want coworkers to see that!