mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-22 12:29:06 +00:00
c64: better detection of PRG start addr.
This commit is contained in:
parent
00b9d3ab15
commit
ed674f2cdb
10
presets/c64/basicheader.dasm
Normal file
10
presets/c64/basicheader.dasm
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
processor 6502
|
||||
.org $07FF
|
||||
.word $0801 ; two-byte start address
|
||||
.org $0801 ; start of BASIC program
|
||||
|
||||
.word BASIC_END, 10 ; Next line and current line number
|
||||
.byte $9e," 2064",0 ; SYS 2064
|
||||
BASIC_END:
|
||||
.word 0 ; End of program
|
17
presets/c64/skeleton.dasm
Normal file
17
presets/c64/skeleton.dasm
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
include "cartheader.dasm"
|
||||
|
||||
Start
|
||||
ldy #0
|
||||
.Loop
|
||||
lda Message,y
|
||||
beq .LoopExit
|
||||
jsr $FFD2 ; CHROUT
|
||||
iny
|
||||
bne .Loop
|
||||
.LoopExit
|
||||
jmp . ; infinite loop
|
||||
Message
|
||||
; PETSCII - http://sta.c64.org/cbm64pet.html
|
||||
byte "HELLO WORLD!"
|
||||
byte 13,0
|
@ -580,8 +580,12 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine {
|
||||
// load rom
|
||||
if (this.romptr && this.romlen) {
|
||||
this.exports.machine_load_rom(this.sys, this.romptr, this.romlen);
|
||||
this.prgstart = this.romarr[0] + (this.romarr[1]<<8); // TODO: get starting address
|
||||
if (this.prgstart == 0x801) this.prgstart = 0x80d;
|
||||
this.prgstart = this.romarr[0] + (this.romarr[1]<<8); // get load address
|
||||
// look for BASIC program start
|
||||
if (this.prgstart == 0x801) {
|
||||
this.prgstart = this.romarr[2] + (this.romarr[3]<<8) + 2; // point to after BASIC program
|
||||
console.log("prgstart", hex(this.prgstart));
|
||||
}
|
||||
}
|
||||
// clear keyboard
|
||||
for (var ch=0; ch<128; ch++) {
|
||||
@ -593,8 +597,8 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine {
|
||||
this.exports.machine_exec(this.sys, 150000);
|
||||
// set IRQ routine @ 0x314
|
||||
var old0x314 = this.read(0x314) + this.read(0x315) * 256;
|
||||
this.write(0x314, 0x0d);
|
||||
this.write(0x315, 0x08);
|
||||
this.write(0x314, this.prgstart & 0xff);
|
||||
this.write(0x315, (this.prgstart >> 8) & 0xff);
|
||||
// wait until IRQ fires
|
||||
for (var i=0; i<50000 && this.getPC() != this.prgstart; i++) {
|
||||
this.exports.machine_tick(this.sys);
|
||||
|
Loading…
x
Reference in New Issue
Block a user