Jump to content
IGNORED

Effectus 0.2 : why result=0 ?


Recommended Posts

Hi good afternoon.

Why is result = 0 ?


func_asm.xex






CARD FUNC MultiplyB=*(BYTE a,x)[
$85 $E0 $86 $E1 $A9 $00 $85 $A0 $A2
$08 $46 $E0 $90 $03 $18 $65 $E1 $6A
$66 $A0 $CA $D0 $F3 $85 $A1
$60]

BYTE FUNC PokeTest=*(BYTE d)[
$8D $02C6
$60
]

PROC Test()

BYTE i
BYTE j
CARD z

; Poke background with color
PokeTest(210)

; Multiply two numbers
i=20
j=30
z=MultiplyB(i,30)

PrintF("Result = %U%E",z)

RETURN



greeting

post-31221-0-68591600-1440407130_thumb.jpg

Edited by funkheld
Link to comment
Share on other sites

The problem is the way Effectus saves function result, which is stored in variable STORE1 (equates.asm), location $CB. This must be definitely changed in next version, to make sure resulting MADS listing looks like source code below. The result is returned in memory locations A0 and A1.

 org $3200

 icl 'c:\atari\projects\effectus\lib\equates.asm'
 icl 'c:\atari\projects\effectus\lib\common.asm'

 .var var19750412_eff_ .word
 .var i_eff_ .byte
 .var j_eff_ .byte
 .var z_eff_ .word


MULTIPLYB_reff_ .proc ( .byte a, x) .reg
 .he  85 E0 86 E1 A9 00 85 A0 A2 08 46 E0 90 03 18 65 E1 6A 66 A0 CA D0 F3 85 A1  60
 rts

 .endp


POKETEST_reff_ .proc ( .byte a) .reg
 .he  8D C6 02  60 
 rts

 .endp


TEST_reff_

; Poke background with color         

 PokeTest_reff_ #210
; Multiply two numbers        

 mva #20 i_eff_
 mva #30 j_eff_
 MultiplyB_reff_ #20, #30
 mwa $A0 z_eff_

 jsr printf
 dta c'Result = ',0
 jsr printf
 dta c'%',0
 dta a(z_eff_)
 PutE

 jmp *

.link 'c:\atari\projects\effectus\lib\runtime.obx'
.link 'c:\atari\projects\effectus\lib\printf.obx'

 run Test_reff_

This code compiles fine with MADS and appropriate Effectus libraries. Type this:

 

mads.exe func_asm

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...