Pl2 ANNEXE.DOC
Jump to navigation
Jump to search
--------------------- APPENDIX --------------------- *** DISASSEMBLERS *** -------------------------- To put it very simply, we can say that a disassembler does exactly the opposite of an assembler: The assembler codes your program's instructions into binary and the disassembler reads the binary codes, recognizes them, and translates them to eventually give you the LISTING of the program. Since this operation is quite delicate, it may not be able to translate all the codes it encounters... On most disassemblers, it is possible to obtain either the disassembly of a program in ASCII CODE (LISTING) or a disassembly in HEX CODE (In this case, there are rarely errors in decoding the program) Refer to the manual of your ASSEMBLER for more information, as most assemblers come with a DISASSEMBLER... *** DEBUGGERS *** --------------------- A DEBUGGER is a tool that will become essential, when you write longer programs. As its name suggests, it allows you to search for the BUG (Parasite, error) that causes your program to crash... It resembles a disassembler, but its greatest interest is that it allows you to visualize the contents of the registers, PC, SR... This utility is often accompanied by an ASSEMBLER, and it is quite specific... Therefore, I cannot tell you more about it, it will suffice to refer to the manual of your ASSEMBLER... 'SP' will be translated to A7 ... NB: A debugger often runs in TRACE MODE. --- This mode is activated by setting the T bit of the SR to 1. TRACE MODE triggers the execution of an exception program whose address is found in the 29th EXCEPTION VECTOR and which executes after every instruction decoded by the 68000. To replace this exception program with one of our routines, just change the address contained in the exception vector that controls the trace mode. To do this, you need to: .Switch to SUPERVISOR MODE in order to change the value of the exception vector and activate the T bit of the SR .Deposit the address of the new routine in the trace mode exception vector (With MOVE.L #ADDRESS,$24) .Enter trace mode by activating the SR's T bit (For example with ORI.w #%1000000000000000,SR) The routine itself must not modify SP (Or must reposition it), as at the end of it, a RTE must be executed: The RTE will unstack the PC to return to the main program: Changing SP would lead to an incorrect restoration of the PC saved on the system stack... *** ST MEMORY *** ------------------------- Here is the structure of the ST's ROM and RAM memory: ADDRESSES : CONTENT -------------------- $0000000 : SP after a RESET $0000004 : PC after a RESET to $0000008 from $00003FF : EXCEPTION VECTORS to $0000400 : SYSTEM VARIABLES to $00007FF from $001FFFF : The RAM to $007FFFF end of the RAM for the 520 ST to $00FFFFF end of the RAM for the 1040 ST to $01FFFFF end of the RAM for the MEGA 2 ST at $0FA0000 : 128 KB ROM start at $0FEFFFF : 192 KB operating system ROM at $0FF8000 : Internal registers at $0FF8200 : Video registers at $0FF8600 : DMA and FCD registers (Disk) at $0FF8800 : AY3-8910 registers (sounds) at $0FFFA00 : MFP registers (See previous chapter) at $0FFFC00 : ACIA registers (Keyboard and Midi) ---------------- This initiation ends here, all that remains is to thank you for your cooperation. (And to congratulate you for the good idea you had in wanting to get into assembly...) You may well think that assembly programming does not end here, on the contrary, this initiation was only meant to teach you the basics of 68000 programming. It is now up to you to explore the rest of this language with fantastic capabilities... My mission ends here! (OHHH GOD!) :FAREWELL! Author: PIECHOCKI Laurent --------- 8,Impasse Bellevue 57980 TENTELING Acknowledgements: Thanks to Vincent and Dominique for testing this initiation in preview and for the help they provided me. (Especially for their suggestions and approvals...) Thanks to THOMSON EFCIS for the documentation on the 68000 Thanks to FREDERIK for his precious help...
Back to ASM_Tutorial