0100 ;A simple floating point calculator to show how to use floating point functions with MAC/65›0110 ;Compare this program with FCALC.C and FCALC.ACT›0120 ;›0130 .INCLUDE #D1:ION.DVC›0140 .INCLUDE #D1:DVCIO.M65›0150 .INCLUDE #D1:FLOAT.M65›0160 *= $4004›0170 JMP MAIN›0180 ;›0190 ;reserve space for variables›0200 ;FA .FLOAT 0 ;SUPERCARTRIDGE version ONLY!›0210 ;FB .FLOAT 0›0220 ;SUM .FLOAT 0›0230 ;›0240 FA .BYTE 1,2,3,4,5,6›0250 FB .BYTE 1,2,3,4,5,6›0260 SUM .BYTE 1,2,3,4,5,6›0270 C .BYTE 0›0280 ;›0290 MAIN DISPLAY "}Floating point calculator with MAC/65.",EOL›0300 DISPLAY "Enter: # [space] operator [space] #",EOL,EOL›0310 MAINLP SCANF "%f %c %f",FA,C,FB›0320 CPX #0 ;bad input such as hitting the break key will exit to DOS›0330 BEQ OKAY›0340 RTS ;return to DOS›0350 OKAY PRINTFS "%f ",FA ;PRINTFS is used for floating point and strings›0360 PRINTF "%c ",C ;PRINTF is used for chars, integers, and unsigned›0370 PRINTFS "%f ",FB›0380 LDA C›0390 ADD? CMP #'+›0400 BNE SUBTRACT?›0410 FADD FA,FB,SUM ;SUM=A+B›0420 JMP ENDSWITCH›0430 SUBTRACT? CMP #'-›0440 BNE MULTIPLY?›0450 FSUB FA,FB,SUM ;SUM=A-B›0460 JMP ENDSWITCH›0470 MULTIPLY? CMP #'*›0480 BNE DIVIDE?›0490 FMUL FA,FB,SUM ;SUM=A*B›0500 JMP ENDSWITCH›0510 DIVIDE? CMP #'/›0520 BNE UNKOWN›0530 FDIV FA,FB,SUM ;SUM=A/B›0540 JMP ENDSWITCH›0550 UNKOWN PRINTF "%c is an unkown operator.%n",C›0560 JMP MAINLP›0570 ENDSWITCH PRINTFS "= %f%n",SUM ;NOTE: %n is used instead of \n›0580 JMP MAINLP›