mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-29 20:49:19 +00:00
292 lines
12 KiB
Plaintext
292 lines
12 KiB
Plaintext
;
|
|
; File: DoubleByteSupport.a
|
|
;
|
|
; Contains: Assembly level support routines for drawing double byte characters in
|
|
; QuickDraw and caching double byte characters in TrueType.
|
|
;
|
|
; Written by: Joe Ternasky
|
|
;
|
|
; Copyright: © 1990-1992 by Apple Computer, Inc. All rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <SM3> 11/5/92 SWC Changed INCLUDEs to a LOAD of StandardEqu.d.
|
|
; <2> 6/22/92 JH #1033107 <AMW>: Changed GetEncodingTable to return the real
|
|
; script ID rather than 0 when the script isn't a CJK script.
|
|
; <1> 1/20/90 JF Created file, relocated Joe's routines from “DrawText.a”,
|
|
; and slapped on standard routine headers.
|
|
;
|
|
|
|
LOAD 'StandardEqu.d'
|
|
|
|
|
|
; -------------------------------------------------------------------------------------
|
|
;
|
|
; Routine: GetEncodingMap
|
|
;
|
|
; Input: d0.w text font ID
|
|
;
|
|
; Output: d0.w script code
|
|
; a0.l encoding table pointer
|
|
;
|
|
; Purpose: GetEncodingMap expects the text font ID in register d0. It returns the
|
|
; script code in d0 and the encoding table pointer in a0. The encoding
|
|
; table is is indexed by a byte code and each entry is a boolean value
|
|
; true if this is a high byte in the given font's encoding, false if this
|
|
; is a single byte. If the encoding table pointer is zero, this is a single
|
|
; byte font.
|
|
;
|
|
; Warning: none
|
|
;
|
|
; Frame: none
|
|
;
|
|
; -------------------------------------------------------------------------------------
|
|
|
|
|
|
GetEncodingMap proc export
|
|
|
|
cmp.w #1,d0 ; special font ID number?
|
|
bhi.s @noFontRemapping ; greater, skip all this
|
|
blo.s @systemFontRemapping ; less, remap to system font
|
|
|
|
@applicationFontRemapping
|
|
move.w ApFontID,d0 ; remap to application font
|
|
bra.s @noFontRemapping ; all through here
|
|
|
|
@systemFontRemapping
|
|
move.w SysFontFam,d0 ; remap to system font
|
|
|
|
@noFontRemapping
|
|
sub.w #smFondStart,d0 ; in the Roman range?
|
|
bmi.s @defaultEncoding ; yes, return default encoding
|
|
lsr.w #8,d0 ; divide font number by 2^8
|
|
lsr.w #1,d0 ; divide font number by 2^1
|
|
add.w #1,d0 ; make it a real script code
|
|
|
|
lea sjisHighBytes,a0 ; assume the SJIS encoding
|
|
cmp.w #smJapanese,d0 ; really is japanese?
|
|
beq.s @returnToCaller ; yes, just return now
|
|
lea bigFiveHighBytes,a0 ; assume the Big Five encoding
|
|
cmp.w #smTradChinese,d0 ; really is taiwanese?
|
|
beq.s @returnToCaller ; yes, just return now
|
|
lea kisHighBytes,a0 ; assume the KIS encoding
|
|
cmp.w #smKorean,d0 ; really is korean?
|
|
beq.s @returnToCaller ; yes, just return now
|
|
lea sgbHighBytes,a0 ; assume the SGB encoding
|
|
cmp.w #smSimpChinese,d0 ; really is chinese?
|
|
beq @returnToCaller ; assume the SGB encoding
|
|
sub.l a0,a0 ; clear result
|
|
bra.s @returnToCaller ; but keep the script code in d0
|
|
|
|
@defaultEncoding
|
|
sub.l a0,a0 ; assume the generic encoding
|
|
clr.w d0 ; set script number to smRoman
|
|
|
|
@returnToCaller
|
|
rts ; return to the caller
|
|
|
|
sjisHighBytes
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $00 to $0F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $10 to $1F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $20 to $2F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $30 to $3F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $40 to $4F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $50 to $5F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; $60 to $6F
|
|
dc.b 0,0,0,0,0,0,0,0,0,0,0,0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1,1,1,1,1,1,1,1,1,1,1 ; $C0 to $CF
|
|
dc.b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; $D0 to $DF
|
|
dc.b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; $E0 to $EF
|
|
dc.b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 ; $F0 to $FF
|
|
|
|
dc.b $a1,$00 ; default low byte.
|
|
|
|
endproc
|
|
|
|
|
|
; -------------------------------------------------------------------------------------
|
|
;
|
|
; Routine: Function GetEncodingTable( fondID: Integer; VAR script: Integer ) : Ptr;
|
|
;
|
|
; Input: none
|
|
;
|
|
; Output: none
|
|
;
|
|
; Purpose: GetEncodingTable is a Pascal cover for the corresponding register based
|
|
; routine, GetEncodingMap. It expects the FOND ID number and a pointer to
|
|
; the script code storage on the stack and returns the encoding table pointer
|
|
; as the result and the proper script code in the storage. Only those few
|
|
; scripts that require the encoding table return one in the result; all other
|
|
; scripts return a nil pointer. The script code is always correct, but does
|
|
; not check with the Script Manager to make sure that the script system is
|
|
; really installed.
|
|
;
|
|
; Warning: none
|
|
;
|
|
; Frame:
|
|
|
|
GetEncodingTableFrame: Record {oldA6},decrement
|
|
|
|
result: ds.l 1
|
|
fondID: ds.w 1
|
|
scriptPtr: ds.l 1
|
|
returnAddress: ds.l 1
|
|
oldA6: ds.l 1
|
|
frameSize: equ *
|
|
|
|
EndR
|
|
;
|
|
; -------------------------------------------------------------------------------------
|
|
|
|
|
|
GetEncodingTable proc export
|
|
|
|
with GetEncodingTableFrame
|
|
link a6,#frameSize ; build the stack frame
|
|
|
|
move.w fondID(a6),d0 ; load the fond ID number
|
|
bsr GetEncodingMap ; get encoding table and script code
|
|
move.l a0,result(a6) ; save the encoding table pointer
|
|
move.l scriptPtr(a6),a0 ; load the script code storage pointer
|
|
move.w d0,(a0) ; save the script code
|
|
|
|
unlk a6 ; remove the stack frame
|
|
move.l (sp)+,a0 ; load the return address
|
|
add.l #6,sp ; remove the arguments
|
|
jmp (a0) ; return to the caller
|
|
endWith
|
|
endProc
|
|
|
|
end |