Re: A83: Could somebody _please_ check this code soon?


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

Re: A83: Could somebody _please_ check this code soon?




That's not what it's for.  It's to calculate the virtual screen
diminsions for a bounce word program so no matter how long the string is,
it takes up the whole screen.  Besides, it's more memory efficient to
calculate the centered text on your own, unless you had in mind a program
that used the same code to display different strings or something


>i already wrote a routine to center graph font. i was the one the one
>who asked pat for the info on that rom call, so i kinda beat you to 
>the
>punch. even though it looks remarkably similar, i can guarantee that 
>i
>wrote it before you. i am NOT trying to take credit for your work. i
>just uploaded it to ticalc, in the routines dir. but since it won't 
>show
>up for a day or so, read on and you will be enlightened... (in case 
>you
>were wondering why i included a separate routine just to get the 
>length
>of a string, it is because i needed it in the program i was writing 
>the
>centering routine for. so it just made sense, cause then i could 
>djnz!)
>
>
>;--------= put string centered =--------
>; Author:       Ian Graf
>;               (ian_graf@geocities.com)
>; Platform:     TI-83 Assembly
>; Version:      1.0
>; Date:         10/6/98
>;---------------------------------------
>; to use this routine load hl with the
>; location of the string to center on
>; the graph screen. the string will be
>; drawn centered at penrow.
>;
>; ex:
>;
>;       ld      hl,somestring
>;       call    vputsc
>;
>; feel free to use this in your own
>; programs, but please give me credit.
>;---------------------------------------
>
>
>        #define sfontlen        $4A6C
>        #define vputs           $4781
>        #define pencol          $8252
>
>
>;--------= put string centered =--------
>; input:        hl - string
>;               penrow - row
>; output:       string drawn centered/
>;               cliped
>
>vputsc: push    hl                      ;
>        call    getlength               ; get length of string
>        ld      b,e                     ;
>        xor     a                       ;
>countl: push    bc                      ;
>        push    hl                      ;
>        push    af                      ;
>        ld      a,(hl)                  ; get character
>        ld      h,0                     ;
>        ld      l,a                     ;
>        add     hl,hl                   ; hl = hl*8
>        add     hl,hl                   ;
>        add     hl,hl                   ;
>        call    sfontlen                ; get char width
>        pop     af                      ;
>        cp      93                      ; clip?
>        jr      nc,contc                ;
>        add     a,b                     ;
>contc:  pop     hl                      ;
>        inc     hl                      ;
>        pop     bc                      ;
>        djnz    countl                  ;
>        ld      b,a                     ; center string
>        ld      a,96                    ;
>        sub     b                       ;
>        srl     a                       ;
>        ld      (pencol),a              ;
>        pop     hl                      ;
>        jp      vputs                   ; draw string
>
>
>;--------= get length of string =-------
>
>getlength:
>        ld      bc,100                  ; get length of string in hl
>        xor     a                       ; max length 100 chars
>        push    hl                      ; (the max length can be 
>changed
>        cpir                            ; to fit your needs)
>        ld      hl,99                   ;
>        sbc     hl,bc                   ;
>        ex      de,hl                   ;
>        pop     hl                      ;
>        ret                             ; de = length
>

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
or call Juno at (800) 654-JUNO [654-5866]