home *** CD-ROM | disk | FTP | other *** search
- /*
- * Utility assembly routines.
- *
- * Copyright 1992-1993 Merit Network, Inc. and The Regents of the
- * University of Michigan. Usage of this source code is restricted
- * to non-profit, non-commercial purposes. The source is provided
- * "as-is", without warranty.
- */
-
- #include "ppp.h"
-
- /* SetLAPPtr and GetLAPPtr store and return lap pointer */
-
- LapInfo *GetLAPPtr();
-
- void SetLAPPtr(LapInfo *lap) {
- asm {
- lea.l @LapPtr,a0
- move.l lap,(a0)
- bra.s @1
-
- extern GetLAPPtr:
- move.l @LapPtr,d0
- rts
-
- @LapPtr dc.l 0 /* pointer to LAP variable storage */
- @1
- }
- }
-
- /* Clear a block of memory starting from "ptr" (a0) */
- /* with size "cnt" bytes (d0) */
-
- void bzero(b_8 *ptr, short cnt) {
- asm {
- movea.l ptr,a0 ;get pointer to area to zero
- move.w cnt,d0 ;and its length in bytes
- bra.s @20
-
- @10 clr.b (a0)+ ;clear a byte
- @20 dbra d0, @10
- }
- }
-
- /* Return the current value of A5, and set A5 to the passed value */
- long seta5(long v)
- {
- asm {
- move.l a5,d0 ; return current a5 value
- movea.l v,a5 ; set a5 to new value
- }
- }
-
- /* return the current value of A5 */
- long geta5(void)
- {
- asm {
- move.l a5,d0 ; return current a5
- }
- }
-
- /* Return the current value of A4, and set A4 to the passed value */
- long seta4(long v)
- {
- asm {
- move.l a4,d0 ; return current a4 value
- movea.l v,a4 ; set a4 to new value
- }
- }
-
- /* just return the current value of A4 */
- long geta4(void)
- {
- asm {
- move.l a4,d0 ; return current a4
- }
- }
-
- /* set interrupt level */
- short set_sr(short v)
- {
- asm {
- move sr,d0 ; return current sr value
- move v,sr ; set sr to mask interrupts
- }
- }
-
- /* get status register */
- short get_sr(void)
- {
- asm {
- move sr,d0 ; get sr value
- }
- }
-