易码技术论坛

 找回密码
 加入易码
搜索
查看: 2963|回复: 0

[源码] 精简&除bug以后的nc3000电量检测函数

[复制链接]
发表于 2008-4-2 19:37:04 | 显示全部楼层 |阅读模式
原函数近400字节,除去无法正常显示100%的bug和精简以后,只有200多字节~


.INCLUDE "head.txt"
.INCLUDE "define.txt"
;.org $46BF
MAIN:
;UPDATETEXT
INT CLEARTEXT
LDX #$0D
LOOPA:
LDA WORDA-1,X
STA _TEXTBUF+2,X
DEX
BNE LOOPA
LDX #$08
LOOPB:
LDA WORDB-1,X
STA _TEXTBUF+46,X
DEX
BNE LOOPB
SEI
LDA _BATTERYDET
ORA #$C0
STA _BATTERYDET
LDX #$FF
LOOPC:
INX
CPX #$1F
BCS END
LDA _BATTERYDET
AND #$E0
STA _BATTERYDET
TXA
ORA _BATTERYDET
STA _BATTERYDET
JSR DELAY20
JSR DELAY20
JSR DELAY20
LDA _BATTERYDET
AND #$20
BEQ LOOPC
END:
CLI
TXA
STA _TMPA
JSR CHANGEDATA
JSR DRAWPIC
INT WAIT_KEY
RTS


CHANGEDATA:
SEC
SBC #$06
ASL
ASL
STA _TOASCII_I
INT TOASCII
LDA _TOASCII_O
CMP #$30
BEQ NEXTA
;H EXIST
STA _TEXTBUF+55
LDA _TOASCII_O+1
STA _TEXTBUF+56
NEXTA:
LDA _TOASCII_O+1
CMP #$30
BEQ NEXTB
STA _TEXTBUF+56
NEXTB:
LDA _TOASCII_O+2
STA _TEXTBUF+57
LDA #$25 ;%
STA _TEXTBUF+58
INT REFRESH
RTS


DRAWPIC:
LDA #$14
STA _XA
LDA #$1F
SEC
SBC _TMPA
ASL
CLC
ADC #$14
LDX #$20
LDY #$43
INT BLOCK
LDA #$13
STA _XA
LDX #$21
LDY #$44
INT SQUARE
LDA #$17
STA _XA
LDA #$10
LDX #$1D
LDY #$13
INT SQUARE
LDA #$1E
STA _XA
LDA #$1F
TAY
LDX #$20
INT LINE
LDA #$1E
STA _XA
LDA #$2B
TAY
LDX #$20
INT LINE
LDA #$1E
STA _XA
LDA #$37
TAY
LDX #$20
INT LINE
RTS


WORDA:
.DB "BATTERY CHECK"
_TMPA
.db $00
WORDB:
.DB "BATTERY:"

battery.rar

1.1 KB, 下载次数: 233

包含头文件的源代码

发表于 2008-4-2 23:01:58 | 显示全部楼层
看不懂……
发表于 2008-4-3 12:39:34 | 显示全部楼层
不错,不错。
发表于 2008-6-20 10:55:46 | 显示全部楼层
太好了!
发表于 2008-6-20 11:50:51 | 显示全部楼层
Nc3000的也太麻烦了吧……
您需要登录后才可以回帖 登录 | 加入易码

本版积分规则

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

GMT+8, 2023-6-7 02:52 , Processed in 0.013860 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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