Re: PET kernal routines

From: Pete Rittwage <>
Date: Thu, 13 Apr 2017 14:35:52 -0400
Message-ID: <>
> Hello all; I am new to this forum and this is my first post.
> I am one of the very early PET buyers/users, but 'got out of' the
> Commodore
> world in 1985 when I sold my PETs, VIC-20 and C-64. Only more recently did
> I
> decide to relive some of my past by acquiring a PET model 2001-32B to do
> demonstrations of early computers (along with my Altair 8800, COSMAC
> "ELF",
> etc), but so far I have only demonstrated BASIC. I wanted to add a little
> machine language to the demo, and planned to use the "Upgrade ROM"
> integral
> Tiny Machine Language Monitor (TIM or MLM). I found a scan of the manual
> for
> the TIM, but it is the version that came with a cassette, presumably to be
> loaded into computers that did not already have it in the ROMs. As far as
> I
> know, only the later PET ROMs had the TIM, while the VIC-20 & C-64 did not
> have it. I don't know if the TIM manual I downloaded is for a version
> intended for the early PETs, or for the later VIC & C-64 machines.
> Anyway, there is a short (18 byte) piece of ML code in the manual that
> simply writes a bunch of characters to the screen. It is supposed to use
> two
> of the TIM's internal routines, called as subroutines; "CRLF" which I
> believe simply does a 'carriage return/line feed' to move the cursor
> position (screen pointer) away from the text already on the screen, and
> this
> is supposed to be at $04F2, and "WRT" at $FFD2 which writes the ASCII code
> currently in the 6502's accumulator to the screen at the position of the
> current screen pointer. The rest of the little program is basically just a
> loop to increment the contents of the accumulator so that a different
> character is written in each screen position.
> My problem is that the program sends the PET into oblivion, apparently
> because the first part of the program is a JSR to $04F2, to use the "CRLF"
> routine, and I don't think the routine (or ANYTHING) is actually at that
> location. Nothing there to send control back to my program. The Upgrade
> version of the PET memory map shows that area of memory being unused and
> available for RAM expansion. And it seems odd that for a 'tiny' monitor
> program, two of its internal routines would be so widely spaced in memory
> at
> $04F2 and $FFD2.
> I NOP-ed the first three bytes of the program, eliminating the JSR to
> $04F2,
> and the rest of the program works fine.
> But I have had no success in finding any references to show where the
> correct "CRLF" routine address is. I wonder if any of you might know of a
> resource that would have this information. Ideally, a full list of the
> kernel subroutines, especially those that are ostensibly part of the TIM,
> or
> at a minimum the location of the "CRLF" routine.
> Reference - here is the program in question. It resides in the second
> cassette buffer at $033A.
> 033A      20 F2 04                JSR $04F2 ("CRLF" routine)  *** clearly
> "CRLF" is not at $04F2, but WHERE is it? ***
> 033D      A2 20                     LDX $20 (load $20 into X)
> 033F       8A                           TXA (copy value from X to A so
> subroutine can use it)
> 0340       20 D2 FF               JSR $FFD2 ("WRT" or "CHROUT" subroutine,
> prints ASCII character from A onto screen at current screen pointer
> location)
> 0343       E8                           INX (increment X)
> 0344       E0 60                      CPX $60 (compare X with immediate
> value $60, to see if screen writing should stop)
> 0346       D0 F7                     BNE $F7 (if X does not equal $60, do
> relative branch back to start of loop at $033F)
> 0348       00                           BRK (if X does equal $60, exit
> loop
> and return to TIM/MLM)
> 0349       4C 3A 03               JMP $033A (if 'go' command is again
> typed
> on TIM/MLM, program control returns to here, so jump to start of program)
> Thanks for any help with this

Hi Paul,

Well, 04F2 is in the middle of the beginning of RAM normally used by
BASIC, so that would be very wrong for a KERNAL routine. I would grab an
accurate KERNAL reference manual and memory map for the PET.

Here is a good starting point:

-Pete Rittwage

       Message was sent through the cbm-hackers mailing list
Received on 2017-04-13 20:01:41

Archive generated by hypermail 2.2.0.