#robotics Logs
Jan 19 2012
#robotics Calendar
00:16 rue_house now I should make macros for taking selection blocks and putting them in fors, ifs, whiles, do while, else...
20:20 rue_house wow
20:21 rue_house http://ideone.com/V1Ev5 <-- wow, is something missing here?
20:22 rue_house I think c++ is missing from that assembler?
20:22 rue_house huh
20:26 Tom_itx is that the asm output from it below?
20:28 rue_house yes
20:28 rue_house small eh?
20:28 rue_house its x86 asm
20:29 rue_house the avr asm is... odd
20:30 rue_house its the core of my avr ihex interperter
20:30 rue_house I'm having interesting insight into microcotnroller programming again
20:30 rue_house back to coding assembler via C
20:31 Tom_itx i noticed
20:31 rue_house 'how would I do this in assembler?'
20:31 rue_house its making the C look odd
20:31 rue_house if (c >= '0')
20:31 rue_house if (c <= '9') return (c - '0');
20:31 rue_house by not using & it dosn't store both and then test
20:32 rue_house so the assembler jumps out right away
20:32 Tom_itx if one fails no reason to test the other one
20:32 rue_house just like you would do in asm
20:37 Triffid_Hunter rue_house: in the thing you pasted, it has c, but it's dropped len. it loads (c + len) into %edi and simply compares c to it
20:37 Triffid_Hunter which is quite an elegant way to manage both loop variables in one register :)
20:37 rue_house ...
20:38 rue_house but C goes u;... len goes down...
20:38 Triffid_Hunter rue_house: yep. consider: c = 5; len = 5; do { c++; len--; } while (len); printf("%d", c); <-- prints 10, ie c + len
20:39 Triffid_Hunter your code is almost identical except it does some other stuff with c as well
20:39 rue_house c is my buffer pointer
20:39 Triffid_Hunter it's functionally equivalent to c = 5; endc = c + len; do { c++ } while (c < end_c);
20:40 Triffid_Hunter which is exactly what shows up in your assembler
20:40 rue_house it disturbs me when gcc teaches me stuff
20:42 Triffid_Hunter it's pretty incredible sometimes :)
20:42 Triffid_Hunter and other times it's downright stupid
20:42 rue_house so, if I add len to c and test for c hitting that number
20:43 rue_house maybe I'll just let the compiler do the optimization on that one
20:43 Triffid_Hunter yeah leave it to the compiler, keep your readability
20:43 rue_house personally, I would asm it as a decrement last thing and use zero test to repeat the loop
20:44 Triffid_Hunter rue_house: sure, but then you have two loop variables that both must be incremented/decremented, perhaps this way is faster or smaller or both? compile with -O0, see what it does
20:44 rue_house I still regard a zero test from a decrement to be faster than a test against a limit
20:44 rue_house I'm -O1 right now
20:44 Triffid_Hunter depends on the cpu. in some it sure is (eg PIC), but maybe not with x86
20:45 rue_house the x86 is just entertainment, I'm writing this for an avr
20:46 Triffid_Hunter well that'll have totally different optimisations again ;)
20:48 Triffid_Hunter rue_house: on an unrelated note, http://www.youtu.be/0m7qMmTXLNo <-- 3d printers are awesome for robotics :)
20:49 rue_house I"v put reprap on my todo list
20:49 dunz0r Too bad that repraps and the likes are pricey :/
20:49 rue_house I see the posability for total copyright infringement ont eh cup I bought at the corner store :)
20:49 rue_house pricey? no
20:49 rue_house people just keep buying kits
20:51 dunz0r Well... manufacturing the parts yourself isn't very cheap either, unless you've got a CNC and a lathe :)
20:51 Tom_itx have both
20:51 rue_house a reprap can be built with little more than a hand drill and hacksaw
20:52 rue_house the rediculously simple machine that will take over the world
20:52 dunz0r It won't be as expensive as a kit, but it's not cheap either.
20:52 rue_house I'd say, if repraps were computers, were at the early 70's
20:53 dunz0r Although... I spend ~25% of what a Reprap would cost me on electronics a month.
20:53 Tom_itx what would a reprap cost you?
20:54 Triffid_Hunter dunz0r: so in 4 months you could have your own reprap?
20:54 Triffid_Hunter took me 2 years :P
20:54 rue_house I cant believe this, nomatter how much I screw up with code it just keeps working
20:58 rue_house I bet, if not distracted, I could build one in two days
20:58 rue_house (some pregathered materials)
21:01 Triffid_Hunter rue_house: yeah I
21:02 Triffid_Hunter 've heard of people unpacking their kit on friday and getting first noodles on sunday with decent prints the sunday after
21:02 Triffid_Hunter not common but does happen :)
21:02 Tom_itx seemed maxbots struggled a while on his
21:03 Triffid_Hunter yeah he had issues with his electronics iirc
21:03 rue_house the world would never leave me alone long enough to do it
21:03 Triffid_Hunter he's actually designed another variant using alu extrusions instead of threaded rod
21:03 zhanx yep drunk again.. i suck
21:04 rue_house on a reprap, does the head or table move up/down?
21:04 Tom_itx head
21:04 rue_house hah, silly
21:05 Tom_itx i think
21:08 rue_house hmm I have a bad tendency to write realy looooooong functions in asm
21:10 Triffid_Hunter rue_house: depends on the design. mendel has bed move in Y, and nozzle moves in X and Z
21:10 Triffid_Hunter rue_house: ultimaker moves nozzle in X and Y and table in Z
21:10 Triffid_Hunter rue_house: mosaic moves nozzle in X and table in Y and Z
21:10 Triffid_Hunter so there's many configurations ;)
21:10 rue_house cool , houston, we have varriants
21:11 Triffid_Hunter rue_house: in theory you could simply strap an extruder to a CNC mill. in practice they're too slow and can't get enough acceleration for nice looking prints that don't take all day
21:13 rue_house has anyone made micro ball jet based one yet?
21:18 rue_house ok! I _CAN_
21:18 rue_house - clean the kitty litter box
21:19 rue_house - start a fire in the boierl or its gonna freeze
21:20 rue_house :0B00810000900000E4F0A3D8FCD9FAC6
21:20 rue_house OK
21:20 rue_house Length: 0B
21:20 rue_house Address: 0081
21:20 rue_house Rec. Type:00
21:20 rue_house Data: 00900000E4F0A3D8FCD9FA
21:51 rue_house ^^ its working!
21:53 rue_house and I did the literbox and the fire too
21:54 Tom_itx you should rest
21:54 rue_house I need to work out code to act on the ihex data
21:55 rue_house and I need to expand my mcs80 bus code to atleast a 16bit address bus