That shouldn't assemble; this line is not valid:
Code:
   ld l,(Y_COORD)
Instead, you need to:
Code:
   ld a,(Y_COORD)
   ld l,a
   ld a,(X_COORD)
Why didn't my statement work? Doesn't opcode 2E allow you to store one-byte variables into the L register?
shundra9 wrote:
Why didn't my statement work? Doesn't opcode 2E allow you to store one-byte variables into the L register?
One-byte immediates, yes, but not indirection to a two-byte memory address. You can only load a one-byte value from memory to the accumulator.
Mmk that's still a little fuzzy to me I guess, but I believe you:P
Dammit I really wish I could program something substantial without having to ask for help every other line...but I'm totally stuck. Following Kerm's advice I can now place the smileyFace sprite in different locations according to the contents of an X_COORD and Y_COORD variable, but I cannot for the life of me change this variable according to keypresses. It was easy to move a point around the screen so I have no idea why this situation is so much more difficult. Below is my source code:


Code:

#include    "ti83plus.inc"
.org    $9D93
.db    $BB, $6D

start:       
   bcall(_clrLCDfull)
   bcall(_grbufclr)
   set fullScrnDraw, (IY + apiFlg4)
   ld a,skDown

loop:            ;Wait for user input
   jp nz,checkInput
   bcall(_getCSC)
   jp loop
checkInput:         ;Check user input
   cp skEnter
   jp z,End
   cp skClear
   jp z,End
   cp skLeft
   jp z,Left
   cp skRight
   jp z,Right
   cp skUp
   jp z,Up
   cp skDown
   jp z,Down
   ld a,0
   jp loop
Disp:
   ld b,8         ;Display the sprite at (X_COORD, Y_COORD)
   ld a,(Y_COORD)
   ld l,a
   ld a,(X_COORD)
   ld ix,smileyFace
   call ionPutSprite
   call ionFastCopy
   ld a,0
   jp loop

Left:
   ld a,(X_COORD)
   dec a
   ld (X_COORD),a
   jp Disp
Right:
   ld a,(X_COORD)
   inc a
   ld (X_COORD),a
   jp Disp
Up:
   ld a,(Y_COORD)
   dec a
   ld (Y_COORD),a
   jp Disp
Down:
   ld a,(Y_COORD)
   inc a
   ld (Y_COORD),a
   jp Disp
End:
   bcall(_clrLCDfull)
   ret

X_COORD:
   .db 17
Y_COORD:
   .db 0

smileyFace:
  .db %00000000
  .db %01100110
  .db %01100110
  .db %00000000
  .db %00000000
  .db %10000001
  .db %01000010
  .db %00111100

.end


Yes I know that there is no bounds checking to make sure the sprite doesn't go off the screen, and yes I know that the sprite keeps getting redrawn without erasing the last one... What I can NOT figure out is why the program doesn't seem to be responding to any key presses at all. It displays the smileyFace once, as intended, but then it gets stuck in some infinite loop from which I cannot escape. From debugging, I believe that this is occurring inside the loop label, seemingly because the program isn't recognizing when a new key is pressed and a is made nonzero. But I really have no idea. I just wanna make my smileyFace move, help!!
Also, you know how in Basic you can make a program be run through MirageOS by putting two colons on the first line of code? What is the equivalent thing that must be written in asm code to make a program be run by Mirage?
You've got some wild jumping going around there, you're not going to miss a keypress, the calculator is too quick. All i did was remove some of the jumps (changed no other code) and it works fine for me:

Code:
#include    "ti83plus.inc"
#include "ion.inc"
.org    $9D93
.db    $BB, $6D

   ret
   jr nc,start
.db "test",0

start:
   bcall(_clrLCDfull)
   bcall(_grbufclr)
   set fullScrnDraw, (IY + apiFlg4)
loop:            ;Wait for user input
   bcall(_getCSC)
   cp skEnter
   jp z,End
   cp skClear
   jp z,End
   cp skLeft
   jp z,Left
   cp skRight
   jp z,Right
   cp skUp
   jp z,Up
   cp skDown
   jp z,Down
   jp loop
Disp:
   ld b,8         ;Display the sprite at (X_COORD, Y_COORD)
   ld a,(Y_COORD)
   ld l,a
   ld a,(X_COORD)
   ld ix,smileyFace
   call ionPutSprite 
   call ionFastCopy
   jp loop

Left:
   ld a,(X_COORD)
   dec a
   ld (X_COORD),a
   jp Disp
Right:
   ld a,(X_COORD)
   inc a
   ld (X_COORD),a
   jp Disp
Up:
   ld a,(Y_COORD)
   dec a
   ld (Y_COORD),a
   jp Disp
Down:
   ld a,(Y_COORD)
   inc a
   ld (Y_COORD),a
   jp Disp
End:
   bcall(_clrLCDfull)
   ret

X_COORD:
   .db 17
Y_COORD:
   .db 0

smileyFace: 
  .db %00000000 
  .db %01100110 
  .db %01100110 
  .db %00000000 
  .db %00000000 
  .db %10000001 
  .db %01000010 
  .db %00111100


As for MirageOS, you have two options:
1. Simply use the ion header (MirageOS detects ion files, you could probably even use the MirageOS functions this way).
2. Put the MirageOS header, not that different from the ion header, at the start of your program.

Code:
#include   "ti83plus.inc"         ;General TI-83 Plus include file
#include   "mirage.inc"         ;MirageOS include file
   .org   $9d93            ;Origin (set back two to account for AsmPrgm)
   .db   $BB,$6D            ;Compiled AsmPrgm token
   ret               ;So TIOS wont run the program
   .db   1            ;Identifier as MirageOS program
   .db   %00000000,%00000000      ;15x15 button
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   "Description",0         ;Zero terminated description
                  ;Program code starts here
Do you think you could send me a link to download mirage.inc? It didn't come with Doors SDK and I cant seem to find it on ticalc.org
Why not just use dcs7.inc and use a Doors CS header? Doors CS can run Ion, MirageOS, and Doors CS programs, and offers a ton more routines than Ion or MOS on their own. Smile
Dammit Kerm how are you so good with calculators! You continue to amaze me sir; Doors CS is crazy impressive and you've made my life so much easier now that I have it on my emulator. I'm a still a tad confused on how to make ASM programs compatible with it though. My program #includes the ti83plus and dcs7 .inc files, but although the program appears on the DCS desktop, it returns BASIC Ex Err:prg, and I have no idea what that means. What exactly is the DCS header that you need to put at the start of your code?
Ok scratch that, I did the unthinkable and read your manual. Some of the syntax of your header confuses me, but I got the program to run just fine, and even gave it a fancy little icon and description...any problems now are just bugs in my code:P Thanks again!
I think DoorsCS detects every program and then tries to classify them. For example, it even detects DATA programs (with no code, just level data, sprites, etc.) and classifies them as BASIC programs (since they have no AsmPrgm token at the start). You can find the header here:
http://dcs.cemetech.net/index.php?title=ASM_Header

And the reason for using a MirageOS header would be because not everyone uses DoorsCS, there still appear to be quite a few people who use MirageOS and i dunno if zStart/noShell provide DoorsCS support. Though to be honest, i can't recall ever using any of the MirageOS-specific routines. Initially i used ionFastCopy and the sprite routines, then i started writing my own sprite routines, and now i just write my own fastcopy routines Wink I would just use the ion header for wider compatibility (though i think you'd be safe with MirageOS now because i think very few people use an older shell anymore). Here's a link to the MirageOS developer info just in case: http://www.detachedsolutions.com/mirageos/develop/mirdevinfo.zip
  
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 2 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