Jump to content

Recommended Posts

It says in the help file to include the line

-include div_mul.asm

in order for multiplication to work for variables.

 

But when I assign numbers to variables like in this .bas file, the answer always comes out to be 62 regardless of what I assigned the variables. I'm trying to make a multiplication table for the 2600, and you put in one variable and another and press right for the answer, but it's always 62. Could I have a little help here?

numbermenu3.bas

Link to comment
https://forums.atariage.com/topic/90384-multiplication-in-batari-basic/
Share on other sites

It says in the help file to include the line

-include div_mul.asm

in order for multiplication to work for variables.

 

But when I assign numbers to variables like in this .bas file, the answer always comes out to be 62 regardless of what I assigned the variables. I'm trying to make a multiplication table for the 2600, and you put in one variable and another and press right for the answer, but it's always 62. Could I have a little help here?

 

I don't have time at the moment to study your code fully, but part of your problem is that you can't use multiplication with the score (at least, it doesn't work that way *yet*). So you'll need to use a variable to do the multiplication, then assign the result to the score, like this:

 

  p=n*o : score=p : rem instead of score=n*o

 

Except if I remember correctly from another thread a week or two ago, you can't assign a variable to the score right now, either, because it's broken.

 

Michael Rideout

Except if I remember correctly from another thread a week or two ago, you can't assign a variable to the score right now, either, because it's broken.

 

I tried your suggestion and it looks to be broken. I got a message that says "cannot open div.asm for reading" and for the 2600ide, it says:

 

NO_ILLEGAL_OPCODES 0000 ???? ( R )

game 0000 ???? ( R )

scoretable 0000 ???? ( R )

 

whatever that means.

Edited by atari2600land

62 hmmm.... of by 20 errror. ;-)

 

What version of BBasic are you using?

 

The errors that you see, like NO_ILLEGAL_OPCODES are just a side effect of something else going wrong.

Version 3.5, I think. It has a 35 in it somewhere. I just don't remember what the exact version # is at the moment.

I got it to work in alpha35 by using the following

 

include div_mul.asm

 

 

It was the first line in the numbermen3.bas file and it had No Quotes around the file name. Also note the space before the include (important)

Could you post the .bas file for me so I can see what you did in detail?

It was on a different computer that's not on my network at the moment.

 

it was just this:

 

include div_mul.asm

10 set smartbranching on


20 COLUBK=70 : COLUP0=128
25 x=20 : y=20 : n=1
  .
  .
  .

 

And the remaining code was as you posted. The only change was the first line.

 

When I put

 

include "div_mul.asm"

 

I got the exact same errors as you posted. If you misspell the file or the div_mul.asm isn't in your bbasic folder (or otherwise missing) then you will get the NO_ILLEGAL_OPCODES game and scoretable errors.

It's hard to see but you need to indent the include statement at least on space. I should have put four or more to make it clear. Sorry.

 

	include div_mul.asm

 

edit:

Oh yeah, and I forgot that when you post code, the AtariAge forum seems to eat a space, so the above code I posted seems to be missing the aforementioned space!

Edited by djmips

Yes, but are all the answers still 62? Because they are on mine.

I looked at the bB source, and apparently I put in support for score=score+variable but not score=variable.

 

But there is another issue - the score must use a BCD number, but the multiply routines use hexadecimal. So they would need to be converted - the easiest way is in a loop. I went ahead and modified your program. It should work now.

numbermenu3.bas

How would I tell it that when it's done multiplying to go back to the start if I pressed the reset switch? I thought it would have been

 

1165 if joy0fire && z=0 then z=1 : goto 1000

if !joy0fire && z=1 then z=0

if joy0right then gosub 1200

if switchreset then goto 20 <- I added this line

1166 goto 1160

 

but it didn't work.

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...