! Compile with: ! as -Av8plus -o fcc2_test.o fcc2_test.s ; ld -o fcc2_test fcc2_test.o ! + Syscalls have number in %g1, options in %o0,%o1,... ! Result returned in %o0 ! Linux syscall is called by "ta 0x10" .equ SYSCALL_EXIT,1 .equ SYSCALL_WRITE,4 .equ STDOUT,1 .globl _start _start: set float1,%g1 ldd [%g1],%f6 set float2,%g1 ldd [%g1],%f8 fcmped %fcc2, %f6, %f8 set float3,%g1 stx %fsr,[%g1] ldd [%g1],%g2 loaded: fbule,pn %fcc2, less_equal nop ba greater nop less_equal: set lessequal_string,%o1 ba write_stdout nop greater: set greater_string,%o1 #================================ # WRITE_STDOUT #================================ # %o1 has string write_stdout: set SYSCALL_WRITE,%g1 ! Write syscall in %g1 set STDOUT,%o0 ! 1 in %o0 (stdout) set 0,%o2 ! 0 (count) in %o2 str_loop1: ldub [%o1+%o2],%l0 ! load byte cmp %l0,%g0 ! compare against zero bnz str_loop1 ! if not nul, repeat # BRANCH DELAY SLOT inc %o2 ! increment count dec %o2 ! correct count ta 0x10 ! run the syscall exit: mov 0,%o0 ! exit value mov SYSCALL_EXIT,%g1 ! put the exit syscall number in g1 ta 0x10 ! and exit !=========================================================================== .data !=========================================================================== data_region: float1: .double 0.025132741 float2: .double 0.0 float3: .double 0.0 greater_string: .ascii "Greater\n\0" lessequal_string: .ascii "Less Equal\n\0"