0 Members and 1 Guest are viewing this topic.

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
« on: January 22, 2011, 09:02:57 am »
I decided to create a topic for general discussion about general Hexadecimal Assembly programming. It is also a small tutorial and introduction.

Hexadecimal is a numeration system just like the Arabic one (1,2,3,4,5,6,7,8,9.5,11,12,...) or the Roman one (I,II,III,IV,V,X,L,MCM,...).
So, a number like seven can have multiple representations, according to the system used, let's check the number 28:

Code: [Select]
28          // ArabicXXVIII    // Roman1C        // Hexadecimal11100  // Binary
So, why don't we all use the same? It's hard for all of us to use the same and some are useful in some situations but terrible in others. For example, to make a sprite we use binary or hexadecimal, but to solve a giant equation using any of those would be a pain in the ass!

Now, when we make a Calculator Assembly program (ld hl,1 ....), it is written as a binary file (10010101011110101010...). Binary is hard to read, so we just use Hexadecimal.

So, why don't we just program in Assembly and leave the Hexadecimal alone?

If we know how to code in Hexadecimal instead of using an assembler that makes our assembly code hexadecimal, we can program assembly on the calculator. Of course, with Mimas (and some others) we can also do it, and Mimas is quite good. However, I'm not sure if we can all use Mimas or if it has everything there is.

So, I assume you already know Assembly if you're reading this, and here's an Assembly program:

Code: [Select]
.nolist#include "ti83plus.inc".list    .org $9D95-2 .db$BB, \$6D Start:  B_CALL (_ClrLCDFull)  ld hl,1  B_CALL (_DispHL)  B_CALL (_GetKey)    ret
This program will Clear the Screen, the set the hl registers to 1, then display "1" and wait for a key press until ending.

The hexadecimal code it creates (the data) is something like:

Code: [Select]
EF4045  // ClrLCDFull210100  // Set hl registers to 1EF0745  // Display the hl registers, so display "1"EF7249  // Wait for key pressC9
Now, how do I know this is the hexadecimal code for it? One, I checked the ti83plus.inc, I use Assemblex and I learnt it with Xeda. Now, the ti83plus.inc has all the hexadecimal codes for BCalls. Assemblex converts hexadecimal to assembly and disassembles files which lets me learn it from other programs.

Also, for opcodes such as 210100, I check this all the time!

How to program in my calculator?

Press PRGM
Create a new PRGM
Call it whatever you want
Then make it like this:

Code: [Select]
AsmPrgmEF4045EF7045 // Turns the run diagnostic off  B_CALL (_RunIndicOff)FDCB00AE  // Disables the 'Done' message when the program closes (res 5,(iy+0))210100EF0745EF7249C9

Never forget the ending C9 (ret), without it the calculator crashes!

Now you can run that program by typing Asm(prgmNAME.

You can also compile it so you can run it in shells and it is a true Assembly program: AsmComp(prgmNAME,prgmNAME2)

Note, in AsmComp( the names have to be different. Also, press 2ND + 0 to access the catalog and use the Asm( and AsmPrgm and AsmComp( tokens, don't just type them.

I hope more discussion comes, for now, skim through the pages I gave you and try and make something new.

Note: The language on this tutorial may be wrong. For example, I said that AsmComp( made it a real Assembly program, but it was already, it just compiles it.

Also, concerning Assemblex, the last uploaded version is still not perfect, so you can have a demo here, but the 'Export to 8xp' isn't finished, so it does not count as an upload. Assemblex is what I use to program in Hexadecimal in my computer.

Discuss!

EDIT: You can also use brandonw's website for more bcalls and information, I think. The Z80 tables with opcodes can also be found in ticalc.org.

EDIT 2:
I have a lot to tell you yet, but for now, here's another program:

Code: [Select]
EF40453E01C60A26006FEF0745EF7249EF4045C9
Who guesses what this does?
« Last Edit: January 22, 2011, 01:31:12 pm by Scout »

#### Binder News

• Posts: 785
• Rating: +46/-3
• Zombie of Tomorrow
« Reply #1 on: January 22, 2011, 09:47:26 am »
Very useful. Definite bookmark!
Spoiler For userbars:

Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
« Reply #2 on: January 22, 2011, 01:40:08 pm »
Very useful. Definite bookmark!

Thanks much!

I edited with another program
« Last Edit: January 22, 2011, 01:41:03 pm by Scout »

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4669
• Rating: +718/-6
• Calc-u-lator, do doo doo do do do.
« Reply #3 on: January 22, 2011, 01:50:28 pm »
Want another chart I like to use?!? This is one I made after I learned assembly...

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
« Reply #4 on: January 22, 2011, 02:23:42 pm »
Nice chart Xeda! I really like the way it looks! You should check mine and get the unofficial instructions and the IX and IY tables. Also the IX bits and IY bits tables and put them in yours. I did not fully make all of those, though. Runer made two of those, I just don't remember which.

#### holmes221b

• Posts: 282
• Rating: +13/-1
• RESISTANCE IS FUTILE.
« Reply #5 on: January 22, 2011, 02:24:54 pm »
What file type is xls? I don't recall ever seeing that one before...
* holmes221b wants to download it to start teaching herself how to program in HEX, but isn't sure if it's in a format she can read

Spoiler For "Projects":
Spoiler For "Because Everyone Else Is":
*Sigh*
can we keep this on topic? The topic is about what the big thing might be, NOT SEX

#### FinaleTI

• Believe in the pony that believes in you!
• CoT Emeritus
• LV10 31337 u53r (Next: 2000)
• Posts: 1830
• Rating: +121/-2
• Believe in the pony that believes in you!
« Reply #6 on: January 22, 2011, 02:26:01 pm »
What file type is xls? I don't recall ever seeing that one before...
* holmes221b wants to download it to start teaching herself how to program in HEX, but isn't sure if it's in a format she can read
It's an Excel spreadsheet, but I think it'll open in OpenOffice as well.

Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
« Reply #7 on: January 22, 2011, 02:26:22 pm »
What file type is xls? I don't recall ever seeing that one before...
* holmes221b wants to download it to start teaching herself how to program in HEX, but isn't sure if it's in a format she can read

It's Excel file, opened with Microsoft Excel, which can be either bought or used online for free in a limited way (Google Chrome+Hotmail Account).

www.davidgom.co.cc/z80table.html The tables are also there, online.

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4669
• Rating: +718/-6
• Calc-u-lator, do doo doo do do do.
« Reply #8 on: January 22, 2011, 02:29:15 pm »
Yeah, I've checked yours... me likes
Oh, um, yeah, I made it with Open Office...
« Last Edit: January 22, 2011, 02:30:25 pm by Xeda112358 »

#### holmes221b

• Posts: 282
• Rating: +13/-1
• RESISTANCE IS FUTILE.
« Reply #9 on: January 22, 2011, 03:15:21 pm »
Well, I do have Excell...It's been a long while since I've done anything in Excell, so no wonder I've forgotten the file extension...xD

Spoiler For "Projects":
Spoiler For "Because Everyone Else Is":
*Sigh*
can we keep this on topic? The topic is about what the big thing might be, NOT SEX

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
« Reply #10 on: January 22, 2011, 04:23:01 pm »
Well, I do have Excell...It's been a long while since I've done anything in Excell, so no wonder I've forgotten the file extension...xD

Oh I see, Excel is quite useful for this kind of tables, though.

So, anybody already knows (not you, Xeda) what the final program of my code does?

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4669
• Rating: +718/-6
• Calc-u-lator, do doo doo do do do.
« Reply #11 on: January 22, 2011, 05:57:51 pm »
Pssh, that is SO unoptimised...
(but it is for an example, so I guess it's okay )

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
« Reply #12 on: January 22, 2011, 05:59:45 pm »
Code: [Select]
EF40453E01C60A26006FEF0745EF7249EF4045C9
It could be optimized to:

Code: [Select]
EF4045210B00EF0745EF7249EF4045C9
However, it would lose the point of the challange.
« Last Edit: January 22, 2011, 06:08:26 pm by Scout »

#### AngelFish

• Is this my custom title?
• LV12 Extreme Poster (Next: 5000)
• Posts: 3242
• Rating: +270/-27
• I'm a Fishbot
« Reply #13 on: January 22, 2011, 06:04:40 pm »
Scout, no one is going to be able to remove their finger from the keypad quickly enough for that not to execute through

EDIT: Now write it without system calls
« Last Edit: January 22, 2011, 06:05:20 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4669
• Rating: +718/-6
• Calc-u-lator, do doo doo do do do.