Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ORG $C000 *start of ROM (program)
- a equ 1
- b equ 20
- c equ 3
- delim equ 46
- ldx #str
- jsr $ffc7 .OUTSTR
- ldaa #c
- ldab #c
- mul * D contain c^2
- ldaa #a
- aba
- tab
- clra
- xgdx * save second expression to IX
- ldaa #a
- ldab #b
- aba * add B to A
- psha * save a+b to stack
- ldaa #a
- ldab #c
- mul * multiply a*c -> result in D
- pula * a+b now in A
- sba * b is a less significant byte from mult. result ( total result must be less than 2^8 otherwise operation is incorrect )
- * now A contain result of first expression
- tab * move A to less significant part of B
- clra
- idiv * divide D ( that represents now by B) by IX that saved before
- * result == IX.D
- pshx
- pula
- pula
- jsr $ffb5 .OUTLHL
- ldaa #delim
- jsr $ffb8 .OUTA
- pshb
- pula
- jsr $ffb5 .OUTRHL
- rts
- str fcc "(a+b-a*c)/(a+c*c)="
- db 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement