Advertisement
rnort

AVMISL1V6 + OUT

Sep 4th, 2013
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ORG $C000   *start of ROM (program)
  2. a equ 1
  3. b equ 20
  4. c equ 3
  5. delim equ 46
  6.    
  7.     ldx #str
  8.     jsr $ffc7 .OUTSTR
  9.  
  10.     ldaa #c
  11.     ldab #c
  12.     mul * D contain c^2
  13.  
  14.     ldaa #a
  15.     aba
  16.     tab
  17.     clra
  18.     xgdx    * save second expression to IX
  19.  
  20.     ldaa #a
  21.     ldab #b
  22.     aba * add B to A
  23.     psha    * save a+b to stack
  24.  
  25.     ldaa #a
  26.     ldab #c
  27.     mul * multiply a*c -> result in D
  28.     pula    * a+b now in A
  29.     sba * b is a less significant byte from mult. result ( total result must be less than 2^8 otherwise operation is incorrect )
  30. * now A contain result of first expression
  31.    
  32.     tab * move A to less significant part of B
  33.     clra
  34.     idiv    * divide D ( that represents now by B)  by IX that saved before
  35. *  result  == IX.D
  36.  
  37.     pshx
  38.     pula
  39.     pula
  40.     jsr $ffb5 .OUTLHL
  41.  
  42.     ldaa #delim
  43.     jsr $ffb8 .OUTA
  44.  
  45.     pshb
  46.     pula
  47.     jsr $ffb5 .OUTRHL
  48.  
  49.     rts
  50.    
  51. str fcc "(a+b-a*c)/(a+c*c)="
  52.     db 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement