; ; package.a ; ; package definitions include file for assembler ; ; kCompressPkgFlag EQU 0x00000000 kUnknown1PkgFlag EQU 0x01000000 kFasterComprPkgFlag EQU 0x02000000 kRelocatePkgFlag EQU 0x04000000 kUnknown2PkgFlag EQU 0x08000000 kDontCompressPkgFlag EQU 0x10000000 kUnknown3PkgFlag EQU 0x20000000 kCopyProtectedPkgFlag EQU 0x40000000 kAutoRemovePkgFlag EQU 0x80000000 kProtocolPart EQU 0x00000000 kFramesPart EQU 0x00000001 kRawPart EQU 0x00000002 kRelocationPart EQU 0x00000004 kUnknownPart EQU 0x00000008 kAutoLoadPartFlag EQU 0x00000010 kAutoRemovePartFlag EQU 0x00000020 kCompressedPartFlag EQU 0x00000040 kNotifyPartFlag EQU 0x00000080 kRawPartType EQU 0x00000000 kFormPartType EQU 0x666F726D ; "form" kBookPartType EQU 0x626F6F6B ; "book" kAutoPartType EQU 0x6175746F ; "auto" kStorePartType EQU 0x736F7570 ; "soup" kFontPartType EQU 0x666F6E74 ; "font" kDictionaryPartType EQU 0x64696374 ; "dict" kNILRef EQU 0x02 kTRUERef EQU 0x1A kIntegerRef EQU 0x0 kPointerRef EQU 0x1 kImmediateRef EQU 0x2 kMagicPtrRef EQU 0x3 kCharacterRef EQU 0x6 kBinaryObject EQU 0x00 kArrayObject EQU 0x01 kFrameObject EQU 0x03 MACRO InfoRef $offset, $size DCD (($offset):SHL:16 + $size) MEND MACRO UnicodeCString $str LCLA i i SETA 0 WHILE i<:LEN:$str DCB 0,(($str:LEFT:(i+1)):RIGHT:1) ; assumes characters are first 256 ASCII i SETA i+1 WEND DCB 0,0 MEND MACRO IntegerRef $n DCD (($n):SHL:2 + kIntegerRef) MEND MACRO ImmediateRef $n DCD (($n):SHL:2 + kImmediateRef) MEND MACRO PointerRef $n DCD ($n + kPointerRef) MEND MACRO NILRef ImmediateRef 0 ; NIL MEND MACRO ObjectHeader $size, $type DCD (($size):SHL:8 + 0x40 + ($type)) DCD 0 MEND MACRO BinaryFiller $byte LCLA i i SETA 4 - {PC} + ({PC}:SHR:2):SHL:2 [ i = 4 i SETA 0 ] WHILE i>0 DCB ($byte) i SETA i-1 WEND MEND MACRO UnicodeCStringObject $str ObjectHeader (12+((:LEN:($str))*2)+2), kBinaryObject PointerRef 0x003C13A4 ; 'string symbol inside ROM of MP2100 UnicodeCString ($str) BinaryFiller 0xBA MEND MACRO SymbolObject $str LCLA hash hash SETA 0 ; insert hash code here ObjectHeader (12+(:LEN:$str)+1+4), kBinaryObject ImmediateRef 0x15554 DCD hash DCB $str,0 BinaryFiller 0xBF MEND MACRO FnObject $instr, $lits, $numLocals, $numArgs ObjectHeader 0x20, kFrameObject PointerRef 0x01A8C680 ; function map in Patch4 ImmediateRef 0xC ; function class PointerRef $instr ; instruction bytecode PointerRef $lits ; literals array NILRef ; argFrame IntegerRef (($numLocals):SHL:16 + ($numArgs)) ; numArgs integer MEND MACRO UnicodeCInfoRef $copyright InfoRef gDataPos,(:LEN:($copyright) + 1)*2 gDataPos SETA gDataPos + (:LEN:($copyright) + 1)*2 MEND MACRO ASCIIInfoRef $copyright InfoRef gDataPos,:LEN:($copyright) gDataPos SETA gDataPos + :LEN:($copyright) MEND MACRO ASCIICInfoRef $copyright InfoRef gDataPos,:LEN:($copyright)+1 gDataPos SETA gDataPos + :LEN:($copyright)+1 MEND MACRO PartEntry $partComprSize=0, $partSize=0, $partType, $partFlags, $notifyMsg="" DCD gPartPos ; part offset DCD $partComprSize ; part compressed size DCD $partSize ; part uncompressed size DCD $partType ; part type DCD 0 ; reserved DCD $partFlags [ (($partFlags):AND:kNotifyPartFlag) <> 0 ASCIIInfoRef $notifyMsg ; Notification message | InfoRef 0,0 ; empty notification message ] InfoRef 0,0 ; compression info-ref gPartPos SETA gPartPos + $partSize MEND MACRO PkgHeader $target=1, $pkgType="xxxx", $pkgFlags=kDontCompressPkgFlag, $version=1, $copyright="", $name="", $size, $creation=0, $header, $numParts=1 GBLA gPartPos gPartPos SETA 0 GBLA dataPos gDataPos SETA 0 [ ($target) = 1 DCB "package0" ; NOS 1.x | DCB "package1" ; NOS 2.x ] DCB $pkgType DCD $pkgFlags DCD $version ; version UnicodeCInfoRef ($copyright) UnicodeCInfoRef ($name) DCD $size ; package size DCD $creation ; creation date 32-bit unsigned integer (seconds since midnight January 1, 1904) DCD 0 ; time stamp 30-bit signed integer (minutes since midnight January 1, 1904) DCD 0 ; reserved DCD $header ; header size DCD $numParts ; number of parts MEND END