Jump to content
IGNORED

Programming Equivalents Tool Has Been Improved


Random Terrain

Recommended Posts

In case you don't know, I look for useful free scripts on the Internet when I need an interactive chart or tool. Well, the Programming Equivalents tool on the bB Tools and Toys page has always bothered me because the Binary box never padded out the numbers to 8 digits. I didn't know how to edit the javascript myself and I couldn't find a fix using Google. While using the tool today, the lack of leading zeroes was irritating me once more, so I went Googling again and finally found a solution:

 

stackoverflow.com/questions/1267283/how-can-i-create-a-zerofilled-value-using-javascript/1268377#1268377

 

I merged that script with the script that was already on the page and now the Binary box always shows at least 8 digits when you put a number in one of the other boxes:

 

randomterrain.com/atari-2600-memories-batari-basic-tools-toys.html

 

 

 

Update:

 

I'm now using code by bogax on the page instead.

  • Like 1
Link to comment
Share on other sites

For my own amusement I rewrote

your radix converter.

 

radix_converter.html

 

 

 

Thanks, but the code I added from that page makes sure there are at least 8 digits while being able to handle larger numbers. For example, if you put 7777 in the decimal box of the current page, you'll get 1111001100001 in the binary box, but with your version, you'll get 01100001 in the binary box.

Link to comment
Share on other sites

 

Thanks, but the code I added from that page makes sure there are at least 8 digits while being able to handle larger numbers. For example, if you put 7777 in the decimal box of the current page, you'll get 1111001100001 in the binary box, but with your version, you'll get 01100001 in the binary box.

oh, well if you insist :)

 

radix_converter_mk2.html

 

really I was just playin'

 

one thing I was considering is grouping the hex digits into bytes

Edited by bogax
Link to comment
Share on other sites

oh, well if you insist :)

 

radix_converter_mk2.html

 

really I was just playin'

 

one thing I was considering is grouping the hex digits into bytes

 

Thanks. While you're playing, can you make the Hexadecimal box show a leading zero when the number is 0 through F? So instead of 1, it will show 01 and instead of F, it will show 0F?

Link to comment
Share on other sites

If you have a Windows PC, you might already know that the calculator in your Accessories folder can convert decimal, hex, and binary numbers when switched to Scientific under the View menu.

 

If you have a Mac, the Calculator program in the Applications folder can do so as well when switched to Programmer under the View menu.

post-3056-0-59710100-1378217705_thumb.png

 

While you cannot type in binary values, you can click the 0s and 1s in the binary view (between display and keypad) to toggle the value of each bit. The display will change to match the new binary value.

 

 

Just checked my work computer and they changed the calculator in Windows 7 - there's now Programmer option under the View menu. They've also added the bit display, complete with click-to-toggle each bit. You can also type in the binary values, which is nice.

post-3056-0-94057900-1378218318_thumb.png

Edited by SpiceWare
Link to comment
Share on other sites

 

They've also added the bit display, complete with click-to-toggle each bit.

 

I just tried that with the calculator on my computer and it thinks that 10000000 is -128.

 

 

Speaking of toggling bits . . . bogax, if you are reading this, do you feel like making a tool that has 8 boxes that can toggle off and on similar to the Playfield Toy? I'm looking for something that will instantly display the correct hex number every time the boxes are toggled. The tool might look something like this:

 

post-13-0-78336400-1378221611.png

 

If it could display hex and decimal numbers, that would be even better.

 

Now that I think about it, this thing could be a separate tool, or if you know how, you could add the 8 interactive boxes at the top of the Programming Equivalents tool and just have the values displayed in the Decimal, Hexadecimal, Binary, Ternary, Quintal, and Octal boxes below it. It might look something like this:

 

post-13-0-88921000-1378224996_thumb.png

  • Like 1
Link to comment
Share on other sites

Maybe a pseudo drawing tool that displayed the decimal value for each row. That's what I typically wish for when drawing playfield pixels

 

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

Link to comment
Share on other sites

Maybe a pseudo drawing tool that displayed the decimal value for each row. That's what I typically wish for when drawing playfield pixels

 

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

[X][X][X][X][X][X][X][X] = 255

[X][X][X][X][X][X][X][X] = 0

 

VisualbB can already convert a playfield into data that will work directly with the playfield variables.

Link to comment
Share on other sites

I see covert to data file but that doesn't output to decimal. I also cannot see anything like the format I suggested above.

 

Do you plan on using it as data to use directly with playfield variables? If so, why does it need to be in decimal? Here's an example playfield:

__

  playfield:
  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  XX............................XX
  XX............................XX
  XX..XXXXXXXXXXX..XXXXXXXXXXX..XX
  XX..XX....................XX..XX
  XX..XX....................XX..XX
  XX..XX....................XX..XX
  XX..XXXXX..XXXX..XXXX..XXXXX..XX
  XX............................XX
  XX............................XX
  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

__

__

And here is the converted data:

__

   data _Data_PF_01
   $FF,$FF,$FF,$FF
   $C0,$00,$00,$C0
   $C0,$00,$00,$C0
   $CF,$7F,$7F,$CF
   $CC,$00,$00,$CC
   $CC,$00,$00,$CC
   $CC,$00,$00,$CC
   $CF,$79,$79,$CF
   $C0,$00,$00,$C0
   $C0,$00,$00,$C0
   $FF,$FF,$FF,$FF
end

__

Once you have the data, you can place parts of it anywhere on the screen like I did here and it's lightning-fast:

 

http://atariage.com/forums/topic/205563-whats-so-great-about-vbbs-convert-to-data-file-example-program/

Link to comment
Share on other sites

Nah. Not as fast as my post. If I want to create landmarks instead of whole playfields the method I describe is alot more helpful.

 

Say, if you wanted to create a gravestone you could record the decimal values after drawing them like in my checkbox area I described in my post. After that you could easily reuse the results in different columns of playfield variables.

Link to comment
Share on other sites

Nah. Not as fast as my post. If I want to create landmarks instead of whole playfields the method I describe is alot more helpful.

 

Say, if you wanted to create a gravestone you could record the decimal values after drawing them like in my checkbox area I described in my post. After that you could easily reuse the results in different columns of playfield variables.

 

If you are putting data directly into playfield variables, you need to know which variables will be reversed. As I have said in another thread, you don't have to do whole playfields. You don't even need to do horizontal strips of playfields. You can draw what you want in the editor, then use VbB to spit out the values with reversed data and just copy and paste the specific part of the data that you want to use. As long as you remember that the second and fourth playfield variables of each row have a reversed bit order, you can place that data exactly where you want it.

Link to comment
Share on other sites

I just tried that with the calculator on my computer and it thinks that 10000000 is -128.

 

That's because it is.

 LDA #%10000000
 BMI NEGATIVE_VALUE
 ...
 LDA #%01111111
 BPL POSITIVE_VALUE

Both of those branches will be taken.

 

If you want the Windows calculator to treat %10000000 as positive use Word, Dword or Qword instead of Byte.

  • Like 1
Link to comment
Share on other sites

Hmm, the link to the Two's Complement entry at Wiki broke. Looks like the forum doesn't like the ' in the link. Copy the following and paste in your address bar to get there.

 

en.wikipedia.org/wiki/Two's_complement

 

en.wikipedia.org/wiki/Two%27s_complement

 

Test

 

When I pasted, the forum software converted that character to something it could use.

Link to comment
Share on other sites

Here's a preliminary whack at it

At least it seems to work

 

edit: nested the tables

 

radix_converter_03_2.html

 

 

 

 

 

Wow, that seems to be working great so far. Thanks. The only thing I could see people complaining about is that the new byte section only remembers what has been clicked inside of it. For example, if somebody types 80 in the decimal box, then goes to toggle one of the boxes in the byte area, the byte area remembers what has or hasn't been toggled inside of it previously. Do you think you could make the memory for the byte area reset when something is typed in one of the Decimal, Hexadecimal, Binary, Ternary, Quintal, and Octal boxes below it, then remember the new number?

Link to comment
Share on other sites

 

Wow, that seems to be working great so far. Thanks. The only thing I could see people complaining about is that the new byte section only remembers what has been clicked inside of it. For example, if somebody types 80 in the decimal box, then goes to toggle one of the boxes in the byte area, the byte area remembers what has or hasn't been toggled inside of it previously. Do you think you could make the memory for the byte area reset when something is typed in one of the Decimal, Hexadecimal, Binary, Ternary, Quintal, and Octal boxes below it, then remember the new number?

 

The bit boxes are just a new way to input

If you change any of the boxes they all

(including the bit boxes) get updated to the

new value except the bit boxes only get the

lo byte.

If you change the bit boxes then you only

get eight bits (they'll all be <=255)

 

At least that's how it's supposed to work.

 

It maybe differences in browsers I suppose

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