diff --git a/c64/kernal/,aliases.s b/c64/kernal/,aliases.s index 00578fd7..da75162a 100644 --- a/c64/kernal/,aliases.s +++ b/c64/kernal/,aliases.s @@ -12,7 +12,6 @@ .label load_or_scroll_temp_pointer = $AC // We also use the following for temp colour pointer when scrolling .label load_save_verify_end_address = $AE - .label cassette_buffer_ptr = $B2 .label current_logical_filenum = $B8 .label current_secondary_address = $B9 .label current_device_number = $BA diff --git a/c64/kernal/cartridge_check.s b/c64/kernal/cartridge_check.s index f74cfeaa..00221fb4 100644 --- a/c64/kernal/cartridge_check.s +++ b/c64/kernal/cartridge_check.s @@ -8,6 +8,6 @@ cartridge_check_l1: bne no_cartridge dex bne cartridge_check_l1 - rts + // FALLTROUGH no_cartridge: rts diff --git a/c64/kernal/fd50.interop b/c64/kernal/fd50.interop new file mode 100644 index 00000000..7e314936 --- /dev/null +++ b/c64/kernal/fd50.interop @@ -0,0 +1,3 @@ +RRAMTAS is an important startup routine, frequentl called b cartridges - unfortunately, we can't count on them calling it +via the jumptable, as even some tutorials on the web advise to call it directly - see for example here: +https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image diff --git a/c64/kernal/fd50.ramtas.jmp.s b/c64/kernal/fd50.ramtas.jmp.s new file mode 100644 index 00000000..b20ed77e --- /dev/null +++ b/c64/kernal/fd50.ramtas.jmp.s @@ -0,0 +1,6 @@ + +// Our implementation is longer than the original one, +// placing it here would cause a collision with OPEN + +RAMTAS: + jmp ramtas_real diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index a64b1fc4..bdffec29 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -71,6 +71,9 @@ IOINIT: // Enable CIA1 IRQ and ~50Hz timer (https://csdb.dk/forums/?roomid=11&topicid=69037) lda #$7F sta CIA1_ICR // disable all + + // Same for CIA2 - it can generate IRQs too, we definitely don't want this + sta CIA2_ICR // Set timer interval to ~1/60th of a second diff --git a/c64/kernal/ramtas.s b/c64/kernal/ramtas_real.s similarity index 84% rename from c64/kernal/ramtas.s rename to c64/kernal/ramtas_real.s index e5feb561..d632102c 100644 --- a/c64/kernal/ramtas.s +++ b/c64/kernal/ramtas_real.s @@ -8,17 +8,18 @@ // CPU registers that has to be preserved (see [RG64]): none // -RAMTAS: +ramtas_real: // C64 Programmer's Reference guide p291: // Clear $0000-$0101, $0200-$03ff // PGS: $0000, $0001 are CPU IO ports, so shouldn't get written to ldy #$02 lda #$00 -ramtas_l1: - sta $00,Y +!: + sta $00,y iny - bne ramtas_l1 -ramtas_l2: + bne !- + +!: // How many ways are there to efficiently erase these two pages // of RAM? We would like to avoid any unnecessary byte similarity // with the C64 KERNAL. Thus we do $0300 before $0200, even though @@ -28,14 +29,14 @@ ramtas_l2: sta $0300,Y sta $0200,Y iny - bne ramtas_l2 + bne !- - // allocate cassette buffer - // "Mapping the C128", p61 + // Allocate cassette buffer + // "Mapping the C64", p237 lda #<$033C - sta cassette_buffer_ptr+0 + sta TAPE1+0 lda #>$033C - sta cassette_buffer_ptr+1 + sta TAPE1+1 // set screen address to $0400 // https://www.c64-wiki.com/wiki/Screen_RAM @@ -60,7 +61,7 @@ ramtas_l2: // and several following ldx #>$0400 stx HIBASE - + // Work out RAM size and put in MEMSTR and MEMSIZK // "Compute's Mapping the 64", p54 // http://unusedino.de/ec64/technical/project64/mapping_c64.html @@ -70,22 +71,19 @@ ramtas_l2: stx MEMSTR+0 stx MEMSIZK+0 // Try to modify $8000, if it fails then RAM ends at $7FFF, else $9FFF - lda $8000 - eor #$FF - tax - eor #$FF + ldx $8000 + inx + stx $8000 + cpx $8000 + bne ramtas_32K_RAM + dex stx $8000 - cmp $8000 - beq ramtas_32K_RAM - sta $8000 ldx #$A0 stx MEMSIZK+1 - jmp ramtas_RAM_sized + bne !+ // always non-zero, saves one byte + ramtas_32K_RAM: - sta $8000 // in case RAM is hiding beneath a ROM ldx #$80 stx MEMSIZK+1 - // Fall through -ramtas_RAM_sized: - +!: rts diff --git a/c64/kernal/reset_entry.s b/c64/kernal/reset_entry.s index 626e6d72..17b021ad 100644 --- a/c64/kernal/reset_entry.s +++ b/c64/kernal/reset_entry.s @@ -37,7 +37,7 @@ reset_entry: jsr JCINT // What do we do when finished? A C64 jumps into the BASIC ROM - cli // Allow interrupts to happen + cli // allow interrupts to happen // c64 prg p269 jmp (IBASIC_COLD_START)