Jump to content
IGNORED

Multi-platform coding and 80 column support?


leech

Recommended Posts

I've been thinking of learning some coding.  And while I could do something modern and code for current platforms, where is the fun in that?  Also for my idea, there are already plenty of alternatives... so I am considering writing something for the Atari 8bits, but would like some advice on making the code more portable to the other 8bit computers (at least the C64/C128 and Apple II line).

 

I'd also, as an optional support is hardware for 80 column modes.  I know each of those respective platforms have some 80 column support, but I'm guessing a lot of that code would not translate directly between the three.  I'm also assuming that the display routines would have to be different.  Just thinking that any of the math involved could be raw 6502 assembly code, but doing any UI work could all at least look the same, even if the code itself is different.

 

This won't be a graphical application at all, though there is a potential to display images eventually.

 

Anyone else done something similar?

  • Like 1
Link to comment
Share on other sites

Portability between the 8-bits is generally very poor. There is no common basis on which these machines operate. The best you can probably hope for is to get a C compiler such as cc65, and work through its C library, using stdio functions. But that doesn't get you very far, it's mostly limited to text input and text output.

 

As soon as it comes to graphics and sound, you enter non-portable land. Even if it goes for Basic, the machines are sufficiently different to make porting an issue.

Link to comment
Share on other sites

1 hour ago, thorfdbg said:

Portability between the 8-bits is generally very poor. There is no common basis on which these machines operate. The best you can probably hope for is to get a C compiler such as cc65, and work through its C library, using stdio functions. But that doesn't get you very far, it's mostly limited to text input and text output.

 

As soon as it comes to graphics and sound, you enter non-portable land. Even if it goes for Basic, the machines are sufficiently different to make porting an issue.

This is about what I expected.  One thing I was hoping for was a standard 6502 library for random number generation, but if I have to use different ones it shouldn't be too big of a deal.

Link to comment
Share on other sites

9 hours ago, leech said:

I've been thinking of learning some coding.  And while I could do something modern and code for current platforms, where is the fun in that?  Also for my idea, there are already plenty of alternatives... so I am considering writing something for the Atari 8bits, but would like some advice on making the code more portable to the other 8bit computers (at least the C64/C128 and Apple II line).

 

I'd also, as an optional support is hardware for 80 column modes.  I know each of those respective platforms have some 80 column support, but I'm guessing a lot of that code would not translate directly between the three.  I'm also assuming that the display routines would have to be different.  Just thinking that any of the math involved could be raw 6502 assembly code, but doing any UI work could all at least look the same, even if the code itself is different.

 

This won't be a graphical application at all, though there is a potential to display images eventually.

 

Anyone else done something similar?

MAME: Atari 800XL (NTSC) [a800xl] (8bitworkshop.com)

If you are a beginner. USE THIS. very useful- real time compiling too!

image.thumb.png.6b113a1953f0bc405b239d7305aaf7ad.png; Supports assembly language....

image.thumb.png.1a587440163426f22b16b4132d3d9f0e.png..... and C!

It also supports various other platforms. It's what I use. I understand it's aimed at beginers but it's so useful. 

  • Like 1
Link to comment
Share on other sites

Interesting, hadn't actually thought of using MAME at all.  I believe, as far as emulation goes, Altirra is the only one that would support the VBXE, and I think you can even emulate the ACE80 carts (which I have hardware for each).  Only downside to Altirra is that it is Windows only.  Though it seems to work fine under Wine.  I'd love to see Atari800 get U1MB, VBXE, etc support, as it's already multi-platform, though I wonder how well VBXE emulation would work on the Falcon.

  • Like 1
Link to comment
Share on other sites

3 hours ago, leech said:

Interesting, hadn't actually thought of using MAME at all.  I believe, as far as emulation goes, Altirra is the only one that would support the VBXE, and I think you can even emulate the ACE80 carts (which I have hardware for each).  Only downside to Altirra is that it is Windows only.  Though it seems to work fine under Wine.  I'd love to see Atari800 get U1MB, VBXE, etc support, as it's already multi-platform, though I wonder how well VBXE emulation would work on the Falcon.

I must say though, some of the emulators aren't that accurate, there can be issues, and PLEASE, for testing purposes use the ACCURATE emulators.

 

What's worse is that some systems don't support bank-switching (7800) or floppy disks (800 doesn't, but 800xl does.) or certain hardware tricks/modes. Or the sound might be bugged (2600).

so it's not perfect, but for development purposes it's great!!! Have fun. They even include some examples.

Link to comment
Share on other sites

Hi!

34 minutes ago, Ecernosoft said:

MAME: Atari 800XL (NTSC) [a800xl] (8bitworkshop.com)

If you are a beginner. USE THIS. very useful- real time compiling too!

; Supports assembly language....

..... and C!

It also supports various other platforms. It's what I use. I understand it's aimed at beginers but it's so useful. 

It also supports FastBasic, you should give FastBasic a look, I think it will help you prototype your game faster than using assembly.

 

Sadly, the DLI program does not work fully, the multiple player objects at the end does not move: https://8bitworkshop.com/v3.10.0/?platform=atari8-800.xlmame&file=dli.bas

 

Have Fun!

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, dmsc said:

Hi!

It also supports FastBasic, you should give FastBasic a look, I think it will help you prototype your game faster than using assembly.

 

Sadly, the DLI program does not work fully, the multiple player objects at the end does not move: https://8bitworkshop.com/v3.10.0/?platform=atari8-800.xlmame&file=dli.bas

 

Have Fun!

 

Oh yeah true! I forgot. I never use C or FB on 800xl. I'm an assembly language guy, 6502's my game!

Edited by Ecernosoft
Link to comment
Share on other sites

Hi!

6 minutes ago, Ecernosoft said:

Oh yeah true! I forgot. I never use C or FB on 800xl

The current 8bitworkshop even supports asset edition in FastBasic, if you load the "Joyas" example:

 

image.thumb.png.5f38da83da682211fcc9f6d84aeeb1d7.png

 

You can press "Asset Editor" and edit all the game graphics, in real time:

image.thumb.png.3298c207bca3693a0a353a814bd3baa9.png

 

Have Fun!

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, dmsc said:

Hi!

The current 8bitworkshop even supports asset edition in FastBasic, if you load the "Joyas" example:

 

image.thumb.png.5f38da83da682211fcc9f6d84aeeb1d7.png

 

You can press "Asset Editor" and edit all the game graphics, in real time:

image.thumb.png.3298c207bca3693a0a353a814bd3baa9.png

 

Have Fun!

 

Oh yeah that too!!!!
 

Have fun. One day show me some of your projects.

 

 

Of course, you can't edit the assets in C&A.

 

Here's the source code for C&A if you want it:

ConnerandAnthony_VB7.0 (1).a

Have fun @leech!

I also use this for my 7800 and 2600 development, and it even supports NES (though nes sux compared to 7800, so I don't code NES that often.)

Link to comment
Share on other sites

23 minutes ago, Ecernosoft said:

I also use this for my 7800 and 2600 development, and it even supports NES (though nes sux compared to 7800, so I don't code NES that often.)

It's a shame that Nintendo had such a stranglehold on developers back then.  Also the 7800 lacking the POKEY, and shipping with the 2600 sound didn't help it, but it's a very nice console, capability wise!  (I was a Sega Master System fan at the time!)

Link to comment
Share on other sites

55 minutes ago, dmsc said:

Hi!

It also supports FastBasic, you should give FastBasic a look, I think it will help you prototype your game faster than using assembly.

 

Sadly, the DLI program does not work fully, the multiple player objects at the end does not move: https://8bitworkshop.com/v3.10.0/?platform=atari8-800.xlmame&file=dli.bas

 

Have Fun!

 

I'm not planning on a game, per se.  I haven't decided yet if I'm going to be making a Pathfinder 2e Character Creator, or if I'm going to create an Encounter builder for it.  But it's going to be a utility.  So at least that'll eliminate the need for doing various sound.  Ha, so I don't really need to argue SID vs POKEY.  I'm going to keep it simple and it'll be mostly text, though if I could figure out a way to get the free images for creatures / races for the characters, would be interesting to have graphics display.  But that's definitely one of those 'many moons down the road.' features.

  • Sad 1
Link to comment
Share on other sites

12 hours ago, Ecernosoft said:

Oh yeah true! I forgot. I never use C or FB on 800xl. I'm an assembly language guy, 6502's my game!

I like assembler, but also C, I use cc65 which does allow assembler files in the build, so

custom display lists and VBI/DLI are easy, it also supports in-line assembly, but I find it a bit "wordy/clumsy"

so prefer a separate .asm file instead.

Link to comment
Share on other sites

5 hours ago, TGB1718 said:

I like assembler, but also C, I use cc65 which does allow assembler files in the build, so

custom display lists and VBI/DLI are easy, it also supports in-line assembly, but I find it a bit "wordy/clumsy"

so prefer a separate .asm file instead.

I like assembly mostly for DAT SPEEED. (and dat simplicite

When your DMA looks like this:

image.thumb.png.d3f638a76a64aa2e1a6df8fddb1339b6.png; yeah.......

Edited by Ecernosoft
Link to comment
Share on other sites

Hi!

19 minutes ago, Ecernosoft said:

I like assembly mostly for DAT SPEEED.

When your DMA looks like this:

image.thumb.png.d3f638a76a64aa2e1a6df8fddb1339b6.png; yeah.......

 

You are fixated on that "DMA visualization", but I think you are confused.

 

In Antic mode D, with NTSC, you loose only 14% of the CPU cycles to DMA, is not much, and this gives you an equivalent CPU speed of over 1.4MHz - this is not slow. The worst case, mode 2 or 4 in NTSC gives you about 1.1 million CPU cycles per second, so it is not that bad also. And in PAL, the overhead is 20% less.

 

Have Fun!

Link to comment
Share on other sites

24 minutes ago, Ecernosoft said:

Awh man! Would've been interesting to see a game come out of you. But that's ok!

Ha, a game would require some artistic talent, of which mine is pretty crap.  I am better at words and layout than graphics.  Also I won't need to worry about sound.

 

That being said, if I can get good enough at working with the VBXE, I REALLY want to work on a Ultima IV enhanced version.

Link to comment
Share on other sites

16 hours ago, Ecernosoft said:

Atari can do that.

 

 

Use POKEY+$09.

So close.  POKEY is $D200; $D209 is STIMER (W) / KBCODE (R).

 

RANDOM (R) is $D20A.

Quote

 

53769              D209              STIMER

     (W) Start the POKEY timers (the AUDF registers above). You
     POKE any non-zero value here to load and start the timers; the
     value isn't itself used in the calculations. This resets all of the audio
     frequency dividers to their AUDF values. If enabled by IRQEN
     below, these AUDF registers generate timer interrupts when they
     count down from the number you POKEd there to zero. The
     vectors for the AUDF1, AUDF2 and AUDF4 timer interrupts are
     located between 528 and 533 ($210 and $215). POKEY timer four
     interrupt is only enabled in the new "B" OS ROMs.

                              KBCODE

     (R) Holds the keyboard code which is then loaded into the shadow
     register (764; $2FC) when a key is hit. Usually read in response to
     the keyboard interrupt. Compares the value with that in CH1 at
     754 ($2F2). If both values are the same, then the new code is
     accepted only if a suitable key debounce delay time has passed.
     The routines which test to see if the key code will be accepted start
     at 65470 ($FFBE). BIT 7 is the control key flag, BIT 6 is the shift key
     flag.

53770              D20A              SKREST

     (W) Reset BITs 5 - 7 of the serial port status register at 53775 to one.

                              RANDOM

     (R) When this location is read, it acts as a random number
     generator. It reads the high order eight bits of the 17 bit
     polynomial counter (nine bit if BIT 7 of AUDCTL is set) for the
     value of the number. You can use this location in a program to
     generate a random integer between zero and 255 by:

     10  PRINT PEEK(53770)

     This is a more elegant solution than INT(RND(0) * 256). For a test of
     the values in this register, use this simple program:

     10 FOR N = 1 TO 20: PRINT PEEK(53770): NEXT N

 

 

Link to comment
Share on other sites

3 hours ago, David_P said:

So close.  POKEY is $D200; $D209 is STIMER (W) / KBCODE (R).

 

RANDOM (R) is $D20A.

 

(my bad)

 

 

Speaking of, if you want to code Atari, it's not that hard.

 

There's a few registers that denote where "things" are, like the Display list, NMI/IRQ/DLI vectors, which of those are enabled, ETC.

 

DLISTL/DLISTH
This is the pointer to your display list. It's really simple and 8bitworkshop does a better job explaining it.

Reminder that 8bitworkshop uses the SHADOW registers. If you want speed, set NMIEN to $80 or $C0 if you are working on a XL or higher (So you can set your own NMI vector too) and if you don't have a custom NMI vector available, use a DLI as one.

 

PMBASE

The player/missle base address. Like DLISTH but for players. Unfortunately this means that players must be page-aligned in terms of memory and what's worse is the offsets.

M0/1/2/3 starts at PMBASE+$300, P0 starts at PMBASE+$400, P1 starts at PMBASE+$500, etc.

 

CHBASE
Where does your character set start? This defines that. Unfortunately like players character sets must be page-aligned, but unlike players there's no weird offset.

Reminder that the Bitmap modes don't use this register and that ANTIC 6-7 have a 512 byte character set whereas all the other modes have a 1K one. Hence why I don't usually use modes 6 or 7.

 

COLPF0-3 and COLBK and COLPM0-3

These are the color registers. COLPF0-3 and COLBK are for the playfeild and COLPM0-3 are for the players. In 5 player mode, all missiles act as one player and use $D011 for color. (I believe that is COLPF3?)

 

GPRIOR

I'm going to ignore the bottom 6 bits because from what you've said you want to make a character set editor. (I'd love to try it!)

The top 2 bits (Bits 7 and 6) are very useful as they choose what GTIA mode (if at all) that you want to use.

If you set these to 00 then.... well, nothing.

image.png.7b5fd20c5daf5aec236b3e0f7047b918.png; Normal mode

If you set these to 10 however you get the special 9 color mode. All 9 color registers are used and any hires (antic 2, 3, F) graphics are treated as super low res 4bpp graphics.

(Keep in mind that only these modes are intended for GTIA modes. Any low res modes look wrong using any GTIA mode.)

image.png.1100f6daa86a1bb5f6e81161ea3847c6.png; GTIA mode 10

Setting these bits to 01 will get you 16 hue mode.  This is GTIA mode 9. We get 16 luminances and the hue comes from COLBK.

image.png.379567fc6d27617b06dd3ed54b262c8e.png; GTIA mode 9

And finally, GTIA mode 11. This is what you get by setting both bits to 11. We get 16 hues and the luminance comes from COLBK.

image.png.963efe9a04383ecc655cc2dcb1b3c25e.png; GTIA mode 12

 

Special trick

By overlaying players on top of hires graphics, the colors between the players and the background do a bitwise OR. You can get extra colors this way.

 

Hope this was useful! Have fun.

 

Link to comment
Share on other sites

5 hours ago, dmsc said:

Hi!

 

You are fixated on that "DMA visualization", but I think you are confused.

 

In Antic mode D, with NTSC, you loose only 14% of the CPU cycles to DMA, is not much, and this gives you an equivalent CPU speed of over 1.4MHz - this is not slow. The worst case, mode 2 or 4 in NTSC gives you about 1.1 million CPU cycles per second, so it is not that bad also. And in PAL, the overhead is 20% less.

 

Have Fun!

Yes, I know.

 

Unfortunately, on top of using antic 4 for C&A and SCROLLING, which means that it's like having a wide playfeild. I do have one line of non-scrolled at the top though.
That's all. (Also  I have P/M graphics enabled.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...