GEOS Booting from Function ROM Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl> 29.03.2002 LICENSE Software included here may be freely distributed and modified as long as this note is distributed too and I am credited as author. DISCLAIMER I can't guarantee that you will get prefectly working EPROM. Actually last time I used this method 3 years ago. PREREQUISITES You need following software/hardware: - a working GEOS128 setup - GEOSROM tool disk - Action Replay (or C128 monitor) - 32K EPROM chip - stuff required for burning EPROMs CREATING BOOT IMAGE Prepare a copy of GEOSROM tool disk - this will be your data disk. Startup your GEOS128 and configure everything exactly like you want it to have after booting from ROM - e.g. colors, VDC horizontal/vertical screen position, input driver etc. You don't need to worry about drive setup as you will probably have Configure128 on your bootdisk. There is one exception - you must make image using a disk drive that will be used for booting. E.g. for booting from a 1581 you need to setup things so 1581 will be device #8 (or drive A: in GEOS) and files from data disk must be there. Run GeoMakeDir on drive A: (which will be your bootdrive). In a few moments a GEOBOOT128 file will be created. This is your BOOT IMAGE. COMPRESSING BOOT IMAGE Go into C64 mode, load and execute ByteBruiser from data disk. Then use it to compress BOOT IMAGE (GEOBOOT128) into GEOS128.BBR file. It will take many minutes even though ByteBruiser utilizes 2MHz mode of C128. Anyway, it is quite efficient. PREPARING ROM IMAGE This is probably the most trickiest part. I don't have automated way to do this, only by using machine language monitor. You can use C128 built-in monitor or Action Replay. I can't remember C128 variations of standard commands, but it should be easy to acomplish the task using any of the two. 1. Prepare work area: .F 2000 A000 FF This will fill 32k with value FF which is neutral for EPROMs 2. Load booter code: .L "BOOT.BIN",8,2000 This will load bootstrap code into the start ($2000 will become $8000) 3. Load depacker code: .L "DEP*",8,3DC0 This will load Byte Bruiser depacker into proper area 4. Load starter code: .L "STARTER.BIN",8,3F00 This will load starter used to execute depacker, you will need to edit it in a while. 5. Load compressed data: .L "GEOS128.BBR",8,3F15 This will load BOOT IMAGE compressed by Byte Bruiser. IMPORTANT: Action Replay will show you start and end addresses, like: LOADING $3F15 $9E02 You need to remember or note down the end address. I can't remember if C128 monitor shows this information, but you can find it by searching the memory from $A000 to lower addresses to find where $FF data block ends. You will have something like: .:9DF8 32 41 A8 C3 81 E5 FA 9C .:9E00 A1 E2 FF FF FF FF FF FF .:9E08 FF FF FF FF FF FF FF FF As you see $9E01 is the last value different than $FF so the value needed is $9E02. NOTE: IF YOU WILL GET $9Fxx THEN COMPRESSED DATA IS TOO BIG, READ PROBLEMS SECTION 6. Calculate end address after relocation Now you must do some maths: Calculate: [RelocatedEnd]= [EndAddress]- $12C0 You can convert both values into decimal and use BASIC for that ($12C0=4800). In this example it will be $9E02-$12C0=$8B42 7. Fix STARTER code Back to monitor. Do .D 3F00 3F08 You will have something like: LDA #$0F STA $AE LDA #$8C STA $AF JMP $2B1D You need to fix both values in 'LDA' instructions to calculated address lower and higher byte, so using example from previous point there will be LDA #$42 STA $AE LDA #$8B STA $AF JMP $2B1D 8. Save EPROM image Congratulations - EPROM building is complete. Now you need to save the image and burn that file on EPROM. .S "GEOS128.ROM",8,2000,A000 Remember that if you are going to use anything else than a C64/128 for burning EPROM you will need to strip first two bytes (loadaddress - $00,$20) from the file. 9. Testing You can hack bootstrap code so it will copy data from bank0 to bank1 instead of FunctionROM space to bank1 and test if everything works. Sorry I can't remember exact modifications. INSTALLING ROM CHIP Open your C128 and push EPROM chip into empty U36 socket. Make sure that notches on socket and chip match. USAGE Now every time you turn on C128 GEOS128 will try to boot. This is probably not what you want always, but you can do hardware RESET and press one of two keys: - RUN/STOP will drop you into C128 monitor, you can exit from it to BASIC - C= will drop you into C64 mode CHANGES There is still plenty of room - whole area between $8100 and $9DC0 is unused. If you are brave enough you might want to put something there. PROBLEMS Use included image (GEOS128RC71) as a reference. You can probably load your data into it at $3F15 and then fix address in STARTER segment and this should work. In this image unused areas are filled with value $BD. There can be only one problem - when compressed data is too large. Then you will need to edit bootstrap and starter code and save a new depacker at a different address (use ByteBruiser to save relocated depacker). I can't help you much because I can't remember what exactly needs to be changed. The table below shows what is where in EPROM image ($2000 will become $8000) and where it is relocated by bootstrap. 2000-207e boot.bin 3dc0-3ee8 depacker -> 2b00 (entry: $2b1d) 3f00-3f08 starter -> 2c40 3f15-9f00 data -> 2c55 Data part may not exceed $9F00 because in C128 there are 5 I/O bytes at $FF00. Have fun and good luck!
Amiga7878