In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Heineken wrote: Hello guys I entered the code here (that s the 8- bit calc for addiotiuona na dsubtraction ) [code]device SX28L, OSCHS,TURBO reset start_point freq 4000000 ;4Mhz resonator org 8 addend ds 1 adder ds 1 Sum ds 1 Subtrahend ds 1 subtractor ds 1 difference ds 1 X ds 1 org 0 start_point mov !ra,#$f mov !rb,#$ff ; begin code on page 0 ; all of port A lines are input ; all of port B lines are output ; main program starts here arithloop mov Addend,#137 ; Addend value mov X,Addend call output ; display Addend mov Adder,#27 mov X,Adder call output mov Sum,Addend add Sum,Adder mov X,Sum call output ; Adder Value ; display Adder ; first value in Sum ; perform addition ; display Sum mov Subtrahend,^ 37 ; Subtrahend value mov X,Subtrahend call output ; display Subtrahend mov Subtractor,#27; Subtracter Value mov X, Subtracter call output ; display Subtracter mov Difference,Subtrahend sub Difference,Subtractor ; first value in Difference ; perform subtraction mov X,Difference ; display Difference call output jmp arithloop ; start again ; The subroutine defined below displays the value contained in X at LEDs attached to all : lines of Port B output mov W,X ; invert the bits, l's complement not W mov rb,W ra0ontest ras0offtest ralontest raslofftest jb ra.0,ra 0ontest jnb ra.0,ra 0offtest jb ra.l,ra l ontest jnb ra.l,ra l offtest ret [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=121474#m121955 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)