[A83] Re: ugly symbols with an directory list


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

[A83] Re: ugly symbols with an directory list



I ran into the same problem when creating Jackknife, my shell... and this is
pretty much how I fixed it.  All this does is skip the first two programs in
the table, since I found that these two are always first, unless some
obscure memory operation moves them (which has never yet happened), in which
case your TI-83 most likely has corrupted memory ;):

> kEnter .EQU  05h ; Enter key
> kQuit  .EQU  40h ; Quit key
    skipcounter    .EQU    (saferam location)
>
>
    LD    HL,skipcounter
    LD    (HL),2+1        ;skip the first two programs
> LD HL, (PROGPTR) ; get offset to program/list table
> LD A, 4 ; four programs/keypress
> main_loop:
> LD (count), A ; store latest update of count
>
> LD A, (HL) ; get type of data
> AND 01Fh ; mask out bits 0-4
>
> CP 05H ; program
> JR Z, program
> CP 06H ; protected program
> JR Z, program
> CP 01H ; real list
> JR Z, list
> CP 0DH ; complex list
>
> JR Z, list
> JR the_end ; unknown/end of list
> program:
    ld    a,(skipcounter)
    dec   a                ;is skipcounter=1?
    jr    nz,badprog       ;if no, skip this program

> DEC HL ; move back 3 bytes to length-of-name
> DEC HL
> DEC HL
> CP 06h ; display '*' for protected programs
> JR Z, protected
> LD A, ' '
> JR go_on
> protected:
> LD A, '*'
> go_on:
> CALL _PUTC
> LD B, (HL) ; load length-of-string
> program_loop:
> DEC HL ; move backwards to next char
> LD A, (HL) ; load char
>    CALL    _PUTC ; display char
> DJNZ program_loop
> DEC HL ; move backwards to next item
>
>     CALL    _NEWLINE
> LD A, (count) ; have we displayed four programs?
> DEC A
> JR NZ, main_loop
> key_loop:
> PUSH HL
>     CALL    _GETKEY ; wait for key
> POP HL
>     CP kQuit
> JR Z, the_end
>     CP      kEnter ; enter key?
>     JR      NZ, key_loop ; no
>
> LD A, 4 ; four programs/keypress
> JR main_loop

badprog:
    ld    (skipcounter),a    ;update skip counter with
                            ;decremented value
> list:
> DEC HL ; move back 3 bytes to length-of-name
> DEC HL
> DEC HL
> LD B, (HL) ; load length-of-string
> list_loop:
>
> DEC HL ; move backwards to next char
> DJNZ list_loop
> DEC HL ; move backwards to next item
>
> LD A, (count) ; no change really, load A
> JP main_loop
>
> the_end:
> RET
> count:
> .DB 00h
> .END
>
>
>
>



Follow-Ups: References: