Task

Demonstrate a language's methods of:

   variable declaration
   initialization
   assignment
   datatypes
   scope 
   referencing,     and 
   other variable related facilities


 
/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program variable64.s   */
 
/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*********************************/
/* Initialized data              */
/*********************************/
.data
szString:         .asciz "String définition"
sArea1:           .fill 11, 1, ' '            // 11 spaces
     // or
sArea2:           .space 11,' '               // 11 spaces
 
cCharac:          .byte '\n'                  // character
cByte1:           .byte 0b10101               // 1 byte binary value
 
hHalfWord1:       .hword   0xFF               // 2 bytes value hexa
.align 4
iInteger1:        .int 123456                 // 4 bytes value decimal
iInteger3:        .short 0500                 // 4 bytes value octal
iInteger5:        .int 0x4000                 // 4 bytes value hexa
 
iInteger7:        .word 0x4000                //   4 bytes value hexa
iInteger6:        .int  04000                 //   4 bytes value octal
 
TabInteger4:      .int  5,4,3,2               // Area of 4 integers = 4 * 4 = 16 bytes
 
dDoubleInt1:      .quad  0xFFFFFFFFFFFFFFFF   //  8 bytes value hexa
 
dfFLOAT1:         .double 0f-31415926535897932384626433832795028841971.693993751E-40 //  Float 8 bytes
sfFLOAT2:         .float  0f-31415926535897932384626433832795028841971.693993751E-40 //  Float 4 bytes (or use .single)
 
/*********************************/
/* UnInitialized data            */
/*********************************/
.bss  
sBuffer:         .skip  500                      // 500 bytes values zero
iInteger2:       .skip 4                         // 4 bytes value zero
dDoubleint2:     .skip 8                         // 8 bytes value zero
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main 
main:                                            // entry of program 
    ldr x0,qAdriInteger2                         // load variable address
    mov x1,#100                                    
    str x1,[x0]                                  // init variable iInteger2
 
100:                                             // standard end of the program 
    mov x0, 0                                    // return code
    mov x8, EXIT                                 // request to exit program
    svc 0                                        // perform the system call
 
qAdriInteger2:             .quad iInteger2       // variable address iInteger2
 
 