Re: A83: Re: Assembly-83 Digest V1 #842


[Prev][Next][Index][Thread]

Re: A83: Re: Assembly-83 Digest V1 #842




In a message dated 10/11/99 11:18:24 AM Central Daylight Time, 
benjamin99@juno.com writes:

> > But I still
>  > don't know how to do a lot of things. How would I go about setting 
>  > this up?
>  > Should I store the deck in an actual list/matrix? If so how do I 
>  > switch using
>  > ASM?
>  
>  You definitely shouldn't use TI-OS variables for this.  There is an
>  assembler directive (I cant rmember which one) that defines a certain
>  number of bytes in one command.  You would want to use that.
>  
>  .dd  52 'Its something with .dX where X is another letter, not b or w

You shouldnt use the OS matrix and list variables because they are bulky and 
take too many clocks to read from and sort out, compared to using an array 
directly in your program. Each entry in a matrix and list is 9 bytes or so, 
and thats a waste of space... I think that compiler directive you are 
thinking of is ".ds"? I havent gotten that to work successfully, so you best 
avoid it and just put the desired amount of space in the code with ".db 0"s 
or something...
  
>  > If not how do I switch using ASM? Also, program writeback, I 
>  > NEED this in my
>  > program, but I can't seem to figure it out. I don't like using 
>    
>  Program writeback is something that happens automaticaly  For example:
>  
>  Myprog:
>   ld a,5
>   ld (Data1),a
>   ret
>  
>  Data1: .db  0
>  
>  Next time you run the program, Data1 will be 5

Not when he isnt using a shell that does program write back, then there wont 
be any automatic program write back that you speak of. If you choose not to 
program for a shell, then you have to look up your program with _chkfindsym, 
find the starting address, then count the number of bytes your data is 
relative to the start of the program, add that number to the address you get 
from the _chkfindsym, and store your data there. A process that prolly isnt 
worth the bytes or clocks to accomplish, so i recommend using a shell... I'll 
give you a sequence i used in my program FLAGSCAN, which just could not use a 
shell because of the way it functioned, but i still needed to do program 
write back...

Program_Write_Back:
    call _zeroop1           ;Clear OP1 with all 0's to be safe.
    ld de, OP1              ;Make DE point to the Address of OP1.
    ld hl, ProgName         ;Make HL point to the Program's Name.
    ld bc, 9 \ LDIR         ;Copy 9 Bytes form the Name into OP1.
    call _chkfindsym        ;Call Rom Routine to Look Up Program
    inc de \ inc de         ;Skip Past the two Size bytes in Prog.
    ld hl, ProgData-$9327   ;HL is Value Of how many bytes into
                            ; this program, that our Vars are at.
    add hl, de              ;Get correct pointer in HL, of where
                            ; in the program to write back to.
    ex de, hl               ;Exchange the Values in DE and HL.
    ld hl, ProgData         ;Point HL to Data in this Copied Prog.
    ld bc, 4                    ;4 Variables to Copy with the LDIR.
    LDIR \ ret              ;Copy that Data and RET from Subroutine.

ProgName:    .db 5,"ZFLGSCAN"

and you must change the routine accordingly to your program, so the label to 
your data ("ProgData") is right for you, and the number of bytes to copy is 
what you need also. In my case, i had to write back 4 bytes, but yours may be 
more than that, so you should count them up and change that number. All the 
data you need written back muct follow each other, and shouldnt be scattered 
around the source, else you must have several copies of this sequence in your 
prog to write back different places... Well I hope that helps you. You make 
the decision if you want to program for a shell or not, cya... :)

Jason_K