💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2023-01-29 at 10:14:54.
-=-=-=-=-=-=-
Article 10916 of comp.sys.apple2.programmer: Path: news1.icaen!news.uiowa.edu!news.physics.uiowa.edu!newsrelay.iastate.edu!hammer.uoregon.edu!newsfeed.direct.ca!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: bruzzi@hotmail.com Newsgroups: comp.sys.apple2.programmer Subject: Please convert this SLOW BASIC program to machine language Date: Sat, 02 Oct 1999 13:04:47 GMT Organization: Deja.com - Before you buy. Lines: 76 Message-ID: <7t4vtc$mgi$1@nnrp1.deja.com> References: <FHKnqn.CAq@freenet.buffalo.edu> <37D258CF.F8264C02@swbell.net> <7slde5$nkc$1@nnrp1.deja.com> NNTP-Posting-Host: 209.246.198.79 X-Article-Creation-Date: Sat Oct 02 13:04:47 1999 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) X-Http-Proxy: 1.1 x43.deja.com:80 (Squid/1.1.22) for client 209.246.198.79 X-MyDeja-Info: XMYDJUIDcomputerwhiz Xref: news1.icaen comp.sys.apple2.programmer:10916 Hello, could anybody please convert this short BASIC program into machine language, that I can feed into the built-in machine langauge monitor on the Apple IIe? Please post your code here...thanks. 10 REM PEP Calculator - (C) 1993-99 Alan C. Bruzzi 20 DIM SA%(163) 30 DIM MU%(163) 40 DIM MX%(163, 99) 1000 REM Main routine to enter the factorial number, 1010 REM call the factorial function, and print out the answer. 1020 PRINT "PEP Calculator" 1030 PRINT : INPUT "Enter number (0-100): ", N 1040 IF N >= 0 AND N <= 100 THEN 1070 1050 PRINT "Number is greater than 100 or less than 0." 1060 END: REM exits the program 1070 PRINT "Computing " + STR$(N) + "!" 1080 IF N > 1 THEN 1110 1090 PRINT "The answer is: 1" 1100 END 1110 LET F = INT((N * LOG(N) - N) / LOG(10) + 2) + 1: REM Calculus 2 equation 1120 LET MU%(162) = 1 1130 GOSUB 2000: REM Calculate the Factorial of N 1140 PRINT "The answer is: " 1150 REM The following routine leaves out excess zeros before the first 1160 REM non-zero digit. 1170 FOR N = 157 TO 0 STEP -1 1180 IF SA%(N) <= 0 THEN 1230 1190 LET CH = 1 1200 LET D = D + 1 1210 PRINT STR$(SA%(N)); 1220 GOTO 1260 1230 IF SA%(N) <> 0 OR CH <> 1 THEN 1260 1240 PRINT "0"; 1250 LET D = D + 1 1260 NEXT N 1270 PRINT 1280 PRINT "Number of digits = "; STR$(D) 1290 PRINT 1300 END 1998 REM 1999 REM This subroutine calculates the Factorial of N and returns it in SA%() 2000 FOR J = N TO 1 STEP -1 2020 LET BW = 162 2030 LET FW = 0 2040 REM 1) The following routine multiplies digits 2041 REM Each column is a single digit 2050 FOR C = 162 TO 162 - F STEP -1 2060 LET MX%(C, 1) = MU%(C) * J 2070 NEXT C 2080 REM 2) The following routine adds up the columns and rows. 2090 FOR C = 162 TO 162 - F STEP -1 2100 LET A = 0 2110 LET R = 1 2120 FOR K = 1 TO 98 2130 LET A = A + MX%(C, R) 2140 LET R = R + 1 2150 IF A <= 9 THEN 2200 2160 LET MX%(C, 1) = MX%(C, 1) - 10 2170 LET MX%(C - 1, 1) = MX%(C - 1, 1) + 1 2180 LET A = MX%(C, 1) 2200 NEXT K 2210 LET MU%(BW) = A 2220 LET BW = BW - 1 2230 LET SA%(FW) = A 2240 LET FW = FW + 1 2250 NEXT C 2270 NEXT J 2280 RETURN Sent via Deja.com http://www.deja.com/ Before you buy.