Skip to content

Commit

Permalink
Merge pull request #4 from doomhack/master
Browse files Browse the repository at this point in the history
Update main branch
  • Loading branch information
Kippykip authored Jan 24, 2020
2 parents f6814b8 + c0fd95a commit 9f581a0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
48 changes: 37 additions & 11 deletions source/fixeddiv.s
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,48 @@ udiv32_arm :

mov r3, r1 /* r3 ← r1 */
cmp r3, r0, LSR #1 /* update cpsr with r3 - r0/2 */
.Lloop2:
movls r3, r3, LSL #1 /* if r3 <= 2*r0 (C=0 or Z=1) then r3 ← r3*2 */
cmp r3, r0, LSR #1 /* update cpsr with r3 - (r0/2) */
bls .Lloop2 /* branch to .Lloop2 if r3 <= 2*r0 (C=0 or Z=1) */

.Lloop2:


.rept 7
movls r3, r3, LSL #1 /* if r3 <= 2*r0 (C=0 or Z=1) then r3 ← r3*2 */
cmp r3, r0, LSR #1 /* update cpsr with r3 - (r0/2) */
bhi .L2Done /* branch to .Lloop2 if r3 <= 2*r0 (C=0 or Z=1) */
.endr

movls r3, r3, LSL #1 /* if r3 <= 2*r0 (C=0 or Z=1) then r3 ← r3*2 */
cmp r3, r0, LSR #1 /* update cpsr with r3 - (r0/2) */
bls .Lloop2 /* branch to .Lloop2 if r3 <= 2*r0 (C=0 or Z=1) */



.L2Done:

mov r2, #0 /* r2 ← 0 */

.Lloop3:
cmp r0, r3 /* update cpsr with r0 - r3 */
subhs r0, r0, r3 /* if r0 >= r3 (C=1) then r0 ← r0 - r3 */
adc r2, r2, r2 /* r2 ← r2 + r2 + C.
.Lloop3:

.rept 7
cmp r0, r3 /* update cpsr with r0 - r3 */
subhs r0, r0, r3 /* if r0 >= r3 (C=1) then r0 ← r0 - r3 */
adc r2, r2, r2 /* r2 ← r2 + r2 + C.
Note that if r0 >= r3 then C=1, C=0 otherwise */

mov r3, r3, LSR #1 /* r3 ← r3/2 */
cmp r3, r1 /* update cpsr with r3 - r1 */
blt .L3Done /* if r3 < r1 branch to .Done */
.endr

cmp r0, r3 /* update cpsr with r0 - r3 */
subhs r0, r0, r3 /* if r0 >= r3 (C=1) then r0 ← r0 - r3 */
adc r2, r2, r2 /* r2 ← r2 + r2 + C.
Note that if r0 >= r3 then C=1, C=0 otherwise */

mov r3, r3, LSR #1 /* r3 ← r3/2 */
cmp r3, r1 /* update cpsr with r3 - r1 */
bhs .Lloop3 /* if r3 >= r1 branch to .Lloop3 */
mov r3, r3, LSR #1 /* r3 ← r3/2 */
cmp r3, r1 /* update cpsr with r3 - r1 */
bhs .Lloop3 /* if r3 >= r1 branch to .Lloop3 */

.L3Done:
mov r0, r2 /* move quotient to r0 return val */
bx lr
1 change: 0 additions & 1 deletion source/r_hotpath.iwram.c
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,6 @@ void R_RenderPlayerView (player_t* player)
R_DrawMasked ();
}


void V_DrawPatchNoScale(int x, int y, const patch_t* patch)
{
y -= patch->topoffset;
Expand Down
1 change: 1 addition & 0 deletions source/v_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ void V_DrawPatch(int x, int y, int scrn, const patch_t* patch)
}
}


// CPhipps - some simple, useful wrappers for that function, for drawing patches from wads

// CPhipps - GNU C only suppresses generating a copy of a function if it is
Expand Down

0 comments on commit 9f581a0

Please sign in to comment.