爱技术

 找回密码
 注册会员

QQ登录

只需一步,快速开始

微信登录

微信扫一扫,快速登录

搜索
查看: 1134|回复: 5
收起左侧

[原创]短消息计数的源码和思路

[复制链接]
发表于 2005-8-10 00:00:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册会员 微信登录

x
今天有点累了,明天来了再注释,大家主要看一下类似于IMEI信息的这种窗体和自定义字串的使用。

$Segmented
$Mod167

;Memory Function
memchr                                                EQU 0xC78360  ;Finds characters in a buffer. R12 = Offset R13 = Page R14 = Char R15 = Size
memcmp                                                EQU        0xC78388  ;[R0] = Size.
memcpy                                                EQU 0xC783DC  ;[r0] = size r12 = Dstoff  r13 = Dstpag r14 = Srcoff r15 = Srcpag
memset                              EQU 0xC78416  ;R13:R12 = pDst R14 = char r15 = size           
                           
;String Function                                
strcat                                                EQU 0xC784A6  ;Append a string. r12 = Dstoff  r13 = Dstpag r14 = Srcoff r15 = Srcpag
strchr                                                EQU 0xC784CC  ;Find a character in a string. R12 = Offset R13 = Page R14 = Char
strrchr                                         EQU 0xC785CC  ;Scan a string for the last occurrence of a character.
strcmp                                                EQU 0xC784EE  ;Compare strings. r12 = Dstoff  r13 = Dstpag r14 = Srcoff r15 = Srcpag
strncmp                                          EQU 0xC78578  ;Compare strings. [R0] = Size
strcpy                                                EQU 0xC78516  ;Copy a string. r12 = Dstoff  r13 = Dstpag r14 = Srcoff r15 = Srcpag
strncpy                             EQU 0xC7859E  ;R13:R12 = DST  R15:R14 = SRC [R0] =  size
strcspn                                                EQU 0xC785F0  ;Find a substring in a string.r12 = Setoff  r13 = Setpag r14 = SubSrcoff r15 = SubSrcpag
strset                                                EQU 0xC78416  ;Set characters of a string to a character.R12 = Offset R13 = Page R14 = Char R15 = Size
strlen                                                EQU 0xC78536  ;R12 = Offset R13 = Page R4 = Length
                           
;String format                      
sprintf                             EQU 0xA4D282  ;R13:R12 = pDst R15:R14 = Format [r0...]...           
WordToDigString_LE_6                        EQU 0xC7891E      
                    
;AT Function                                    
SendATCommand                                EQU 0xCC9DCC  ;Send reply string.
GetATCommandLine                EQU 0xCD6B68            
StoreStringR13R12toSendLater    EQU 0xCDB04C   
  
;MenuFunction
CreateMenu                                             EQU 0xF5BB52
SetMenu                                                          EQU 0xF648C2
GetSelectMenu                                         EQU 0xF64A28
UpdateMenu                                   EQU 0xF6302C

ShowMessageDlg                                         EQU 0xDD8FE4

StoreTextAsStringId                                 EQU 0xE4A7CE    ;void StoreTestAsStringId(int ID, char far *String, int unknown = 0)   
ClearStringID                                         EQU 0xE4A990    ;void ClearStringID(int ID, int unknown = 0)

                  
;Address for Patch Data
BattleHistoryAddress                        EQU 0x03BA32
Flash_Address                                EQU 0x800000
MAIN_Address                                     EQU 0xBF1E20
      
Patch        Section Code Word At MAIN_Address ; Start Patch at Patch_Address
    main proc far  ; start main of patch
      
        mov     [-r0], r9
        mov     [-r0], r8
        mov                [-r0], r7
        mov                [-r0], r6
        sub     r0, #40h
        mov     r12, r0
        and     r12, #3FFFh
        mov     r13, DPP1
        mov     r14, #pof(strRecieved)
        mov     r15, #pag(strRecieved)
        calls   seg(strcpy),sof(strcpy)
        mov     r8, #10
                          
        extp        #pag(BattleHistoryAddress),#1                     
        mov     R6, pof(BattleHistoryAddress)
        mov     r12, R6
        mov     r13, r0
        and     r13, #3FFFh
        mov     r14, DPP1
        add     r13, r8
        calls   seg(WordToDigString_LE_6), sof(WordToDigString_LE_6)
        mov                r12, r4
        mov                r13, r5
        calls   seg(strlen), sof(strlen)
        add     r8, r4
               
        movb    rl1, #0Dh
        mov     r12, r8
        add     r12, r0
        movb    [r12], rl1
        add     r8, #1
        
        mov     r12, r0
        and     r12, #3FFFh
        mov     r13, DPP1
        add                r12, r8
        mov     r14, #pof(strSent)
        mov     r15, #pag(strSent)
        calls   seg(strcpy),sof(strcpy)
        add     r8, #6
        
        extp        #pag(BattleHistoryAddress+2),#1                     
        mov     R6, pof(BattleHistoryAddress+2)
        mov     r12, R6
        mov     r13, r0
        and     r13, #3FFFh
        mov     r14, DPP1
        add     r13, r8
        calls   seg(WordToDigString_LE_6), sof(WordToDigString_LE_6)
        mov                r12, r4
        mov                r13, r5
        calls   seg(strlen), sof(strlen)
        add     r8, r4

        movb    rl1, #0
        add     r8, r0
        movb    [r8], rl1
        mov     r12, #138Bh
        mov     r13, r0
        and     r13, #3FFFh
        mov     r14, DPP1
        mov     r15, #0
        calls   0E4h, StoreTextAsStringId
        mov     r12, #pof(WndClass)
        mov     r13, #pag(WndClass)
        mov     r14, #pof(TextList)   
        mov     r15, #pag(TextList)
        calls   0DDh, ShowMessageDlg
                              
        add     r0, #040h ; '?
        mov     r6, [r0+]
        mov     r7, [r0+]
        mov     r8, [r0+]
        mov     r9, [r0+]
        rets

    main endp

    NewOnSelect proc far  ; start main of patch
                cmp         R14, #38h
                jmpa    cc_NZ, EndPro
        extp        #pag(BattleHistoryAddress),#2                     
        mov     pof(BattleHistoryAddress), ZEROS
        mov     pof(BattleHistoryAddress+2), ZEROS
EndPro:
                rets
    NewOnSelect endp
   

   
strRecieved:
                db 'Recieved: ', 0
strSent:
                db 'Sent: ', 0                    
      
SKeyList:
        dw 38h
        dw 52h
        dw 206h
        dw 52h
        dw 52h
        dw 0FFFEh
        dw 52h
        dw 52h
        dw 0FFFEh
        dw 25h
        dw 52h
        dw 274h

TextList:   
;                dw 56Dh
        dw 138Bh
        dw 7FFFh
WndClass:         
        dw 4000h              ; Flag1
        dw 0                  ; Flag2
        dw 22h                ; Flag3
        dw 0                  ; TimeToKeep
        dw 0                  ; unknown
        dw 4DFh               ; DialogTitle
        dw 0                  ; Offset
        dw 0                  ; Page
        dw sof(NewOnSelect)   ; HandleOffset
        dw seg(NewOnSelect)   ; HandlePage
        dw 0                                    ; Offset1
        dw 0                                    ; Page1
        dw pof(SKeyList)      ; ButtondefOffset
        dw pag(SKeyList)      ; ButtondefPage
        dw 0                  ; field_1C
        dw 0                  ; field_1E

    InSMS proc far
            mov                DPP0, #pag(BattleHistoryAddress)
            mov                r4, pof(BattleHistoryAddress)
            add                r4, #1
            mov                pof(BattleHistoryAddress), R4
            calls   0DCh, 0D25Ch
            rets
    InSMS        endp
    OutSMS proc far
            mov                DPP0, #pag(BattleHistoryAddress)
            mov                r4, pof(BattleHistoryAddress+2)
            add                r4, #1
            mov                pof(BattleHistoryAddress+2), R4
            calls        0DDh, 080DAh
            rets
    OutSMS        endp                    
   
    Patch   EndS
END
发表于 2005-8-10 00:01:00 | 显示全部楼层
没有细看,但是建议狼大考虑把这种窗体处理和以前那个退出询问是否的菜单 做成可以单独调用的函数方式,这样就可以为类似的处理节约代码和时间了。


再发:
  谢谢狼大这个太有用了,基本上看明白了, 就是  其中一部分还不清楚,如。

add     r8, r4               
        movb    rl1, #0Dh
        mov     r12, r8
        add     r12, r0
        movb    [r12], rl1
        add     r8, #1        
mov     r12, r0     


另外向狼大推荐一个 字串ID :  6E0  ,它简直就是为这个定做的.  而且用好了的话,我相信还能够大幅度减少这个补丁的长度。

[此贴子已经被作者于2004-2-26 19:51:42编辑过]

发表于 2005-8-10 00:02:00 | 显示全部楼层
狼大还没来吗? 我在等你看记事的结果阿 :)
发表于 2005-8-10 00:03:00 | 显示全部楼层
这东西小2的好多机油都想要~~~太好了~~~大力UP~~~:)
希望尽快做出适合2128的这个补丁~~~:)
发表于 2005-8-10 00:04:00 | 显示全部楼层
S57也要哦!
发表于 2005-9-8 21:31:17 | 显示全部楼层
不知可否在计入计数前作一个询问的动作呢?这个好复杂..不是改动一下代码可以达到的吧!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员 微信登录

本版积分规则

小黑屋|Archiver|手机版|爱技术 ( 沪ICP备08115260号-3 )

GMT+8, 2024-5-20 00:42

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

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