view g23m/objdiff/l1_ext/l1_afunc.notes @ 333:7f0df37b785b

l1p_sync.c: fix for pm_read >> 5 shift
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 29 Oct 2017 08:29:06 +0000
parents 576e684603e0
children
line wrap: on
line source

The result of l1_afunc.c recompilation is identical to the original up until
the l1a_clip_txpwr() function, which is the last function in the module.

Original 20070608 version of l1_afunc.obj, disassembly of l1a_clip_txpwr():

$l1a_clip_txpwr:	; Global
; u_char l1a_clip_txpwr();
; Begin function
; REGPARM r0: u_char supplied_txpwr;
; REGPARM r1: u_short radio_freq;
; REG r1: unsigned "C$21";
; REG r1: unsigned "C$22";
; REG r1: unsigned "C$23";
; REG r2: struct ? *"K$6";
; REG r1: u_char "U$41";
; REG r1: u_char "U$82";
; REG r1: u_char "U$95";
; REG r1: u_char "U$108";
; REG r0: u_char power;
; REG r1: u_short radio_freq;
; REG r0: u_char supplied_txpwr;
; REG r3: int "S$20";
; REG r5: int "S$19";
; REG r2: unsigned "S$18";
; REG r1: unsigned "S$17";
; REG r3: int "S$16";
; REG r5: int "S$15";
; REG r2: unsigned "S$14";
; REG r1: unsigned "S$13";
; REG r1: int "S$12";
; REG r5: int "S$11";
; REG r2: unsigned "S$10";
; REG r1: unsigned "S$9";
; REG r3: int "S$8";
; REG r5: int "S$7";
; REG r2: unsigned "S$6";
; REG r1: unsigned "S$5";
; REG r3: int "S$4";
; REG r5: int "S$3";
; REG r2: unsigned "S$2";
; REG r1: unsigned "S$1";
; REG r3: unsigned "U$26";
; REG r3: unsigned "U$26";
; REG r3: unsigned "U$26";
; REG r1: u_char "U$22";
; REG r3: u_char "U$22";
; REG r4: unsigned "U$30";
; REG r4: unsigned "U$30";
; REG r4: unsigned "U$30";
; REG r4: unsigned "U$30";
; REG r4: unsigned "U$30";
; REG r3: unsigned "U$51";
; REG r3: unsigned "U$51";
; REG r1: u_char "U$75";
; REG r1: u_char "U$75";

$CODE16:	; label
     490:	b530		push	{r4, r5, lr}
; switch statement
     492:	4a87		ldr	r2, =_l1_config	; via 0x6b0
     494:	7813		ldrb	r3, [r2, #0]
     496:	1e5b		sub	r3, r3, #1
     498:	2b01		cmp	r3, #1
     49a:	d800		bhi	0x49e
     49c:	e0fa		b	0x694	; GSM or GSM_E
     49e:	3b02		sub	r3, #2
     4a0:	2b00		cmp	r3, #0
     4a2:	d100		bne	0x4a6
     4a4:	e0cf		b	0x646	; PCS1900
     4a6:	3b01		sub	r3, #1
     4a8:	2b00		cmp	r3, #0
     4aa:	d100		bne	0x4ae
     4ac:	e0a4		b	0x5f8	; DCS1800
     4ae:	3b01		sub	r3, #1
     4b0:	2b01		cmp	r3, #1
     4b2:	d968		bls	0x586	; DUAL or DUAL_EXT
     4b4:	3b02		sub	r3, #2
     4b6:	2b00		cmp	r3, #0
     4b8:	d03d		beq	0x536	; GSM850
     4ba:	3b01		sub	r3, #1
     4bc:	2b00		cmp	r3, #0
     4be:	d000		beq	0x4c2	; DUAL_US
     4c0:	e0f5		b	0x6ae	; default - return
; case DUAL_US:
     4c2:	68d3		ldr	r3, [r2, #12]	; 0xc
     4c4:	4299		cmp	r1, r3
     4c6:	d20e		bcs	0x4e6
; low band (850)
     4c8:	4b7c		ldr	r3, =_MIN_TXPWR_GSM850	; via 0x6bc
     4ca:	497d		ldr	r1, =_l1a_l1s_com+0x335	; via 0x6c0
     4cc:	7809		ldrb	r1, [r1, #0]
     4ce:	5c59		ldrb	r1, [r3, r1]
     4d0:	4288		cmp	r0, r1
     4d2:	db06		blt	0x4e2
; line
     4d4:	69d1		ldr	r1, [r2, #28]	; 0x1c
     4d6:	4288		cmp	r0, r1
     4d8:	d800		bhi	0x4dc
     4da:	e0e8		b	0x6ae
; line
     4dc:	0608		lsl	r0, r1, #24
     4de:	0e00		lsr	r0, r0, #24
     4e0:	e0e5		b	0x6ae
; line
     4e2:	1c08		mov	r0, r1		(add r0, r1, #0)
     4e4:	e0e3		b	0x6ae
; high band (1900)
     4e6:	6a54		ldr	r4, [r2, #36]	; 0x24
     4e8:	42a0		cmp	r0, r4
     4ea:	d901		bls	0x4f0
     4ec:	1c05		mov	r5, r0		(add r5, r0, #0)
     4ee:	e001		b	0x4f4
     4f0:	2120		mov	r1, #32	; 0x20
     4f2:	180d		add	r5, r1, r0
     4f4:	4b73		ldr	r3, =_MIN_TXPWR_PCS	; via 0x6c4
     4f6:	4974		ldr	r1, =_l1a_l1s_com+0x336	; via 0x6c8
     4f8:	7809		ldrb	r1, [r1, #0]
     4fa:	5c59		ldrb	r1, [r3, r1]
     4fc:	42a1		cmp	r1, r4
     4fe:	d901		bls	0x504
     500:	1c0b		mov	r3, r1		(add r3, r1, #0)
     502:	e001		b	0x508
     504:	2320		mov	r3, #32	; 0x20
     506:	185b		add	r3, r3, r1
     508:	429d		cmp	r5, r3
     50a:	db12		blt	0x532
; line
     50c:	42a0		cmp	r0, r4
     50e:	d901		bls	0x514
     510:	1c01		mov	r1, r0		(add r1, r0, #0)
     512:	e001		b	0x518
     514:	2120		mov	r1, #32	; 0x20
     516:	1809		add	r1, r1, r0
     518:	6a13		ldr	r3, [r2, #32]	; 0x20
     51a:	42a3		cmp	r3, r4
     51c:	d802		bhi	0x524
     51e:	2220		mov	r2, #32	; 0x20
     520:	18d2		add	r2, r2, r3
     522:	e000		b	0x526
     524:	1c1a		mov	r2, r3		(add r2, r3, #0)
     526:	4291		cmp	r1, r2
     528:	d800		bhi	0x52c
     52a:	e0c0		b	0x6ae
; line
     52c:	0618		lsl	r0, r3, #24
     52e:	0e00		lsr	r0, r0, #24
     530:	e0bd		b	0x6ae
; line
     532:	1c08		mov	r0, r1		(add r0, r1, #0)
     534:	e0bb		b	0x6ae
; case GSM850:
     536:	6a54		ldr	r4, [r2, #36]	; 0x24
     538:	42a0		cmp	r0, r4
     53a:	d901		bls	0x540
     53c:	1c05		mov	r5, r0		(add r5, r0, #0)
     53e:	e001		b	0x544
     540:	2120		mov	r1, #32	; 0x20
     542:	180d		add	r5, r1, r0
     544:	495d		ldr	r1, =_MIN_TXPWR_GSM850	; via 0x6bc
     546:	4b5e		ldr	r3, =_l1a_l1s_com+0x335	; via 0x6c0
     548:	781b		ldrb	r3, [r3, #0]
     54a:	5ccb		ldrb	r3, [r1, r3]
     54c:	42a3		cmp	r3, r4
     54e:	d901		bls	0x554
     550:	1c19		mov	r1, r3		(add r1, r3, #0)
     552:	e001		b	0x558
     554:	2120		mov	r1, #32	; 0x20
     556:	18c9		add	r1, r1, r3
     558:	428d		cmp	r5, r1
     55a:	db12		blt	0x582
; line
     55c:	42a0		cmp	r0, r4
     55e:	d901		bls	0x564
     560:	1c01		mov	r1, r0		(add r1, r0, #0)
     562:	e001		b	0x568
     564:	2120		mov	r1, #32	; 0x20
     566:	1809		add	r1, r1, r0
     568:	69d3		ldr	r3, [r2, #28]	; 0x1c
     56a:	42a3		cmp	r3, r4
     56c:	d802		bhi	0x574
     56e:	2220		mov	r2, #32	; 0x20
     570:	18d2		add	r2, r2, r3
     572:	e000		b	0x576
     574:	1c1a		mov	r2, r3		(add r2, r3, #0)
     576:	4291		cmp	r1, r2
     578:	d800		bhi	0x57c
     57a:	e098		b	0x6ae
; line
     57c:	0618		lsl	r0, r3, #24
     57e:	0e00		lsr	r0, r0, #24
     580:	e095		b	0x6ae
; line
     582:	1c18		mov	r0, r3		(add r0, r3, #0)
     584:	e093		b	0x6ae
; case DUAL:
; case DUAL_EXT:
     586:	68d3		ldr	r3, [r2, #12]	; 0xc
     588:	4299		cmp	r1, r3
     58a:	d20e		bcs	0x5aa
; low band (900)
     58c:	4b4f		ldr	r3, =_MIN_TXPWR_GSM	; via 0x6cc
     58e:	494c		ldr	r1, =_l1a_l1s_com+0x335	; via 0x6c0
     590:	7809		ldrb	r1, [r1, #0]
     592:	5c59		ldrb	r1, [r3, r1]
     594:	4288		cmp	r0, r1
     596:	db06		blt	0x5a6
; line
     598:	69d1		ldr	r1, [r2, #28]	; 0x1c
     59a:	4288		cmp	r0, r1
     59c:	d800		bhi	0x5a0
     59e:	e086		b	0x6ae
; line
     5a0:	0608		lsl	r0, r1, #24
     5a2:	0e00		lsr	r0, r0, #24
     5a4:	e083		b	0x6ae
; line
     5a6:	1c08		mov	r0, r1		(add r0, r1, #0)
     5a8:	e081		b	0x6ae
; high band (1800)
     5aa:	6a54		ldr	r4, [r2, #36]	; 0x24
     5ac:	42a0		cmp	r0, r4
     5ae:	d901		bls	0x5b4
     5b0:	1c05		mov	r5, r0		(add r5, r0, #0)
     5b2:	e001		b	0x5b8
     5b4:	2120		mov	r1, #32	; 0x20
     5b6:	180d		add	r5, r1, r0
     5b8:	4b45		ldr	r3, =_MIN_TXPWR_DCS	; via 0x6d0
     5ba:	4943		ldr	r1, =_l1a_l1s_com+0x336	; via 0x6c8
     5bc:	7809		ldrb	r1, [r1, #0]
     5be:	5c59		ldrb	r1, [r3, r1]
     5c0:	42a1		cmp	r1, r4
     5c2:	d901		bls	0x5c8
     5c4:	1c0b		mov	r3, r1		(add r3, r1, #0)
     5c6:	e001		b	0x5cc
     5c8:	2320		mov	r3, #32	; 0x20
     5ca:	185b		add	r3, r3, r1
     5cc:	429d		cmp	r5, r3
     5ce:	db11		blt	0x5f4
; line
     5d0:	42a0		cmp	r0, r4
     5d2:	d901		bls	0x5d8
     5d4:	1c01		mov	r1, r0		(add r1, r0, #0)
     5d6:	e001		b	0x5dc
     5d8:	2120		mov	r1, #32	; 0x20
     5da:	1809		add	r1, r1, r0
     5dc:	6a13		ldr	r3, [r2, #32]	; 0x20
     5de:	42a3		cmp	r3, r4
     5e0:	d802		bhi	0x5e8
     5e2:	2220		mov	r2, #32	; 0x20
     5e4:	18d2		add	r2, r2, r3
     5e6:	e000		b	0x5ea
     5e8:	1c1a		mov	r2, r3		(add r2, r3, #0)
     5ea:	4291		cmp	r1, r2
     5ec:	d95f		bls	0x6ae
; line
     5ee:	0618		lsl	r0, r3, #24
     5f0:	0e00		lsr	r0, r0, #24
     5f2:	e05c		b	0x6ae
; line
     5f4:	1c08		mov	r0, r1		(add r0, r1, #0)
     5f6:	e05a		b	0x6ae
; case DCS1800:
     5f8:	6a54		ldr	r4, [r2, #36]	; 0x24
     5fa:	42a0		cmp	r0, r4
     5fc:	d901		bls	0x602
     5fe:	1c05		mov	r5, r0		(add r5, r0, #0)
     600:	e001		b	0x606
     602:	2120		mov	r1, #32	; 0x20
     604:	180d		add	r5, r1, r0
     606:	4932		ldr	r1, =_MIN_TXPWR_DCS	; via 0x6d0
     608:	4b2d		ldr	r3, =_l1a_l1s_com+0x335	; via 0x6c0
     60a:	781b		ldrb	r3, [r3, #0]
     60c:	5cc9		ldrb	r1, [r1, r3]
     60e:	42a1		cmp	r1, r4
     610:	d901		bls	0x616
     612:	1c0b		mov	r3, r1		(add r3, r1, #0)
     614:	e001		b	0x61a
     616:	2320		mov	r3, #32	; 0x20
     618:	185b		add	r3, r3, r1
     61a:	429d		cmp	r5, r3
     61c:	db11		blt	0x642
; line
     61e:	42a0		cmp	r0, r4
     620:	d901		bls	0x626
     622:	1c01		mov	r1, r0		(add r1, r0, #0)
     624:	e001		b	0x62a
     626:	2120		mov	r1, #32	; 0x20
     628:	1809		add	r1, r1, r0
     62a:	69d3		ldr	r3, [r2, #28]	; 0x1c
     62c:	42a3		cmp	r3, r4
     62e:	d802		bhi	0x636
     630:	2220		mov	r2, #32	; 0x20
     632:	18d2		add	r2, r2, r3
     634:	e000		b	0x638
     636:	1c1a		mov	r2, r3		(add r2, r3, #0)
     638:	4291		cmp	r1, r2
     63a:	d938		bls	0x6ae
; line
     63c:	0618		lsl	r0, r3, #24
     63e:	0e00		lsr	r0, r0, #24
     640:	e035		b	0x6ae
; line
     642:	1c08		mov	r0, r1		(add r0, r1, #0)
     644:	e033		b	0x6ae
; case PCS1900:
     646:	6a54		ldr	r4, [r2, #36]	; 0x24
     648:	42a0		cmp	r0, r4
     64a:	d901		bls	0x650
     64c:	1c05		mov	r5, r0		(add r5, r0, #0)
     64e:	e001		b	0x654
     650:	2120		mov	r1, #32	; 0x20
     652:	180d		add	r5, r1, r0
     654:	4b1b		ldr	r3, =_MIN_TXPWR_PCS	; via 0x6c4
     656:	491a		ldr	r1, =_l1a_l1s_com+0x335	; via 0x6c0
     658:	7809		ldrb	r1, [r1, #0]
     65a:	5c59		ldrb	r1, [r3, r1]
     65c:	42a1		cmp	r1, r4
     65e:	d901		bls	0x664
     660:	1c0b		mov	r3, r1		(add r3, r1, #0)
     662:	e001		b	0x668
     664:	2320		mov	r3, #32	; 0x20
     666:	185b		add	r3, r3, r1
     668:	429d		cmp	r5, r3
     66a:	db11		blt	0x690
; line
     66c:	42a0		cmp	r0, r4
     66e:	d901		bls	0x674
     670:	1c01		mov	r1, r0		(add r1, r0, #0)
     672:	e001		b	0x678
     674:	2120		mov	r1, #32	; 0x20
     676:	1809		add	r1, r1, r0
     678:	69d3		ldr	r3, [r2, #28]	; 0x1c
     67a:	42a3		cmp	r3, r4
     67c:	d802		bhi	0x684
     67e:	2220		mov	r2, #32	; 0x20
     680:	18d2		add	r2, r2, r3
     682:	e000		b	0x686
     684:	1c1a		mov	r2, r3		(add r2, r3, #0)
     686:	4291		cmp	r1, r2
     688:	d911		bls	0x6ae
; line
     68a:	0618		lsl	r0, r3, #24
     68c:	0e00		lsr	r0, r0, #24
     68e:	e00e		b	0x6ae
; line
     690:	1c08		mov	r0, r1		(add r0, r1, #0)
     692:	e00c		b	0x6ae
; case GSM:
; case GSM_E:
     694:	4b0d		ldr	r3, =_MIN_TXPWR_GSM	; via 0x6cc
     696:	490a		ldr	r1, =_l1a_l1s_com+0x335	; via 0x6c0
     698:	7809		ldrb	r1, [r1, #0]
     69a:	5c59		ldrb	r1, [r3, r1]
     69c:	4288		cmp	r0, r1
     69e:	db05		blt	0x6ac
; line
     6a0:	69d1		ldr	r1, [r2, #28]	; 0x1c
     6a2:	4288		cmp	r0, r1
     6a4:	d903		bls	0x6ae
; line
     6a6:	0608		lsl	r0, r1, #24
     6a8:	0e00		lsr	r0, r0, #24
     6aa:	e000		b	0x6ae
; line
     6ac:	1c08		mov	r0, r1		(add r0, r1, #0)
; line
     6ae:	bd30		pop	{r4, r5, pc}
; End function

Conclusion: the logic contained in the above disassembly is exactly the same
as in the available C code, but there must have been some change to the code
expression that results in different output from the compiler.