home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
flexcat-1.5.lha
/
FlexCat
/
languages
/
schw臙isch.asm
< prev
next >
Wrap
Assembly Source File
|
1994-07-04
|
18KB
|
561 lines
*
* $VER: schwäbisch.language 38.2 (13.1.94)
* WARNING: BETA TEST VERSION!!!
*
include 'exec/types.i'
include 'exec/lists.i'
include 'exec/libraries.i'
include 'exec/resident.i'
include 'exec/initializers.i'
include 'libraries/locale.i'
_LVOFreeMem EQU -$d2
; Uncomment this to activate slovene ToUpper and StrCmp function.
;NO_SORT_EXTENSION SET 1
SECTION CODE
moveq #-1,d0
rts
Start dc.w RTC_MATCHWORD
dc.l Start
dc.l End
dc.b RTF_AUTOINIT
dc.b 38
dc.b NT_LIBRARY
dc.b 156
dc.l name
dc.l idStr
dc.l initTable
name dc.b 'schwäbisch.language',0
idStr dc.b 'schwäbisch 38.2 (29.3.94)',13,10,0
initTable
dc.l 42 ; library base size
dc.l vectors ; library routine vectors
dc.l structure ; library base initialization structure
dc.l InitFunction ; initialization function
vectors
dc.l FuncOpen
dc.l FuncClose
dc.l FuncExpunge
dc.l FuncNull
dc.l FuncMask
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncGetString
IFND NO_SORT_EXTENSION
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncNull
dc.l FuncToUpper
dc.l FuncStringCompare
ENDC
dc.l -1
structure
INITBYTE LN_PRI,156
INITBYTE LN_TYPE,NT_LIBRARY
INITLONG LN_NAME,name
INITBYTE LIB_FLAGS, LIBF_CHANGED ! LIBF_SUMUSED
INITWORD LIB_VERSION,38
INITWORD LIB_REVISION,2
INITLONG LIB_IDSTRING,idStr
dc.w 0
*- InitFunction ---------------------------------------------------*
* Input:
* D0 - catalog base
* A6 - execbase
* A0 - ???
*------------------------------------------------------------------*
InitFunction
move.l d0,a1 ; get catalog base
move.l a0,34(a1)
move.l a6,38(a1) ; save sysbase
rts
*- FuncOpen -------------------------------------------------------*
* Input:
* A6 - catalog base
* Output:
* D0 - catalog base
*------------------------------------------------------------------*
FuncOpen
addq.w #1,LIB_OPENCNT(a6) ; increase open counter
bclr #LIBB_DELEXP,LIB_FLAGS(a6) ; clear delayed expunge flag
move.l a6,d0 ; return catalog base
rts
*- FuncClose ------------------------------------------------------*
* Input:
* A6 - catalog base
* Output:
* D0 = 0
*------------------------------------------------------------------*
FuncClose
subq.w #1,LIB_OPENCNT(a6) ; decrease open counter
btst #LIBB_DELEXP,LIB_FLAGS(a6) ; test delayed expunge flag
bne.s .expunge ; expunge library if requested
moveq #0,d0
rts
.expunge
tst.w LIB_OPENCNT(a6) ; still open?
beq.s doExpunge ; expunge catalog
moveq #0,d0
rts
*- FuncExpunge ----------------------------------------------------*
* Input:
* A6 - catalog base
* Output:
* ???
*------------------------------------------------------------------*
FuncExpunge
tst.w LIB_OPENCNT(a6) ; catalog opened?
beq.s doExpunge ; expunge library
bset #LIBB_DELEXP,LIB_FLAGS(a6) ; set delayed expunge flag
moveq #0,d0
rts
doExpunge
movem.l d2/a5/a6,-(sp)
move.l a6,a5 ; get catalog base
move.l 38(a5),a6 ; get execbase
move.l 34(a5),d2
move.l a5,a1 ; get catalog base
REMOVE ; remove catalog node
move.l a5,a1 ; get catalog base
moveq #0,d0 ; clear d0
move.w LIB_NEGSIZE(a5),d0 ; get vector array size
sub.l d0,a1 ; get array start address
add.w LIB_POSSIZE(a5),d0 ; get catalog base size
jsr _LVOFreeMem(a6) ; free catalog base memory
move.l d2,d0
movem.l (sp)+,d2/a5/a6
rts
*- FuncNull -------------------------------------------------------*
FuncNull
moveq #0,d0
rts
*- FuncMask -------------------------------------------------------*
* Output:
* D0 = bitmask of implemented functions
* (f.e. D0 = 1<<3 means function 3 implemented -> function 3 = GetString)
*------------------------------------------------------------------*
FuncMask
; IFND NO_SORT_EXTENSION
; move.l #(1<<3|1<<15|1<<16),d0 ; GetString, ToUpper, StringCompare
; else
move.l #(1<<3),d0 ; GetString
; ENDC
rts
IFND NO_SORT_EXTENSION
*- FuncStringCompare ----------------------------------------------*
* Input:
* D0 - string length
* D1 - comparsion type
* A1 - first string
* A2 - second string
* Output:
* <0 means string1 < string2
* =0 means string1 = string2
* >0 means string1 > string2
*------------------------------------------------------------------*
FuncStringCompare
tst.l d0 ; zero length?
bne.s .oklen ; length specified
rts
.oklen tst.l d1 ; SC_ASCII?
bne.s doCol1 ; no, do SC_COLLATE1 or SC_COLLATE2
movem.l d2/a2,-(sp) ; save regs
lea convTab2(pc),a0 ; get comparison table pointer
moveq #0,d2
.next move.b (a1)+,d1 ; get character from first string
move.b (a2)+,d2 ; get character from second string
move.b (a0,d1.w),d1 ; get first comparison char from table
cmp.b (a0,d2.w),d1 ; compare with second comp. char
bne.s .lower ; are chars equal?
tst.b d1 ; end of string?
beq.s .equal
subq.l #1,d0 ; one less to go...
bne.s .next ; go to next character
movem.l (sp)+,d2/a2
rts
.equal moveq #0,d0 ; characters are equal
movem.l (sp)+,d2/a2
rts
.lower bhi.s .higher ; char1 > char2?
moveq #-1,d0 ; char1 < char2
movem.l (sp)+,d2/a2
rts
.higher moveq #1,d0 ; char1 > char2
movem.l (sp)+,d2/a2
rts
doCol1 subq.l #1,d1 ; SC_COLLATE1?
bne.s doCol2 ; no, do SC_COLLATE2
movem.l d2/a2,-(sp)
lea convTab1(pc),a0
moveq #0,d2
.next move.b (a1)+,d1
move.b (a2)+,d2
move.b (a0,d1.w),d1
cmp.b (a0,d2.w),d1
bne.s lbC0001AA
tst.b d1
beq.s lbC0001A2
subq.l #1,d0
bne.s .next
movem.l (sp)+,d2/a2
rts
lbC0001A2:
moveq #0,d0
movem.l (sp)+,d2/a2
rts
lbC0001AA:
bhi.s lbC0001B4
moveq #-1,d0
movem.l (sp)+,d2/a2
rts
lbC0001B4:
moveq #1,d0
movem.l (sp)+,d2/a2
rts
doCol2 subq.l #1,d1
bne.s lbC000226
movem.l d2/d3/a2,-(sp)
lea convTab1(pc),a0
moveq #0,d2
moveq #0,d3
lbC0001CC:
move.b (a1)+,d1
beq.s lbC0001E0
move.b (a2)+,d2
cmp.b d2,d1
bne.s lbC0001EC
subq.l #1,d0
bne.s lbC0001CC
movem.l (sp)+,d2/d3/a2
rts
lbC0001E0:
cmp.b (a2)