Author Topic: The missing code!  (Read 3868 times)

0 Members and 1 Guest are viewing this topic.

Offline systwo

  • LV2 Member (Next: 40)
  • **
  • Posts: 25
  • Rating: +7/-0
    • View Profile
The missing code!
« on: January 13, 2012, 12:30:21 am »
Hi everyone! I have been messing around with BASIC for a bit, but I found it too slow to do some of the fun things on the calculator. That was before I found out about assembly. I have very specific questions for the community here, hopefully you guys can answer it.

Lurking on these forums for a while I discovered that asm was possible to program on the calculator itself - which is something I was looking for, as I do not have a USB link cable. Seeing there are people on this forum who program in hex, I have this question for you:

I noticed that this piece of code is present in every asm program I have seen:
Code: [Select]
.org 9D95hAs I understand it, this tells the calculator to place the program in this location in ram. Is this for the assembler or the calculator (or both?)? The hex programs that I saw have no reference to this as far as I can discover (on this forum and some others as well). Is there some mystery behind this? Because of this, I have yet to actually program on the calculator.

Also I have also looked into the process of programming and I do know it is safer to program on an emulator first before typing it onto the calculator. Is there a method to convert the program into hex? Preferably not the IRC bot thingy that was posted a while ago (I do not have access to the IRC sometimes)


Many thanks for those who answer this question!

Systwo

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: The missing code!
« Reply #1 on: January 13, 2012, 12:44:17 am »
It is for the assembler. The calculator *always* loads programs at that position in RAM, so that statement tells the assembler what addresses it needs to use for labels and such.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

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: The missing code!
« Reply #2 on: January 13, 2012, 12:49:53 am »
It gives the assembler a reference point for addresses, so by counting bytes from that .org statement it will know what numerical value to use for things like $ (current pointer) and labels.

EDIT: Five-minute ninja.
« Last Edit: January 13, 2012, 12:50:26 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: The missing code!
« Reply #3 on: January 13, 2012, 11:23:57 am »
! I like to program in hex for my calcy :3 If you would like some help, I can assist and if you want a chart for converting mnemonics to hex you can try this. The main difficulty with programming in hex on the calc is computing addresses. If you forget to count a byte, you could crsah your calc, so you have to be careful.

Also, if you are new to assembly, that chart also has info on the right about the instructions and what they do. It is BASICised a bit, so some of it should be rather easy to get :)

I hope I can help!

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: The missing code!
« Reply #4 on: January 13, 2012, 11:27:26 am »
And to answer your other question, an asm program is first compiled to its hex statements. Later it is compressed into it's "one-byte" values (like the AsmComp( oncalc command). But if you want to program on a computer, you can, and just copy the hex values. But it'd be much easier (and safer) to send it. There are also programs you can send to your calc to program in actual assembly, if ever get the chance to borrow a USB cable.
« Last Edit: January 13, 2012, 11:32:37 am by chickendude »

Offline systwo

  • LV2 Member (Next: 40)
  • **
  • Posts: 25
  • Rating: +7/-0
    • View Profile
Re: The missing code!
« Reply #5 on: January 13, 2012, 07:41:59 pm »
Ah, that clears up the mystery! Thank you to everyone!

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: The missing code!
« Reply #6 on: January 13, 2012, 07:45:12 pm »
If you have any other questions, feel free to ask us! There are lots of experienced coders here that can help out :)