• Please review our updated Terms and Rules here

PETTESTE2KV04 at $F800

Nivag Swerdna

Veteran Member
Joined
Jul 17, 2020
Messages
740
Location
London, UK
I would quite like to bodge PETTESTE2KV04 to work in the H7 slot of a 2001-8 with 6540 ROMs so the machine would only need a single ROM to start

Has this been done before? I don't want to re-invent the wheel if it has...

I was considering putting the following snippet at the top of the file...

Code:
VECTORS equ $FFFA

org VECTORS

dw dummy_irq
dw reset
dw dummy_irq


org VECTORS-8

reset:
ldx #$FF
txs
cld
jmp start

dummy_irq:
rti


EDITROM equ $F800

org EDITROM

Feasible?

Thanks in advance
 
I would think you would need to run the assembler on source again to get all the jumps and branches to go to the right locations, given the new code location - would depend on if there were instructions with absolute locations. Aside from that, should be possible.
 
OK I created a version with conditional compilation and it works pretty well... I'm happy to contribute this back...
Code:
$ 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
+

; **************
; *** ***

It also calculates the checksum of the editor ROM and the first 2K of kernel space... so when installed in H7 in an original PET it should checksum everything apart from H7 itself.
 
I would think you would need to run the assembler on source again to get all the jumps and branches to go to the right locations, given the new code location - would depend on if there were instructions with absolute locations. Aside from that, should be possible.
Indeed needs to be assembled at ASM80.com
 
Yes,

I was going to get around to doing this at some point, but real paid work has got in the way!

Thanks for doing this, a great enhancement.

Dave
 
For these old 2K ROMs PETs, are you calculating the checksums over 2K boundaries instead of 4K to isolate sum check problem to one ROM?

I didn't change much. The Editor ROM and Low Kernel are now 2K checksums and the extra checksum neatly fits on the line. 2K checksums is a nice idea.

(Checksum is 0000 here because that region is 0000s in my example)
 

Attachments

  • Capture.JPG
    Capture.JPG
    81.9 KB · Views: 1
Back
Top