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 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:
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 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:
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:
Here's what it looks like when it comes up. It also shows eXec mode:
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:
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!
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!