funkheld Posted August 24, 2015 Share Posted August 24, 2015 (edited) 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 Edited August 24, 2015 by funkheld Quote Link to comment Share on other sites More sharing options...
Gury Posted August 24, 2015 Share Posted August 24, 2015 Good question! I will dig into it. Quote Link to comment Share on other sites More sharing options...
Gury Posted August 24, 2015 Share Posted August 24, 2015 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.