.sect .text .sect .rom .sect .data .sect .bss .sect .text !---------------------------------------------------------------------------- ! CLEARS , INCREMENTS , DECREMENTS !----------------------------------------------------------------------------- inc_z: move.l sp,a0 4: #if test comp und,(a0) bne 3f ; bsr e_iund 3: #endif ad #1,(a0) #if test bvs 9f #endif jmp (a4) #ifdef lword inl__1W: move.l a2,a0 ; sub.l #4,a0 ; bra 4b inl__2W: move.l a2,a0 ; sub.l #8,a0 ; bra 4b inl__3W: move.l a2,a0 ; sub.l #12,a0 ; bra 4b #else inl__1W: move.l a2,a0 ; sub.l #2,a0 ; bra 4b inl__2W: move.l a2,a0 ; sub.l #4,a0 ; bra 4b inl__3W: move.l a2,a0 ; sub.l #6,a0 ; bra 4b #endif inl_w_1: move.l #-1,d0 ; move.b (a3)+,d0 2: asl.l wmu,d0 1: move.l a2,a0 ; add.l d0,a0 ; bra 4b inl_pw: adroff ; move.w (a5),d0 6: asl.l wmu,d0 ; add.l #0+l0,d0 bra 1b inl_qpw: move.l (sp)+,d0 ; bra 6b inl_nw: adroff ; move.w (a5),d0 ext.l d0 ; bra 2b inl_qnw: move.l (sp)+,d0 ; bra 2b ine_lw: adroff ; move.w (a5),d0 ; bra 5f ine_qw: move.l (sp)+,d0 ; bra 5f ine_w0: clr.w d0 ; move.b (a3)+,d0 5: asl.l wmu,d0 ; move.l d0,a0 add.l a6,a0 ; bra 4b !--------------------------------------------------------------------------- dec_z: move.l sp,a0 4: #if test locptr heaptr extptr 7: bra e_badptr 6: comp und,(a0) ;bne 3f bsr e_iund 3: #endif subt #1,(a0) #if test bvs 9f #endif jmp (a4) del_w_1: move.l #-1,d0 ; move.b (a3)+,d0 1: asl.l wmu,d0 2: move.l a2,a0 ; add.l d0,a0 ; bra 4b del_pw: adroff ; move.w (a5),d0 5: asl.l wmu,d0 ; add.l #0+l0,d0 ; bra 2b del_qpw: move.l (sp)+,d0 ; bra 5b del_nw: adroff ; move.w (a5),d0 ext.l d0 ; bra 1f del_qnw: move.l (sp)+,d0 ; bra 1f dee_w0: clr.w d0 ; move.b (a3)+,d0 0: asl.l wmu,d0 ; move.l d0,a0 add.l a6,a0 ; bra 4b dee_lw: adroff ; move.w (a5),d0 ; bra 0b dee_qw: move.l (sp)+,d0 ; bra 0b #if test 9: bsr e_iovfl !error routine for integer overflow jmp (a4) #endif !---------------------------------------------------------------------------- zrl__1W: cl l_1(a2) ; jmp (a4) zrl__2W: cl l_2(a2) ; jmp (a4) zrl_w_1: move.l #-1,d0 ; move.b (a3)+,d0 1: asl.l wmu,d0 ; add.l a2,d0 move.l d0,a0 #if test locptr 7: bra e_badptr 6: #endif cl (a0) jmp (a4) zrl_nw: adroff ; move.w (a5),d0 ext.l d0 ; bra 1b zrl_qnw: move.l (sp)+,d0 ; bra 1b zrl_pw: adroff ; move.w (a5),d0 2: asl.l wmu,d0 ; add.l a2,d0 move.l d0,a0 ; cl l0(a0) jmp (a4) zrl_qpw: move.l (sp)+,d0 ; bra 2b zre_lw: adroff ; move.w (a5),d0 ; bra 7f zre_qw: move.l (sp)+,d0 ; bra 7f zre_w0: clr.w d0 ; move.b (a3)+,d0 7: asl.l wmu,d0 ; add.l a6,d0 move.l d0,a0 #if test extptr 7: bra e_badptr 6: #endif cl (a0) jmp (a4) zrf_l: adroff ; move.w (a5),d0 ; bra 8f zrf_z: mov (sp)+,d0 8: move.l d7,d1 3: asr.w #1,d0 ; dbcs d1,3b bcs e_oddz ; sub.w #1,d0 0: cl -(sp) ; dbra d0,0b jmp (a4) zer_s0: clr.w d0 ; move.b (a3)+,d0 ; bra 8b zer_l: adroff ; move.w (a5),d0 ; bra 8b zer_z: mov (sp),d0 ; bra 8b ! The test on illegal argument takes some time , specially in 4byte case. !----------------------------------------------------------------------- ! LOGICAL GROUP !------------------------------------------------------------------------- and_1W: mov (sp)+,d1 an d1,(sp) jmp (a4) and_l: adroff ; move.w (a5),d0 ; bra 1f and_z: mov (sp)+,d0 1: ble e_oddz ; move.l d0,a0 move.l d7,d2 2: asr.l #1,d0 ; dbcs d2,2b ; bcs e_oddz add.l sp,a0 ; sub.l #1,d0 3: mov (sp)+,d1; an d1,(a0)+ dbra d0,3b ; jmp (a4) !------------------------------------------------------------------------------ ior_1W: mov (sp)+,d1; inor d1,(sp) jmp (a4) ior_s0: clr.w d0 ; move.b (a3)+,d0; bra 4f ior_l: adroff ; move.w (a5),d0 ; bra 4f ior_z: mov (sp)+,d0 4: ble e_oddz ; move.l d0,a0 move.l d7,d2 5: asr.l #1,d0 ; dbcs d2,5b ; bcs e_oddz add.l sp,a0 ; sub.l #1,d0 move.l d6,d1 3: mov (sp)+,d1 inor d1,(a0)+; dbra d0,3b jmp (a4) !---------------------------------------------------------------------------- xor_l: adroff ; move.w (a5),d0 ; bra 6f xor_z: mov (sp)+,d0 6: ble e_oddz ; move.l d0,a0 move.l d7,d2 8: asr.l #1,d0 ; dbcs d2,8b ; bcs e_oddz add.l sp,a0 ; sub.l #1,d0 7: mov (sp)+,d1 exor d1,(a0)+; dbra d0,7b jmp (a4) !---------------------------------------------------------------------------- com_l: adroff ; move.w (a5),d0 ; bra 0f com_z: mov (sp)+,d0 0: ble e_oddz ; move.l d7,d2 1: asr.l #1,d0 ; dbcs d2,1b ; bcs e_oddz move.l sp,a0 ; sub.l #1,d0 2: nt (a0)+ ; dbra d0,2b jmp (a4) !--------------------------------------------------------------------------- rol_l: adroff ; move.w (a5),d0 ; bra 3f rol_z: mov (sp)+,d0 3: ble e_oddz ; move.l d7,d2 4: asr.l #1,d0 ; dbcs d2,4b bcs e_oddz sub.l #1,d0 mov (sp)+,d1 bmi 2f 0: move.l sp,a0 !d0 = #words-1 , d1 = shift count 5: mov (a0),d2 ; rotl d1,d2 mov d2,(a0)+; dbra d0,5b jmp (a4) 2: nega d1 ; bra 0f 2: nega d1 ; bra 0b ror_l: adroff ; move.w (a5),d0 ; bra 6f ror_z: mov (sp)+,d0 6: ble e_oddz ; move.l d7,d2 7: asr.l #1,d0 ; dbcs d2,7b bcs e_oddz ; sub.l #1,d0 mov (sp)+,d1 bmi 2b 0: move.l sp,a0 8: mov (a0),d2 ; rotr d1,d2 mov d2,(a0)+; dbra d0,8b jmp (a4) !----------------------------------------------------------------------------- ! SET GROUP !------------------------------------------------------------------------------ set_s0: clr.w d0 ; move.b (a3)+,d0 0: ble e_oddz ; move.l #0,d1 mov (sp)+,d1; move.l d0,d2 move.l d7,d3 1: asr.l #1,d2 ; dbcs d3,1b bcs e_oddz ; sub.l #1,d2 2: cl -(sp) ; dbra d2,2b move.l sp,a0 ; move.l d1,d2 asr.l #3,d2 ; cmp.l d0,d2 !d2 byte number bmi 3f ; bsr e_set jmp (a4) 3: #ifdef lword bchg #1,d2 !0->3,1->2 #endif bchg #0,d2 ; add.l d2,a0 bset d1,(a0) ; jmp (a4) !d1 mod 8 bit set set_l: adroff ; move.w (a5),d0 ; bra 0b set_z: mov (sp)+,d0; bra 0b !---------------------------------------------------------------------------- inn_s0: clr.w d0 ; move.b (a3)+,d0 0: ble e_oddz move.l d6,d1 ; mov (sp)+,d1 btst #0,d0 ; bne e_oddz #ifdef lword btst #1,d0 ; bne e_oddz #endif move.l sp,a0 ; add.l d0,sp move.l d1,d2 ; asri #3,d2 comp d2,d0 ; bhi 3f cl -(sp) !#if test ! bsr e_set !#endif jmp (a4) 3: #ifdef lword bchg #1,d2 #else ext.l d2 #endif bchg #0,d2 ; add.l d2,a0 btst d1,(a0) ; beq 7f mov #1,-(sp); jmp (a4) 7: cl -(sp) ; jmp (a4) inn_l: adroff ; move.w (a5),d0 ; bra 0b inn_z: mov (sp)+,d0; bra 0b