Martin King

Program

Discussion created by Martin King on Apr 2, 2011
Latest reply on Apr 12, 2011 by Gilbert Gagne

I am having problems wtih this program and am stuck does anyone have suggestions

 

; algorithm for equation of form: z = (2w+3)/4

 XDEF Entry, main
     XREF __SEG_END_SSTACK   

RAM_Data: SECTION

       ORG $1100
w  dc.b  #100
 
       ORG $1110
; output value
z    ds.w  1

Code:     SECTION
main:
Entry:   

ldaa w  

ldab #2
mul           ; d = a x b 

addd #3   

ldx #4    
idiv          ; x = d/x,   d=rem

xgdx      ; get quotient in d so it can be...
std z         ; ... stored to memory

L1: bra L1  ; program ends in a loop

***** end of file *****

Outcomes