Software for Pi 3
David Feugey (2125) 2687 posts |
I switched on my Pi 3 this afternoon. I only have a few non working software. Thanks to PatchSWP, I patched several tools with success. But I don’t have a generic and fast image viewer any more. Do you have an alternative for PNG/JPG files? |
Mike Freestone (2564) 128 posts |
This version works on my panda is that what you used? |
Dave Higton (1515) 3404 posts |
Contact the author. He is permanently busy, but he did fix a bug that I reported to him a year or two ago – and he is most definitely still around and still active! |
David Feugey (2125) 2687 posts |
Yep. The module works, but the frontend crashes badly.
I will. I have the impression that the bug is somewhere in the decoding routines. Visible only with new or big JPEGs. Probably need a refresh. |
David Feugey (2125) 2687 posts |
AMPlayer crashing code is somewhere here: .plotbar% ; R0=Level 0..15 ; R1->bitmap ; R5=peak level STMFD R13!,{R14} MOV R12,R1 MOV R11,#0 .dlp MOV R1,#0 CMP R11,R5 CMPNE R0,R11 BLT over CMP R11,#13 LDRLT R1,blue LDRGE R1,red .over MOV R2,R1,LSR#8 STRB R2,[R12,#1] STRB R1,[R12,#32] STRB R2,[R12,#33] STRB R1,[R12,#64] STRB R2,[R12,#65] STRB R1,[R12],#2 ADD R11,R11,#1 CMP R11,#16 BLT dlp LDMFD R13!,{PC}^ .blue EQUD &FFFC .red EQUD &5554 |
Jon Abbott (1421) 2601 posts |
It will be the LDMFD R13!,{PC}^, you’ll need to check if calls to plotbar% require flag preservation, if not just remove the ^ |
Jeff Doggett (257) 231 posts |
Yet another piece of ARM code with one of my pet hates – signed branches used on unsigned numbers. Tells me that the programmer is less than experienced. |
Steve Pampling (1551) 7932 posts |
As a novice I have to ask: Isn’t the STM and LDM aspect OTT even if R14 is used? |
Rick Murray (539) 13405 posts |
In the olden days, there was no penalty in using a multiple load/store with a single register. It is extremely prevalent because LDM and STM are a lot easier to remember than… Was it STR R14, [R13], #-4? Or [R13, #-4]!? Or… Oh whatever…STM it…. Of course, nowadays there is a penalty. Though, as Jeff pointed out, R14 isn’t corrupted anywhere so deleting the STM entirely and replacing the LDM with a simple MOV PC,LR will do the trick. |
Jeff Doggett (257) 231 posts |
And then there’s the pointless MOV R12,R1 – there is no need as you can swap R1 & R12 for the rest of the function. |
David Feugey (2125) 2687 posts |
Summary: a lot of things to correct :) |
rob andrews (112) 200 posts |
These are just the things we need to see in a training how to on assembler so more people can improve there skills level anyone want to start a workshop pick a program that needs work see what’s wrong, work thought the ways to fix it. |
Dave Higton (1515) 3404 posts |
So who’s going to start the wiki page on this site, then? |
Steve Drain (222) 1620 posts |
As an amateur, and with my tongue firmly in my cheek, I would like to justify the writing of this code a little, based on readability and maintainability. I do agree that the criticisms are strictly correct, of course.
Because the numbers will never go negative, do they have to be treated as unsigned? They will never have bit 31 set. The use of LT always feels more natural than CC, or even LO. The effect is identical.
When I start out writing a routine I always do this, because at some point I may include a sub-routine or extract a chunk of code as a sub-routine. That saves keeping track. I will only remove it, if possible, at a late stage or even keep it there so that if I edit the code a long time later I will not create a bug. Some short routines naturally do not require this, but the penalty for a long routine may be marginal. As an aside, what does a C compiler do?
But just how great is the penalty? In a longish routine with loops it may pale into insignificance. A macro removes any debate.
This looks like a no-brainer, but if the mindset of the coder is to use registers in a certain way, this may keep the code more maintainable. The penalty may be tiny.
Perhaps. ;-) |
Clive Semmens (2335) 3130 posts |
Take your tongue out of your cheek, Steve. Much of what you write there is perfectly good sense. (For what it’s worth, I wrote ARM’s own Assembler User Guide from its first issue in 1998 up to when I retired in 2007 – with a bit of a gap for a couple of years when someone else took it over because I was too busy with the ARM ARM.) |
Jeffrey Lee (213) 6046 posts |
C compilers have a few different tricks up their sleeves:
|
Jon Abbott (1421) 2601 posts |
At the end of the day, it comes down to personal programming style. If you write code that’s legible, you’re probably not writing optimal code. Could you imagine optimizing hand written assembler that takes account of scheduling and stalls? You’d only do it where those few saves cycles make a difference as it makes the code an utter mess.
I think Jeff just nominated himself ;) … don’t forget to mention that loops should preferably be written to reduce to zero, to avoid unnecessary termination CMP’s. |
Jeff Doggett (257) 231 posts |
That’s what the writer of Filecore thought many years ago. Hence the (now removed) 2GiB filesize limit. Sometimes code will get reused for something else which may come back to bite you. I seem to recall that when some memory was moved to the upper reaches of the memory map a whole load of pointers went negative.
Oops.
I didn’t mention that because the loop counter is used in the loop in this case. |
Steve Pampling (1551) 7932 posts |
You sound like just the man to write up a guide for the wiki :) |
Clive Semmens (2335) 3130 posts |
Probably not really. Ten years ago I might have been, but I’m as rusty as the Mary Rose’s cannon balls. Also, while I wrote quite a lot of assembler back in 26 bit days, I’ve never written more recent stuff in anger – just tiny little routines to check that I actually understood what the instructions were doing before writing the docs. These days I mostly write BASIC – for what I want to do it’s plenty fast enough on the Pi. I might write the odd bit of assembler for a heavily-used loop or two if the occasion arises – but it hasn’t in years. |
Rick Murray (539) 13405 posts |
Haven’t you noticed? So is RISC OS. :-P
Don’t like that phrase. ARM code is beautiful. If I was going to write in anger, I’d learn x86. |
Clive Semmens (2335) 3130 posts |
Good point. I get angry enough writing HTML though. As for tricking BASIC into writing SVG…it’s not BASIC that makes me angry, it’s SVG, of course. http://clive.semmens.org.uk/Nuclear.html?LithBlank has an SVG diagram at the top that I (re)drew in !Draw on the Pi and used my !XP1Dr2SVG app to convert to SVG. There are others, but that’s one of the nastiest. All the HTML handwritten throughout my site – I can’t be bothered with website authoring tools. |
Steve Pampling (1551) 7932 posts |
Two things are required:
Besides, an email or two to the coders1 who have contributed to this thread will cover accuracy of the technical content. 1 As opposed to agent provocateurs that sometimes masquerade as network engineers. |
Dave Higton (1515) 3404 posts |
The great thing about a wiki is that it can be the work of more than one person. In this case, it clearly should be the work of more than one person – there are several people here who can contribute original material, additional explanations/examples, and corrections. The first thing it needs is someone to start it. |
Clive Semmens (2335) 3130 posts |
I wrote it as an employee of ARM, so they own the copyright I think. They don’t own the contents of my head, but that’s where the rust is :(
I can certainly contribute, but I’m not up for being a major player – I have other irons in the fire. |