Author Topic: BASIC (Ab)Uses of Assembly Opcodes  (Read 15114 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
BASIC (Ab)Uses of Assembly Opcodes
« on: November 20, 2010, 04:03:37 am »
As many of you know by now, I program in hex on the calculator, but once upon a time I was a BASIC programmer-- a maker of RPG's that spread through my school, games, and math programs. Many of these programs in some way or another used an assembly opcode to make them better. Naturally, as any curious person would do, I started to play with the opcodes. After hundreds of RAM clears, I would make headway and create my own opcodes.

So what is this topic about? For those BASIC programmers (or interested Assembly programmers) I want to make some DIY assembly opcodes-- codes that I will explain how to safely modify for desired effects!.

Now where to begin... output? Okey dokey then... Here is an example program. I will explain stuff afterward:
AsmPrgm
210000
224B84
21A29D
EF1045
C9
0C
48656C6C6F20576F726C6421

Green is okay to change, it won't harm anything
Blue has rules if you want to change it
Red should not be changed

The blues are what need to be explained.
  • The 210000 is the coordinate to display the text. 210100 will display one row down. 210001 will display one column over. Do not go off the screen or it will crash.
  • The 21A89D is changed if you add or take away any code before the C9. For example, if you add EF4645 to the beginning, that is 3 bytes of code added so you use 21AB9D. If you take out the 210000224B84, that is 6 bytes removed, so you would use 21A29D
  • The 0C is the size of the string to display. This will not harm anything if changed. 0Ch=12 which is how many bytes gets displayed.

Feel free to ask questions because I am sure there will be some. I jumped right into it without explaining a lot of it, mostly because it is 4:00AM here and I haven't slept yet...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #1 on: November 20, 2010, 04:29:12 am »
(Off-topic: Btw have you released any of those RPGs? I kinda like RPGs, unless they're only menus and short)

That seems like an interesting topic. It might be helpful for BASIC coders who want to have some small libs.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #2 on: November 20, 2010, 04:32:01 am »
Sorry, I made them two years ago, before I had internet access :C But I have been trying to remake them when I get random time. They had animation and where mostly in BASIC except for a few opcodes. I used the creative idea of polar graphs for sprites!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #3 on: November 20, 2010, 05:09:00 am »
Ah ok I see. Do you still have them or are they gone for good, like Donjon, Illusiat 4 and Illusiat 2002?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #4 on: November 20, 2010, 05:21:07 am »
They are completely lost and gone for good :C But on the bright side, I have made several quiet attempts to revive my BATTLE series. Actually, wait a minute. Hmm... Okay, I have a newer version that does not have many features of my complete version, but it is the version that made use of Celtic 3...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #5 on: November 20, 2010, 09:51:19 am »
Aw sorry to hear :(. In my case I had no link cable (the TI-PC link cable was only sold with the 83+SE and unavailable separately over here) and limited computer access, so no way to backup. A bad MirageOS 1.1 crash occured and I was forced to reset both archive and RAM through a full mem reset because the ram clear and arc vars clear options didn't work anymore (freeze/crashes), same for GarbageCollecting. As a result I lost 3 RPGs I spent a lot of time on.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #6 on: November 20, 2010, 10:49:08 am »
Aww, are you sure that some of your friends don't still have them?  It would be really cool to see some of them. :)

This looks neat.  What does the green line do?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #7 on: November 20, 2010, 10:53:20 am »
It's the text "Hello World!" in hex, so it can be changed to whatever you want.

Too bad about the games, Xeda. As ztrumpet said, are you sure you don't have a copy somewhere on someone else's calc?

And how did you do sprites with polar graphs? Was it fast? Sounds pretty fun :D
« Last Edit: November 20, 2010, 10:55:35 am by Deep Thought »




Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #8 on: November 20, 2010, 01:27:42 pm »
Okay, well here is a bit of a rundown... Back in 2008, my school loaned out TI-84+s to anybody interested, so I borrowed one as did most of my friends (only one of whom programs them). I started learning BASIC and after about a three months I had a cool RPG. It was right around the first time I broke my first assembly code to make it do what I wanted (the next one I plan to post), so it used maps made in assembly even though I had no assembly knowledge (I knew hex as a number system, of course). I had 60 items, monsters to fight, experience, stats, background stats, and my other pride: Polar Sprites (that is what I am calling them :D). Every sprite used 8 bytes and if it used less, I made it take 8 bytes so that I could easily do sub(Str1,8A+1,8→r1 where A is the monster number. I gave it to a bunch of friends, but two things went wrong. One, at the end of the year, we handed our calcs back in, and two, I had no cords to transfer it to a computer. In fact, my program, which was only about 6000 bytes in total, I put in by hand on each of the calculators.

Now, the game was mostly designed around the battling, so when you were on the map, you were just a pixel, but in the battle, the monsters had full fledged sprites that looked AWESOME. My favorite was Maxpider. The map was split up into 9 areas that had there own monsters and there was a house to enter in the center section to buy stuff and whatnot. Later on in the development, I made a program called Codem2 for cheats in my games and I made two maps to play on, but you only got to play on one which was decided at the beginning.

!!!! I just found some notes from the last time I tackled this project ♥. It is a little outdated, now, but this is what I have. (outdated because it was before I had SpriteLib and a few other programs).

Also, I am not going to guarantee that I will work on this much, but I do go back to it every now and then. I have a few other projects that I am working on as well on top of college where I am trying to complete my first major in the first two years, so I have my plate half full already :D

Edit crap, forgot to upload the files. Oh well, here are the polar coordinates at least taken from my notes:
Code: [Select]
T represents theta

Xmin=-pi/2
Xmax=pi/2
Ymin=-62pi/188
Ymax=62pi/188

I'll probably multiply the limits by 2 for the game
================================================================
Bufli sin(sin(tan(T
Magfly sin(cos(tan(T
Attack Master sin(tan(tan(T
Wataray cos(sin(tan(T
--- cos(cos(tan(T
Maxpider cos(tan(tan(T
Bufli (big) tan(sin(tan(T
Magfly (big) tan(cos(tan(T
Los-Wei tan(tan(tan(T


Eye sin(T+sin(T+sin(T
--- sin(T+sin(T+cos(T
Psyita sin(T+sin(T+tan(T
--- sin(T+cos(T+sin(T
--- sin(T+cos(T+cos(T
Shalka sin(T+cos(T+tan(T
??? sin(T+tan(T+sin(T
Healer sin(T+tan(T+cos(T
Sabem sin(T+tan(T+tan(T
--- cos(T+sin(T+sin(T
--- cos(T+sin(T+cos(T
??? cos(T+sin(T+tan(T
--- cos(T+cos(T+sin(T
Side Eye cos(T+cos(T+cos(T
??? cos(T+cos(T+tan(T
??? cos(T+tan(T+sin(T
Water Demon cos(T+tan(T+cos(T
??? cos(T+tan(T+tan(T
--- tan(T+sin(T+sin(T
--- tan(T+sin(T+cos(T
--- tan(T+sin(T+tan(T
--- tan(T+cos(T+sin(T
--- tan(T+cos(T+cos(T
??? tan(T+cos(T+tan(T
??? tan(T+tan(T+sin(T
??? tan(T+tan(T+cos(T
??? tan(T+tan(T+tan(T

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #9 on: November 20, 2010, 11:37:33 pm »
Nice :O

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #10 on: November 21, 2010, 12:17:59 am »
Okay, so anyway, here is the next thing, something I mentioned in my previous post. Rectangles. This was the first thing I cracked as a BASIC programmer.
Here is a rectangle that inverts the upper left quarter of the screen:
210000
112F1F
EF5F4D
C9

Again, the blue has rules...
  • 210000 is what determines the upper left coordinate. The first 00 is the left coordinate and the second 00 is the upper coordinate. 5F and 3F are the maximums, respectively
  • 112F1F is the lower right coordinate where the 2F is the right coordinate (2F=47) and the 1F is the lower coordinate (1F=31)
  • EF5F4D is a B_Call, but if you change the 5F to certain values, you get a different style of rectangle as listed below
IMPORTANT: if you put incorrect coordinates such as coordinates going off the screen or where the right coordinate is smaller than the left, you will crash your calculator.
EF5C4D-Clear Rectangle
EF624D-Fill Rectangle
EF5F4D-Invert Rectangle
EF7D4D-Rectangle Border
EF864D-Clear Rectangle Border
EF8C4D-Draw Border, Clear inside

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #11 on: November 21, 2010, 12:31:18 am »
You're already getting respect for every post on this thread, so I'll give you another. Great job.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #12 on: November 21, 2010, 12:34:58 am »
Thanks! I didn't even notice that, so thanks all! If anybody has questions about these opcodes or ideas, feel free to let me know. I only have a few ideas... (my next one will be how to make an assembly library).

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #13 on: November 21, 2010, 12:58:56 am »
Nice, the rectangle stuff seems smaller than I thought.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BASIC (Ab)Uses of Assembly Opcodes
« Reply #14 on: November 21, 2010, 01:04:17 am »
The cool part is that you can combine codes like this:

210000
112F1F
EF5F4D

213020
115F3F
EF5F4D

C9

That was my whole premise to my ASMDRAW programs.