I am trying to compile this code using Assembly Studion 8x, and I cannot find the file it creates.

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

start:
ld hl,txtHello
ret

txtHello
.db "Hello World"


.end
compile this

Code:
.org $9D93
 .db $BB,$6D
 
 ret
.end
final code

Quote:
#include "ti83plus.inc"
.org $9D95
.db $BB,$6D
#define bcall (label) rst $28 \ .dw label

start:
ld hl,txtHello
B_CALL _PutS
ret
txtHello
.db "Hello World",0

Code:
#include "ti83plus.inc"
keyloop:
  bcall _GetKey
  cp kEnter
  jr nz,keyloop

Code:
#include "ti83plus.inc"
.org $9D95              ;start ram memory storage
.db $BB,$6D             ;asmprgm token

start:
  B_CALL _ClrLCDFull    ;clear the lcd
  ld b,100              ;load register b with 100
  ld a,1                ;load accumulator with 1
loop: 
    ld a,(txtHello)     ;load a with 1
    B_CALL _PutS        ;disp a
  djnz loop             ;goto loop
  ret                   ;ret
txtHello                ;label txtHello
.db 1                   ;store 1 to accumulator

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

start:
  B_CALL _ClrLCDFull
  ld b,100  ;b = 100
  ld a,1 ;a = 1
loop: 
    ld a,(txtHello)  ; the byte located at the address of txthello is put in a.  this happens to always be 1 so basically, a = 1
    B_CALL _PutS ; displays the text at the address stored in hl
    B_CALL _NewLine
    B_CALL _NewLine
    B_CALL _NewLine ;8 new lines.  I have no idea why.
    B_CALL _NewLine
    B_CALL _NewLine
    B_CALL _NewLine
    B_CALL _NewLine
    B_CALL _NewLine
  djnz loop ;decrement b and jump if 0.  some of the rom calls may or may not destroy b, I'm not sure
  ret
txtHello
.db 1
I used this code


Code:
#include "ti83plus.inc"
.org $9D95              ;start ram memory storage
.db $BB,$6D             ;asmprgm token

start:
  B_CALL _ClrLCDFull    ;clear the lcd
  ld b,100              ;load register b with 100
  ld hl,1                ;load HL with 1
loop: 
    ld a,(txtHello)     ;load a with 1
    B_CALL _PutS        ;disp a
    sub (hl)
  djnz loop             ;goto loop
  ret                   ;ret
txtHello                ;label txtHello
.db 1                   ;store 1 to accumulator



and it did this


What the hell are you trying to do? Whatever it is, you clearly have no idea what you're doing. Let's start with what exactly you're trying to do so I can explain what you're screwing up. Secondly, don't forget the .end / END at the end. Thirdly, and the reason I'm annoyed, stop triple-posting, it's rude and annoying.
sorry Kerm, we were just using this as a way to display code better. Second, Will_W was teaching me assembly, so anything I was having trouble with I would post it so he could see my source code.
_player1537 wrote:
sorry Kerm, we were just using this as a way to display code better. Second, Will_W was teaching me assembly, so anything I was having trouble with I would post it so he could see my source code.
That's fine, and that's a good way to do it. However, that's what the Edit button on each one of your posts is for. If it's less than 24 hours since you had the last post in the same topic, it's considered double-posting and poor netiquette. Now, what exactly are you trying to do with that 100-iteration piece of code?
While he was teaching me then he decided to test me to see what I knew. So he challenged me to create a programs that starts at 1 and counts to 100 and display it in the upper left hand corner. Here is what I have so far


Code:
#include "ti83plus.inc"
.org $9D95              ;start ram memory storage
.db $BB,$6D             ;asmprgm token

start:
  B_CALL _ClrLCDFull
  ld b,100              ;load register b with 100
  ld hl,variable                ;load HL with 1
loop: 
    inc l
    ld l,a
    ld h,0
    B_CALL _DispHL
    djnz loop 
    B_CALL _NewLine           ;goto loop
  ret                   ;                 

variable:
  .DB $00
 
1) Because of the two-byte BB,6D token you need to start at $9d93, not $9d95
2) Why are you loading a into l after you inc l? Surely you should see why that's pointless
3) IIRC, DispHL trashed HL, so it might not be a bad idea to wrap a push hl/pop hl around it.
4) .DB is for a _B_yte, and .DW is for a _W_ord, or 16 bits or two bytes. Since hl is a 16-bit register, you can only load a two-byte value into it. However, even better would be xor a \ ld h,a \ ld l,a, which is three bytes and saves the two-byte .DW statement.
5) Indirection: What you actually meant was ld hl,(Variable), because you want the contents of the memory address Variable, not the actual numerical address. Indirection and stack manipulation are the two most vital z80 ASM concepts you need to master before you can start writing good, efficient code.


Code:
db $BB,$6D             ;asmprgm token

start:
    B_CALL _ClrLCDFull
    ld b,100              ;load register b with 100
    xor a
    ld h,a
    ld l,a
loop:
    inc l
    push hl
    push bc  ;b probably gets trashed too
    B_CALL _DispHL
    pop bc
    pop hl
    djnz loop
    B_CALL _NewLine           ;goto loop
  ret                   ;                 

variable:
  .dw $00

.end
END
did you modify that code any, besides the ".dw" and the pop and push parts?
_player1537 wrote:
did you modify that code any, besides the ".dw" and the pop and push parts?
Surely you can actually READ my post; not only did I explicitly talk about what I suggested before I made the changes, I posted code that you can use your perfectly good brain to compare with the code you posted above.
Sorry, I wasn't sure, when I ran the code it only showed 22-24. I saw your edited post and reread it a couple of times to make sure I understood it. Why do you xor a?
_player1537 wrote:
Sorry, I wasn't sure, when I ran the code it only showed 22-24. I saw your edited post and reread it a couple of times to make sure I understood it. Why do you xor a?
Good question. "xor a" is one byte, and it does the equivalent of "ld a,0", a two-byte instruction. It's a way of resetting the accumulator register with a smaller (though unfortunately no faster) instruction.
thanks, when I run your program exactly, it only shows numbers 1 2 and 3.
9D95 works whereas 9D93 doesn't. I have no idea why.

Code:
   ld hl,1
   
   xor a
   ld (curRow),a;it might actually be 1
loop:
   ld (curCol),a;it might actually be 1
   push HL
   B_CALL _DispHL
   pop HL
   inc l
   ld a,101
   cp l
   ret z
   xor a
   jp loop
It should be 9D93 for the sake of BB6D.
Mapar007 wrote:
It should be 9D93 for the sake of BB6D.
Exactly. We've established that executing the $BB,$6D bytes is harmless, but it's bad form to do so.
  
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