Task

Increment a numerical string.




 
/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program incstring64.s   */
 
/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
 
.equ BUFFERSIZE,   100
/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szMessNum:           .asciz "Enter number : \n"
szCarriageReturn:    .asciz "\n"
szMessResult:        .asciz "Increment number is =  @ \n"      // message result
 
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss 
sBuffer:    .skip BUFFERSIZE
sZoneConv:  .skip 24
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main 
main:                      // entry of program
 
    ldr x0,qAdrszMessNum
    bl affichageMess
    mov x0,#STDIN          // Linux input console
    ldr x1,qAdrsBuffer     // buffer address 
    mov x2,#BUFFERSIZE     // buffer size 
    mov x8, #READ          // request to read datas
    svc 0                  // call system
    ldr x1,qAdrsBuffer     // buffer address 
    strb wzr,[x1,x0]       // store zero at the end of input string (x0
    // 
    ldr x0,qAdrsBuffer     // buffer address
    bl conversionAtoD      // conversion string in number in x0
                           // increment x0
    add x0,x0,1
                           // conversion register to string
    ldr x1,qAdrsZoneConv                
    bl conversion10S       // call conversion
    ldr x0,qAdrszMessResult
    ldr x1,qAdrsZoneConv 
    bl strInsertAtCharInc  // insert result at @ character
    bl affichageMess       // display message
 
100:                       // standard end of the program
    mov x0,0               // return code
    mov x8,EXIT            // request to exit program
    svc 0                  // perform the system call
 
qAdrsZoneConv:          .quad sZoneConv
qAdrszMessNum:          .quad szMessNum
qAdrsBuffer:            .quad sBuffer
qAdrszMessResult:       .quad szMessResult
qAdrszCarriageReturn:   .quad szCarriageReturn
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
 