I have a couple of questions.

  1. How do you create a new program and store data in it from another program?
  2. How do you archive and unarchive programs? Appvars?
  3. How would you recognize multiple key presses at once?
  4. How are the I/O commands like in and out used?
1. Use the functions _CreateProg, _CreateProtProg, or _CreateVar. (Or use the libraries; which are also available in asm)

2. You would use the _ChkFindSym call to first check if the variable is in ram or the archive; and then from there execute a call to _ArcUnarch.

3.Read the keypad directly. It's quite easy with the memory mapped interface; check out the documentation on wikiti under 'ports'

4. You don't unless you are absolutely sure you want to. Most peripherals are memory mapped; so you can just use them like you would normal memory.
MateoConLechuga wrote:
1. Use the functions _CreateProg, _CreateProtProg, or _CreateVar. (Or use the libraries; which are also available in asm)

2. You would use the _ChkFindSym call to first check if the variable is in ram or the archive; and then from there execute a call to _ArcUnarch.

3.Read the keypad directly. It's quite easy with the memory mapped interface; check out the documentation on wikiti under 'ports'

4. You don't unless you are absolutely sure you want to. Most peripherals are memory mapped; so you can just use them like you would normal memory.


1. Do those functions need the name in OP1, or something?
2. What does _ChkFindSym take as input and what does it output into? Same with _ArcUnarch?
3. Thank you. Makes sense
4. Got it. Thanks.
1. Read the doc
2. Read the doc
3. Awesome Smile
4. Good luck! Very Happy
Lots of useful information can be found on the wiki here:

http://wikiti.brandonw.net/index.php?title=Calculator_Documentation#TI-84_Plus_CE.5B-T.5D.2C_TI-83_Premium_CE

Some of the older system routines documents are also handy, though not 100% since it's for an older model calc: http://education.ti.com/~/media/01E6AF2CADF84171B6F2E2039357BAAC
Can anyone explain to me what the function _frameset does?
seanlego23 wrote:
Can anyone explain to me what the function _frameset does?


jacobly wrote:
<jacobly> it allocates a C stack frame
<jacobly> hl is the negative stack frame size
<jacobly> ld hl,-n \ call __frameset is the same as doing push ix \ ld ix,sp-n
PT_ wrote:
seanlego23 wrote:
Can anyone explain to me what the function _frameset does?


jacobly wrote:
<jacobly> it allocates a C stack frame
<jacobly> hl is the negative stack frame size
<jacobly> ld hl,-n \ call __frameset is the same as doing push ix \ ld ix,sp-n

Then why would you call _frameset when you can just do what's stated above?
Because it is smaller in size to do the call Wink
MateoConLechuga wrote:
Because it is smaller in size to do the call Wink

True. I guess the question is whether you'd want to save bytes or save cycles at the expense of a couple bytes.
What are relocation tables and how do you use them?
Relocation tables are used in programs that float around in RAM somewhere, and don't have a fixed starting point. An example are all the C libs, they won't be executed from UserMem, but are somewhere in RAM. However, the C libs does have SMC and jp's, so it's necessary to know the right location where to SMC/jump, and that is where a relocation table jumps in. This is just a table at the start of the program, with all the pointers to the jp's/SMC's in it. When you run a C program, LibLoad reads each lib, and because it sees a relocation table, it relocates all the necessary SMC's/jp's.

What I did in AoCE was, using a macro (.r), which stores the address in a separate file, and then include that file in the main program.

Check this program, which creates my relocation table (although it's stored at the end of the program:


Code:
#macro relocate1()
   #ifdef old_addr
      .echo >> relocation_table1.asm "\t.dl ",$ - new_addr + old_addr - 3,"\n"
   #else
      .echo >> relocation_table1.asm "\t.dl ",$-3,"\n"
   #endif
#endmacro
#define .r1 relocate1()

#macro relocate2()
   #ifdef old_addr
      .echo >> relocation_table2.asm "\t.dl ",$ - new_addr + old_addr - 3,"\n"
   #else
      .echo >> relocation_table2.asm "\t.dl ",$ - 3,"\n"
   #endif
#endmacro
#define .r2 relocate2()

#macro relocate(addr)
   #define old_addr eval($)
   .org addr
   #define new_addr eval($)
#endmacro

#macro endrelocate()
   .org $-new_addr+old_addr
   #undefine old_addr
   #undefine new_addr
#endmacro

.echo >> relocation_table1.asm "RelocationTable1:\n"
.echo >> relocation_table2.asm "RelocationTable2:\n"
PT_ wrote:
Relocation tables are used in programs that float around in RAM somewhere, and don't have a fixed starting point. An example are all the C libs, they won't be executed from UserMem, but are somewhere in RAM. However, the C libs does have SMC and jp's, so it's necessary to know the right location where to SMC/jump, and that is where a relocation table jumps in. This is just a table at the start of the program, with all the pointers to the jp's/SMC's in it. When you run a C program, LibLoad reads each lib, and because it sees a relocation table, it relocates all the necessary SMC's/jp's.

What I did in AoCE was, using a macro (.r), which stores the address in a separate file, and then include that file in the main program.

Check this program, which creates my relocation table (although it's stored at the end of the program:


Code:
#macro relocate1()
   #ifdef old_addr
      .echo >> relocation_table1.asm "\t.dl ",$ - new_addr + old_addr - 3,"\n"
   #else
      .echo >> relocation_table1.asm "\t.dl ",$-3,"\n"
   #endif
#endmacro
#define .r1 relocate1()

#macro relocate2()
   #ifdef old_addr
      .echo >> relocation_table2.asm "\t.dl ",$ - new_addr + old_addr - 3,"\n"
   #else
      .echo >> relocation_table2.asm "\t.dl ",$ - 3,"\n"
   #endif
#endmacro
#define .r2 relocate2()

#macro relocate(addr)
   #define old_addr eval($)
   .org addr
   #define new_addr eval($)
#endmacro

#macro endrelocate()
   .org $-new_addr+old_addr
   #undefine old_addr
   #undefine new_addr
#endmacro

.echo >> relocation_table1.asm "RelocationTable1:\n"
.echo >> relocation_table2.asm "RelocationTable2:\n"

Ok. Makes a little sense. Can you explain what your code means? I'm not exactly following how it works when I put a .r in my program.
I did notice that in fileio_lib.asm all of the labels that are supposed to be relocated were at the bottom of the source file. I didn't see a relocation table for them though, so how does that work?
Well, my code is a little bit different. When the assembler sees \.r, it reads the current location - 3 (because an address is 3 bytes) (the program started at UserMem) and inserts it in a table, together with a " .dl", which means at the current location - 3 is a jump/call, which needs to be relocated. However, I added some code, which checks if you relocate something IN a relocation, which is not possible. The C libs use something different though, you might ask Mateo or someone else about that Razz
PT_ wrote:
Well, my code is a little bit different. When the assembler sees \.r, it reads the current location - 3 (because an address is 3 bytes) (the program started at UserMem) and inserts it in a table, together with a " .dl", which means at the current location - 3 is a jump/call, which needs to be relocated. However, I added some code, which checks if you relocate something IN a relocation, which is not possible. The C libs use something different though, you might ask Mateo or someone else about that Razz

Ok, so the code creates the table. How does your old_addr and new_addr work? Does it allow you to choose where it's relocated?
seanlego23 wrote:
Ok, so the code creates the table. How does your old_addr and new_addr work? Does it allow you to choose where it's relocated?

That is only important for relocating an entire code block (old_addr is then the address where the relocation started), rather than a jump or call. You might take a look at the C libs source, what Mateo does with relocation Wink
So this question probably has an obvious answer, but I can't seem to figure it out. How do you include files in assembly? I'm trying to include the fileioc library in my assembly program so that it will stop giving errors.
I tried #include, because that's what I've seen in other examples, but I can't figure out what I'm doing wrong.
#include is in general the correct directive, so you're doing something else wrong. As usual, what message(s) do you get?
Tari wrote:
#include is in general the correct directive, so you're doing something else wrong. As usual, what message(s) do you get?

Mateo helped me fix it earlier, and I forgot to edit. All I needed was a .ref to reference the functions. You can't include the libraries in assembly like you do in C.
A couple of questions.
  1. How are equations stored? Do they have a certain format they follow?
  2. How does MathPrint mode work? How does things like the square root or the integral signs stretch?
  3. How are token's accessed from a ez80 program? tice.h tells me their equates but not how to find them and use them.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement