mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-22 04:31:30 +00:00
287 lines
8.5 KiB
Plaintext
287 lines
8.5 KiB
Plaintext
;
|
|
; File: IntlResourcesPriv.a
|
|
;
|
|
; Contains: Macros for building itl2, and equates used for IntlTokenize code in
|
|
; ScriptMgrUtilText.a and itl4Roman.a. This file can be given to localizers and script
|
|
; developers along with sources for RomanItl2.a and itl4Roman.a. The macros are
|
|
; extracted from itl2 source to avoid unnecessary duplication. The itl4 equates are
|
|
; separated out from ScriptPriv.a because the other stuff in ScriptPriv.a should not
|
|
; be distributed and is not neeeded in order to build itl4 resources.
|
|
;
|
|
; Written by: PKE Peter Edberg
|
|
;
|
|
; Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <2> 11/20/92 PKE Also add in SetFSRow macro used in script itl2 sources.
|
|
; <1> 11/17/92 PKE Extracted itl2 macros from RomanItl2.a and itl4 equates from
|
|
; ScriptPriv.a
|
|
;
|
|
;___________________________________________________________________________________________________
|
|
|
|
IF &TYPE('__INCLUDINGINTLRESOURCESPRIV__') = 'UNDEFINED' THEN
|
|
__INCLUDINGINTLRESOURCESPRIV__ SET 1
|
|
|
|
; ----------------------------------------------------------------------------
|
|
tblSize equ 256 ; bumped from 65 to 70 <03/12/89 pke> and up to 256 <1>
|
|
|
|
; ===============================MACROS=============================================
|
|
;
|
|
; Set up compressed type & case tables for CharType and Transliterate <12/16/87med>
|
|
;
|
|
; Modified SetClass macro to add NoMarkList <03/29/89 pke>
|
|
; eliminated LowerNoMarkList <1>
|
|
|
|
macro
|
|
SetClass &type, &casestrip, &case, &strip, &rest
|
|
gbla &cls[256], &TypeList[tblSize]
|
|
gbla &UpperList[tblSize], &LowerList[tblSize]
|
|
gbla &UpperNoMarkList[tblSize], &NoMarkList[tblSize]
|
|
lcla &i,&j,&first,&a,&b,&c,&t,&cs,&s
|
|
|
|
&t: seta &eval(&type)
|
|
&cs: seta &eval(&casestrip) ; change case + strip diacritics <9/23/88 ldc>
|
|
&c: seta &eval(&case) ; change case only
|
|
&s: seta &eval(&strip) ; strip diacritics only <03/12/89 pke>
|
|
&i: seta 5 ; now 5th parameter <03/12/89 pke>
|
|
while &i <= &nbr(&syslist) do
|
|
if &nbr(&syslist[&i]) then
|
|
&a: seta &eval(&syslist[&i,1])
|
|
&b: seta &eval(&syslist[&i,2])
|
|
else
|
|
&a: seta &eval(&syslist[&i])
|
|
&b: seta &a
|
|
endif
|
|
if &first = 0 then
|
|
&first: seta &a
|
|
endif
|
|
while &a <= &b do
|
|
&cls[&a+1]: seta lastClass
|
|
&a: seta &a+1
|
|
endWhile
|
|
&i: seta &i+1
|
|
endWhile
|
|
lastClass: set lastClass+1
|
|
&TypeList[lastClass]: seta &t
|
|
&UpperList[lastClass]: seta 0
|
|
&LowerList[lastClass]: seta 0
|
|
&UpperNoMarkList[lastClass]: seta 0
|
|
&NoMarkList[lastClass]: seta 0
|
|
if &c <> 0 then
|
|
if (&t**$80)= 0 then ; lowercase or no case
|
|
&UpperList[lastClass]: seta $000000FF**(&c-&first)
|
|
&UpperNoMarkList[lastClass]: seta $000000FF**(&cs-&first) ; <09/23/88 ldc>
|
|
else ; uppercase
|
|
&LowerList[lastClass]: seta $000000FF**(&c-&first)
|
|
&UpperNoMarkList[lastClass]: seta $000000FF**(&s-&first) ; <03/12/89 pke>
|
|
endif
|
|
&NoMarkList[lastClass]: seta $000000FF**(&s-&first) ; <03/29/89 pke>
|
|
endif
|
|
endMacro
|
|
|
|
; ==========================================================================================
|
|
; modified DumpCharTable macro to add NoMarkList <03/29/89 pke>
|
|
; eliminated LowerNoMarkList <1>
|
|
|
|
macro
|
|
DumpCharTable &index
|
|
gbla &cls[256], &TypeList[tblSize]
|
|
gbla &UpperList[tblSize], &LowerList[tblSize]
|
|
gbla &UpperNoMarkList[tblSize], &NoMarkList[tblSize]
|
|
lcla &i
|
|
|
|
&i: seta 1
|
|
if &index = 0 then
|
|
while &i <= 256 do ; corrected to <= <04/12/89 pke>
|
|
dc.b &cls[&i],&cls[&i+1],&cls[&i+2],&cls[&i+3],&cls[&i+4],&cls[&i+5],&cls[&i+6],&cls[&i+7]
|
|
&i: seta &i+8
|
|
endWhile
|
|
elseif &index = 1 then ; Type list
|
|
while &i <= lastClass do
|
|
dc.b &TypeList[&i]
|
|
&i: seta &i+1
|
|
endWhile
|
|
elseif &index = 2 then ; Uppercase delta list
|
|
while &i <= lastClass do
|
|
dc.b &UpperList[&i]
|
|
&i: seta &i+1
|
|
endWhile
|
|
elseif &index = 3 then ; Lowercase delta list
|
|
while &i <= lastClass do
|
|
dc.b &LowerList[&i]
|
|
&i: seta &i+1
|
|
endWhile
|
|
elseif &index = 4 then ; StripUppercase delta list
|
|
while &i <= lastClass do
|
|
dc.b &UpperNoMarkList[&i]
|
|
&i: seta &i+1
|
|
endWhile
|
|
elseif &index < 7 then ; Strip (diacritics) delta list (was 6, now 5 to replace unused LowerNoMarkList)
|
|
while &i <= lastClass do
|
|
dc.b &NoMarkList[&i]
|
|
&i: seta &i+1
|
|
endWhile
|
|
endif
|
|
align 2
|
|
endMacro
|
|
|
|
|
|
; ----------------------------------------------------------------------------
|
|
; macro: setByte
|
|
; input: Base address, value, settings.
|
|
; Each setting is either a number or a range (f,s).
|
|
;
|
|
; This macro is used to create the first part of a breakTable, the character
|
|
; type array. This array is indexed by ASCII code, and contains the type of
|
|
; each character. For example, the characters 'a' through 'z' will all have
|
|
; the type 'letter' in the array.
|
|
; ----------------------------------------------------------------------------
|
|
|
|
macro
|
|
setByte &base,&v
|
|
print push,nomdir
|
|
lcla &n,&a,&b,&value
|
|
&value seta &eval(&v)
|
|
&n seta 3
|
|
while &n<=&nbr(&syslist) do
|
|
if &nbr(&syslist[&n]) then
|
|
&a seta &eval(&syslist[&n,1])
|
|
&b seta &eval(&syslist[&n,2])
|
|
else
|
|
&a seta &eval(&syslist[&n])
|
|
&b seta &a
|
|
endif
|
|
org &base+&a
|
|
dcb.b &b-&a+1,&value
|
|
&n seta &n+1
|
|
endwhile
|
|
org
|
|
print pop
|
|
endm
|
|
|
|
; ----------------------------------------------------------------------------
|
|
; macro: SetRow
|
|
; input: Base address, state number, action 1, action 2, …
|
|
; other symbols: Assumes Nstate and Nclass are set to the number of states
|
|
; and the number of classes, respectively (uses these for
|
|
; error checking only)
|
|
; Note: each action is a state number, optionally preceded by '*' to indicate
|
|
; that the word in progress should be updated to include the current
|
|
; char
|
|
;
|
|
; Macro for setting up transition table rows and transition table index values
|
|
; No error checking yet!
|
|
; ----------------------------------------------------------------------------
|
|
|
|
macro
|
|
SetRow &base, &state
|
|
print push, nogen
|
|
lcla &off, &n, &act
|
|
lclc &str
|
|
&off seta * - &eval(&base)
|
|
org &base + (&eval(&state) << 1)
|
|
dc.w &off
|
|
org
|
|
&n seta 2
|
|
while &n<&nbr(&syslist) do
|
|
&n seta &n+1
|
|
&act seta 0
|
|
&str setc &syslist[&n]
|
|
if &scanne('*',&str,1)<>0 then
|
|
&act seta $80
|
|
&str setc &substr(&str,2,&len(&str))
|
|
endif
|
|
&act seta &act OR (&eval(&str) << 1)
|
|
dc.b &act
|
|
endw
|
|
print pop
|
|
endm
|
|
|
|
; ****************************************************************************
|
|
; FindScriptRun macros
|
|
; ****************************************************************************
|
|
|
|
; ----------------------------------------------------------------------------
|
|
; macro: SetFSRow
|
|
; input: Base address, state number, action 1, action 2, …
|
|
; other symbols: Assumes Nstate and Nclass are set to the number of states
|
|
; and the number of classes, respectively (uses these for
|
|
; error checking only)
|
|
; Note: each action is a state number, optionally preceded by:
|
|
; '*' to mark, i.e. indicate that the word in progress should be
|
|
; updated to include the current char
|
|
; 'e' to exit. In this case, the following number is an index into
|
|
; a table of ScriptRunStatus values - it specifies the correct
|
|
; value for the completed run.
|
|
;
|
|
; Macro for setting up transition table rows and transition table index values
|
|
; No error checking yet!
|
|
; ----------------------------------------------------------------------------
|
|
|
|
macro
|
|
SetFSRow &base, &state
|
|
print push, nogen
|
|
lcla &off, &n, &act
|
|
lclc &str
|
|
&off seta * - &eval(&base)
|
|
org &base + (&eval(&state) << 1)
|
|
dc.w &off
|
|
org
|
|
&n seta 2
|
|
|
|
while &n<&nbr(&syslist) do
|
|
&n seta &n+1
|
|
&act seta 0
|
|
&str setc &syslist[&n]
|
|
|
|
if &scanne('*',&str,1)<>0 then
|
|
&act seta $80
|
|
&str setc &substr(&str,2,&len(&str))
|
|
endif
|
|
|
|
if &scanne('e',&str,1)<>0 then
|
|
&act seta &act OR $40
|
|
&str setc &substr(&str,2,&len(&str))
|
|
endif
|
|
|
|
&act seta &act OR &eval(&str)
|
|
dc.b &act
|
|
endw
|
|
|
|
print pop
|
|
endm
|
|
|
|
; ----------------------------------------------------------------------------
|
|
; IntlTokenize equates for itl4 and IntlTokenize code
|
|
; ----------------------------------------------------------------------------
|
|
|
|
srcA EQU a0
|
|
srcL EQU d0
|
|
toks EQU a1
|
|
tokL EQU d1
|
|
holdA EQU a2
|
|
cSym EQU d2
|
|
lastA EQU a3
|
|
ld EQU d3
|
|
map EQU a4
|
|
lc1 EQU d4
|
|
pBlok EQU a5
|
|
lc2 EQU d5
|
|
temp EQU d6
|
|
dTab EQU a6
|
|
temp1 EQU d7
|
|
|
|
rd EQU ld
|
|
escRD EQU lc1
|
|
rc EQU ld
|
|
|
|
mapEmergOffset equ -8
|
|
mapExtendOffset equ -4
|
|
|
|
magicStackTokenEnd equ 6
|
|
magicStackErrorValue equ 4
|
|
|
|
; ----------------------------------------------------------------------------
|
|
ENDIF ; ...already included
|