home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d8xx
/
d832
/
term.lha
/
Term
/
term-3.1-Source.lha
/
termMisc.asm
< prev
next >
Wrap
Assembly Source File
|
1993-01-24
|
3KB
|
147 lines
**
** termMisc.asm
**
** Miscellaneous assembly language routines.
**
** Copyright © 1990-1993 by Olaf `Olsen' Barthel & MXM
** All Rights Reserved
**
include "exec/lists.i"
include "exec/io.i"
*--------------------------------------------------------------------------
CALL macro
xref _LVO\1
jsr _LVO\1(a6)
endm
*--------------------------------------------------------------------------
csect text,0,0,1,2
*--------------------------------------------------------------------------
xdef _SPrintf
xdef _VSPrintf
xdef _Atol
xdef __BeginIO
xdef __NewList
*--------------------------------------------------------------------------
_SPrintf:
movem.l a2/a3/a6,-(sp) ; Save registers
move.l 4+12(sp),a3 ; Get destination buffer
move.l 8+12(sp),a0 ; Get format string
lea 12+12(sp),a1 ; Get arguments
lea stuffchar(pc),a2 ; Get formatting routine
move.l 4,a6 ; Get ExecBase
CALL RawDoFmt ; Format the string
movem.l (sp)+,a2/a3/a6 ; Restore registers
rts
*--------------------------------------------------------------------------
_VSPrintf:
movem.l a2/a3/a6,-(sp)
move.l 4+12(sp),a3
move.l 8+12(sp),a0
move.l 12+12(sp),a1
lea stuffchar(pc),a2
move.l 4,a6
CALL RawDoFmt
movem.l (sp)+,a2/a3/a6
rts
stuffchar:
move.b d0,(a3)+
rts
*--------------------------------------------------------------------------
*
* A tiny replacement for Atol(), implemented through StrToLong.
*
*--------------------------------------------------------------------------
_Atol: move.l a0,d1 ; Save argument
movem.l d2/a6,-(sp) ; Save registers
pea.l 0 ; Push a zero on the stack
lea.l (sp),a0 ; Get a pointer to the value
move.l a0,d2 ; Get it into a convenient register
move.l _DOSBase(a4),a6 ; Get DOSBase
CALL StrToLong ; Convert the string
tst.l d0
bgt.b 1$ ; Did we get anything sensible?
addq #4,sp ; Fix the stack
moveq #0,d0 ; Clear the result
movem.l (sp)+,d2/a6 ; Restore registers
rts
1$ move.l (sp)+,d0 ; Get the conversion result
movem.l (sp)+,d2/a6 ; Restore registers
rts
*--------------------------------------------------------------------------
*
* Replacements for two amiga.lib provided routines. These are
* special versions which accept their parameters in registers.
*
*--------------------------------------------------------------------------
__BeginIO:
BEGINIO
rts
__NewList:
NEWLIST a0
rts
*--------------------------------------------------------------------------
*
* These two lines are actually to make SLINK believe that some kind
* of startup code will clear the Data/BSS segment before running the
* main program. Since this is no longer necessary with Kickstart 2.x
* these two lines will save quite some disk space.
*
*--------------------------------------------------------------------------
lea __BSSBAS,a0
move.l #__BSSLEN,d0
*--------------------------------------------------------------------------
csect __MERGED
xref _DOSBase
xref __BSSBAS
xref __BSSLEN
end