Menu

#2235 Problem with PETCAT for CBM-II Basic

v3.10
open
nobody
GTK3
petcat
2026-06-24
2026-06-21
No

It seems PETCAT (v3.10) can't differ BASIC v4.0 for the PET and BASIC v4.0 for the CBM-II. It knows only the first option. It would be great to add support for the second.
C64-Wiki calls this version 4+ - https://www.c64-wiki.com/wiki/BASIC#Overview_of_BASIC_Version_4+_Commands

Thank you.

Discussion

  • gpz

    gpz - 2026-06-21

    good catch, there are some comment in the code that indicate the two are the same - but obviously they are not :)

    (if you could point at a complete token list, with their absolute values, that would help a lot)

     
  • Vladimir Lidovski

    Hi
    I wrote a small program 'gentokens.c' that generates a Basic program that uses the all possible token numbers from 128 to 255. Then I loaded the generated program 'tokens.prg' into the VICE emulator using 'xpet tokens.prg'. Then I type
    OPEN8,8,8,"TOKENS40,S,W"
    CMD8
    LIST-218
    LIST220-236
    LIST238-
    PRINT#8
    CLOSE8
    This made the TOKEN40 file on the virtual FS I used. Then I slightly processed the file and got the result list of tokens in 'tokens40x.txt'.
    I did the same procedure using 'xcbm2 tokens.prg'. However sometimes it didn't work. It seems there is a tricky error in this emu. The list of tokens I got with
    LIST-232
    and saved it after the similar processing in 'tokens40+x.txt'. However it seems 'xcbm2' has another bug, I couldn't use the virtual FS. :( So I had to attach a disk image file. I had troubles with a D80-image but I could persuade the emu to work with a D64-image. Sorry I am not going to open a ticket for these bugs. But I hope that my report will be noted.
    I also hope this can help to improve PETCAT v3.11.
    Regards,

     

    Last edit: Vladimir Lidovski 2026-06-22
  • Vladimir Lidovski

    In the 'RESERVED WORD LIST', there are the same keywords as in 'tokens40+x.txt' and they are in the same order. However it seems there are some problems. For instance, the 'tokens' document claims that there is token $AB for the plus sign but type
    10 ?1+2
    in 'xcbm2' and check the expression in VICE monitor. It shows token $AA for the plus... It seems they also missed the token for the pi sign.

     
  • gpz

    gpz - 2026-06-22

    I came up with this so far, does that make sense? :)

    CBM2 Basic V4.0 Tokens
    ----------------------
    
    // 0x80 - 0xcb  common CBM Basic Keywords
    
     128 end
     129 for
    
     130 next
     131 data
     132 input#
     133 input
     134 dim
     135 read
     136 let
     137 goto
     138 run
     139 if
    
     140 restore
     141 gosub
     142 return
     143 rem
     144 stop
     145 on
     146 wait
     147 load
     148 save
     149 verify
    
     150 def
     151 poke
     152 print#
     153 print
     154 cont
     155 list
     156 clr
     157 cmd
     158 sys
     159 open
    
     160 close
     161 get
     162 new
     163 tab(
     164 to
     165 fn
     166 spc(
     167 then
     168 not
     169 step
    
     170 +
     171 -
     172 *
     173 /
     174 ^
     175 and
     176 or
     177 >
     178 =
     179 <
    
     180 sgn
     181 int
     182 abs
     183 usr
     184 fre
     185 pos
     186 sqr
     187 rnd
     188 log
     189 exp
    
     190 cos
     191 sin
     192 tan
     193 atn
     194 peek
     195 len
     196 str$
     197 val
     198 asc
     199 chr$
    
     200 left$
     201 right$
     202 mid$
     203 go
    
    ----------------------------------------------------------------------------
    // 0xcc - 0xde, same as 4.0 (PET)
    
     204 concat
     205 dopen
     206 dclose
     207 record
     208 header
     209 collect
    
     210 backup
     211 copy
     212 append
     213 dsave
     214 dload
     215 catalog
     216 rename
     217 scratch
     218 directory
     219 dclear
    
     220 bank
     221 bload
     222 bsave
    
     ----------------------------------------------------------------------------
    // 0xdf - 0xe8 4.0 CBM2 extra
    
     223 key
     224 delete
     225 else
     226 trap
     227 resume
     228 dispose
     229 pudef
    
     230 using
     231 err$
     232 instr
    
     ----------------------------------------------------------------------------
     255 PI sign
    
     
  • Vladimir Lidovski

    It seems that the extra keywords for the CBM II start from the position 219 (DCLEAR, $db). I am also unsure about ancient Basic v1.0... It is about the common CBM Basic keywords.

     
  • gpz

    gpz - 2026-06-22

    and here is a patch, completely untested :)

     
  • Vladimir Lidovski

    Have you checked my previous post?

     
    • gpz

      gpz - 2026-06-22

      I'll check against xpet now... the existing comments seem to be slightly inaccurate then :)

      can you test the patch?

       
  • Vladimir Lidovski

    How? I can only repeat that
    "dclear", "bank", "bload", "bsave"
    are not part of the xpet Basic v4.0.

     
    • gpz

      gpz - 2026-06-22

      Yes you are right, i just wanted to confirm it for myself :)

      And now... i'd like to see this supposed "Basic v4" for the C64 too, so i really do the right thing ....

       
  • gpz

    gpz - 2026-06-22

    check r46151 please

     
  • Vladimir Lidovski

    It seems to work, but I haven't carried out thorough testing.
    Thank you.

     
  • Vladimir Lidovski

    Let me add one more suggestion. In my opinion, it would be better to use '{pi}' rather than the tilde sign in the output for the -k option.

     

Log in to post a comment.

MongoDB Logo MongoDB