**************************************************************************** * * * Amiga misc.resource version 33.10 (16 Jan 1986) disassembly * * this version of the resource was contained in Kickstart 1.2 * * * * disassembled and commented by Pavel Zima on 14 Jul 2016 * * * * following text supposes knowledge of 68k assembly language and * * structures of Amiga operating system * * * * this little work was inspired by disassembly of AmigaOS 1.2 Exec by * * Markus Wandel (http://wandel.ca/homepage/execdis/exec_disassembly.txt) * * or downloadable from Aminet (aminet.net) * * structure and appearance is from that reason similar * * * **************************************************************************** ---------------------------------------------------------------------------- misc.resource functions ---------------------------------------------------------------------------- FE47B8 init code FE482A AllocMiscResource (-6) FE4862 FreeMiscResource (-12) ---------------------------------------------------------------------------- misc.resource base ---------------------------------------------------------------------------- ; this is content of misc resource base structure as it is in RAM ; standard node $0000 ds.l 1 LN_SUCC $0004 ds.l 1 LN_PRED $0008 ds.b 1 LN_TYPE (NT_RESOURCE) $0009 ds.b 1 LN_PRI (0) $000A ds.l 1 LN_NAME ("misc.resource") ; library structure ; idstring is not set $000E ds.b 1 LIB_FLAGS (6) $000F ds.b 1 LIB_pad $0010 ds.w 1 LIB_NEGSIZE (12) $0012 ds.w 1 LIB_POSSIZE ($32) $0014 ds.w 1 LIB_VERSION ($20) $0016 ds.w 1 LIB_REVISION ($0A) $0018 ds.l 1 LIB_IDSTRING (0) $001C ds.l 1 LIB_SUM $0020 ds.w 1 LIB_OPENCNT ; resource variables $0022 ds.l 1 Name for MR_SERIALPORT $0026 ds.l 1 Name for MR_SERIALBITS $002A ds.l 1 Name for MR_PARALLELPORT $002E ds.l 1 Name for MR_PARALLELBITS ---------------------------------------------------------------------------- jump to init code ---------------------------------------------------------------------------- ; this is the disassembly of Kickstart 1.2 ROM at addresses ; $FE47770 - $FE487F, this address range is preceded by ; mathffp.library and followed by potgo.resource FE4770 bra.l $FE47B8 ; jump to init routine ---------------------------------------------------------------------------- misc.resource ROM tag ---------------------------------------------------------------------------- ; this is the disassembly of Kickstart 1.2 ROM at addresses ; $FC4502 - $FC478F, this address range is preceded by ; audio.device and followed by disk.resource FE4774 4AFC RTC_MATCHWORD (start of ROMTAG marker) FE4776 00FE4774 RT_MATCHTAG (pointer RTC_MATCHWORD) FE477A 00FE487C RT_ENDSKIP (pointer to end of code) FE477E 01 RT_FLAGS (RTF_COLDSTART) FE477F 20 RT_VERSION (version number) FE4780 08 RT_TYPE (NT_RESOURCE) FE4781 46 RT_PRI (priority = 70) FE4782 00FE478E RT_NAME (pointer to name) FE4786 00FE479C RT_IDSTRING (pointer to ID string) FE478A 00FE47B8 RT_INIT (execution address) ; the priority (70) is quite high, disk.resource is the seventh initialized ; resident module, just after exec.library, expansion.library, ; potgo.resource, keymap.resource, cia.resource and disk.resource ---------------------------------------------------------------------------- name, version ---------------------------------------------------------------------------- FE478E "misc.resource", 00 FE479C "misc 33.10 (16 Jan 1986)", CR, LF, 00, 00 ---------------------------------------------------------------------------- init routine ---------------------------------------------------------------------------- ; as the RTF_AUTOINIT bit in RT_FLAGS is not set the InitResident calls ; resource's own initialization routine below FE47B8 movem.l A2/A6,-(SP) ; saves registers FE47BC move.l $000004,A6 FE47C2 lea $FE486E,A0 ; vectors FE47C8 lea $FE4806,A1 ; structure FE47CE sub.l A2,A2 ; init FE47D0 move.l #$32,D0 ; size FE47D6 jsr -$54(A6) ; MakeLibrary FE47DA tst.l D0 ; initialized? FE47DC bne.s $FE47F8 ; yes => continue FE47DE movem.l D7/A5/A6,-(SP) FE47E2 move.l #$22020000,D7 FE47E8 move.l $0004,A6 FE47EC jsr -$6C(A6) ; no => Alert no #$22020000 FE47F0 movem.l (SP)+,D7/A5/A6 FE47F4 bra.l $FE4800 ; finish FE47F8 move.l D0,A2 FE47FA move.l A2,A1 FE47FC jsr -$01E6(A6) ; AddResource FE4800 movem.l (SP)+,A2/A6 ; restore registers FE4804 rts ---------------------------------------------------------------------------- init table, 5 entries ---------------------------------------------------------------------------- ; as used by MakeLibrary or InitStruct FE4806 E0000008 ; offset 8, next byte $08, count 1 => LN_TYPE = NT_RESOURCE FE480A 0800 FE480C C000000A ; offset $A, next long $FE478E, count 1 => LN_NAME = "misc.resource" FE4810 00FE478E FE4814 E000000E ; offset $E, next byte $06, count 1 => LIB_FLAGS = $06 FE4818 0600 FE481A D0000014 ; offset $14, next word, count 1 => LIB_VERSION = $20 FE481E 0020 FE4820 D0000016 ; offset $16, next word, count 1 => LIB_REVISION = $0A FE4824 000A FE4826 00 ; end of init structure FE4827 00 ; padding FE4828 0000 ; padding ---------------------------------------------------------------------------- CurrentUser = AllocMiscResource(unitNum, name) D0 D0 A1 ---------------------------------------------------------------------------- FE482A move.l $000004,A0 FE4830 lsl.l #2,D0 FE4832 move.l D0,D1 FE4834 move.l $0004,A0 FE4838 move.w #$4000,$DFF09A FE4840 addq.b #1,$0126(A0) ; Disable FE4844 move.l $22(A6,D1.w),D0 ; check the slot for an unit number FE4848 bne.s $FE484E ; full? => finish FE484A move.l A1,$22(A6,D1.w) ; empty? => put the requested one in FE484E move.l $0004,A0 FE4852 subq.b #1,$0126(A0) ; Enable FE4856 bge.s $FE4860 FE4858 move.w #$C000,$DFF09A FE4860 rts ---------------------------------------------------------------------------- FreeMiscResource(unitNum) D0 ---------------------------------------------------------------------------- FE4862 lsl.l #2,D0 FE4864 move.l #0,$22(A6,D0.w) ; clears one of four unit numbers FE486C rts ---------------------------------------------------------------------------- offset table, 2 entries ---------------------------------------------------------------------------- ; as used in MakeLibrary FE486E 00FE482A ; AllocMiscResource offset -6 FE4872 00FE4862 ; FreeMiscResource offset -12 FE4876 FFFFFFFF ; end of table FE487A 0000 ; padding FE487C 00000000 ; padding