view lib/alib/div8x8.as @ 2811:611715587834 lwtools-port

Updated rules.mak and level1/coco1/bootfiles/makefile Updated the rules.mak file to remove the format entire image related to drivewire server disk images. Updated level1/coco1/bootfiles/makefile to create 3 new bootfile images. These images are stripped down to just the common files needed for vovdg games on os9 level 1. These bootfiles are for becker, dw, and arduino. Also corrected a duplicated dd descriptor when building some bootfiles that had both floppy_40d, floppy_80d, RBDW, RBBECKER, and RBARDUINO. Removed the dd descriptor from each of these sections and made it where the dd descriptor for the specific section was added in the main bootfile list.
author David Ladd <drencor-xeen@users.sf.net>
date Mon, 11 Feb 2013 20:16:24 -0600
parents 03f26e88b809
children
line wrap: on
line source

*********************************
* 8 x 8 Divide

* OTHER MODULES NEEDED: none

* ENTRY: A = divisor
*        B = dividend

*  EXIT: A = remainder
*        B = quotient

 nam 8x8 bit Divide
 ttl Assembler Library Module


 section .bss
negcount rmb 1
 endsect

 section .text

* Signed Divide
SDIV88:
 clr negcount,u
 PSHS D
 tst ,s
 bpl testquo
 lda ,s
 coma
 inca
 sta ,s
 inc negcount,u
testquo
 tst 1,s
 bpl ok
 ldd 1,s
 coma
 adda #$01
 std 1,s
 inc negcount,u
ok
 puls d
 bsr DIV88
 dec negcount,u
 bne goforit
 pshs d
 lda ,s
 coma
 inca
 sta ,s
 lda 1,s
 coma
 inca
 sta 1,s 
 puls d
goforit
 rts


DIV88:
 PSHS A save divisor
 LDA #8 bit counter
 PSHS A
 CLRA initialize remainder

div1
 ASLB shift dividend & quotient
 ROLA
 CMPA 1,S trial subtraction needed
 BLO div2
 SUBA 1,S
 INCB

div2
 DEC 0,S count down # of bits
 BNE div1
 LEAS 2,S clean up stack
 RTS

 endsect