11 December, 2013, 23:23:07
 OmnomIRC You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

 Pages: [1] 2 3 4   Go Down
 Author Topic: Hexadecimal Assembly Programming -  (Read 9308 times) 0 Members and 1 Guest are viewing this topic.
Munchor

Offline

Gender:
Last Login: 24 August, 2013, 21:18:13
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209

Topic starter
Total Post Ratings: +174

 « on: 22 January, 2011, 16:02:57 » +4

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:

 1234 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:

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

 12345 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:

 12345678 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:

 123456789 EF40453E01C60A26006FEF0745EF7249EF4045C9

Who guesses what this does?
 Assemblex0011.zip (13.77 KB - downloaded 125 times.) « Last Edit: 22 January, 2011, 20:31:12 by Scout » Logged
Binder News

Offline

Gender:
Last Login: 18 September, 2013, 21:37:48
Date Registered: 26 October, 2010, 22:05:05
Location: In a pit on an island somewhere in the Atlantic.
Posts: 779

Total Post Ratings: +43

 « Reply #1 on: 22 January, 2011, 16:47:26 » 0

Very useful. Definite bookmark!
 Logged

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

Offline

Gender:
Last Login: 24 August, 2013, 21:18:13
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209

Topic starter
Total Post Ratings: +174

 « Reply #2 on: 22 January, 2011, 20:40:08 » 0

Very useful. Definite bookmark!

Thanks much!

I edited with another program
 « Last Edit: 22 January, 2011, 20:41:03 by Scout » Logged
Xeda112358
Xombie. I am it.
Coder Of Tomorrow

Offline

Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 4040

Total Post Ratings: +644

 « Reply #3 on: 22 January, 2011, 20:50:28 » 0

Want another chart I like to use?!? This is one I made after I learned assembly...

Munchor

Offline

Gender:
Last Login: 24 August, 2013, 21:18:13
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209

Topic starter
Total Post Ratings: +174

 « Reply #4 on: 22 January, 2011, 21:23:42 » 0

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

Offline

Gender:
Last Login: 09 January, 2012, 05:13:13
Date Registered: 15 June, 2010, 18:25:03
Location: Virginia, USA
Posts: 288

Total Post Ratings: +12

 « Reply #5 on: 22 January, 2011, 21:24:54 » 0

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
 Logged

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!
Coder Of Tomorrow

Offline

Gender:
Last Login: 22 September, 2013, 09:30:42
Date Registered: 04 June, 2010, 00:34:27
Location: Alteria
Posts: 1818

Total Post Ratings: +119

 « Reply #6 on: 22 January, 2011, 21:26:01 » 0

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

Spoiler for Projects:
Spoiler for Pokemon TI:
Map engine is going to be redone from scratch, since I was lacking in organization last time. With a project as big as Pokemon, planning and organization is key, so that will probably be the brunt of the work done on this project for the time being.

Spoiler for Nostalgia:
Being worked on. Nothing really new to put here, but it's being worked on.

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

Spoiler for Nostalgia Origins: Sky's Story:
Currently on hold. I am unsure of whether this will remain DCS7 Hybrid BASIC or if it will use Batlib, Grammer or perhaps Axe.
This may see more progress once a demo of Nostalgia is released.
Munchor

Offline

Gender:
Last Login: 24 August, 2013, 21:18:13
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209

Topic starter
Total Post Ratings: +174

 « Reply #7 on: 22 January, 2011, 21:26:22 » 0

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.
 Logged
Xeda112358
Xombie. I am it.
Coder Of Tomorrow

Offline

Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 4040

Total Post Ratings: +644

 « Reply #8 on: 22 January, 2011, 21:29:15 » 0

Yeah, I've checked yours... me likes
Oh, um, yeah, I made it with Open Office...
 « Last Edit: 22 January, 2011, 21:30:25 by Xeda112358 » Logged

holmes221b

Offline

Gender:
Last Login: 09 January, 2012, 05:13:13
Date Registered: 15 June, 2010, 18:25:03
Location: Virginia, USA
Posts: 288

Total Post Ratings: +12

 « Reply #9 on: 22 January, 2011, 22:15:21 » 0

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
 Logged

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

Offline

Gender:
Last Login: 24 August, 2013, 21:18:13
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209

Topic starter
Total Post Ratings: +174

 « Reply #10 on: 22 January, 2011, 23:23:01 » 0

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?
 Logged
Xeda112358
Xombie. I am it.
Coder Of Tomorrow

Offline

Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 4040

Total Post Ratings: +644

 « Reply #11 on: 23 January, 2011, 00:57:51 » 0

Pssh, that is SO unoptimised...
(but it is for an example, so I guess it's okay )
 Logged

Munchor

Offline

Gender:
Last Login: 24 August, 2013, 21:18:13
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209

Topic starter
Total Post Ratings: +174

 « Reply #12 on: 23 January, 2011, 00:59:45 » 0

 123456789 EF40453E01C60A26006FEF0745EF7249EF4045C9

It could be optimized to:

 123456 EF4045210B00EF0745EF7249EF4045C9

However, it would lose the point of the challange.
 « Last Edit: 23 January, 2011, 01:08:26 by Scout » Logged
AngelFish
Is this my custom title?

Offline

Gender:
Date Registered: 15 August, 2010, 09:18:54
Posts: 3207

Total Post Ratings: +230

 « Reply #13 on: 23 January, 2011, 01:04:40 » 0

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: 23 January, 2011, 01:05:20 by Qwerty.55 » Logged

∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ
Xeda112358
Xombie. I am it.
Coder Of Tomorrow

Offline

Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 4040

Total Post Ratings: +644

 « Reply #14 on: 23 January, 2011, 01:09:54 » 0

Been there. Done that. It is fun.
 Logged

 Pages: [1] 2 3 4   Go Up