📄 ide.cod
字号:
; 274 :
; 275 : WAIT_IDE_BUSY;
0014c e5d80000 ldrb r0, [r8]
00150 e3100080 tst r0, #0x80
00154 1afffffc bne |$L37168|
; 276 : if (IS_IDE_ERROR)
00158 e5d80000 ldrb r0, [r8]
0015c e3100001 tst r0, #1
00160 0a000003 beq |$L37176|
; 277 : {
; 278 : RETAILMSG(1, (TEXT("ERROR: Sector read failed.\r\n")));
00164 e59f0078 ldr r0, [pc, #0x78]
00168 eb000000 bl EdbgOutputDebugString
0016c |$L37441|
; 279 : return(-1);
0016c e3e07000 mvn r7, #0
00170 ea000015 b |$L37124|
00174 |$L37176|
; 280 : }
; 281 : WAIT_IDE_NOT_DRQ;
00174 e5d80000 ldrb r0, [r8]
00178 e3100008 tst r0, #8
0017c 0afffffc beq |$L37176|
; 282 :
; 283 : // Copy sector buffer contents to callers buffer
; 284 : for(i=0 ; i < (SECTOR_SIZE / sizeof(USHORT)) ; i++)
00180 e1a02007 mov r2, r7
00184 |$L37179|
; 285 : *((USHORT *)pbuf + i) = (USHORT)(READ_IDE_USHORT(IDE_DATA_REG));
00184 e3a00101 mov r0, #1, 2
00188 e1d010b0 ldrh r1, [r0]
0018c e0860082 add r0, r6, r2, lsl #1
00190 e1c010b0 strh r1, [r0]
00194 e2821001 add r1, r2, #1
00198 e1a00801 mov r0, r1, lsl #16
0019c e1a02820 mov r2, r0, lsr #16
001a0 e1a01802 mov r1, r2, lsl #16
001a4 e1a02821 mov r2, r1, lsr #16
001a8 e3520c01 cmp r2, #1, 24
001ac 3afffff4 bcc |$L37179|
; 286 :
; 287 : // Increment total number of sectors and update status bar
; 288 : if (g_bstartcounting)
001b0 e59f0028 ldr r0, [pc, #0x28]
001b4 e5d01000 ldrb r1, [r0]
001b8 e31100ff tst r1, #0xFF
; 289 : {
; 290 : ++g_sectorsread;
001bc 159f2018 ldrne r2, [pc, #0x18]
001c0 15920000 ldrne r0, [r2]
001c4 12801001 addne r1, r0, #1
001c8 15821000 strne r1, [r2]
001cc |$L37124|
; 226 : return(-1);
001cc e1a00007 mov r0, r7
; 291 : //update_statusbar(&g_statbar, g_sectorsread);
; 292 : }
; 293 :
; 294 : return(0);
; 295 : }
001d0 e28dd004 add sp, sp, #4
001d4 e8bd41f0 ldmia sp!, {r4 - r8, lr}
001d8 e12fff1e bx lr
001dc |$L37446|
001dc 00000000 DCD |g_sectorsread|
001e0 00000000 DCD |g_bstartcounting|
001e4 00000000 DCD |??_C@_0BN@HJM@ERROR?3?5Sector?5read?5failed?4?$AN?6?$AA@|
001e8 00000000 DCD |??_C@_0CF@FANO@INFO?3?5Reading?5sector?5?$CILBA?5?$DN?50x?$CFx@|
001ec 00000000 DCD |??_C@_0CL@PJOM@INFO?3?5Reading?5sector?5?$CIP?9CHS?5?$DN?5?$CFd@|
001f0 00000000 DCD |g_bLBAMode|
001f4 |$M37443|
ENDP ; |read_sector|
EXPORT |init_ide|
00000 AREA |.text| { |init_ide| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$init_ide|, PDATA, SELECTION=5, ASSOC=|.text| { |init_ide| } ; comdat associative
|$T37452| DCD |init_ide|
DCD 0x40000701
; Function compile flags: /Ogsy
00000 AREA |.text| { |init_ide| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |init_ide| PROC
; 299 : {
00000 e52de004 str lr, [sp, #-4]!
00004 |$M37450|
; 300 :
; 301 : // Get drive geometry info - needed for LBA -> P-CHS convertion
; 302 : if (id_drive())
00004 eb000000 bl id_drive
00008 e3500000 cmp r0, #0
; 303 : return(-1);
0000c e3e00000 mvn r0, #0
; 304 :
; 305 : return(0);
00010 03a00000 moveq r0, #0
; 306 : }
00014 e8bd4000 ldmia sp!, {lr}
00018 e12fff1e bx lr
0001c |$M37451|
ENDP ; |init_ide|
EXPORT |load_image_ide|
EXPORT |??_C@_04JPBA@B5?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0CL@CPEM@ERROR?3?5IDE?5device?5initialization@| [ DATA ] ; `string'
EXPORT |??_C@_0CE@OECD@ERROR?3?5FAT?5initialization?5failed@| [ DATA ] ; `string'
EXPORT |??_C@_0CD@FELD@ERROR?3?5EOF?5reading?5image?5header?4@| [ DATA ] ; `string'
EXPORT |??_C@_0BL@GAGB@ERROR?3?5File?5read?5failed?4?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0BA@LPOH@Image?5Header?3?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0CO@DKHE@?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9@| [ DATA ] ; `string'
EXPORT |??_C@_0CB@CJKF@Sync?5Bytes?5?5?5?5?$DN?5?8?$CFc?$CFc?$CFc?$CFc?$CFc?$CFc?8?$AN?6@| [ DATA ] ; `string'
EXPORT |??_C@_0BH@DNOO@Image?5Address?5?$DN?50x?$CFx?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0BH@PLBO@Image?5Length?5?5?$DN?50x?$CFx?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0CE@OOJP@ERROR?3?5EOF?5reading?5record?5header@| [ DATA ] ; `string'
EXPORT |??_C@_0BB@JKGB@Record?5Header?3?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0CN@GCHE@?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9@| [ DATA ] ; `string'
EXPORT |??_C@_0BJ@BGIE@Record?5Address?5?5?$DN?50x?$CFx?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0BJ@HCEC@Record?5Length?5?5?5?$DN?50x?$CFx?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0BJ@IAAG@Record?5CheckSum?5?$DN?50x?$CFx?$AN?6?$AA@| [ DATA ] ; `string'
EXPORT |??_C@_0BL@OANF@ERROR?3?5EOF?5reading?5data?4?$AN?6?$AA@| [ DATA ] ; `string'
IMPORT |init_fat|
IMPORT |file_open|
IMPORT |file_close|
IMPORT |file_read|
00000 AREA |.text| { |load_image_ide| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$load_image_ide|, PDATA, SELECTION=5, ASSOC=|.text| { |load_image_ide| } ; comdat associative
|$T37474| DCD |load_image_ide|
DCD 0x40009e02
00000 AREA |.rdata| { |??_C@_04JPBA@B5?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_04JPBA@B5?$AN?6?$AA@| DCB "B5", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CL@CPEM@ERROR?3?5IDE?5device?5initialization@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CL@CPEM@ERROR?3?5IDE?5device?5initialization@| DCB "ERROR: IDE de"
DCB "vice initialization failed.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CE@OECD@ERROR?3?5FAT?5initialization?5failed@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CE@OECD@ERROR?3?5FAT?5initialization?5failed@| DCB "ERROR: FAT in"
DCB "itialization failed.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CD@FELD@ERROR?3?5EOF?5reading?5image?5header?4@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CD@FELD@ERROR?3?5EOF?5reading?5image?5header?4@| DCB "ERROR: EOF "
DCB "reading image header.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BA@LPOH@Image?5Header?3?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BA@LPOH@Image?5Header?3?$AN?6?$AA@| DCB "Image Header:", 0xd, 0xa
DCB 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CO@DKHE@?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CO@DKHE@?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9@| DCB "-"
DCB "------------------------------------------", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CB@CJKF@Sync?5Bytes?5?5?5?5?$DN?5?8?$CFc?$CFc?$CFc?$CFc?$CFc?$CFc?8?$AN?6@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CB@CJKF@Sync?5Bytes?5?5?5?5?$DN?5?8?$CFc?$CFc?$CFc?$CFc?$CFc?$CFc?8?$AN?6@| DCB "S"
DCB "ync Bytes = '%c%c%c%c%c%c'", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BH@DNOO@Image?5Address?5?$DN?50x?$CFx?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BH@DNOO@Image?5Address?5?$DN?50x?$CFx?$AN?6?$AA@| DCB "Image Addr"
DCB "ess = 0x%x", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BH@PLBO@Image?5Length?5?5?$DN?50x?$CFx?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BH@PLBO@Image?5Length?5?5?$DN?50x?$CFx?$AN?6?$AA@| DCB "Image Len"
DCB "gth = 0x%x", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BB@JKGB@Record?5Header?3?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BB@JKGB@Record?5Header?3?$AN?6?$AA@| DCB "Record Header:", 0xd, 0xa
DCB 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CN@GCHE@?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CN@GCHE@?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9?9@| DCB "-"
DCB "-----------------------------------------", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BJ@BGIE@Record?5Address?5?5?$DN?50x?$CFx?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BJ@BGIE@Record?5Address?5?5?$DN?50x?$CFx?$AN?6?$AA@| DCB "Record "
DCB "Address = 0x%x", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BJ@HCEC@Record?5Length?5?5?5?$DN?50x?$CFx?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BJ@HCEC@Record?5Length?5?5?5?$DN?50x?$CFx?$AN?6?$AA@| DCB "Record"
DCB " Length = 0x%x", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BJ@IAAG@Record?5CheckSum?5?$DN?50x?$CFx?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BJ@IAAG@Record?5CheckSum?5?$DN?50x?$CFx?$AN?6?$AA@| DCB "Record C"
DCB "heckSum = 0x%x", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CE@OOJP@ERROR?3?5EOF?5reading?5record?5header@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CE@OOJP@ERROR?3?5EOF?5reading?5record?5header@| DCB "ERROR: EOF r"
DCB "eading record header.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BL@GAGB@ERROR?3?5File?5read?5failed?4?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BL@GAGB@ERROR?3?5File?5read?5failed?4?$AN?6?$AA@| DCB "ERROR: Fil"
DCB "e read failed.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0BL@OANF@ERROR?3?5EOF?5reading?5data?4?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0BL@OANF@ERROR?3?5EOF?5reading?5data?4?$AN?6?$AA@| DCB "ERROR: EOF"
DCB " reading data.", 0xd, 0xa, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |load_image_ide| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |load_image_ide| PROC
; 311 : {
00000 e92d41f0 stmdb sp!, {r4 - r8, lr}
00004 e24dd02c sub sp, sp, #0x2C
00008 |$M37472|
00008 e1a04000 mov r4, r0
0000c e1a06001 mov r6, r1
; 312 : int stat=0;
; 313 : IMGHDR imghdr;
; 314 : RECHDR rechdr;
; 315 : ULONG cnt = 0;
; 316 :
; 317 : DEBUGMSG(ZONE_BOOTPROG, (TEXT("B5\r\n")));
00010 e59f025c ldr r0, [pc, #0x25C]
00014 eb000000 bl EdbgOutputDebugString
; 318 :
; 319 : //
; 320 : g_bstartcounting = 0;
; 321 : g_sectorsread = 0;
00018 e59f0250 ldr r0, [pc, #0x250]
0001c e59f5248 ldr r5, [pc, #0x248]
00020 e3a07000 mov r7, #0
00024 e5807000 str r7, [r0]
00028 e5c57000 strb r7, [r5]
; 322 :
; 323 : // Initialize IDE
; 324 : if (init_ide())
0002c eb000000 bl init_ide
00030 e3500000 cmp r0, #0
; 325 : {
; 326 : RETAILMSG(1, (TEXT("ERROR: IDE device initialization failed.\r\n")));
00034 159f022c ldrne r0, [pc, #0x22C]
00038 1a000075 bne |$L37469|
; 328 : }
; 329 :
; 330 :
; 331 : // Initialize FAT structs
; 332 : if (init_fat())
0003c eb000000 bl init_fat
00040 e3500000 cmp r0, #0
; 333 : {
; 334 : RETAILMSG(1, (TEXT("ERROR: FAT initialization failed.\r\n")));
00044 159f0218 ldrne r0, [pc, #0x218]
00048 1a000071 bne |$L37469|
; 335 : return(-1);
; 336 : }
; 337 :
; 338 : // Open image (finds starting LBA and size - inits structs for later ops)
; 339 : // Only read is supported
; 340 : if (file_open(pname))
0004c e1a00004 mov r0, r4
00050 eb000000 bl file_open
00054 e3500000 cmp r0, #0
; 341 : {
; 342 : RETAILMSG(1, (TEXT("ERROR: File open failed (%s)\r\n"), pname));
00058 11a00004 movne r0, r4
0005c 1a00006c bne |$L37469|
; 343 : return(-1);
; 344 : }
; 345 :
; 346 : // Display status bar
; 347 : //create_statusbar(&g_statbar, 0, (g_fileinfo.fsize / SECTOR_SIZE) - 1);
; 348 : g_bstartcounting = 1;
00060 e3a00001 mov r0, #1
00064 e5c50000 strb r0, [r5]
; 349 :
; 350 : // Get image header
; 351 : stat = file_read((unsigned char *)&imghdr, sizeof(IMGHDR));
00068 e3a0100f mov r1, #0xF
0006c e28d001c add r0, sp, #0x1C
00070 eb000000 bl file_read
; 352 : if (stat == FAT_EOF)
00074 e3a08cff mov r8, #0xFF, 24
00078 e38880fe orr r8, r8, #0xFE
0007c e1500008 cmp r0, r8
; 353 : {
; 354 : RETAILMSG(1, (TEXT("ERROR: EOF reading image header.\r\n")));
00080 059f01d8 ldreq r0, [pc, #0x1D8]
00084 0a000062 beq |$L37469|
; 355 : return(-1);
; 356 : }
; 357 : else if (stat)
00088 e3500000 cmp r0, #0
; 358 : {
; 359 : RETAILMSG(1, (TEXT("ERROR: File read failed.\r\n")));
; 360 : return(-1);
0008c 1a000059 bne |$L37459|
; 361 : }
; 362 :
; 363 : // Determine jump address
; 364 : *pimgloc = imghdr.imgaddr;
00090 e59d0024 ldr r0, [sp, #0x24]
00094 e59d3020 ldr r3, [sp, #0x20]
00098 e1a01400 mov r1, r0, lsl #8
0009c e1a02421 mov r2, r1, lsr #8
000a0 e1a00402 mov r0, r2, lsl #8
000a4 e1801c23 orr r1, r0, r3, lsr #24
; 365 :
; 366 : // Display image header
; 367 : DEBUGMSG(ZONE_INFO, (TEXT("Image Header:\r\n")));
000a8 e59f01ac ldr r0, [pc, #0x1AC]
000ac e5861000 str r1, [r6]
000b0 eb000000 bl EdbgOutputDebugString
; 368 : DEBUGMSG(ZONE_INFO, (TEXT("-------------------------------------------\r\n")));
000b4 e59f019c ldr r0, [pc, #0x19C]
000b8 eb000000 bl EdbgOutputDebugString
; 369 : DEBUGMSG(ZONE_INFO, (TEXT("Sync Bytes = '%c%c%c%c%c%c'\r\n"), imghdr.syncbytes[0], imghdr.syncbytes[1], imghdr.syncbytes[2], imghdr.syncbytes[3], imghdr.syncbytes[4], imghdr.syncbytes[5]));
000bc e1dd32d1 ldrsb r3, [sp, #0x21]
000c0 e59d201c ldr r2, [sp, #0x1C]
000c4 e1a00c03 mov r0, r3, lsl #24
000c8 e1a01c40 mov r1, r0, asr #24
000cc e58d1008 str r1, [sp, #8]
000d0 e1a00802 mov r0, r2, lsl #16
000d4 e1a01842 mov r1, r2, asr #16
000d8 e1a05840 mov r5, r0, asr #16
000dc e1a00c01 mov r0, r1, lsl #24
000e0 e1a04c40 mov r4, r0, asr #24
000e4 e1dd02d0 ldrsb r0, [sp, #0x20]
000e8 e1a03441 mov r3, r1, asr #8
000ec e1a01c00 mov r1, r0, lsl #24
000f0 e1a00c03 mov r0, r3, lsl #24
000f4 e1a02c41 mov r2, r1, asr #24
000f8 e1a01c40 mov r1, r0, asr #24
000fc e58d2004 str r2, [sp, #4]
00100 e1a00c04 mov r0, r4, lsl #24
00104 e58d1000 str r1, [sp]
00108 e1a03c40 mov r3, r0, asr #24
0010c e1a01c05 mov r1, r5, lsl #24
00110 e1a00445 mov r0, r5, asr #8
00114 e1a04c41 mov r4, r1, asr #24
00118 e1a01c00 mov r1, r0, lsl #24
0011c e1a00c04 mov r0, r4, lsl #24
00120 e1a02c41 mov r2, r1, asr #24
00124 e1a01c40 mov r1, r0, asr #24
00128 e59f0124 ldr r0, [pc, #0x124]
0012c eb000000 bl EdbgOutputDebugString
; 370 : DEBUGMSG(ZONE_INFO, (TEXT("Image Address = 0x%x\r\n"), imghdr.imgaddr));
00130 e59d0024 ldr r0, [sp, #0x24]
00134 e59d3020 ldr r3, [sp, #0x20]
00138 e1a01400 mov r1, r0, lsl #8
0013c e1a02421 mov r2, r1, lsr #8
00140 e1a00402 mov r0, r2, lsl #8
00144 e1801c23 orr r1, r0, r3, lsr #24
00148 e59f0100 ldr r0, [pc, #0x100]
0014c eb000000 bl EdbgOutputDebugString
; 371 : DEBUGMSG(ZONE_INFO, (TEXT("Image Length = 0x%x\r\n"), imghdr.imglen));
00150 e59d0028 ldr r0, [sp, #0x28]
00154 e59d3024 ldr r3, [sp, #0x24]
00158 e1a01400 mov r1, r0, lsl #8
0015c e1a02421 mov r2, r1, lsr #8
00160 e1a00402 mov r0, r2, lsl #8
00164 e1801c23 orr r1, r0, r3, lsr #24
00168 e59f00dc ldr r0, [pc, #0xDC]
0016c eb000000 bl EdbgOutputDebugString
; 372 :
; 373 : do
; 374 : {
; 375 : // Get record header
; 376 : stat = file_read((unsigned char *)&rechdr, sizeof(RECHDR));
00170 ea000019 b |$L37471|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -