Code:
     ld hl,0         ;loading 0 into hl (gives it the number to start at)
     ld b,100      ;loading 100 into b (gives it the number of loops)
Loop:       ;label
     xor a       ;stores 0 into a (that's the row/col i want to display on)
     ld (penRow),a     ;loading a into penRow
     ld (penCol),a      ;loading a into penCol
     VDispHL      ;display the contents of hl
     inc hl       ;increase hl (goes to next number that i want to display)
     djnz Loop      ;run the loop (not too sure how to elaborate)
     ret      ;exit the prgm



That's what I know (or think i know)
DJNZ decrements B, and jumps back to the label specified if the Z flag isn't set.
Oh, ok. Sweet
Or, if you work better with mnemonics: Decrement and Jump if Not Zero. Decrements B and if B is not zero, jump to the label following. Note, that you can only DJNZ 128 bytes forward and backward from the current location.
Ok. The code doesn't work, though. It compiles, but when I run it, nothing displays. And then the program ends...
I completely forgot to say something earlier. I just checked and VDispHL is a DCS call. So, instead of bcall _VDispHL it is call VDispHL. Sorry for the confusion. I'm surprised your program didn't crash, though.
Here is the code I am using....


Code:

.nolist
    #include    "ti83plus.inc"
    #include   "dcs7.inc"
.list
.org    $9D93
.db    t2ByteTok, tAsmCmp

   ld hl,0
   ld b,100
Loop:
   xor a
   ld (penRow),a
   ld (penCol),a
   call VDispHL
   inc hl
   djnz Loop
   ret

.end


It displays "33941", and then it froze. My calculator has crashed...
Before you do the call VDispHL, you need to save the B register and the HL register from being overwritten. You can do this with push BC \ push HL \ call VDispHL \ pop HL \ pop BC.

Edit: You forgot the entire DCS header Razz
To start off, you are using DCS to run this program, correct? After that, you aren't using the DCS header. Here is a slightly modified (smaller, without the pretty stuff like descriptions, icons, and ALEs (not needed here)).
Code:
.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
   .org progstart
   .db $BB,$6D
Init:
   xor d
   ret
   jr Start
   
   .dw 0000         ;or .dw $0000 if you don't have a description
   .db $07,$00         ;always this string
   .dw 0000         ;or .dw $0000 if you don't have an icon
   .dw 0000            ;usually .dw $0000 if you don't have or know what an ALE is
Start:                             ;main routines
You would then match up your Start with the Start from this header. (Header was taken from: http://dcs.cemetech.net/index.php?title=ASM_Header#Normal_Header )

Edit: Also, what Souvik said. Don't forget that you pop in the order that you push. In other words, push bc \ push hl \ call VDispHL \ pop bc \ pop hl won't work the way you expect.
This is the final (working) code:


Code:

.nolist
    #include    "ti83plus.inc"
    #include   "dcs7.inc"
.list
.org    $9D93
.db    t2ByteTok, tAsmCmp

   ld hl,0
   ld b,100
Loop:
   xor a
   ld (penRow),a
   ld (penCol),a
   push hl
   push bc
   call VDispHL
   pop bc
   pop hl
   inc hl
   djnz Loop
   ret

.end
Because you're using a DCS call, you need to add a Doors CS header to your program, to prevent other shells or the TI-OS from mistakenly executing it and crashing on the VDispHL. You can read about the ASM Header on the DCS wiki, although since you seem to have difficulties with reading documentation, here's a sample:


Code:
; Program Name:
; Author:
; Version:
; Date:
; Written for Doors CS 7.0 and higher (http://dcs.cemetech.net)

.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
   .org progstart
   .db $BB,$6D
Init:
   xor d
   ret
   jr Start
   
   .dw Description         ;or .dw $0000 if you don't have a description
   .db $07,$00         ;always this string
   .dw Icon         ;or .dw $0000 if you don't have an icon
   .dw $0000            ;no ALEs
Start:                             ;main routines
   ;etc etc etc
   ;ret
Description:
   .db "Hello World",0   ;can be omitted if .dw Description is .dw 0000 above
Icon:            ;a 16x16 icon (can be omitted if .dw Icon is .dw 0000 above)
   .db %11111111,%11111000
   .db %10000000,%00001100
   .db %10111100,%00001010
   .db %10010010,%00001111
   .db %10010010,%01010001
   .db %10010010,%10101001
   .db %10111100,%01010101
   .db %10000000,%00000001
   .db %10101010,%10101001
   .db %10010101,%01010101
   .db %10101010,%10101001
   .db %10000000,%00000001
   .db %10010101,%01010101
   .db %10101010,%10101001
   .db %10000000,%00000001
   .db %11111111,%11111111
FWIW, I have a shortened header on the page before with the header, though Kerm's is better commented than mine, I believe.
_player1537 wrote:
FWIW, I have a shortened header on the page before with the header, though Kerm's is better commented than mine, I believe.
Ah, I didn't see that, thanks for that. Smile Hopefully TI_Coder will see that.
I just recently got into asm programming again, but can't seem to get anything to compile correctly. I am using the SDK. I write "compile.bat count.asm" into cmd under the correct directory. It compiles count.asm into an empty .8xp file. How can I get it to compile correctly?
Does the assembling/linking process seem to throw any errors? If so, can you post them here? If not, can you start by posting the program source in question here?
No errors. Even the example source code doesn't compile correctly. No matter what prgm I try to compile, it turns it into an empty .8xp file
Do "compile.bat count" and make sure count.asm is under the source/ directory. Also, make sure Python is installed and BinPac8x is running.
As Souvik says, don't put the .asm on the end. I believe if you had read the readme a bit more carefully you might have seen that. Wink
Ok, I've written a "Count" program referring back to a previous project. Here is the working code for it...


Code:

; Program Name: Count
; Author: TI_Coder
; Version: 1.0
; Date: 10.13.11
; Written for Doors CS 7.0 and higher (http://dcs.cemetech.net)

.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
   .org progstart
   .db $BB,$6D
Init:
   xor d
   ret
   jr Start
   
   .dw Description         ;or .dw $0000 if you don't have a description
   .db $07,$00         ;always this string
   .dw Icon         ;or .dw $0000 if you don't have an icon
   .dw ALE            ;usually .dw $0000 if you don't have or know what an ALE is
Start:                             ;main routines
   ;etc etc etc
   ;ret
Description:
   .db "Description",0   ;can be omitted if .dw Description is .dw 0000 above
Icon:            ;a 16x16 icon (can be omitted if .dw Icon is .dw 0000 above)
   .db %11111111,%11111000
   .db %10000000,%00001100
   .db %10111100,%00001010
   .db %10010010,%00001111
   .db %10010010,%01010001
   .db %10010010,%10101001
   .db %10111100,%01010101
   .db %10000000,%00000001
   .db %10101010,%10101001
   .db %10010101,%01010101
   .db %10101010,%10101001
   .db %10000000,%00000001
   .db %10010101,%01010101
   .db %10101010,%10101001
   .db %10000000,%00000001
   .db %11111111,%11111111
ALE:               ;must be omitted if .dw ALE is .dw 0000 above
   .db "ZALE",0,0,0,0 ;always eight bytes, use
   .db "ZLALE",0,0,0 ;zeros for extra bytes
   .db $FF ;put after last ALE

   call clrLCDFull
   ld hl,0
   ld b,100
   
Loop:
   xor a
   ld (penRow),a
   ld (penCol),a
   push hl
   push bc
   call VDispHL
   pop bc
   pop hl
   inc hl
   djnz Loop
   call getKey
   ret
.end


I really would love to start re-writing PAZAAK. I'm starting to understand the language a bit more than I was able to before. I'm actually retaining information lol

Edit: And yes, I used the "Normal Header" from the DCS SDK
So far so good. Smile Since you're writing a Doors CS program, by the way, you can call Pause, which has fewer side effects than calling getkey. Are you writing for the TI-83 or the TI-83+? If the latter, your two calls need to be bcall()s.
  
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 4 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