X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=doc%2Fatari.sgml;h=459e8e7453e9a8a6c6be7c1987d93884a6aea451;hb=a10f36c837c1608c59fa6b7932b547207dd16391;hp=4b848575d787ee9681d7e8e0a5f4e960e5b11295;hpb=79d8a0d857ffafb30170729e201d034d5a329c8a;p=cc65 diff --git a/doc/atari.sgml b/doc/atari.sgml index 4b848575d..459e8e745 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -6,7 +6,7 @@ and -2014-03-27 +2014-04-24 An overview over the Atari runtime system as it is implemented for the cc65 C @@ -30,13 +30,13 @@ The , it is recommended to use the . Even functions marked as "platform dependent" may be available on more than one platform. Please see the function reference for more information. @@ -63,7 +63,7 @@ detailed information about the load chunks see the chapter sufficient to know that the first load chunk(s) do preparation work and the main part of the program is in the last load chunk. -The values determining the size of the main part of the program (the only load +The values determining the size of the main part of the program (the second load chunk for With the default load address of $2400 this gives a usable memory range of -[$2400-$CFFF]. Note that the default load address for . +[$2400-$CFFF]. +Please note that the first load chunk (which checks the system +compatibilty and available memory) will always be loaded at +$2E00, regardless of the specified start address. This address +can only be changed by a custom linker config file. Special locations: @@ -147,7 +148,7 @@ Special locations: ($58). @@ -264,7 +265,7 @@ header file. Atari specific functions

The functions and global variable listed below are special for the Atari. -See the for declaration and usage. +See the for declaration and usage. get_ostype @@ -274,6 +275,7 @@ See the for declaration a _getcolor _getdefdev _graphics +_is_cmdline_dos _rest_vecs _save_vecs _scroll @@ -315,6 +317,101 @@ chip registers.

+Display lists

+ +A major feature of the Atari graphics chip "ANTIC" is to +process instructions for the display generation. +cc65 supports constructing these display lists by offering defines +for the instructions. In conjunction with the "void"-variable extension +of cc65, display lists can be created quite comfortable: + + +... +unsigned char ScreenMemory[100]; + +void DisplayList = +{ + DL_BLK8, + DL_BLK8, + DL_BLK8, + DL_LMS(DL_CHR20x8x2), + ScreenMemory, + DL_CHR20x8x2, + DL_CHR20x8x2, + DL_CHR20x8x2, + DL_BLK4, + DL_CHR20x8x2, + DL_JVB +}; +... +POKEW(560,(unsigned int)&DisplayList); // SDLSTL +... + + +Please inspect the Character mapping

+ +The Atari has two representations for characters: + + ATASCII is character mapping which is similar to ASCII and used +by the CIO system of the OS. This is the default mapping of cc65 when +producing code for the atari target. + The internal/screen mapping represents the real value of the +screen ram when showing a character. + + +For direct memory access (simplicity and speed) enabling the internal +mapping can be useful. This can be achieved by including the +"For assembler sources the macro " + +You can switch back to the ATASCII mapping by including +" +#include <atari_screen_charmap.h> +char pcScreenMappingString[] = "Hello Atari!"; + +#include <atari_atascii_charmap.h> +char pcAtasciiMappingString[] = "Hello Atari!"; + + +delivers correct results, while + + +#include <atari_screen_charmap.h> +char* pcScreenMappingString = "Hello Atari!"; + +#include <atari_atascii_charmap.h> +char* pcAtasciiMappingString = "Hello Atari!"; + + +does not. Loadable drivers

@@ -434,7 +531,6 @@ Currently there are two joystick drivers available: - Default drivers: - All mouse devices connect to joystick port #0. Default drivers: Mouse callbacks

+ +There are two mouse callbacks available. +

+The "text mode" callbacks ( + .export mouse_txt_char : zp = 96 ; 'diamond' screen code + +

+The "P/M" callbacks ( + .export mouse_pm_bits + .export mouse_pm_height : zeropage + .export mouse_pm_hotspot_x : zeropage + .export mouse_pm_hotspot_y : zeropage + .rodata +mouse_pm_bits: + .byte %11110000 + .byte %11000000 + .byte %10100000 + .byte %10010000 + .byte %10001000 + .byte %00000100 + .byte %00000010 +mouse_pm_height = * - mouse_pm_bits +; hot spot is upper left corner +mouse_pm_hotspot_x = 0 +mouse_pm_hotspot_y = 0 + +

+ +The default callbacks definition (RS232 device drivers

Currently there is one RS232 driver. It uses the R: device (therefore @@ -519,7 +657,7 @@ The contents of this chunk come from the SYSCHKCHNK memory area of the linker co main program&nl; This load chunk is loaded at the selected program start address (default $2000) and contains all of the code and data of the program.&nl; -The contents of this chunk come from the RAM memory area of the linker config file. +The contents of this chunk come from the MAIN memory area of the linker config file. @@ -649,7 +787,7 @@ Function keys are mapped to Atari + number key. Passing arguments to the program

-Command line arguments can be passed to Arguments are separated by spaces. @@ -666,8 +804,10 @@ The runtime for the Atari uses routines marked as . +feature in the . +Please note that on the Atari targets the Reserving a memory area inside a program

@@ -699,7 +839,7 @@ segments should go above $7FFF.

The main problem is that the EXE header generated by the cc65 runtime lib is wrong. It defines a single load chunk with the sizes/addresses -of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in +of the STARTUP, LOWCODE, ONCE, CODE, RODATA, and DATA segments, in fact, the whole user program (we're disregarding the "system check" load chunk here).

@@ -752,7 +892,7 @@ SEGMENTS { NEXEHDR: load = FSTHDR, type = ro; # first load chunk STARTUP: load = RAMLO, type = ro, define = yes; LOWCODE: load = RAMLO, type = ro, define = yes, optional = yes; - INIT: load = RAMLO, type = ro, optional = yes; + ONCE: load = RAMLO, type = ro, optional = yes; CODE: load = RAMLO, type = ro, define = yes; CHKHDR: load = SECHDR, type = ro; # second load chunk @@ -764,7 +904,7 @@ SEGMENTS { AUTOSTRT: load = RAM, type = ro; # defines program entry point } FEATURES { - CONDES: segment = RODATA, + CONDES: segment = ONCE, type = constructor, label = __CONSTRUCTOR_TABLE__, count = __CONSTRUCTOR_COUNT__; @@ -783,7 +923,7 @@ the MAINHDR segment get discarded.

The newly added NEXEHDR segment defines the correct chunk header for the first intended load chunk. It -puts the STARTUP, LOWCODE, INIT, and CODE segments, which are the +puts the STARTUP, LOWCODE, ONCE, and CODE segments, which are the segments containing only code, into load chunk #1 (RAMLO memory area).

The header for the second load chunk comes from the new CHKHDR @@ -814,7 +954,7 @@ cl65 -t atari -C split.cfg -o prog.com prog.c split.s Low data and high code example

-Goal: Put RODATA and DATA into low memory and STARTUP, LOWCODE, INIT, +Goal: Put RODATA and DATA into low memory and STARTUP, LOWCODE, ONCE, CODE, BSS, ZPSAVE into high memory (split2.cfg): @@ -849,7 +989,7 @@ SEGMENTS { CHKHDR: load = SECHDR, type = ro; # second load chunk STARTUP: load = RAM, type = ro, define = yes; - INIT: load = RAM, type = ro, optional = yes; + ONCE: load = RAM, type = ro, optional = yes; CODE: load = RAM, type = ro, define = yes; BSS: load = RAM, type = bss, define = yes; @@ -857,7 +997,7 @@ SEGMENTS { AUTOSTRT: load = RAM, type = ro; # defines program entry point } FEATURES { - CONDES: segment = RODATA, + CONDES: segment = ONCE, type = constructor, label = __CONSTRUCTOR_TABLE__, count = __CONSTRUCTOR_COUNT__;