Legacy wrote:Code: Select all
#processor 6502 ;vic 20 processor program size 512 bytes?
Your program, when assembled, is actually 22 bytes long. (DASM will produce a 24-byte file -- the first two bytes are the load address which determines where in memory the program should reside.)
If you are writing a program in the cassette buffer, you have a maximum size of 196 bytes. The first byte of the cassette buffer is 828 ($033C) and last byte is 1019 ($03FB), but there are four unused bytes beyond it (1020 to 1023), for a total of 196.
Immediately above the cassette buffer (at higher addresses) is the 3K RAM expansion area, which is empty and unusable without a 3K RAM Expansion or Super Expander cartridge.
If you're writing in machine language, you can always break the program into multiple segments that are not contiguous and have the code jump from one segment to the next. A lot of cartridge software is like this. The VIC's memory map reserves 8K for game cartridges, but a lot of cartridges are 16K. One half of the cartridge is located in the 8K area reserved for cartridges, and the other half is located elsewhere. Being able to break up the code is one of the advantages of machine language.
Legacy wrote:now i remember about seeing an article here that explains ML on the vic is useless you can do everything you need to with POKES and SYS828, and BASIC, is that true...
Which article was that? It's possible you may have misunderstood.
Machine language certainly isn't useless. Its big advantage is speed -- it can accomplish things much more quickly. There are other advantages, too, as I mentioned above. But it's a lot harder to use than BASIC. There are times when it doesn't make sense to develop a program in machine language when BASIC would do the job just as well. A BASIC program is a lot easier to maintain and easier for a person to read and understand.
Keep in mind that "SYS 828" is a BASIC command, but it calls a machine-language subroutine at address 828 ($033C). So if you use SYS 828 in a BASIC program, you're using machine language.
The VIC had plenty of professionally published software written in BASIC, including some games. There was also a lot of software that was written mostly in BASIC but with machine-language subroutines for extra speed where it was needed. In those cases, if you typed
LIST, you would occasionally see a SYS command to a particular address where a machine-language subroutine started.
There's nothing BASIC can do that machine language cannot because the BASIC interpreter is written in machine language. If you have a copy of the VIC's memory map, you'll see that the second-last 8K block of memory is designated "BASIC ROM" -- that's the BASIC interpreter. It is written in machine language and it interprets and executes BASIC programs by translating them into machine language as they are being run.
But some things are a lot easier to do in BASIC, like dealing with floating-point numbers or manipulating strings. BASIC has the routines built-in to deal with them. With machine language, you'll either have to call BASIC's routines or write your own.