$ diff -u PETTESTE2KV04.orig PETTESTE2KV04.a65
--- PETTESTE2KV04.orig 2021-05-26 11:08:03.479774600 +0100
+++ PETTESTE2KV04.a65 2021-05-26 11:04:57.766980500 +0100
@@ -2,7 +2,7 @@
; PETTESTE2KV04.a65
; =================
;
-VERSION EQU $04
+VERSION EQU $05
; PETTESTE2K - A program to replace the editor ROM of a Commodore PET computer
; - with the purpose of testing out key functionality of the machine.
@@ -63,7 +63,17 @@
; This replaces the 2K PET EDIT ROM located at $E000.
; ================================================== =
-EDITROM equ $E000
+
+;
+; locate_at_kernal 0=EDITOR, 1=$F800 Kernel
+;
+locate_at_kernal equ 1
+
+.if locate_at_kernal
+ EDITROM equ $F800
+.else
+ EDITROM equ $E000
+.endif
org EDITROM
@@ -783,12 +793,26 @@
jsr ROMCKSUM ; Do it...
lda #$D0 ; Checksum the 4K rom at DXXX.
jsr ROMCKSUM ; Do it...
+
+.if locate_at_kernal
+
+ ; Unable to checksum F800 so try 2K of E000 instead
+ ;
+ lda #$E0 ; Checksum the 2K rom at E0XX.
+ jsr ROMCKSUM ; Do it...
+ lda #$F0 ; Checksum the 2K rom at F0XX.
+ jsr ROMCKSUM ; Do it...
+
+.else
+
;
; No need to do EXXX as this is where our PETTEST is living. It also includes the PET I/O space...
;
lda #$F0 ; Checksum the 4K rom at FXXX.
jsr ROMCKSUM ; Do it...
+.endif
+
; ************************************************** *************************************
; *** ***
; *** Scan the key matrix and display the results (in hex) on a line on the screen. ***
@@ -894,8 +918,23 @@
lda #0 ; Initialise the low byte of the ROM address in page 0 memory.
sta ROMLL ; " " " " " " " " " " " " " " "
+.if locate_at_kernal
+ lda ROMHH
+ cmp #$E0 ; Note that we are doing Editor ROM... only 2K
+ beq small_rom
+ cmp #$F0 ; Note that we are doing lower Kernel... only 2K
+ beq small_rom
+big_rom:
+ lda #$10
+ jmp size_calculated
+small_rom:
+ lda #$08
+size_calculated:
+ sta ROMSIZ
+.else
lda #$10 ; Number of pages of 256 bytes in each 4K ROM. 16*256=4,096 = 0x10(00).
sta ROMSIZ ; " " " " " " " " " " "
+.endif
lda #0 ; Initially zero the checksum value.
sta CKSUMLL ; Low byte.
@@ -1923,9 +1962,42 @@
; ================================================== ===============================
- db "PETTESTE2K - Copyright (c) 2019 David E. Roberts.", 0
+ db "PETTESTE2K - Copyright (c) 2021 David E. Roberts.", 0
; ================================================== ===============================
+
+
+;
+; When located at Kernel ROM we also need the reset vector and include the same
+; reset preamble from the original ROMs for good measure before heading off to
+; the proper start
+;
+
+
+.if locate_at_kernal
+
+VECTORS equ $FFFA
+
+org VECTORS
+ dw dummy_irq
+ dw reset
+ dw dummy_irq
+
+; Preamble from original Kernel
+
+org VECTORS-8
+
+ reset:
+ ldx #$FF
+ txs
+ cld
+ jmp start
+
+dummy_irq:
+ rti
+
+.endif
+
; **************
; *** ***