This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
MaxVT103


Member


Joined: 24 Aug 2003
Posts: 109

Posted: 05 Nov 2003 05:17:55 pm    Post subject:

Ok, does anyone know of any good tutorials or know how to read from a file for a regular asm program.

Not so wise Duck Smile
Back to top
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 05 Nov 2003 07:47:46 pm    Post subject:

I didnt write this, Justin Wales did (by the way I figured out what my problem was with reading the numbers, Justin)


Code:
;Standard template for ti83+ asm programs
 #include "ti83plus.inc";File needed to access system routines
 .org userMem-2 ;Define where to start in memory
 .db $BB,$6D ;AsmPrgm instruction
 
 
   ld hl,appvarname
  rst 20h   ;don't use bcall(_Mov9ToOp1) it takes 2 more bytes than rst 20h and they
    ;do the same thing.
  ld hl,24
  bcall(_CreateAppVar)  

;The ROM call CreateAppVar once executed will return the same pointers as ChkFindSym therefore we
;do not need to use ChkFindSym in this case as we can immediately start writing to the appvar
 
   inc de
   inc de;by incrementing de twice we have bypassed the size bytes of the appvar
   push de;save this pointer for later
   
   ld hl,stufftoput ;load pointer to text into hl
  ld bc,10 ;10 being the length of the string
  ldir   ;copy the bytes
   bcall(_getkey)
   bcall(_clrlcdfull)
   
;ok here's where I teach you a bit of optimization
;as you remember I pushed de above to save a pointer
;well that pointer is then stored to the stack
;the neat thing is, we don't have to pop that number back into de.
;we can   pop it back into any 16 bit register we want, therefore if we pop it back into
;hl we no longer need the instruction ex de,hl to switch the pointers
;this results in a 1 byte smaller program and takes 4 clock cycles less per execution.
;these optimizations are rather small and insignificant in this small program but it's things
;like this that add up in the long run.

   pop hl
;there is another major optimization in the next few lines.
;first of all, there is no need for 2 xor a instructions as a doesn't change
;in the ld (curcol),a instruction
;
;second currow preceeds curcol in RAM. Therefore we can use a 16 bit load instruction to load
;both coordinates in two instructions instead of 4

   ld de,00*256+00  ;the first 2 0's are for the cursor row and the 2nd 2 are for the column  ld (currow),de  ;load 1st coordinate to currow, the other byte is copied to curcol

;the method you used takes 8 bytes and 34 clock cycles
;mine takes 7 bytes and 30 clock cycles
;please note you could use this as well
;
;   xor a
;   ld (currow),a
;   ld (curcol),a
;
;That takes the same amount of clock cycles and bytes as my routine above but remember
;that this would only work if both coordinates were 0. My method is more effective overall

   bcall(_puts)
  bcall(_getkey)
   ret
 
stufftoput:
 .db "Test Text",0

appvarname:
 .db AppVarObj,"Tstr",0

.end

;I hope I haven't cluttered your file too much, just thought I'd help ya out a bit :)
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement