Jump to content

danwinslow's Photo

danwinslow

Member Since 9 Mar 2005
OFFLINE Last Active Today, 6:38 AM

#4123879 CC65 VBLANK and DLI

Posted by danwinslow on Sat Sep 29, 2018 4:55 PM

while ( *( (unsigned char *)(0xD40B))) might work too.

But I'm confused - if you are drawing graphics in a normal way, outside of the vertical blanks, then you are by definition not going to be drawing them while the vb is happening, so there's no point in waiting. Any cycles your program gets are always 'after the Vblank', right?  Unless the goal is to draw a complete screen before the next vblank happens...?

Anyway, I don't really understand what he's trying to do, so I'm probably off base.

 

Sanny - I didn't really give him a solution, just showed some examples of how to use a little bit of inline assembler to handle interrupts. He's asking for something else i think.




#4123725 CC65 VBLANK and DLI

Posted by danwinslow on Sat Sep 29, 2018 12:59 PM

A parameter-less C function (void func(void) ) is indistinguishable from an assembler call. If you set up a vbi() function and put it's address into the vbi pointers and do the other necessary settings for a VBI setup, your routine will be called each vblank. You do need to jump back correctly, and that requires an asm("RTI") and stuff, but its pretty easy to use the asm() functions in C.

 

You can hook dli's too, but I am not sure how you would save the regs you need without asm. See the below functions. Using the asm() stuff in C is pretty easy if all you do is save regs, set a few things, and return.

#define DLIST  *((unsigned int *)560)
#define LMS_MASK 0x40
#define DLI_MASK 0x80
#define JVB      0x41
#define JMP      0x01
#define SCAN_GR0 0x02
#define SCAN_GR4 0x04

unsigned char color_save;
unsigned char bloo=(7 << 4 )+1;
unsigned char noo=(7 << 4 )+15;
char dl[256];

void dli0( void )
{

asm("     PHA      "); //save a

//chain to next DLI
asm("     LDA #<_dli1");
asm("     STA $0200");
asm("     LDA #>_dli1");
asm("     STA $0201");

//save color
asm("     LDA $2c6       ");
asm("     STA _color_save");

//load up color
asm("     LDA #1    ");
    asm("     STA $D40A "); // wsync
    asm("     STA $D018 ");

//restore a
asm("     PLA      ");
asm("     RTI      ");
}

void dli1( void )
{

asm("     PHA      "); //save a

//load up color
asm("     LDA #3   ");
asm("     STA $D40A"); // wsync
asm("     STA $D018 ");

//chain to next DLI
asm("     LDA #<_dli2");
asm("     STA $0200");
asm("     LDA #>_dli2");
asm("     STA $0201");

//restore a
asm("     PLA      ");
asm("     RTI      ");
}

void dli2( void )
{

asm("     PHA      "); //save a

asm("     LDA #7   ");
asm("     STA $D40A"); // wsync
asm("     STA $D018 ");

//chain to next DLI
asm("     LDA #<_dli3");
asm("     STA $0200");
asm("     LDA #>_dli3");
asm("     STA $0201");

//restore a
asm("     PLA      ");
asm("     RTI      ");
}

void dli3( void )
{

asm("     PHA      "); //save a

//load up color
asm("     LDA _color_save");
asm("     STA $D40A "); // wsync
    asm("     STA $2c6  ");
asm("     STA $D018 ");

//chain to next DLI
asm("     LDA #<_dli0");
asm("     STA $0200");
asm("     LDA #>_dli0");
asm("     STA $0201");

//restore a
asm("     PLA      ");
asm("     RTI      ");
}

void setup_dli_chain( void )
{
  *(unsigned int  *)(0x0200)=&dli0;
  *(unsigned char *)(0xD40E)=*(unsigned char *)(0xD40E) | 0x80;
}

unsigned int next;

void build_dl( void )
{
int sl=0;

dl[sl++]=0x70;
dl[sl++]=0x70;
//dl[sl++]=0x70;
dl[sl++]=SCAN_GR0 | LMS_MASK;
dl[sl++]=(int)&screen1 & 0xFF;
dl[sl++]=((int)(&screen1) & 0xFF00) >>8;
dl[sl++]=0;

    dl[sl++]=SCAN_GR0;
    dl[sl++]=SCAN_GR0;
    //dl[sl+0]=SCAN_GR0;
    //dl[sl+1]=JMP;
//next=(unsigned int)&dl[sl+4];
//dl[sl+2]=( next & 0xFF );
//dl[sl+3]=( (next >> 8 ) & 0xFF );
//sl+=4;

dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0 | DLI_MASK;
dl[sl++]=SCAN_GR0 | DLI_MASK;
dl[sl++]=SCAN_GR0 | DLI_MASK;
dl[sl++]=SCAN_GR0 | DLI_MASK;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
dl[sl++]=SCAN_GR0;
    dl[sl++]=JVB;
dl[sl++]=(int)&dl & 0xFF;           ;
dl[sl++]=((int)(&dl) & 0xFF00) >>8; ;
}


void activate_dls ( void )
{
  //set screen
  *(unsigned int *)(88)=&screen1;
  //kill antic by storing 0 into $22f
  *(unsigned char *)(0x22F)=0;
  //Then store the address of the new display list into $230 and $231 (low then high).
  DLIST=&dl;
  //Lastly, turn ANTIC back on with a $22 into SDMCTL.
  *(unsigned char *)(0x22F)=0x22;
}



#4120156 CC65 and display list

Posted by danwinslow on Mon Sep 24, 2018 3:13 PM

Yaron - I was in exactly the same place as you a couple of years ago. Then I decided to get over my config phobia and I just started working with it and learning. It makes sense once you get used to it, and it makes serious development MUCH easier in the long run. Well worth the effort. I wound up using it to define overlays and EXT ram loadable stuff and all kinds of things. Well worth the time investment.




#4109243 New Atari Console that Ataribox?

Posted by danwinslow on Sun Sep 9, 2018 7:16 AM

 

Did you have a bad Taco or something?  ;-)

Hah, no, that was a line of Burroughs 3500 OS command. See, WAY up above in post #12727  pacman said something about a burroughs mainframe. So, naturally I thought if I posted like 20 posts later it would make perfect sense, and all of the ex-Burroughs computer programmers here would have a hearty chortle.




#4081722 Atari/Sinclair/Timex 'collection'

Posted by danwinslow on Sun Jul 29, 2018 2:21 PM

Hi Folks.

So, as I continue to divest my 8-bit stuff, I find I have a large amount of stuff that probably isn't worth the effort selling on Ebay, but I hate to throw away as trash. I took a shot at this a while back, but I stalled out. This time I'd like to just list by general content the stuff, and ask if anyone might be interested in paying postage and getting it otherwise free. Stuff like:

 

1. I have about 25 mixed 800xl/1200xl's, and about 10 or so 130xe's - I think some work but some may not and if they do work all have some problem like bad RAM, bad display, bad keyboard, etc. The case conditions are mostly fairly good, some are kind of dusty. The XL's are so heavy it's expensive to mail, I bet I am looking at about 100 pounds worth in total.  I don't really feel like cleaning them and mailing them out one by one, so if someone wants a bulk lot of them for local pickup let me know. I'm in Omaha Nebraska. I am willing to bulk mail but like I said it'll be expensive.

 

2. I have a giant box full of Sinclair/Timex stuff, 4-5 TS1000's, a couple 2068's, a couple zx80's, a printer, a bunch of different memory packs from 16-64k, memotech keyboards, weird boards I have no idea about, etc. Also up for free local pickup or mail with postage paid.

 

Or, if you'd be interested in taking the whole Atari and/or Sinclair piles, just let me know and I'll get a weight and a shipping estimate. Still free, just pay shipping. 

 

3. I have about 6 1050's and an 810 or two and an Indus. No SIO cables, but the drives look good and work as far as I know. Also free bulk pickup or if you want to get it mailed bulk let me know.

 

4. 50 or so mixed Atari cartridges, no rares as far as I know, also free for pickup or mail if postage paid.

 

If you are interested in one of the options, let me know and I will give you exact item counts and give you a postage amount.

 

 

Thanks,

Dan




#3999512 Some new (not really) hardware made by tfhh

Posted by danwinslow on Mon Apr 2, 2018 8:19 PM

Ah so, Prima. Das geht, danke schon.




#3942831 8bit-Slicks: Promo Video

Posted by danwinslow on Tue Jan 23, 2018 11:36 AM

Do you plan to produce another batch soon?
If the game is received as well as I hope, you may get quite a few inquiries...

For Altirra setup, see: http://8bit-slicks.c...with-dragoncart

I was mostly the money, Mark Dusko was the actual hardware guy. He has his design up on his website, though. I am sure he would have no problem if someone wanted to make another run. I have not heard from him in some time, but his atariage handle is puppetmark. I would imagine that dropcheck or one of the other folks still producing boards would be able to handle it. I think a pass-through cart would be much better, and/or a PBI device. The CS8900A is hard to source in 5 volts. Lots of people seem to think that a 'all in one' with its own TCP stack is the way to go, but unless it has a memory mapped transfer bus it won't work very well. SIO is not capable of handling it. And, as you've seen, a dedicated single purpose stack is very doable on the eight bits, especially to support UDP.




#3904256 TS1000/ZX81 fanboys?

Posted by danwinslow on Mon Dec 4, 2017 2:34 PM

My very first computer was a zx80. I wrote my very first program on it too, a BASIC version of "Lunar Lander" with an 'M' for the lander and a landscape of periods and dashes. Makes me mist up just thinking about it.

 

Fast forward to now - alongside all my atari stuff I have a giant box filled with Sinclair/Timex stuff.




#3881366 Does anyone use Pascal anymore?

Posted by danwinslow on Wed Nov 1, 2017 10:51 AM

If you mean in the modern development industry, then no, nobody really uses it for new development. There are nooks and crannies doing legacy maintenance that might have some pascal, but it would less than 1% of the market, probably much less.


  • jhd likes this


#3850665 Is the 8 bit uninspiring?

Posted by danwinslow on Mon Sep 18, 2017 8:29 AM

Wow, this is the most successful trolling I've seen in a while. OP is winning by a mile, not because they are right, but because you guys are all excited about it.




#3849692 Is Java any benefit to programming for the 2600?

Posted by danwinslow on Sat Sep 16, 2017 5:18 PM

 

C is worse as a beginner language than Java in that C will give you a gun and let you shoot yourself in the foot and not give you much indication what you did wrong other than "segmentation fault" or some such error.   Plus if you want to work with strings..   Java is much easier there.    

 

I like and use C a lot.   It is powerful, but the price of that is it will not hold your hand in any way. 

 

Yes Java is OO, but when you are just learning, you can put everything in a single class and it will behave similarly to a non-OO language.   

 

I get it, but I don't agree. It's not about what's easy or safe, it's about understanding. I've been a professional developer for almost 40 years, and this is my opinion.




#3848765 Is Java any benefit to programming for the 2600?

Posted by danwinslow on Fri Sep 15, 2017 9:43 AM

Yeah, I expected someone to say this. You're not wrong in fact, but I personally feel like Java and the other OO languages can put a burden of extra complexity in when all you are doing is just to try and learn programming basics, especially when your stated target is 2600 programming. I figured BASIC would be a good way to prepare for Batari. BASIC has this rep for 'spaghetti code' but let me assure you you can freely create pasta in any language, and people often do. Using a language that doesn't prevent you from doing it in fact is a good way to learn the importance of certain hygienic programming practices. Use of goto is not in and of itself bad, and there are situations even in modern languages where it is an appropriate choice.

 

Actually, I always recommend plan ANSI C as the proper introductory language for a serious computer education. If you learn C well, you will learn everything you'll ever need to know and stuff that most people don't ever know, and you will appreciate the modern languages much better. 




#3848621 Is Java any benefit to programming for the 2600?

Posted by danwinslow on Fri Sep 15, 2017 6:18 AM

 

Sincerely, I get what you mean. My problem is, I am illiterate when it comes to programming anything.

I live in a rural area in Ireland, there aren't a wealth of night classes available to me, so at least if I give this Java thing a bash, it may help me better to understand programming/coding in general, would you think?

At least if I do it then I may have a better understanding of the tutorials you mention above, no?

 

It's only ten classes, plus it will help keep me out of the pub on a thursday :)

 

I'm going to sign up and see how it goes, and will be back in ten odd weeks!

 

Well, Java is a fine language in general, but it is not applicable hardly at all to 2600 programming. As was mentioned, the very basic rock-bottom concepts like data, if/then,looping, etc. are able to be learned in any language.

If that's the only course you have, then sure give it a shot, but keep in mind that Java is NOT an introductory language, no matter what the colleges seem to think. It is an advanced subject, so if you find yourself baffled and overwhelmed it does not mean that you have some kid of problem understanding, it means that even basic Java it really hard without any prior experience programming. Or, maybe you have a knack for it and you'll do great, I don't know, but I expect you'll have some trouble. I do have some other suggestions for you:

1. Google for online courses. There are probably some free ones even, like 'introduction to programming' on you-tube or whatever.

2. Learn BASIC instead. BASIC was created to be easy to learn ( Beginners All-purpose Symbolic Instruction Code). If you have an actual 8-bit Atari, you can use that, or you can grab the Altirra emulator and use that.

3. You can grab tons of different kinds of BASICS for use on your home computer. This, for instance : http://www.nicholson.com/rhn/basic/. Assuming you're on Windows, you could even download the free Visual Basic Express stuff (which I think is now called 'Visual Studio Community' or something dumb like that). Tons of on-line course material on all of the BASICs.

 

I would not try Batari first unless you are a genius. The language is fine, but that 2600 machine is so bizarre and restricted and low-level it's like trying to program a toaster.




#3845698 Developers/testing required for mini-itx clone system - ÉclaireXL

Posted by danwinslow on Mon Sep 11, 2017 5:25 PM

On the Ethernet subject, I can recommend one if you get to that point. Most convenient would be a CS8900A compatible as I already have a driver, but anything with an 8-bit mode would be fine. You may want to consider a chip that has its own TCP stack already on it, too, although that would be a big change. The crucial point there is that it's got to be interfaced via PBI or something, or even mapped in memory. Reading from SIO serial won't work well.




#3845367 Developers/testing required for mini-itx clone system - ÉclaireXL

Posted by danwinslow on Mon Sep 11, 2017 8:48 AM

I'm keen on getting some help with the firmware. Is anyone capable/willing to take on the role of 'main firmware developer'? So I can focus on purely the hardware side.

It can be written in any language, but since code size needs to be small, and the existing firmware is written in it, I propose C. Debugging will be via gdb and a jtag connection to the eclaireXL.

The firmware currently provides the following features:
i) USB HID joystick and keyboard decoding
ii) SD card reading, fat decoding
iii) SIO drive emulation
iv) Cartridge emu setup
v) OS/BASIC rom loading
vi) Video settings

I'm in the process of changing the core to be more a 'modern system' with the 6502 and antic as additional bus masters. Previously the 'ZPU' was bolted on top of the Atari as an afterthought.

The plan is to use the VexRiscV CPU (can compile with GCC, debug via GDB) and a crossbar wishbone interconnect. All the atari custom chips, USB hardware, SD card, will be mapped into a large linear address space. Then the 6502 and antic will access this via an address translation layer. With possibly a 2nd PIA to allow the 6502 to access some of the additional hardware and settings (e.g. turbo!).

I'm busily working on the hardware changes for this, which will take some time to build. After which I'll need to port or rewrite the firmware for the new setup. I think it needs a significant rewrite to be 'good' but I don't think I have the time/motivation for that. Is anyone up for the challenge?

 

I doubt if any one person would be able to take all of this up. Phaeron, Flashjazzcat, the many excellent german & polish coders, all come to mind. I am actually very experienced with C and I've done some simplistic USB HID work before, so I might be able to help with item i. I would need a lot more details about the USB input architecture and probably would eventually need a test system.