Implementing simple sort algorithms in ARM Assembly (part 1)

A while back I started to learn some ARM assembly on the Raspberry Pi (out of curiosity, for no other better reason). I thought it would be interesting to couple this with re-learning some of the basic/standard/common algorithm at the same time, such as common sort algorithms.

So as my first step, since this is turning out to be far more work than I expected (!), here’s my ARM ASM source so far to iterate through a list of 4 byte integer values and print the values to the console using C’s printf. I’ll post further updates as I make progress:

[code]
.global main
main:
push {ip, lr}
MOV R6, #0 @offset to data
loop:
LDR R0, =output @load addr of output string
LDR R5, =nums @ addr of string to R5
LDR R4,[R5,R6] @load current num from R5 with offset R6
MOV R1,R4 @move num for output
BL printf
CMP R6,#16 @ 0 plus 4*4bytes for 5 entries in array
ADD R6,R6, #4 @inc offset by 4 bytes
BNE loop
_exit:
POP {ip, lr}
MOV R1, #0
MOV R7, #1
SWI 0
nums:
.word 5,2,7,1,8
.data
output:
.asciz "%d\n"
[/code]

I’m sure there’s better ways I can approach this limited code so far, but I’ll come back and revisit this again later. If anyone wants to pull or browse the source so far (and other snippets), it’s on github here: https://github.com/kevinhooke/learning-arm-asm

What real users are saying about Windows 10

The Control Panel. Yes, the Control Panel. How is it possible for a final, shipped product (8, 8.1, and now 10) to have multiple versions of a single app (the Control Panel) where some options are in one version and other options are in the other? And the UIs of each are completely different.

At least the Control Panel vs Change PC Settings options are now no longer shown together in the same pop open Charms menu as they were in 8.x. I suppose at least in 8.x they put one at the top of the menu and the other at the bottom of the menu, like there was some discussion to keep them far apart because, oh I don’t know, because having two different links to two different Control Panels in the same menu might be confusing to users.

Anyway, so the bizarre charms menu is gone. The Metro Change PC Settings app from 8.1 is replaced with a new app in 10 with some snazzy looking icons. But wait.. the Windows 7 style Control Panel is still in Windows 10? With the the previous Windows 7 UI style? Wait, what? So there’s still 2 different Control Panels in 10? Microsoft please, get your design teams in the same room!

More other bizarre observations and pet peevs in this post over at The Register.

Changing display resolution on Rasbian

Settings such as HDMI video output are configured in the /boot/config.txt file – you can edit this on the Pi with ‘sudo nano /boot/config.txt’. If you need to edit on another machine, see details here.

This page lists available video modes. On my LG E2341 connected by HDMI, uncommenting and changing these two settings works to set the output to 1080p:

hdmi_group=1

hdmi_mode=16

 

 

Setting Raspberry Pi / Raspbian default locale and keyboard settings

Default locale and keyboard settings on the Raspberry Pi can be configured using raspi-config on Rasbian.

Select option 4 Internationalization, and select options to configure your locale, timezone and connected keyboard layout.

If you’ve installed Raspbian and kept the defaults you probably ended up with a UK keyboard layout, and if you have a US keyboard, you’re wondering why some of your keys are producing unexpected characters 🙂