ap_common.lst

来自「MP3 整个 SDK」· LST 代码 · 共 387 行 · 第 1/2 页

LST
387
字号
    100          * Arguments   : id, 资源代号
    101                  x,y, 屏幕坐标
    102          *
    103          * Returns     : 成功, 1
    104                  失败, 0
    105          *
    106          * Notes       :
    107          *
    108          ********************************************************************************
    109          */
    110          int ResShowPic(WORD id, uchar x, uchar y)
    111          {
   \   0051  C5                PUSH    BC
   \   0052  D5                PUSH    DE
   \   0053  F5                PUSH    AF
   \   0054  F5                PUSH    AF
    112              WORD buf[2];    //buffer for sd read
    113          
    114              ASSERT(id <= UIID_MAX);
    115              
    116              //读entry
    117              SD_FSeek(res_fp, SEEK_SET, (long)id * sizeof(res_entry_t));
   \   0055  6B                LD      L,E
   \   0056  62                LD      H,D
   \   0057  010000            LD      BC,0
   \   005A  3E04              LD      A,4
   \   005C  CD0000            CALL    LWRD ?L_LSH_L03
   \   005F  C5                PUSH    BC
   \   0060  E5                PUSH    HL
   \   0061  0E00              LD      C,0
   \   0063  ED5B0000          LD      DE,(res_fp)
   \   0067  CD0000            CALL    LWRD SD_FSeek
   \   006A  E1                POP     HL
   \   006B  E1                POP     HL
    118              SD_FRead(res_fp, &res_entry, sizeof(res_entry_t));
   \   006C  211000            LD      HL,16
   \   006F  E5                PUSH    HL
   \   0070  011200            LD      BC,res_entry
   \   0073  ED5B0000          LD      DE,(res_fp)
   \   0077  CD0000            CALL    LWRD SD_FRead
   \   007A  F1                POP     AF
    119              if(res_entry.type != RES_TYPE_PIC) return 0;
   \   007B  3A1800            LD      A,(res_entry+6)
   \   007E  3D                DEC     A
   \   007F  2805              JR      Z,?0010
   \   0081            ?0009:
   \   0081  210000            LD      HL,0
    120              ASSERT(res_entry.length <= 512);
   \   0084  1869              JR      ?0013
   \   0086            ?0010:
    121          
    122              //读数据
    123              SD_FSeek(res_fp, SEEK_SET, res_entry.offset);
   \   0086  2A1400            LD      HL,(res_entry+2)
   \   0089  E5                PUSH    HL
   \   008A  2A1200            LD      HL,(res_entry)
   \   008D  E5                PUSH    HL
   \   008E  4F                LD      C,A
   \   008F  ED5B0000          LD      DE,(res_fp)
   \   0093  CD0000            CALL    LWRD SD_FSeek
   \   0096  E1                POP     HL
   \   0097  E1                POP     HL
    124           
    125              SD_FRead(res_fp, buf, sizeof(buf));
   \   0098  210400            LD      HL,4
   \   009B  E5                PUSH    HL
   \   009C  2B                DEC     HL
   \   009D  2B                DEC     HL
   \   009E  39                ADD     HL,SP
   \   009F  4D                LD      C,L
   \   00A0  44                LD      B,H
   \   00A1  ED5B0000          LD      DE,(res_fp)
   \   00A5  CD0000            CALL    LWRD SD_FRead
   \   00A8  F1                POP     AF
    126           
    127              res_region.width = (char)buf[0];
   \   00A9  210000            LD      HL,0
   \   00AC  39                ADD     HL,SP
   \   00AD  7E                LD      A,(HL)
   \   00AE  322400            LD      (res_region+2),A
    128              res_region.height = (char)buf[1];
   \   00B1  23                INC     HL
   \   00B2  23                INC     HL
   \   00B3  7E                LD      A,(HL)
   \   00B4  322500            LD      (res_region+3),A
    129              
    130              //显示
    131              res_region.x = x;
   \   00B7  210600            LD      HL,6
   \   00BA  39                ADD     HL,SP
   \   00BB  7E                LD      A,(HL)
   \   00BC  322200            LD      (res_region),A
    132              res_region.y = y;
   \   00BF  210A00            LD      HL,10
   \   00C2  39                ADD     HL,SP
   \   00C3  7E                LD      A,(HL)
   \   00C4  322300            LD      (res_region+1),A
    133              PutSDImage(&res_region, res_fp->rwpointer);
   \   00C7  211400            LD      HL,20
   \   00CA  ED4B0000          LD      BC,(res_fp)
   \   00CE  09                ADD     HL,BC
   \   00CF  4E                LD      C,(HL)
   \   00D0  23                INC     HL
   \   00D1  46                LD      B,(HL)
   \   00D2  23                INC     HL
   \   00D3  5E                LD      E,(HL)
   \   00D4  23                INC     HL
   \   00D5  56                LD      D,(HL)
   \   00D6  D5                PUSH    DE
   \   00D7  C5                PUSH    BC
   \   00D8  112200            LD      DE,res_region
   \   00DB  CD0000            CALL    LWRD PutSDImage
   \   00DE  E1                POP     HL
   \   00DF  E1                POP     HL
    134              if(ui_auto_update) UpdateScreen(&res_region);
   \   00E0  3A0000            LD      A,(ui_auto_update)
   \   00E3  B7                OR      A
   \   00E4  2806              JR      Z,?0012
   \   00E6            ?0011:
   \   00E6  112200            LD      DE,res_region
   \   00E9  CD0000            CALL    LWRD UpdateScreen
   \   00EC            ?0012:
    135              return 1;
   \   00EC  210100            LD      HL,1
    136          }
   \   00EF            ?0013:
   \   00EF  F1                POP     AF
   \   00F0  F1                POP     AF
   \   00F1  F1                POP     AF
   \   00F2  F1                POP     AF
   \   00F3  C9                RET
    137          #ifdef InvertFlag 
    138          int ResInvertShowPic(WORD id, uchar x, uchar y)
    139          {
    140              WORD buf[2];    //buffer for sd read
    141          
    142              ASSERT(id <= UIID_MAX);
    143              
    144              //读entry
    145              SD_FSeek(res_fp, SEEK_SET, (long)id * sizeof(res_entry_t));
    146              SD_FRead(res_fp, &res_entry, sizeof(res_entry_t));
    147              if(res_entry.type != RES_TYPE_PIC) return 0;
    148              ASSERT(res_entry.length <= 512);
    149          
    150              //读数据
    151              SD_FSeek(res_fp, SEEK_SET, res_entry.offset);
    152           
    153              SD_FRead(res_fp, buf, sizeof(buf));
    154           
    155              res_region.width = (char)buf[0];
    156              res_region.height = (char)buf[1];
    157              
    158              //显示
    159              res_region.x = x;
    160              res_region.y = y;
    161              PutSDImage(&res_region, res_fp->rwpointer);
    162              InvertRegion(&res_region);
    163              if(ui_auto_update) UpdateScreen(&res_region);
    164              return 1;
    165          } 
    166          #endif 
    167          
    168          #pragma function=default
    169          
   \   0000                    RSEG    UDATA0
   \   0000            res_fp:
   \   0002                    DEFS    2
   \   0002            res_head:
   \   0012                    DEFS    16
   \   0012            res_entry:
   \   0022                    DEFS    16
   \   0022            res_region:
   \   0026                    DEFS    4
   \   0000                    RSEG    IDATA0
   \   0000            ui_auto_update:
   \   0001                    DEFS    1
   \   0001            ui_auto_select:
   \   0002                    DEFS    1
   \   0002            ui_run_realtime:
   \   0003                    DEFS    1
   \   0000                    RSEG    CDATA0
   \   0000  01                DEFB    1
   \   0001  01                DEFB    1
   \   0002  00                DEFB    0
   \   0003                    END

Errors: none
Warnings: none
Code size: 244
Constant size: 3
Static variable size: Data(41) Iram(0)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?