home *** CD-ROM | disk | FTP | other *** search
- opt l+,o+,ow-
- *
- * support.s version 8.1 - © Copyright 1990 Jaba Development
- *
- * Author : Jan van den Baard
- * Assembler : Devpac version 2.14
- *
- * library support routines.
- *
-
- incdir 'sys:devpac_inc/'
- include 'mymacros.i'
- include 'exec/exec_lib.i'
-
- *
- * Format routine for "GetDate" which gets it's arguments from the stack.
- *
- xdef DoFmt
-
- DoFmt: movem.l a2-a3/a6,-(sp)
- move.l 16(sp),a3
- move.l 20(sp),a0
- lea.l 24(sp),a1
- move.l #DoBuf,a2
- move.l (_SysBase).w,a6
- libcall RawDoFmt
- movem.l (sp)+,a2-a3/a6
- rts
-
- *
- * This gets called by "RawDoFmt". When called A3 contains the buffer pointer
- * and d0 contains the next formatted character.
- *
- xdef DoBuf
-
- DoBuf: move.b d0,(a3)+
- rts
-
- *
- * Find the last occurance of a character in a string. A0 must point to a
- * null terminated string. D0 must contain the character looked for. When
- * the routine finds the character the addres is returned else null is
- * returned.
- *
- xdef CharRight
-
- CharRight: movea.l a0,a1
- RFindEnd: tst.b (a0)+
- bne.s RFindEnd
- RFindChar: cmpa.l a0,a1
- beq.s RNotFound
- cmp.b -(a0),d0
- bne.s RFindChar
- move.l a0,d0
- rts
- RNotFound: cldat d0
- rts
-
- *
- * Find the first occurance of a character in a string. A0 must point to a
- * null terminated string. D0 must contain the character looked for. When
- * the routine finds the character the addres is returned else null is
- * returned.
- *
- xdef CharLeft
-
- CharLeft: movea.l a0,a1
- LFindEnd: tst.b (a1)+
- bne.s LFindEnd
- LFindChar: cmpa.l a0,a1
- beq.s LNotFound
- cmp.b (a0)+,d0
- bne.s LFindChar
- move.l a0,d0
- dec.l d0
- rts
- LNotFound: cldat d0
- rts
-
- *
- * Copy a null terminated string into a buffer. A0 must point to the buffer.
- * A1 must point to the null terminated string to be copied.
- *
- xdef StrCpy
-
- StrCpy: tst.b (a1)
- beq.s no
- move.b (a1)+,(a0)+
- bne.s StrCpy
- no: move.b #0,(a0)
- rts
-
- *
- * Convert a lower case alphabetical character into upper case.
- * D0 must contain the character.
- *
- xdef ToUpper
-
- ToUpper: cmp.b #'a',d0
- bmi.s NotLoAlp
- cmp.b #'z',d0
- bhi.s NotLoAlp
- sub.b #' ',d0
- NotLoAlp: rts
-
- *
- * Convert a upper case alphabetical character into lower case.
- * D0 must contain the character.
- *
- xdef ToLower
-
- ToLower: cmp.b #'A',d0
- bmi.s NotUpAlp
- cmp.b #'Z',d0
- bhi.s NotUpAlp
- add.b #' ',d0
- NotUpAlp: rts
-
- *
- * Calculate the length of a null terminated string. A0 must be a pointer
- * to a null terminated string. The length of the string, without the null
- * byte, is returned in D0.
- *
- xdef StrLen
-
- StrLen: cldat d0
- SizeLoop: tst.b (a0)+
- beq.s HaveSize
- inc.l d0
- bra.s SizeLoop
- HaveSize: rts
-
- *
- * Compare two strings (case dependant). A0 must point to a null terminated
- * string. A1 must point to a null terminated string. -1, 0 or 1 is returned
- * depending on wether the string in A0 is to be considerd smaller, equal or
- * bigger than the string in A1.
- *
-
- xdef StrCmp
-
- StrCmp: move.b (a0)+,d0
- tst.b d0
- beq.s Smaller
- cmp.b (a1)+,d0
- blo.s Smaller
- bhi.s Bigger
- tst.b d0
- bne.s StrCmp
- cldat d0
- rts
- Smaller: moveq #-1,d0
- rts
- Bigger: moveq #1,d0
- rts
-
- *
- * Compare two strings (case independant). A0 must point to a null terminated
- * string. A1 must point to a null terminated string. -1, 0 or 1 is returned
- * depending on wether the string in A0 is to be considerd smaller, equal or
- * bigger than the string in A1.
- *
- xdef StriCmp
-
- StriCmp: move.b (a0)+,d0
- bsr ToLower
- move.b d0,d1
- tst.b d1
- beq.s Smaller
- move.b (a1)+,d0
- bsr ToLower
- cmp.b d0,d1
- blo.s Smaller
- bhi.s Bigger
- tst.b d1
- bne.s StriCmp
- cldat d0
- rts
-
-