I was referring to Qt because this is a forum which talks about Qt as the main point of interest
Anyway, enough off-topic, hopefully the OP now has what he wants.
I was referring to Qt because this is a forum which talks about Qt as the main point of interest
Anyway, enough off-topic, hopefully the OP now has what he wants.
Hah, my BASIC was the Commodore flavor. How old are you?
Atari had a cartridge based assembler didn't it? Crazy stuff.![]()
Old enough. I started programming when I was around 9 yo.
Cartridge is just a storage device so I guess this is not some important feature of it. I remember one could do assembly directly from BASIC by providing some weird blocks of numbers. At the time I didn't understand any of it.Atari had a cartridge based assembler didn't it?
The C64 used a cartridge-based asssembler. Their cartridge was a read-only expansion device, more often used to ship games, but in this case it gave you an editor and an actual assembly language implementation so you could program using HLL tokens which the assembler then converted into machine code.
The first C64 program I wrote in assembler was a rewrite of a Commodore Basic version of the mathematical game "Life". It ran over a thousand times faster than it's interpreted cousin.
Man, I was like..10 i think at the time...and I didn't have access to anything but a VIC-20 and the tape deck and some programming magazines. It is weird that I remember (wrongly) Atari having a cartridge assembler and not the C64. Did the VIC-20 have it also? I feel really deprived now.
I just checked in wikipedia. Earlier versions of Atari had BASIC provided on a cartridge while later ones (like my Atari 65 XE) had it built-in into ROM. Nothing about assembly though.
The C64 cartridge based assembler was the red 'Power cartridge' guess ? Then you could also use your function keys to show a directory listing without overwriting your program (as you would do with "load *,8,1" if I remember correctly). Great tool.
Regards,
Marc
P.S. I was 13 at the time![]()
I remember writing machine level code for the VIC-20 and C64 using DATA statements along with POKE commands. I had to write all the assembler on scrapes of paper, manually convert it into numbers for the DATA statements, and then watch it crash when I run it.
My first assembler was for the Commodore Amiga, called ASM-One (freeware) and then changed to DevPac (commercial).
Sheesh, I feel like I'm showing my age![]()
Ahh, don't feel bad.Yes, I remember PEEK and POKE and flipping through the programming magazines to find the encoding for "cool looking" sprites. Graph paper was a must if you were sketching out your own.
I remember playing with the builtin libraries and coming up with the verdict that the libraries were far too slow for what I wanted to do. I then got a copy of the Amiga hardware reference manual and had much more fun. I'm sure most Amiga nuts will remember bouncing copper bars, which was always the first hardware hackers demo, followed by spinning 3D floppy disks and the like, those always seemed to be the first demos by people getting into assembler development. I also remember writing a track loader as I wasn't impressed with the standard OS disk routines (and the famous 0×4489 disk sync).
This being 2010, many decades of studying design techniques and measuring the success of the projects that use them...people have pretty much universally decided that global variables are to be avoided at nearly all cost.
Actually, people knew this a long time ago. Most people discover it on their own if they don't learn from those ahead of them in the field.
You might have a case for using one. I'd probably look for a different way but I'm not working on your project so...wtf do I know. At any rate, there's no reason to go through the incredibly expensive effort of altering a language for something like this. Declaring and defining global variables is already fairly easy, though it could be admitted that someone brand new could find it unintuitive.
I followed the link you were given, didn't see what you need to know there. Here's how to do it:
In a header file:
This is a declaration.
In ONE .cpp file:
This is a definition AND an initialization. I suggest initializing your variable, but if you don't it will be "default initialized" (set to 0 in case of an int). You could also initialize through a function call, and in fact I use this a LOT for factory registration (a bigger topic). Just remember that anything you use to initialize your variable will happen before main is called and you have *absolutely no way of knowing in which order* except within specific cpp files.
Once you've done the above two things you can use that variable anywhere that includes the .h you declared it in.
Technically you don't have to have a header, but the reasons behind that would just confuse the hell out of you. Just do it this way...if you really must use a global variable.
This rude guy who doesn't want you to answer his questions.
Note: An "expert" here is just someone that's posted a lot.
"The fact of where you do the encapsulation is meaningless." - Qt Certified Developer and forum moderator
Bookmarks