If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Long hello
- HughBanton
- Posts: 268
- Joined: Sat Apr 12, 2008 3:10 pm
- Location: Evesham, Worcestershire
- Contact:
Long hello
Oh wow .. I didn't realise this forum was functioning again. I've periodically been checking but always either got a '404' or else it wouldn't let me in, password lockout or whatever.
I believe I can claim to be one of the earliest members here, 2008 it sez - although I dare say I'll get told otherwise
However I did go silent between 2010 & 2015 I recall.
Well here we are. Just like the old days!
So now I'd better think of something useful to contribute then
I believe I can claim to be one of the earliest members here, 2008 it sez - although I dare say I'll get told otherwise
Well here we are. Just like the old days!
So now I'd better think of something useful to contribute then
- HughBanton
- Posts: 268
- Joined: Sat Apr 12, 2008 3:10 pm
- Location: Evesham, Worcestershire
- Contact:
Re: Long hello
Thanks!
Here's some Ruby that's potentially useful. I'll explain after ..
################################
require "Win32API"
OpenClipboard = Win32API.new("user32", "OpenClipboard", "L", "I")
EmptyClipboard = Win32API.new("user32", "EmptyClipboard", "", "I")
SetClipboardData = Win32API.new("user32", "SetClipboardData", "IL", "I")
CloseClipboard = Win32API.new("user32", "CloseClipboard", "", "I")
GlobalAlloc = Win32API.new("kernel32", "GlobalAlloc", "II", "I")
GlobalLock = Win32API.new("kernel32", "GlobalLock", "I", "I")
GlobalUnlock = Win32API.new("kernel32", "GlobalUnlock", "I", "I")
RtlMoveMemory = Win32API.new("kernel32", "RtlMoveMemory", "IPI", "V")
GMEM_MOVEABLE = 0x0002
CF_TEXT = 1
#################################
def copy_to_clipboard(text)
OpenClipboard.call(0)
EmptyClipboard.call
# Allocate global memory for the string + null terminator
mem = GlobalAlloc.call(GMEM_MOVEABLE, text.bytesize + 1)
ptr = GlobalLock.call(mem)
# Copy bytes into the allocated memory
RtlMoveMemory.call(ptr, text, text.bytesize)
GlobalUnlock.call(mem)
SetClipboardData.call(CF_TEXT, mem)
CloseClipboard.call
end
# removes all //comment lines UNLESS they contain
# a 'keep word'. Edit keep_words as required.
keep_words = [
"Assignment",
"Hop",
"Loop",
# "Operator",
# "Comparison",
# "Cast",
# "Function",
"NOTE"
]
lines = @text.split(/\r?\n/)
filtered = []
filtered << "// Paste text to an ASSEMBLER prim : " << ""
lines.each_with_index do |line, i|
s = line.strip
is_comment = s.start_with?("//")
keep_comment = keep_words.any? { |w| s.include?(w) }
if is_comment && !keep_comment
# Remove the comment & remove previous line if it's blank
if !filtered.empty? && filtered.last.strip.empty?
filtered.pop
end
next
end
filtered << line
end
result = filtered.join("\n")
output result # no longer required
copy_to_clipboard(result) # direct to Windows clipboard
Here's some Ruby that's potentially useful. I'll explain after ..
################################
require "Win32API"
OpenClipboard = Win32API.new("user32", "OpenClipboard", "L", "I")
EmptyClipboard = Win32API.new("user32", "EmptyClipboard", "", "I")
SetClipboardData = Win32API.new("user32", "SetClipboardData", "IL", "I")
CloseClipboard = Win32API.new("user32", "CloseClipboard", "", "I")
GlobalAlloc = Win32API.new("kernel32", "GlobalAlloc", "II", "I")
GlobalLock = Win32API.new("kernel32", "GlobalLock", "I", "I")
GlobalUnlock = Win32API.new("kernel32", "GlobalUnlock", "I", "I")
RtlMoveMemory = Win32API.new("kernel32", "RtlMoveMemory", "IPI", "V")
GMEM_MOVEABLE = 0x0002
CF_TEXT = 1
#################################
def copy_to_clipboard(text)
OpenClipboard.call(0)
EmptyClipboard.call
# Allocate global memory for the string + null terminator
mem = GlobalAlloc.call(GMEM_MOVEABLE, text.bytesize + 1)
ptr = GlobalLock.call(mem)
# Copy bytes into the allocated memory
RtlMoveMemory.call(ptr, text, text.bytesize)
GlobalUnlock.call(mem)
SetClipboardData.call(CF_TEXT, mem)
CloseClipboard.call
end
# removes all //comment lines UNLESS they contain
# a 'keep word'. Edit keep_words as required.
keep_words = [
"Assignment",
"Hop",
"Loop",
# "Operator",
# "Comparison",
# "Cast",
# "Function",
"NOTE"
]
lines = @text.split(/\r?\n/)
filtered = []
filtered << "// Paste text to an ASSEMBLER prim : " << ""
lines.each_with_index do |line, i|
s = line.strip
is_comment = s.start_with?("//")
keep_comment = keep_words.any? { |w| s.include?(w) }
if is_comment && !keep_comment
# Remove the comment & remove previous line if it's blank
if !filtered.empty? && filtered.last.strip.empty?
filtered.pop
end
next
end
filtered << line
end
result = filtered.join("\n")
output result # no longer required
copy_to_clipboard(result) # direct to Windows clipboard
- HughBanton
- Posts: 268
- Joined: Sat Apr 12, 2008 3:10 pm
- Location: Evesham, Worcestershire
- Contact:
Re: Long hello
OK .. wot it does.
When converting DSP to assembler you traditionally attach a text prim to the DSP's 'S' output, copy the entire text contents and then paste inside an Assem prim. Very neat, but can get tedious.
First thing .. the result is quite verbose, lots of automatic comments are generated. That's very useful when you're just starting out with Assembler but pretty soon you have to spend 10 minutes every time just editing out all the obvious statements that tell you "it's an ADD" , or "it's being NORed" or whatever.
So in this Ruby code you can customise your level by getting it to leave out the comments you don't want. By default I've set it to only keep "Assignment", "Hop", and "Loop". But 'keep_words' can be edited to suit personal skill level.
(Trogg made me a basic version of the same thing years back .. but I lost it!)
Second thing .. I've got it to automatically copy to the clipboard using the Win32API. So all you need to do now is bring up an empty assembler prim and paste inside it - done.
Did I get AI help? Course I did
When converting DSP to assembler you traditionally attach a text prim to the DSP's 'S' output, copy the entire text contents and then paste inside an Assem prim. Very neat, but can get tedious.
First thing .. the result is quite verbose, lots of automatic comments are generated. That's very useful when you're just starting out with Assembler but pretty soon you have to spend 10 minutes every time just editing out all the obvious statements that tell you "it's an ADD" , or "it's being NORed" or whatever.
So in this Ruby code you can customise your level by getting it to leave out the comments you don't want. By default I've set it to only keep "Assignment", "Hop", and "Loop". But 'keep_words' can be edited to suit personal skill level.
(Trogg made me a basic version of the same thing years back .. but I lost it!)
Second thing .. I've got it to automatically copy to the clipboard using the Win32API. So all you need to do now is bring up an empty assembler prim and paste inside it - done.
Did I get AI help? Course I did