[HN Gopher] Commodore 64 BASIC and KERNAL on Atari 8-bit hardware
       ___________________________________________________________________
        
       Commodore 64 BASIC and KERNAL on Atari 8-bit hardware
        
       Author : TMWNN
       Score  : 63 points
       Date   : 2021-08-12 17:35 UTC (5 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | ecpottinger wrote:
       | If I remember right, Atari Basic had 4 byte floats and Commodore
       | Basic has 4 byte floats. The extra precision mattered for some
       | programs, but the small size made the Atari Basic faster.
        
         | jhallenworld wrote:
         | Atari had 6 byte floats, BCD. Commodore had 5 bytes, binary.
        
         | tenebrisalietum wrote:
         | CBM had 5 byte floats I think you meant--edit: maybe it was 6.
         | 5 byte mantissa and 1 byte exponent??
         | 
         | CBM BASIC was a Microsoft product and I think more or less what
         | all the Microsoft BASICs did was convert everything to floats
         | internally--even when not really needed. For example the index
         | in a FOR I=1 to 10 was dealt with internally (and slowly) as a
         | float--including the operation to increment it by 1 or the STEP
         | value.
         | 
         | If Atari BASIC didn't do that it would have made things faster
         | in many situations. Apple's Integer BASIC was faster because it
         | didn't support floats at all, if you could deal with the almost
         | C-style strings IIRC.
        
           | jhallenworld wrote:
           | I always thought it would be cool if the line numbers were
           | floating point. You could always insert a line between any
           | existing ones then.
        
             | nl wrote:
             | This is why everyone use 10, 20 etc.
             | 
             | I think I remember there was a Renumber command that would
             | reset any inserted numbers too?
        
               | guyzero wrote:
               | There were BASIC extensions you could get that added
               | renumber. The C128 had renumber as a builtin.
        
             | adrianmonk wrote:
             | I'm pretty sure Netflix queues used to work this way. For
             | the DVD-by-mail service, I think.
             | 
             | Basically, the web page had a text field next to each
             | movie, and you could type in numbers, then submit a form,
             | and it would reorder your queue.
             | 
             | The obvious thing to do was swap "1" and "2" to flip the
             | order of the top two items. But you could just set the
             | second one to "0.5" and leave the first at "1". When you
             | submitted the form, it would renumber them all with
             | integers.
        
           | bonzini wrote:
           | Integer variables were written I%. I%=I%+1 was certainly
           | faster than I=I+1, but I am not sure if that extended to FOR
           | loops.
        
             | masswerk wrote:
             | The implementation issue with integers in Commodore BASIC 2
             | was that they were still stored in a 5 byte format, while
             | actually using just the first two bytes. Meaning, unlike
             | with other implementations of MS BASIC, they occupied 7
             | bytes in memory (with two leading bytes for the
             | identifier), just like floating point variables, and there
             | was no improvement on memory usage with integers.
        
           | ataylor284_ wrote:
           | CBM had 5 byte floats, but when they were copied into the
           | floating point "registers", they were expanded into a 6 or 7
           | byte representation for speed. It was 8 bits of exponent, 1
           | bit sign, and 31 bits of mantissa (with one extra implicit
           | bit since the leading bit is always 1).
           | 
           | It's true there was very little performance gain to using
           | BASIC integer variables, since they'd be converted to floats
           | internally almost always. The one real advantage of integers
           | is that a DIMed array of ints was more compact than an array
           | of floats.
        
       | intricatedetail wrote:
       | I remember Atari basic was quite superior, so probably that's why
       | there was no port. Awesome work!
        
         | ataylor284_ wrote:
         | It's unfortunate that Commodore shipped BASIC 2.0 on the 64.
         | They already had shipped PETs with the much superior BASIC 4.0
         | years earlier. It was likely a cost saving measure: they had a
         | more favorable licensing deal with MS on BASIC 2.0 and it fit
         | on fewer ROM chips. Too late the C128 came with BASIC 7.0 which
         | was actually quite good (for an 8-bit BASIC anyway).
        
         | tenebrisalietum wrote:
         | Didn't it do something weird with strings where you had to
         | periodically LIST and reload your program to prevent crashes?
        
           | jhallenworld wrote:
           | Yeah, famous bugs. Atari BASIC source is fully documented in
           | this book:
           | 
           | https://archive.org/details/ataribooks-the-atari-basic-
           | sourc...
           | 
           | See appendix B, memmove() was broken.
        
       | fw4h5 wrote:
       | Fuck masks. Fuck vaccine passports.
       | 
       | Fuck anyone that supports this totalitarian bullshit.
        
       | TMWNN wrote:
       | Source:
       | https://www.reddit.com/r/c64/comments/p24fo8/i_modified_the_...
        
       | sys_64738 wrote:
       | Blasphemy.
        
       ___________________________________________________________________
       (page generated 2021-08-12 23:00 UTC)