//---------------------------------------------------------------------- // uppercase.s // Author: Bob Dondero and William Ughetta //---------------------------------------------------------------------- .section .rodata //---------------------------------------------------------------------- .section .data //---------------------------------------------------------------------- .section .bss cChar: .skip 1 //---------------------------------------------------------------------- .section .text //-------------------------------------------------------------- // Read a letter from stdin, and write its uppercase // equivalent to stdout. Return 0. // int main(void) //-------------------------------------------------------------- // Must be a multiple of 16 .equ MAIN_STACK_BYTECOUNT, 16 .global main main: // Prolog sub sp, sp, MAIN_STACK_BYTECOUNT str x30, [sp] // cChar = (char)getchar() bl getchar adr x1, cChar strb w0, [x1] // cChar = (char)toupper((int)cChar) adr x1, cChar ldrb w0, [x1] bl toupper adr x1, cChar strb w0, [x1] // putchar((int)cChar) adr x1, cChar ldrb w0, [x1] bl putchar // putchar('\n') mov w0, '\n' bl putchar // Epilog and return 0 mov w0, 0 ldr x30, [sp] add sp, sp, MAIN_STACK_BYTECOUNT ret .size main, (. - main)