Make your own free website on Tripod.com

COD'EX

RETURN TO HOME PAGE

MOTIVATION
COMMODORE 64 MODE
COMMODORE 128 NATIVE MODE
CP/M MODE

Code examples for your Commodore 128

For C128 native, C64 and CP/M mode

MOTIVATION: It seems there are people who are willing to program in assembly language, but don't seem to get above a certain skill level. This page hopes to reach those people a helping hand. The example source listings are meant to be studied just the way they are intended... as examples. There are easy examples and more elaborate examples. Pick the example that fits your particular skill level and interest.

The source listings presented here are not always the most efficient solutions to particular problems, but the methods and algorithms used should be clear to anyone with some experience in assembly language, and (not unimportant) the resulting code works... If you can do better, please do. In fact, I encourage you to experiment and expand on the ideas presented here. The source listings presented here are only to give you a start, for you own experiments.

All assembly source listings (file type ".ASM") presented below are complete, you do not need to download other listings for reference. The cross-assembler used is the Table-Driven Assembler "TASM" for MS-DOS, which assembles for different types of assembly source codes (e.g. 6502, Z80, etc.) It is, in many cases, not too difficult to translate the source listings presented here into a format your particular assembler understands.

I hope by starting and maintaining this initiative I will have helped out (at least) some of you in their endeavors to create working crash-free machine language code.

Of course, you may want to look for other (broader) resources. One of the best resources for 6502 coding on the Commodore 64 and 128, in my humble opinion, is Stephen L. Judd's brainchild:


COMMODORE 64 MODE

NOTES:
Unless mentioned otherwise, all binary files are located at $C000 (49152), and can be activated by:
LOAD "filename",unit,1
NEW
SYS 49152
(replace filename by the appropriate file name, and unit by the appropriate unit number, e.g. 8)

FILE LOAD example # 1
This elementary routine loads a file with the fixed name "test.bas" to the fixed memory address $0801 (C64 start of Basic).
If a disk error occurs, the disk error message is printed.
Read the ASM text file for more details. The Basic 2.0 file is supplied as well.
asm file: load1.asm (430 lines, approx. 6 pages in print)
obj file: load1.obj (236 bytes)
bas file: test.bas (69 byte)

FILE LOAD example # 2
This is a more sophisticated, but still pretty elementary routine. It asks the user to enter a file name. The file with that name is then loaded to the fixed memory address $0801 (C64 start of Basic).
If a disk error occurs, the disk error message is printed. To relink the loaded file in C64, issue a SYS 42291 (e.g. when the file name "$" is used).
Read the ASM text file for more details.
asm file: load2.asm (541 lines, approx. 8 pages in print)
obj file: load2.obj (294 bytes)

FILE LOAD example # 3
This is a even more sophisticated routine, that is gettin pretty useful. It asks the user to enter a file name, and then a (decimal) address. The address is checked for validity. If it is valid, the file with the entered file name is loaded to the entered memory address.
If an error occurs, an appriate error message is printed. To relink the loaded file in C64, issue a SYS 42291 (e.g. when the file name "$", and an address value of 2049 is used).
With some modifications, this program could even be used in C128 native mode. To relink a loaded file with the modified program in that mode, issue a SYS 20303, or SYS DEC("4F4F").
Read the ASM text file for more details.
asm file: load3.asm (934 lines, approx. 13 pages in print)
obj file: load3.obj (481 bytes)



TOP

COMMODORE 128 NATIVE MODE


sorry, no sample codes yet

TOP

CP/M MODE


sorry, no sample codes yet

TOP

page URL: www.bigfoot.com/~c128page/codex/
contact: c128page@bigfoot.com