@@ -166,7 +166,7 @@ export class AppleII extends BasicScanlineMachine implements AcceptsBIOS {
166166 }
167167 this . bios = Uint8Array . from ( data ) ;
168168 }
169- loadROM ( data ) {
169+ loadROM ( data , title ? , origin ?: number ) {
170170 // is it a 16-sector 35-track disk image?
171171 if ( data . length == 16 * 35 * 256 ) {
172172 var diskii = new DiskII ( this , data ) ;
@@ -181,17 +181,17 @@ export class AppleII extends BasicScanlineMachine implements AcceptsBIOS {
181181 this . HDR_SIZE = 58 ;
182182 } else {
183183 // 4-byte DOS header? (TODO: hacky detection)
184- const origin = this . rom [ 0 ] | ( this . rom [ 1 ] << 8 ) ;
184+ const hdrOrigin = this . rom [ 0 ] | ( this . rom [ 1 ] << 8 ) ;
185185 const size = this . rom [ 2 ] | ( this . rom [ 3 ] << 8 ) ;
186- let isPlausible = origin < 0xc000
187- && origin + size < 0x13000
188- && ( origin == 0x803 || ( origin & 0xff ) == 0 ) ;
186+ let isPlausible = hdrOrigin < 0xc000
187+ && hdrOrigin + size < 0x13000
188+ && ( hdrOrigin == 0x803 || ( hdrOrigin & 0xff ) == 0 ) ;
189189 if ( size == data . length - 4 && isPlausible ) {
190- this . LOAD_BASE = origin ;
190+ this . LOAD_BASE = hdrOrigin ;
191191 this . HDR_SIZE = 4 ;
192192 } else {
193- // default = raw binary @ $803
194- this . LOAD_BASE = 0x803 ;
193+ // Load @ specified origin, fallback to $803
194+ this . LOAD_BASE = origin ?? 0x803 ;
195195 this . HDR_SIZE = 0 ;
196196 }
197197 }
0 commit comments