2 ; 2015-03-08, Greg King
5 ; When you want to create a program with the alternate file format,
6 ; add "-u __BOOT__" to the cl65/ld65 command line. Then, the linker
7 ; will import this symbol name; and, link this module at the front
8 ; of your program file.
10 .export __BOOT__ : abs = 1
12 .import __MAIN_START__, __MAIN_SIZE__, __BSS_RUN__
14 ; ------------------------------------------------------------------------
16 load_addr := __MAIN_START__
17 load_size = __BSS_RUN__ - __MAIN_START__
18 ram_top := __MAIN_START__ + __MAIN_SIZE__
22 ; If you want to change how this bootstrap loader works, then:
23 ; 1. edit this assembly source code,
24 ; 2. define the constant ASM (uncomment the line below),
25 ; 3. assemble this file (and, make a listing of that assembly),
26 ; 4. copy the listing's hex codes into the .byte lines below (notice that most
27 ; of the strings are followed by CR; it's required by the OS65V monitor)
28 ; (be sure to match the listing's lines against the .byte lines),
29 ; 5. undefine ASM (recomment the line),
30 ; 6. assemble this file, again,
31 ; 7. and, add the object file to "osic1p.lib".
40 load := $08 ; private variables
43 GETCHAR := $FFBF ; gets one character from ACIA
45 FIRSTVISC = $85 ; Offset of first visible character in video RAM
46 LINEDIST = $20 ; Offset in video RAM between two lines
55 sta count ; store (-size - 1)
60 L1: inc count ; pre-count one's-complement upwards
64 L2: jsr GETCHAR ; (doesn't change .Y)
67 ; Show that the file is being loaded by rotating an arrow on the screen.
73 ora #$10 ; eight arrow characters
74 sta SCRNBASE + FIRSTVISC + 2 * LINEDIST + 11
79 bnz L1 ; branch always
86 .lobytes ((h) & $0F) + (((h) & $0F) > 9) * 7 + '0'
102 .byte "." ; set an address
103 hex4 ram_top ; put loader where stack will sit
104 .byte "/" ; write bytes into RAM
106 ; ASCII-coded hexadecimal translation of the above assembly code.
107 ; It was copied from the assembler listing.
109 .byte "A0", CR, "00", CR
114 .byte CR, "85", CR, "08", CR
115 .byte "86", CR, "09", CR
118 .byte CR, "49", CR, "FF", CR
119 .byte "85", CR, "0A", CR
122 .byte CR, "49", CR, "FF", CR
123 .byte "85", CR, "0B", CR
125 .byte "E6", CR, "0A", CR
126 .byte "D0", CR, "04", CR
127 .byte "E6", CR, "0B", CR
128 .byte "F0", CR, "16", CR
129 .byte "20", CR, "BF", CR, "FF", CR
130 .byte "91", CR, "08", CR
135 .byte "29", CR, "07", CR
136 .byte "09", CR, "10", CR
137 .byte "8D", CR, "D0", CR, "D0", CR
140 .byte "D0", CR, "E6", CR
141 .byte "E6", CR, "09", CR
142 .byte "D0", CR, "E2", CR
151 .byte "G" ; go to address