Author Topic: Miscellaneous ASM Questions  (Read 382 times)

0 Members and 1 Guest are viewing this topic.

Offline Sue Doenim

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 11
  • Rating: +0/-0
    • View Profile
Miscellaneous ASM Questions
« on: February 16, 2019, 05:07:27 pm »
I have a few small questions that I'm not sure about, but I don't want to make a separate thread for each of them, so I'm combining them all in here.
1) What RAM pages can I use within programs without having any bad consequences?
2) When an appvar is less than 16kb and is archived, will it all be on the same ROM page?
3) Can you interface with headphones beyond simply sending them signals with the ring and the tip? If so, how?
If anyone can answer these questions, or refer me to a source that as answers, I would greatly appreciate it.

Offline Xeda112358

  • Xombie.
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4504
  • Rating: +707/-6
  • meow :3
    • View Profile
Re: Miscellaneous ASM Questions
« Reply #1 on: February 16, 2019, 06:44:13 pm »
1) What RAM pages can I use within programs without having any bad consequences?
Even numbered pages are execution protected by default, so executing code here will crash your calc. That said, you can definitely store data. On the calcs with USBs, page 83h has some data that should be preserved or restored in the first 128 bytes. Just remember that any OS routines that interact with memory or variables expect the right pages to be there.

Ram Pages (WikiTI)

2) When an appvar is less than 16kb and is archived, will it all be on the same ROM page?
No, you can't expect this. Variables won't cross sector boundaries (groups of four RAM pages), but they may cross pages.

3) Can you interface with headphones beyond simply sending them signals with the ring and the tip? If so, how?
I don't know what you mean by this, sorry :| If you want to use headphones, you have to interact directly with port 0.

Offline Sue Doenim

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 11
  • Rating: +0/-0
    • View Profile
Re: Miscellaneous ASM Questions
« Reply #2 on: February 16, 2019, 09:31:54 pm »
Thanks for the answers! I have just a couple more follow ups.
1) What RAM pages can I use within programs without having any bad consequences?
Even numbered pages are execution protected by default, so executing code here will crash your calc. That said, you can definitely store data. On the calcs with USBs, page 83h has some data that should be preserved or restored in the first 128 bytes. Just remember that any OS routines that interact with memory or variables expect the right pages to be there.

Ram Pages (WikiTI)
If you overwrite the data at the start of page $83, will bcall(_fillAppBaseTable) fix that?
3) Can you interface with headphones beyond simply sending them signals with the ring and the tip? If so, how?
I don't know what you mean by this, sorry :| If you want to use headphones, you have to interact directly with port 0.
I looked for a while, and the most info I could find/understand on output to headphones was that you have to use bits 0 and 1 of port 0 (the tip and the ring), and switch them between set and reset at a desired note's frequency (e.g. 440Hz for A4). I thought that for more high quality sound than simply beeps, you send a full byte at a time to the headphones, but after looking at the source code for TruSound, I realize that that was wrong.

Offline Xeda112358

  • Xombie.
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4504
  • Rating: +707/-6
  • meow :3
    • View Profile
Re: Miscellaneous ASM Questions
« Reply #3 on: February 16, 2019, 09:33:05 pm »
Yes, bcall(_fillAppBaseTable) should be sufficient.