//---------------------------------------------------------------- // testcalc.s // // Used for testing linkage with our 'gpacalc.s' routine. // // assemble using: $ gcc testcalc.s gpacalc.o -o testcalc // // programmer: ALLAN CRUSE // written on: 16 OCT 2003 //---------------------------------------------------------------- .globl credits, qpoints, gpabuff # public symbols .section .data credits: .int 51 # value is for testing qpoints: .int 132 # value is for testing gpabuff: .zero 5 # 4-chars (and a null) report: .ascii "\nTOTAL CREDITS TAKEN: %d " .ascii "\nTOTAL POINTS EARNED: %d " .asciz "\nGRADE-POINT AVERAGE: %s \n\n" .section .text main: call gpacalc # an external function pushl $gpabuff # argument 4 for printf pushl qpoints # argument 3 for printf pushl credits # argument 2 for printf pushl $report # argument 1 for printf call printf # call printf function addl $16, %esp # discard four arguments ret # return control to Linux .globl main # so linker can find name