Ok, I'm trying to learn assembly. I JUST STARTED LEARNING TODAY, so everything will have to be explained *completely*. How do I get text to print on the graph screen. I need to be able to specify row and column. Like the Text(4,5, "Hello") command in TI-BASIC
Do ld a,4 \ ld (penRow),a \ ld a,5 \ ld (penCol),a \ ld hl,String \ B_CALL(_VPutS) \ ret \ String: \ .db "Hello",0
Ok, thanks. That works nicely. Now, how to "Pause " a program...
To better explain Souvik's answer, what you have to do is store some numbers into the memory locations that _VPutS uses. You also don't specify if you will be displaying numbers, because that uses something different. To start off, these two statements are equivalent:
Code:
Start:
 ld a,5
 ld (penRow),a
 ld a,12
 ld (penCol),a
 ld hl,String
 bcall VPutS
 ret
String:
 .db "Hello world",0

Code:
Text(5,12,"Hello world")
To break it down, line for line: ld a,5 stores 5 to the register A. A is an 8 bit register, so it can hold the values of zero through 255. We store 5 to A because there is no instruction to store an immediate value to an immediate location. We have to go through a helper variable, A in this case. ld (penRow),a, the TI83Plus.inc file has equates for many locations that are useful to assembly programmers. One of them is penRow, which points to a RAM location that this bcall works with, and tells it what row (vertically) to start writing text from. The next statements are pretty straight-forward. ld a,12 \ ld (penCol),a store 12 to (penCol). A quick note on how I read (penCol). I read it as "at penCol", so "load at penCol comma A" (Yes, I say "comma" to myself). The next line, ld hl,String, stores the memory location of the label "String" to HL. HL is a two byte register, and can hold between zero and 65536. In ASM, you use words (two bytes, whereas "bytes" are just... bytes) to point to memory locations. penCol is a word pointing to $86D7. You use the dollar sign to talk about hexadecimal, which is how you express locations. If you are doing it in decimal, people will start stabbing you. The next statement is kind of controversial (imho), bcall VPutS. I have seen so many ways to express this. I've seen: bcall(_VPutS) \ bcall _VPutS \ b_call _VPutS \ b_call(_VPutS) and I've seen those without the underscore before "VPutS". It really depends though. In actuality, it is really: rst 28h \ .db $4561, but that is too difficult to read, so people use the bcall macro. The next statement is your standard, run-of-the-mill return statement. It just returns execution to the TIOS (in this case). After that, is a label called "String" that points to a memory location, which happens to be right before the .db statement, and right after the ret statement. The next statement defines a set of bytes that correspond to the letters for "Hello", a space, and "world", followed by a null terminator. In ASM, as well as C, you use null terminated strings. All that means is that functions know where the end of a string is according to if it has reached a byte that is zero. If it hasn't, you are still in the string. Otherwise, you have to stop working with it, because the next set of bytes could be used by something else. Does that make sense?

And, if you are displaying numbers, you have to use a different bcall, _VDispHL. (That might be a DCS call, I forget.) You would use it like this (these statements are identical)

Code:
Start:
 ld a,10
 ld (penRow),a
 ld a,30
 ld (penCol),a
 ld hl,1234
 bcall _VDispHL
 ret

Code:
Text(10,30,1234)
I won't bore you with the other parts. ld hl,1234 stores the immediate value 1234 to HL (a two byte register). And then bcall _VDispHL is a bcall that displays the value of HL to the screen, as a number. In the other example, HL is used as a pointer to a string, in this, it is just a value. I should also point out something about HL. HL is a combination of two other one-byte registers: H and L. And it is stored in Little Endian. What this means is that ld hl,$1234 will store $12 to L and $34 to H. That shouldn't bother you here, though it is a good thing to know.
Alright. How can I display a horizontal line?

TI-BASIC: Horizontal 5
Do this:
ld a,$FF \ ld b,12 \ ld hl,plotSScreen+(5*12) \ Loop: \ ld (hl),a \ Inc hl \ djnz Loop \ ret
In the following code, my prgm Displays "Hello World", pauses, then after I hit a button, it displays the horizontal line, then quits. I want it to display the horizontal line BEFORE pausing. Help me out?


Code:

.nolist
    #include    "ti83plus.inc"
.list
.org    $9D93
.db    t2ByteTok, tAsmCmp
   Start:
    b_call(_clrLCDFull)
    ld a,0
    ld (penRow),a
    ld a,0
    ld (penCol),a
    ld hl,String
    b_call(_VPutS)
   
    ld a,$FF
    ld b,12
    ld hl,plotSScreen+(5*12)
   
   Loop:
    ld (hl),a
    Inc hl
    djnz Loop
    b_call(_getKey)
    ret
   
   String:
    .db "Hello world",0
.end
.end
TI_Coder wrote:
In the following code, my prgm Displays "Hello World", pauses, then after I hit a button, it displays the horizontal line, then quits. I want it to display the horizontal line BEFORE pausing. Help me out?


Code:

.nolist
    #include    "ti83plus.inc"
.list
.org    $9D93
.db    t2ByteTok, tAsmCmp
   Start:
    b_call(_clrLCDFull)
   
    ld a,$FF
    ld b,12
    ld hl,plotSScreen+(5*12)

   ; The LCD is not mapped to the RAM
   ; plotSScreen is buffer, iFastCopy writes it to the LCD
   call iFastCopy

    ld a,0
    ld (penRow),a
    ld a,0
    ld (penCol),a
    ld hl,String
    b_call(_VPutS)
   
   Loop:
    ld (hl),a
    Inc hl
    djnz Loop
    b_call(_getKey)
    ret
   
   String:
    .db "Hello world",0
.end
.end


Edited above, don't forget to include DCS to use iFastCopy (or ion, w/e)
1) Turn on textwrite,(iy+sgrflags) at the beginning of your program, and off afterwards
2) Add the DCS header
3) Use the iFastCopy routine after you draw your line and write your text.
What is the code to display a horizontal line, then pause?

I'm looking for the most simple, straight-forward way. Let's see what you guys have =D
That is the most straightforward way. iFastCopy copies from the graph buffer to the LCD. The textwrite flag makes text go to the buffer instead of the LCD, so that when you iFastCopy, the text and the line go to the LCD together.
Ok, but the code he gave me doesn't want to compile, and you gave me directions assuming I know how to interpret them. This is my first day with ASM. Telling me to call iFastCopy doesn't help me too much. I don't know whether to write "b_call(_iFastCopy)" or "call iFastCopy"
It's "call iFastCopy", because iFastCopy is a shell routine, not an OS routine.
TI_Coder wrote:
Ok, but the code he gave me doesn't want to compile, and you gave me directions assuming I know how to interpret them. This is my first day with ASM. Telling me to call iFastCopy doesn't help me too much. I don't know whether to write "b_call(_iFastCopy)" or "call iFastCopy"
You call it. Smile And his did the same thing that I suggested except for the missing textwrite,(iy+sgrflags).
I don't want people to have to have DCS to use my programs...
TI_Coder wrote:
I don't want people to have to have DCS to use my programs...
You can make them pure TI-OS ASM, but you lose the support of a lot of routines that will make your life much, much easier if you have them.

Edit: And also what Souvik says below. Smile
Then do B_CALL(_GrfBufCpy) instead of call iFastCopy.
B_CALL(_GrfBufCpy) didn't want to compile. Here is the code I have so far:


Code:

.nolist
    #include    "ti83plus.inc"
.list
.org    $9D93
.db    t2ByteTok, tAsmCmp
   Start:
    b_call(_clrLCDFull)
    ld a,$FF
    ld b,12
    ld hl,plotSScreen+(5*12)
   
   Loop:
    ld (hl),a
    Inc hl
    djnz Loop
    ret
.end
.end


It displays the horizontal line, which is nice, only I want it to pause. How can I do this?
Use B_CALL(_getKey) to pause the program and wait for a key to be pressed.
souvik1997 wrote:
Use B_CALL(_getKey) to pause the program and wait for a key to be pressed.
This. And it's _grbufcpy_v, not _grbufcpy.
  
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
» Goto page 1, 2, 3, 4, 5  Next
» View previous topic :: View next topic  
Page 1 of 5
» 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