0 Members and 2 Guests are viewing this topic.
;FABS FRn;*******************************;inline;Ra is the register to be processed;destroyed registers;Ra, T bitROTR Ra ;shifts Ra 1 bit right. LSB is placed into the T bitROTCL Ra ;shifts Ra 1 bit left. T bit placed into the LSB of Ra;*******************************;callable function;@(R15) is the data to be processed;data returned to @(R15);registers destroyed ;R1 and T bitMOV.L @R15,R1 ;pops single argument off the stack. only one argument so no point in decrementing R15ROTR R1 ;shifts R1 1 bit right. LSB is placed into the T bitROTCL R1 ;shifts R1 1 bit left. T bit placed into the LSB of R1RTS ;return to code. Delayed branchMOV.L R1,@R15 ;pushes single argument back on;*******************************;interrupt;jumped to from the interrupt handler;@(R15) is the data to be processed;registers destroyed ;R1 (bank 1)MOV.L @R15,R1 ;pops single argument off the stack. only one argument so no point in decrementing R15ROTR R1 ;shifts R1 1 bit right. LSB is placed into the T bitROTCL R1 ;shifts R1 1 bit left. T bit placed into the LSB of R1RTE ;SSR/SPC -> SR/PC. returns to code. Delayed branchMOV.L R1,@R15 ;pushes single argument back on the stack
;FABS FRn;*******************************;inline;Ra is the register to be processed;cannot use R1 as Ra;destroyed registers;RaMOV.L R1,@-R15 ;pushes R1 onto the stackMOVT R1 ;moves the T bit into R1MOV.L R1,@-R15 ;moves R1 onto the stackROTR Ra ;shifts Ra 1 bit right. LSB is placed into the T bitROTCL Ra ;shifts Ra 1 bit left. T bit placed into the LSB of RaMOV.L @R15+,R1 ;pops R1 off the stack. T bitMOV.L R2,@-R15 ;pushes R2 onto the stackMOV $00,R2 ;moves 0 into R2CMP/HI R1,R2 ;if the T bit was 1 then the T bit equals 1. Sounds retarded I know :PMOV.L @R15+,R2 ;pops R2MOV.L @R15+,R1 ;pops R1;*****************************;callable;NOT FINISHED;*****************************;interrupt;jumped to from the interrupt handler;@(R15+8) is the FR to be processed;registers destroyed ;FRnMOV.L R1,@R15+ ;pushes R1 onto the stackMOV.L R2,@R15+ ;pushes R2 onto the stackMOV.L @R15,R2 ;pops FR address off the stack. No decrementMOV.L @R2,R1 ;places contents of @R2 into R1ROTR R1 ;shifts R1 1 bit right. LSB is placed into the T bitROTCL R1 ;shifts R1 1 bit left. T bit placed into the LSB of R1MOV.L R1,@R2 ;places result in FRnMOV.L @R15-,R2 ;pops R2RTE ;SSR/SPC -> SR/PC. returns to code. Delayed branchMOV.L @R15-,R1 ;pops R1
FDIV(float *FRm,*FRn) /* FDIV FRm,FRn */{ clear_cause_VZ(); if((data_type_of(FRm) = = sNaN) | | (data_type_of(FRn) = = sNaN)) invalid(FRn); else if((data_type_of(FRm) = = qNaN) | | (data_type_of(FRn) = = qNaN)) qnan(FRn); else case((data_type_of(FRm) { NORM : case(data_type_of(FRn)) { PINF : NINF : inf(FRn,sign_of(FRm)^sign_of(FRn)); break; default : *FRn =*FRn / *FRm; break; } break; PZERO : NZERO : case(data_type_of(FRn)) { PZERO : NZERO : invalid(FRn); break; PINF : NINF : inf(Fn,Sign_of(FRm)^sign_of(FRn)); break; default : dz(FRn,sign_of(FRm)^sign_of(FRn)); break; } break; PINF : NINF : case(data_type_of(FRn)) { PINF : NINF : invalid(FRn); break; default :zero (FRn,sign_of(FRm)^sign_of(FRn)); break break; } pc += 2;}
Destroys T bit:SHLL Rn SHLR RnKeeps it:MOV.L Rm,@R15-MOVT RmSHLL Rn SHLR RnROTR RmMOV.L @+R15, Rm
SHLL Rn SHLR RnTST Rn,Rn
Start:BSR PCtoR0NOPblah...PCtoR0:RTSSTS PR,R0
MOV.L R1,@R15-MOV.L R2,@R15-MOV.L Rm,@R15-MOVT RmMOV.L @R2,R1SHLL Rn SHLR RnROTR RmMOV.L @+R15, RmMOV.L R1,@R15-MOV.L R2,@R15-
With the whole talk of the asm shell for the Prizm going around recently, I had an idea to incorporate multiple run time libraries at a time. In the header a program would define which libraries it wanted to use and those would be loaded into memory before execution began. Perhaps some of the libraries would be attached to the shell itself, but I also liked the feature of allowing users to create their own run time libraries too.