tag:blogger.com,1999:blog-86889252353462401102024-02-08T04:25:08.143-08:00burnttoysUnknownnoreply@blogger.comBlogger58125tag:blogger.com,1999:blog-8688925235346240110.post-81500319820146598972016-05-06T06:02:00.000-07:002016-05-06T06:02:10.346-07:00Fixing C.Add polymorphism. I can't see any reason this isn't doable outside of function naming. That's fixable.<br />
<br />
"Simple" "templates" based on structure aggregation to make workable generics (list/tree/map etc)<br />
<br />
Clean vector math support (like OGLES)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-89333932979481889062016-05-05T01:14:00.003-07:002016-05-05T01:14:56.194-07:00Also, <a href="http://getchip.com/pages/pocketchip">Pocket C.H.I.P.</a> Does nerd tech get any cooler than this?<br />
<br />
...<br />
<br />
No.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-50213759988080401752016-05-05T00:11:00.002-07:002016-05-05T00:11:42.287-07:00Fixing C 3The embedded guys would, really, like you to standardise the bit shift operations and add rotations will you are there, no... seriously!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-77829616151383453032016-05-04T22:59:00.002-07:002016-05-04T22:59:26.211-07:00Fixing C 2Following on from the previous post.<br />
<br />
Something I've always fancied to help handle error cases is for/else and while/else<br />
<br />
<span style="background-color: #fff2cc; font-family: Courier New, Courier, monospace;">for (int x = start_value; x > 0; --x) {</span><br />
<span style="background-color: #fff2cc; font-family: Courier New, Courier, monospace;"> do_some_work(x,y);</span><br />
<span style="background-color: #fff2cc; font-family: Courier New, Courier, monospace;">} else {</span><br />
<span style="background-color: #fff2cc; font-family: Courier New, Courier, monospace;"> dont_do_some_work();</span><br />
<span style="background-color: #fff2cc; font-family: Courier New, Courier, monospace;">}</span><br />
<br />
... and the same for while loops.<br />
<br />
You see, the loop construct has to test the initial condition before retesting when the loop loops around. It would not be hard to add an "else" clause e.g. if the loop is never executed then please do this.<br />
<br />
It would save the coder writing an additional "if" test and can trivially be used to catch errors e.g. what do you do (or not do) in the above case if start_value is 0.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-51707587481654062282016-05-04T22:19:00.001-07:002016-05-04T22:19:51.803-07:00"Fixing C"There's an interesting debates going on at embedded.com and eetimes.com about <a href="http://www.embedded.com/electronics-blogs/break-points/4441819/Fixing-C">Fixing C</a><br />
<br />
There's a lot of debate about removing brackets, semi-colons, using pythonesque tabbing etc but a lot of this is probably "syntactic sugar" that will lead to further unexpected problems.<br />
<br />
On that note (syntactic) one of the few changes I would make would be the removal of the "single line statement"<br />
<br />
<br />
<span style="background-color: #ffe599; font-family: Courier New, Courier, monospace;">if (something > something_else)</span><br />
<span style="background-color: #ffe599; font-family: Courier New, Courier, monospace;"> a_single_line_statement(something_else);</span><br />
<br />
WHY?!<br />
<br />
Because it leads to hell! It is FAR too easy to see someone plug a line of code in and have everything go wrong. Especially when debugging and a printk/printf/debug() line is added.<br />
<br />
It is not so hard to use {} to delimit that and the rule about "what is a code block" becomes crystal clear.<br />
<br />
I'd apply the same rule to empty code blocks<br />
<br />
<span style="background-color: #ffe599; font-family: Courier New, Courier, monospace;">for(unsigned x = 0; some_array[x]--; x += some_array[x]) ;</span><br />
<br />
Why not just write {} instead of ;<br />
<br />
Now, let's not get into why the structure notation uses the same braces as code blocks. But the answer is... there's only so many braces and C uses them all (and C++ augments them with <>!)<br />
<br />
But - what else is there?<br />
<br />
Proper bounds checking, user defined literals (notably for strings with length instead of null termination), rotate operators and more besides.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-70866339453390073862016-04-18T06:42:00.001-07:002016-04-18T06:42:28.620-07:00Single Lines of Code<span style="font-family: Courier New, Courier, monospace;"><b>// so satan shits in my dinner again!</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span>
<pre><!--StartFragment--><span style="font-family: Courier New, Courier, monospace;"><b><span style="color: navy;">qDebug</span>()<span style="color: silver;"> </span><<<span style="color: silver;"> </span><span style="color: green;">"BAM!"</span>;</b></span><!--EndFragment--></pre>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-36659290702355965562013-07-21T22:06:00.001-07:002013-07-21T22:06:46.195-07:00Dear Susie Wolff<p dir=ltr>Yes! You prove it! Good pace in the young drivers test. **** all them haters! If you don't do it don't worry too much. I'm already training my 10 month old daughter to be a future F1 champ!!!!</p>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-48121647696132723792012-10-15T23:55:00.001-07:002012-10-15T23:55:25.887-07:00Dear AppleMac Book Air 13" + Retina Display + 16 GB RAM + Lots and lots of SSD goodness == $my_moneyUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-29153910809536904962012-03-29T11:18:00.001-07:002012-03-29T11:19:38.216-07:00PS4, PC,XBOX720, Wii, locked phonesI've had it TBH. The more powerful technology becomes the more "they" want to lock it down.<br /><br />I'm not even happy with the GPL.<br /><br />Where's "Anarchy OS" on "Open Hardware"?<br /><br />*me wants*Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-75630406044597260842012-03-08T03:16:00.001-08:002012-03-08T03:16:59.205-08:00POWER UP THE BASS CANNONBBBBBBBBBBOOOOOOOOOOOOOOOOOOOOOOOOOOOMMMMMMMMMMMMMMMMMMMMMMMMMM!!!!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-20865503865833448472012-03-04T02:32:00.002-08:002012-03-04T02:34:30.597-08:00SPAMI wonder when the interwebz will actually be spammed to death? Searching blogs gives endless "stream of consciousness" posts from spam bots and cyberspambots from all over the world. Every word is being parameterised. The bucket of top hits is overflowing. Sometimes I'm just a tiny speck of data in an ocean of noise.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-88145611140992313542012-02-22T00:24:00.003-08:002012-02-22T00:31:05.712-08:00ZEDEXWhat would you want from a good emulator today?<br /><br />Z80 emulation... Good Z80 emulation. TBH, really good emulation starts with the bus and works inwards<br /><br />ULA emulation + those extra bits that get used all over - well, some of them anyway. <br /><br />We'd want ROM and RAM chip select decode and full I,R,RFSH cycle decoding/interpreting or the system just wouldn't work.<br /><br />TV emulation - emulate interlacing effects and much more (pixel blur, even warping)<br /><br />Ear and Mic sockets need good emulation too (I want sound damnit)<br /><br />Back when this machine came out there were TINY ROM cartridges and everything else came on tape (it was very cheap). If you wanted fast and big back then you could've used floppy discs or very small amounts of Flash (4K). Painful.<br /><br />Software, well, a decent multi-pass disassembler in the "IDE" would be perfect as would be the ability to load up pre-built RAM/ROM images and give them a go.<br /><br />A built in assembler would be essential although wouldn't give you that authentic feel! We'd supply an assembler on ROM (additional 8K ROM). TBH, It's the only way to go - A really good cartridge would have additional RAM so we could leave main memory untouched... Can we run the screen from an address < 16384? (my feeling is "NO")<br /><br />Memory watch windows with some reconfigurability for weird floating point types.<br /><br />The ability to follow a 16 bit value as an absolute of relative address would be nice too.<br /><br />You see, there's SO much to do!<br /><br />Lastly, I'd like to be able to use the emulated machine font for the GUI. Now... that's hard!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-81889709911660526532012-02-06T23:21:00.001-08:002012-02-06T23:24:15.692-08:00Old TechnologyThere's lots of fans out there... Black and white moves, vinyl, wax cylinder, 8 bit graphics (sprites, not many colours, colour clash etc) even <a href="http://entertainment.slashdot.org/story/12/02/07/035201/tapeheads-and-the-quiet-return-of-vhs">VHS</a>.<br /><br />Why is this? Will there be Blu-ray fan groups in the not so distant future? 44.1Khz "heads" who will painstakingly resample all their new ultra-hd-mp7s into CD quality?<br /><br />Probably not!<br /><br />But why the love old tech? SNES, ZX Spectrum, Pong, VCS2600, N64 and Playstation even?<br /><br />I reckon it's their "other-worldliness".<br /><br />They can't/don't attempt to mimic reality but paint a cartoon, an abstraction of it instead. It's all they could do!<br /><br />That's what draws people to them. They look like the future, from the near past.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-51767756437322953062011-11-06T07:53:00.000-08:002011-11-06T07:54:24.083-08:00W00T!!!!"Thank you. Your request has been sent to our customer service team and we'll get back to you by email in the next 28 days with details of what you need to do next."<br /><br />Hello O2? This is the internet speaking? TWENTY EIGHT DAYS?<br /><br />Crickey.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-22353478940428959672011-10-13T01:12:00.001-07:002011-10-13T01:13:55.838-07:00dmr<pre>#include <stdlib.h><br /><br />int main(void)<br />{<br /> printf("Goodbye World...\n");<br /><br /> return(0);<br />}</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-57591082606979302462011-10-12T03:27:00.000-07:002011-10-12T03:31:25.672-07:00BlackberryI ♥ my Blackberry. I like its little keyboard. I like the way all the messaging and contacts just fits together.<br /><br />But you've broken it! In a really annoying way.<br /><br />Or to put it another way - I stuck with Blackberry because I like their product - their product includes email!<br /><br />So... I think you need to be careful. When I started with my crackberry there wasn't much competition. Now we have Android phones (some with keyboards), iPhone, WP7 phones and a lot more besides.<br /><br />From now on you'll have to persuade me to stay. My dis is a bit gruntled.<br /><br />SorryUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-16149818343045224522011-10-10T23:37:00.000-07:002011-10-10T23:38:46.648-07:00The Internet...It's hard to tell if people out there are... A - stupid, B - ignorant, C - Cognitively Dissonant, D - Insane, E - Trolls or F - Cunts.<br /><br />SNR... less than a fraction of decibel...Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8688925235346240110.post-3513835419361881472011-10-05T23:16:00.000-07:002011-10-05T23:18:30.017-07:00Good Night Mr Jobs.Best damn computer I've ever bought.<br /><br />I know I paid extra for it... but I'm still glad! 3 years and I've never had a system crash. Once the mail app got stuck - it was such a rare event it's still stuck in my mind.<br /><br />Without Apple, The Steves and all the great engineers they got to build something different the world of computers would be a lot duller, less colourful and generally a bit more... hmmm... Microsoft!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-63652555018701572742011-04-19T04:51:00.000-07:002011-04-19T04:56:33.387-07:00C as a Systems Language<pre>The "Systems Language" definition is a bit fuzzy. I'd say it has to have address manipulation, type coercion (not conversion but all that evil stuff with unions and the like). It should also support plenty of bit meddling operations and structures.<br /><br />To this end C has served well.<br /><br />What has not served well has been the standard libraries and it's evolution.<br /><br />Huge amounts of the specification can no longer change due to backwards compatibility. For example, we really don't need both typedefs and structs. We really could use polymorphism and even templates (without classes). We could build an object system (ala QObject or Objective C) if we had a slightly better macro system. The typedef synonym system really doesn't work well with automatic type conversion (which should be banned!). The string format is a bit... hmmm... It WOULD be FAR more efficient to store length (I really can't over-emphasize that!)<br /><br />We could... but it works.<br /><br />Maybe there's a need for a "new" C... but maybe what we've got is just damn good enough.<br /><br />I say this as I just been rolling a new first fit and buddy memory allocator - it would be nice to have ref counted objects but, you know what, we can still work without them.</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-55661531062168497572011-04-18T02:17:00.000-07:002011-04-18T02:21:10.084-07:00Flow... Explicit vs Implicit<pre>Our computer programs are generally written with the idea that data processing runs from the top of the app the the bottom and may loop round again. Whole programs are written by putting lots and lots of these pieces together.<br /><br />EDGE programs may be written the same way and re-interpreted to make a graph like system or vice versa - in fact we can translate between representations (compilation and optimisation patterns often use SSA - Single Strategic Assignment - which is a lot like a simple graph).<br /><br />My code will look a lot more like EDGE than, say, C. This seems a good way to represent a program pre-compilation and for use in a graphical environment.</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-84672798620653910352011-04-15T08:18:00.001-07:002011-04-15T08:23:34.879-07:00No Update Today?<pre>Yup, just a little one.<br /><br />I'm gonna use Qt for GUI work - yup, I also understand that most of this stuff isn't GUI at all but I'll probably steal their colour coded editor or just plane old QTextEdit, wrap some open/close stuff around it and call it a UI.<br /><br />There are advantages to working this way - think multiple tabs and/or multiple windows - one shows you your central scripting whilst the others change as fast as possible to show how your models are turned into code, interpreted, graph outputs etc. Very nice.<br /><br />One disadvantage is that an installer gets "big" once you've added all of Qt's libraries. Linux with it's dependency system doesn't worry too much. Windows - well you have to ship 'em and same with Mac.<br /><br />I work almost exclusively with Linux (Ubuntu & Android to be precise - although Angstrom is on my list soon too). I do have a Mac (used to be for iPod/iPhone dev - but I simply don't have time to do that anymore). Windows - I don't even have a machine.<br /><br />Qt also added QAudioInput and QAudioOutput recently - I'm not sure what the backing code is but I don't really mind. I used to use PortAudio but doubt I will anymore.<br /><br />Right, next time a lot more on machines then samples and graphing.</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-40035202489697096422011-04-14T05:14:00.000-07:002011-04-14T05:19:14.913-07:00Going Native<pre><u>Machines</u><br /><br />We defined a machine as a functional unit - give some input data it will produce some outputs.<br /><br />To map to native code inputs will be mapped as a pointer (that points to a machines output - note, it _could_ be itself).<br /><br />To map to native code outputs will be represented as physical storage.<br /><br />Every input and output can be named (and maybe typed one day).<br /><br />Somewhat stolen from Forth is the idea that a machine can be compiled - once compiled a lot of dead code can be eliminated BUT (and it's a big but) what's within the machine can no longer change - the data flowing through it can change (necessarily) but we can't add or remove components nor can it's output to input connections be changed.<br /><br />You don't have to do this though. If you continue to interpret your machine all edits are still possible - it will just run a bit slower (probably about 10 times slower!)</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-17277065937555739922011-04-13T05:16:00.000-07:002011-04-13T05:27:13.652-07:00Me again... graphs this time...<pre>Not the sort with an x and y axis that show you data but interconnected nodes.<br /><br />These graphs are a collection of "nodes". Each node in my system represents a function, some work and has a number of inputs and outputs.<br /><br />Inputs are connected to outputs of other nodes (or in fact the same node - they can represent feedback and this is both annoying from a functional perspective but also incredibly useful, nay essential, for programming - my view is that although it creates a slight problem in that is is impossible for a node to ever be coherent it creates an opportunity by allowing feedback to be used as memory).<br /><br />An input can only be connected to a single output (the reasoning here is that all work must be done by a node - if we simply connect 2 inputs to 1 output what work would need to be done to merge those inputs... and, or, addition, multiplication??? It's ambiguous and thus avoided).<br /><br /><u>MACHINE</u><br /><br />A collection of connected nodes is called a "machine".<br /><br />Each node has a "type" (this saves us duplicating every single machine of every single type!)<br /><br />Each node has a name - this must be unique to the environment that it is contained in (but does not preclude a machine within this one from having a machine with this name)<br /><br /><u>CYCLE</u><br /><br />Once per output sample the entire machine (the outer one) is cycled. At least 1 of its inputs needs to be connected to something "outside" the machine - in this case the audio circuitry. Top level inputs could be connected to other devices but don't actually need to be (we can build a whole machine to represent a song).<br /><br /><u>THE SPECIALS A.K.A. The Coventry Automatics</u><br /><br />"Special" machines are built in and deal with lovely stuff like loading and playing samples, simple oscillators, time conversion (time is a MASSIVE subject for discrete mode synthesis), basic math operations.<br /><br />My original intention was to build the entire thing to run as 32 bit ints (which is possible for basic synthesis) but I think the standard atom/quanta of information will be the 64 bit int or double. Much more powerful even if much slower.<br /><br />Lunch nearly over... more soon!</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8688925235346240110.post-39360999362224862702011-04-12T05:40:00.000-07:002011-04-12T06:07:13.833-07:00How to allocate executable memory on Linux...<pre>#include <stdio.h><br />#include <sys/mman.h><br /><br />typedef unsigned (*asmFunc)(void);<br /><br />int main(int argc, char *argv[])<br />{<br /> // probably needs to be page aligned...<br /><br /> unsigned int codeBytes = 4096;<br /> void * virtualCodeAddress = 0;<br /><br /> virtualCodeAddress = mmap(<br /> NULL,<br /> codeBytes,<br /> PROT_READ | PROT_WRITE | PROT_EXEC,<br /> MAP_ANONYMOUS | MAP_PRIVATE,<br /> 0,<br /> 0);<br /><br /> printf("virtualCodeAddress = %p\n", virtualCodeAddress);<br /><br /> // write some code in<br /> unsigned char * tempCode = (unsigned char *) (virtualCodeAddress);<br /> tempCode[0] = 0xb8;<br /> tempCode[1] = 0x00;<br /> tempCode[2] = 0x11;<br /> tempCode[3] = 0xdd;<br /> tempCode[4] = 0xee;<br /> // ret code! Very important!<br /> tempCode[5] = 0xc3;<br /><br /> asmFunc myFunc = (asmFunc) (virtualCodeAddress);<br /><br /> unsigned out = myFunc();<br /><br /> printf("out is %x\n", out);<br /><br /> return 0;<br />}</pre>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-8688925235346240110.post-74130613441308056722011-04-12T01:54:00.001-07:002011-04-12T01:54:46.360-07:00Of hyper-graphs, sound and "issues"As I wander my merry way through life, digging the garden, playing with Charlie, sorting out the car... I wonder things like "how do I allocate memory that is executable and can be used by a dynamic compiler?"<br /><br />Then I think, g'z - it's going to be different on different machines!<br /><br />So that's were I'll start first, then we'll get the parser (very simples), some GUI output, a compiler (of sorts), an interpreter (of sorts) and hopefully some sound (yay!)Unknownnoreply@blogger.com0