易码技术论坛

 找回密码
 加入易码
搜索
查看: 227868|回复: 5

[源码] 小字体的filelist源码[原创]

[复制链接]
发表于 2007-2-4 16:59:57 | 显示全部楼层
有加精的冲动啊!!!
发表于 2007-2-4 17:08:19 | 显示全部楼层
支持,呵呵
发表于 2007-2-4 17:20:28 | 显示全部楼层
不过bin文件有问题,没有加密.用FTPLINK,HOTLINK,都没有办法下载.
 楼主| 发表于 2007-2-4 17:23:08 | 显示全部楼层
还好
可以用ZHAOFEIXXX的编译器编译的
发表于 2007-2-4 19:51:06 | 显示全部楼层
用pac打包后下载
 楼主| 发表于 2007-2-4 16:49:16 | 显示全部楼层 |阅读模式
本帖最后由 gcwy 于 2017-11-18 17:46 编辑

;我闲来无事就试着写写filelist的代码
;我看大家都是在用EASTSUN的filelist
;我便写了个小字体的请大家指教
;大家若想用在自己的程序中就随便用吧
;下面有打包的代码和

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;这是演试程序,可以用ZHAOFEIXXX的编译器编译;;;;;;;;
  .ORG $4000
  .DB $AE,$EE,$EA,$00,$20,$00,$20
        JMP Main
  .DB $DA,$02,$31,$02,$FF,$FF
  .INCLUDE "FileList.txt"
Main:
    JSR filelist
    BCC pn
    INT $C737
    INT $C72A
    LDX #$0E
notpn:
    LDA word2-1,X
    STA $02BF,X
    DEX
    BNE notpn
    JMP pn2
pn:
    INT $C737
    INT $C72A
    LDX #$0B
pn1:
    LDA word-1,X
    STA $02BF,X
    DEX
    BNE pn1
    LDA #$10
    STA $80
    LDA #$18
    STA $81
    LDA #$DA
    STA $82
    LDA #$02
    STA $83
    LDX DIR_NUM
    INX
    INX
    LDY #$00
pn4:
    LDA #$2F
    STA ($82),Y
    INC $82
pn3:
    LDA ($80),Y
    STA ($82),Y
    BEQ pn5
    INY
    CPY #$0E
    BNE pn3
pn5:
    DEX
    BEQ pn2
    CLC
    LDA #$10
    ADC $80
    STA $80
    TYA
    LDY #$00
    ADC $82
    STA $82
    LDA #$00
    ADC $83
    STA $83
    JMP pn4
pn2:
    INT $C719
    INT $C006
    RTS
word:
  .DB "文件路径为:"
word2:
  .DB "没有选择文件!"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;以下是FILELIST的代码;;;;;;;;;;;;;;;;;;;;;
;使用时直接JSR filelist
;没有选择文件则C=0
;选择文件后C=0,返回文件名在$088D,目录在$1800(根目录),$1810(第一层), ...
NAND=$3000  ;将目录所在的NAND块读入地址NAND
FILE_NUM=$400A  ;目录内文件数加1
FIRST_NA=$400B  ;屏幕上第一个文件的序号,从0开始
DIR_NUM=$0B05  ;目录层数,".."为0层
KEY=$400D  ;判断是否按了输入或跳出
CURSOR=$03B4  ;光标所在位置的序号,从0开始
filelist:
    LDA #$00
    STA FIRST_NA
    STA CURSOR
    STA DIR_NUM
    LDY #$04
wd1:
    LDA root-1,Y
    STA $088C,Y
    STA $17FF,Y
    DEY
    BNE wd1
    LDY #$10
    INT $050D
list:
    JSR getblock
    JSR print
    JMP checkkey
;读取目录所在的NAND块到地址NAND
getblock:
    LDA $08e6
    STA $0888
    LDA $08e7
    STA $0889
    LDA #$00
    STA $088A
    STA $088B
    STA $09D2
    LDA #$10
    STA $09D3
    LDA #<NAND
    STA $F0
    LDA #>NAND
    STA $F1
    INT $0505
    LDA #$2E
    STA NAND+2
    STA NAND+3
;计算文件数
filenum:
    LDX #$00
    LDA #<NAND
    STA $80
    LDA #>NAND
    STA $81
num2:
    LDY #$00
    LDA ($80),Y
    INY
    AND ($80),Y
    CMP #$FF
    BEQ num1
    INX
    CLC
    LDA #$10
    ADC $80
    STA $80
    LDA #$00
    ADC $81
    STA $81
    JMP num2
num1:
    STX FILE_NUM
    RTS
;显示到屏幕上
print:
    INT $C72A
    INT $C737
    LDA #<NAND+2
    STA $80
    LDA #>NAND+2
    STA $81
    LDA #$C0
    STA $40
    LDA #$02
    STA $41
    LDA FIRST_NA
    BEQ first2
first1:
    LDX #$00
    STX $81
    ASL
    ROL $81
    ASL
    ROL $81
    ASL
    ROL $81
    ASL
    ROL $81
    CLC
    ADC #<NAND+2
    STA $80
    LDA $81
    ADC #>NAND+2
    STA $81
first2:
    LDY #$00
    LDA FILE_NUM
    SEC
    SBC FIRST_NA
    CMP #$06
    BCC print3
    LDA #$06
print3:
    TAX
print2:
    LDA ($80),Y
    BEQ print1
    STA ($40),Y
    INY
    CPY #$0E
    BNE print2
print1:
    CLC
    LDA $80
    ADC #$10
    STA $80
    LDA $81
    ADC #$00
    STA $81
    CLC
    LDA $40
    ADC #$1A  ;大字为#$14
    STA $40
    LDA $41
    ADC #$00
    STA $41
    LDY #$00
    DEX
    BNE print2
    LDA #$01  ;想改为大字此处要改
    STA $0392
    LDA #$00
    STA $0393
    LDA #$FF
    STA $03AF
    STA $03B0
    INT $C719
;画反显矩形
drawbox:
    LDA #$00
    CLC
    LDX CURSOR
    BEQ draw1
draw2:
    ADC #$0D  ;想改为大字此处要改
    DEX
    BNE draw2
draw1:
    ADC #$01
    STA $03C4
    ADC #$0D
    STA $03C6
    LDA #$00
    STA $03C3
    LDA #$54
    STA $03C5
    LDA #$02
    STA $03C9
    INT $CA0A
    RTS
;检测按键
checkkey:
    LDA #$00
    STA KEY
    INT $C006
    LDY #$00
check:  
    CMP mainkey,Y
    BEQ check1
    INY
    CPY #$0B
    BNE check
    JMP checkkey
check1:
    TYA
    ASL
    TAY
    LDA jmpkey,Y
    STA check2
    INY
    LDA jmpkey,Y
    STA check2+1
  .DB $20
check2:
  .DB $00,$00
    LDA KEY
    CMP #$00
    BEQ ck
    CMP #$02  ;进入了深一层目录
    BEQ isdir
    CMP #$03  ;按了跳出键
    BEQ isexit
    CMP #$04
    BEQ out ;跳出
    CLC
    RTS  ;KEY=01,所选中的是个文件
out:
    SEC
    RTS
ck:
    JMP checkkey
isdir:
    LDA #$00
    STA CURSOR
    STA FIRST_NA
isexit:
    JMP list
mainkey:
  .DB $14,$15,$16,$17,$19,$1B,$0D,$13,$0E,$65,$68
jmpkey:
  .DW Up,Down,Down,Up,Help,Exit,Enter,pageup,pagedown,ekey,hkey
;按E
ekey:
    LDX FILE_NUM
    CPX #$07
    BCS ekey2
    DEX
    STX CURSOR
    LDA #$00
    STA FIRST_NA
    JSR print
    RTS
ekey2:
    LDA #$05
    STA CURSOR
    LDA FILE_NUM
    SEC
    SBC #$06
    STA FIRST_NA
    JSR print
    RTS
;按H
hkey:
    LDA #$00
    STA CURSOR
    STA FIRST_NA
    JSR print
    RTS
;上
Up:
    LDA CURSOR
    BEQ up1
    JSR drawbox
    DEC CURSOR
    JSR drawbox
    RTS
up1:
    LDA FIRST_NA
    BEQ upend
    DEC FIRST_NA
    JSR print
upend:
    RTS
;下
Down:
    LDA CURSOR
    CMP #$05
    BEQ down1
    CLC
    ADC FIRST_NA
    ADC #$01
    CMP FILE_NUM
    BEQ downend
    JSR drawbox
    INC CURSOR
    JSR drawbox
    RTS
down1:
    LDA FIRST_NA
    CLC
    ADC #$06
    CMP FILE_NUM
    BEQ downend
    INC FIRST_NA
    JSR print
downend:
    RTS
;求助
Help:
    INT $C737
    INT $C72A
    LDX #$9C
help1:
    LDA helpword-1,X
    STA $02BF,X
    DEX
    BNE help1
    INT $C719
    INT $C006
    JSR print
    RTS
;跳出
Exit:
    LDA #$03
    STA KEY
    LDA DIR_NUM
    BNE notout
    LDA #$04
    STA KEY
    RTS
notout:
    ASL
    ASL
    ASL
    ASL
    STA $80
    LDA #$18
    STA $81
    LDY #$0F
    LDA ($80),Y
    STA CURSOR
    DEY
    LDA ($80),Y
    STA FIRST_NA
    DEC DIR_NUM
    JSR opendir
    RTS
;输入
Enter:
    LDA #$02
    STA KEY
    LDA CURSOR
    ORA FIRST_NA
    BNE not
    JSR Exit
    RTS
not:
    LDA #$00
    STA $81
    CLC
    LDA CURSOR
    ADC FIRST_NA
    ASL
    ROL $81
    ASL
    ROL $81
    ASL
    ROL $81
    ASL
    ROL $81
    CLC
    ADC #<NAND+2
    STA $40
    LDA $81
    ADC #>NAND+2
    STA $41
    LDX DIR_NUM
    INX
    TXA
    ASL
    ASL
    ASL
    ASL
    STA $80
    LDA #$18
    STA $81
    LDY #$00
enter1:
    LDA ($40),Y
    STA ($80),Y
    BEQ enter3
    INY
    CPY #$0E
    BNE enter1
    LDA #$00
    STA ($80),Y
enter3:
    INC DIR_NUM
    JSR opendir
    BCC enterend
    LDY #$00
enter2:
    LDA ($40),Y
    STA $088D,Y
    BEQ enter4
    INY
    CPY #$0E
    BNE enter2
    LDA #$00
    STA $088D,Y
enter4:
    DEC DIR_NUM
    LDA #$01
    STA KEY
    RTS
enterend:
    LDY #$0F
    LDA CURSOR
    STA ($80),Y
    DEY
    LDA FIRST_NA
    STA ($80),Y
    RTS
;上翻页
pageup:
    LDA FIRST_NA
    CMP #$00
    BEQ pageupend
    CMP #$06
    BCS pageup1
    LDA #$00
    STA FIRST_NA
    JSR print
    RTS
pageup1:
    SEC
    SBC #$06
    STA FIRST_NA
    JSR print
pageupend:
    RTS
;下翻页
pagedown:
    LDA FIRST_NA
    CLC
    ADC #$06
    CMP FILE_NUM
    BCS pagedownend
    STA FIRST_NA
    LDA CURSOR
    CLC
    ADC FIRST_NA
    CMP FILE_NUM
    BCC pagedown1
    LDA FILE_NUM
    SEC
    SBC FIRST_NA
    SBC #$01
    STA CURSOR
pagedown1:
    JSR print
pagedownend:
    RTS
;打开多层目录,是3.6内核int $0530源代码
;若3.6的想直接用INT $0530,则要先将$40保护起来
;文件夹路径写在1800,格式为
;1800第一层(/)
;1810第二层(没有/)
;...
;0B05层数,最多5层

opendir:
    LDA #$00
    STA $82
od6:
    LDA $82
    ASL
    ASL
    ASL
    ASL
    STA $80
    LDA #$18
    STA $81
    LDY #$00
od2:
    LDA ($80),Y
    STA $088D,Y
    BEQ od1
    INY
    CPY #$0E
    BNE od2
    LDA #$00
    STA $088D,Y
od1:
    LDA $088D
    CMP #$2F
    BNE od3
    INT $050A
od3:
    INT $050D
    BCS od4
    LDA $82
    CMP $0B05
    BNE od5
    CLC
    RTS
od4:
    DEC $82
    LDA $82
    STA $0B05
    SEC
    RTS
od5:
    INC $82
    SEC
    BCS od6
root:
  .DB "/.."
  .DB $00
helpword:
  .DB "*********热线帮助*********=========文件列表=========用方向键开或换页键切换要选择的文件,用【输入】键来确认选择。             【H】:目录顶 【E】:目录底 "
  .DB $00

FileList.rar

4 KB, 下载次数: 190

打包以后可以正常下载了

您需要登录后才可以回帖 登录 | 加入易码

本版积分规则

Archiver|手机版|小黑屋|EMAX Studio

GMT+8, 2024-7-19 17:16 , Processed in 0.013950 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表