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

I'm back and I got a problem... Yeah I'm a problem all right...



Hi.

I used to be on this newsgroup a lot a long time ago, and now I'm just
coming back to it.

Anyway, I want to start off my return with a fix-my-program-for-me post
(I'm sorry).

I'm writing a ProDOS SYS file equivalent of a BASIC program I wrote a
while ago. All these routines work individually, but for some reason,
when I put them together it all falls apart.

$D7 is a memory location that contains the number of files in a
catalog, up to 54. The catalog is stored in $6800 with 32 bytes
assigned to each file. Each file's entry is just like the parameter
block for a Get File Info MLI call, except there's a 16 byte Pascal
string instead of a pointer at the beginning. $6500 is a string that
contains all of the ProDOS file type mneumonics, and $6400 is an index
of offsets in that string for each file type. The PrintCat routine is
supposed to list these catalog entries in 3 columns of 18 on the
80-column text screen, but for some reason it's listing 255 of them in
weird horizontal cursor positions. I have tried to figure this out but
it continues to frustrate me. I must be overlooking something.


PRINTCAT   LDA $D7   Print the catalog in $6800
           SEC
           SBC #$36
           BCS PRCATOK
           LDA #$36
           STA $D7
PRCATOK   CLC
           LDX #$00
PRCTLOOP   STX $FE
           CPX $D7
           BEQ PRCATEND
           JSR PRINTITM
            LDX $FE
           INX
           CLC
           BCC PRCTLOOP
PRCATEND   RTS

PRINTITM   STX $E3   Print a file name, with index in X (X must be
preserved!)
           TXA
           SEC
           SBC #$35
           BCS PRITMOK
           RTS
PRITMOK   LDX $E3
           INX
           CPX $08
           BNE NOTSEL
           JSR INVERSE
           CLC
           BCC PRITM2
NOTSEL   JSR NORMAL
PRITM2   LDA $E3   Determine cursor position
           CLC
           JSR DIV18
           CLC
           JSR MUL21
           STA $06
           LDA $E3
           CLC
           JSR MOD18
           CLC
           INC
           INC
           INC
           TAY
           LDX $06
           JSR SETPOS
           LDX $E3   Determine address of file entry
           JSR GETFADDR   At this point, $CE contains the address of
the file's entry in $6800-$6EFF
           LDY #$10
           LDA ($CE),Y
           AND #$02
           BEQ PRCATLKD
           LDA #$A0
           JSR $FDED
           CLC
           BCC PRCATULK
PRCATLKD   LDA #$AA
           JSR $FDED
PRCATULK   LDX $CE
           LDY $CF
           JSR PRSTR16
           LDY #$00
           LDA ($CE),Y
           TAX
PRILOOP1   CPX #$10
           BEQ PRILP1XT
           STX $06
           LDA #$A0
           JSR $FDED
           LDX $06
           INX
           CLC
           BCC PRILOOP1
PRILP1XT   LDY #$11
           LDA ($CE),Y
           TAX
           JSR PRINTYPE
           JSR NORMAL
           LDX $E3
           RTS

NORMAL   JMP $F273
INVERSE   JMP $F277
CLRSCRN   JMP $FC58

SETPOS   STY $25   Set text cursor position, in X/Y registers
           STY $05FB
SETXPOS   STX $24   Set just the horizontal cursor position, in X
register
           STX $057B
           JMP $FC22
SETYPOS   STX $25   Set just the vertical cursor position, in X register
           STX $05FB
           JMP $FC22

PRSTR16   STX $06   Print a Pascal string of 15 characters or less
           STY $07
PRSTR16M   LDY #$00
           LDA ($06),Y
           AND #$0F
           STA ($06),Y
PRHISTR   LDY #$00   Print a Pascal string, with address in $06/$07
           LDA ($06),Y
           TAX
           BEQ PRHSTEND
PHS2LOOP   INY
           LDA ($06),Y
           ORA #$80
           JSR $FDED
           DEX
           BNE PHS2LOOP
PRHSTEND   RTS

PRINTYPE   LDA $6400,X   Print a ProDOS file type, with type in X
register
           BEQ UNKTYPE
           TAX
           LDA $6500,X
           JSR $FDED
           INX
           LDA $6500,X
            JSR $FDED
            INX
            LDA $6500,X
            JMP $FDED
UNKTYPE   LDA $6500
            JSR $FDED
           TXA
            JMP $FDDA

DIV18   LDX #$00   Divide accumulator by 18
           SEC
DV18LOOP   SBC #$12
           BCC DIV18END
           INX
           SEC
           BCS DV18LOOP
DIV18END   TXA
           RTS

MOD18   SEC   Modulo accumulator by 18
MD18LOOP   SBC #$12
           BCC MOD18END
           SEC
           BCS MD18LOOP
MOD18END   ADC #$12
           RTS

MUL21   STA $FF   Multiply accumulator by 21
            LDX #$15
ML21LOOP   DEX
            BEQ MUL21END
            CLC
           ADC $FF
           CLC
           BCC ML21LOOP
MUL21END   RTS

GETFADDR   LDY #$00   Get the address of a file entry; file # in X,
address in $CE/CF
            STX $CE
           STY $CF
           CLC
           ROL $CE
           ROL $CF
           CLC
           ROL $CE
           ROL $CF
           CLC
           ROL $CE
           ROL $CF
           CLC
           ROL $CE
           ROL $CF
           CLC
           ROL $CE
           ROL $CF
           LDA $CF
            CLC
           ADC #$68
           STA $CF   At this point, $CE contains the address of the
file's entry in $6800-$6EFF
           RTS

-- 
Hasta la pasta,
Jonathyn Bet'nct


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----