How to resolve the algorithm Host introspection step by step in the ARM Assembly programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Host introspection step by step in the ARM Assembly programming language

Table of Contents

Problem Statement

Print the word size and endianness of the host machine. See also: Variable size/Get

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Host introspection step by step in the ARM Assembly programming language

Source code in the arm programming language

EndianTest:
mov r0,#0xFF
mov r1,#0x02000000   ;an arbitrary memory location on the Game Boy Advance. 
                     ;(The GBA is always little-endian but this test doesn't use that knowledge to prove it.)
str r0,[r1]          ;on a little-endian CPU a hexdump of 0x02000000 would be: FF 00 00 00
                     ;on a big-endian CPU it would be:                         00 00 00 FF
ldrB r0,[r1]         ;load just the byte at 0x02000000. If the machine is big-endian this will load 00; if little-endian, 0xFF.
cmp r0,#0
beq isBigEndian
;else, do whatever is needed to display "little-endian" to the screen. This part isn't implemented.

  

You may also check:How to resolve the algorithm A+B step by step in the ProDOS programming language
You may also check:How to resolve the algorithm Sorting algorithms/Bubble sort step by step in the Arturo programming language
You may also check:How to resolve the algorithm Bitmap/Midpoint circle algorithm step by step in the Batch File programming language
You may also check:How to resolve the algorithm Magic squares of odd order step by step in the Racket programming language
You may also check:How to resolve the algorithm Queue/Definition step by step in the Quackery programming language