X-Git-Url: http://git.subgeniuskitty.com/ned1/.git/blobdiff_plain/bc5b63cf94c1f263bbe3757237b242f40711203b..418f3fc7602ff5e2dad5bc6c39b283d028be506c:/software/4func_calculator/calc.asm diff --git a/software/4func_calculator/calc.asm b/software/4func_calculator/calc.asm index 4386392..c3aeac5 100644 --- a/software/4func_calculator/calc.asm +++ b/software/4func_calculator/calc.asm @@ -88,7 +88,6 @@ calcinit # Check for loop termination LDSP+0 - TEST BRZ>calcinitzeroloopend JMP>calcinitzeroloop @@ -124,7 +123,6 @@ incrementstackindex LOAD IM_2 # Negative bit in PSW AND - TEST BRZ>incrementstackindexreturn # Negative bit was set, so wrap to start of stack. TEST @@ -158,7 +156,6 @@ decrementstackindex LOAD IM_2 # Negative bit in PSW register. AND - TEST BRZ>decrementstackindexreturn # Negative bit was set, so wrap to end of stack. TEST @@ -240,7 +237,6 @@ printbinaryinteger # First check if the number is zero and print a single zero if true. LDSP+0 - TEST BRZ>printbinaryintegerloopend # Repeatedly divide by ten and push each digit onto the stack in ASCII. @@ -248,7 +244,6 @@ printbinaryinteger # Verify Integer still has digits to print (i.e. Integer != 0) LDSP+0 - TEST BRZ>printbinaryintegerloopend # Extract the least significant digit. @@ -282,7 +277,6 @@ printbinaryinteger # Sign flag (nonzero for negative result, 0 for positive result) # Push sign onto stack as ASCII character. - TEST BRZ>printbinaryintegerpositive # Add ASCII '-' sign to stack @@ -356,7 +350,6 @@ evalzerostackentry IM_1 ADD JSR>subtract - TEST BRZ>evalzerostackentrymatch # No match, return from subroutine @@ -401,7 +394,6 @@ evalstacknavigation # Test for ASCII ',' WORD_44 # ASCII ',' JSR>subtract - TEST BRZ>evalstacknavigationprevmatch # No match. @@ -431,7 +423,6 @@ evalstacknavigation # Test for ASCII '.' WORD_46 # ASCII '.' JSR>subtract - TEST BRZ>evalstacknavigationnextmatch # No match. @@ -470,7 +461,6 @@ evalnegatestackentry IM_1 ADD JSR>subtract - TEST BRZ>evalnegatestackentrymatch # No match, return from subroutine @@ -519,7 +509,6 @@ evalmathaddition IM_13 ADD JSR>subtract - TEST BRZ>evalmathadditionmatch # No match, return from subroutine @@ -587,7 +576,6 @@ evalmathsubtraction IM_15 ADD JSR>subtract - TEST BRZ>evalmathsubtractionmatch # No match, return from subroutine @@ -655,7 +643,6 @@ evalmathmultiplication IM_12 ADD JSR>subtract - TEST BRZ>evalmathmultiplicationmatch # No match, return from subroutine @@ -724,7 +711,6 @@ evalmathdivision IM_17 ADD JSR>subtract - TEST BRZ>evalmathdivisionmatch # No match, return from subroutine @@ -801,7 +787,6 @@ evalasciidigit # Test for ASCII digit. JSR>isasciidigit - TEST BRZ>evalasciidigitmatch # No match, return from subroutine @@ -859,7 +844,6 @@ isasciidigit LOAD IM_2 AND - TEST BRZ>isasciidigitcontinued # The result was negative, so clean up stack and return false. IM_1 @@ -876,7 +860,6 @@ isasciidigit LOAD IM_2 AND - TEST BRZ>isasciidigitfalse # The result was true, so clean up stack and return true. IM_0 @@ -957,7 +940,6 @@ absolutevalue IM_4 LOAD AND - TEST BRZ>absolutevaluereturn JSR>negate @@ -1024,7 +1006,6 @@ multiply SHIFT IM_1 AND - TEST BRZ>skipadd # If indicated by a 1 bit, shift and add first operand to result. LDSP+3 # X Operand @@ -1046,7 +1027,6 @@ multiply LDSP+1 # Shift magnitude IM_30 JSR>subtract - TEST BRZ>multiplycleanup JMP>testbit @@ -1064,7 +1044,6 @@ multiply # Set the sign of the product. applysign SWAP - TEST BRZ>multiplyreturn JSR>negate @@ -1100,7 +1079,6 @@ divide # Check for zero divisor LDSP+0 - TEST BRZ>divideexception # Generate a sign flag and store it behind the operands. @@ -1139,7 +1117,6 @@ divide LDSP+2 # Cycle Counter IM_1 ADD - TEST BRZ>divisionloopend # While Cycle Counter >= 0 @@ -1170,7 +1147,6 @@ divide AND IM_2 XOR - TEST BRZ>divisionsubloopend # If Remainder >= Divisor @@ -1217,7 +1193,6 @@ divide # Set sign of results. LDSP+2 # Sign flag - TEST BRZ>divisioncleanup JSR>negate SWAP @@ -1308,7 +1283,6 @@ itoa LOAD IM_2 AND - TEST BRZ>itoahalt # Verify that operand > -1 LDSP+0 @@ -1320,7 +1294,6 @@ itoa AND IM_2 XOR - TEST BRZ>itoahalt # Branch if operand was negative. # Convert the integer to its ASCII representation and return to caller. WORD_48 @@ -1349,7 +1322,6 @@ putchar putcharloop LDSP+0 LOAD - TEST BRZ>putcharloop TEST # Drop XCSR from stack SWAP @@ -1373,7 +1345,6 @@ getchar getcharloop LDSP+0 LOAD - TEST BRZ>getcharloop LDSP+1 LOAD @@ -1396,6 +1367,7 @@ printstring # Return PC <-- TOS ########################################################################################## SWAP + LDSP+0 BRZ>printstringreturn JSR>putchar JMP>printstring