Hi! On Tue, Oct 27, 2009 at 4:37 PM, Ullrich von Bassewitz <uz@musoftware.de> wrote: > > On Tue, Oct 27, 2009 at 04:19:57PM -0300, Daniel Serpell wrote: >> The problem with the above is that a program that is designed to >> run on the Atari mode 9 normally expects index 0 to be black and >> index 15 to be white, with all the 14 grays in between, and this >> mapping will break the expectations. > > I cannot see a problem with that, since cc65 is not (any more) an Atari > compiler. For a casual programmer, it is probably more important to have a > program run on another machine without much trouble. An Atari hardcode > programmer on the other side has no problem to change the palette. > But then, having a tgi driver for mode 9 has little sense, better use one of the other modes (hires of 4-color). >> Perhaps a new api could be designed modeled on, for example, >> how X11 works: > > Please come back to the ground:-) We're talking about 6502 machines with some > 10KB of memory. And TGI is the "Tiny Graphics Interface". It was designed to > dive into simple graphics programming rather quickly. It was never designed as > a competitor to OpenGL or DirectX. Yes, I know :-) But perhaps a simpler implementation, using the color definitions can be implemented, like: unsigned char black = tgi_alloc_color(COLOR_BLACK); unsigned char white = tgi_alloc_color(COLOR_WHITE); // .... Then, the implementation is only a few bytes: ; See if the color is already allocated ldx #0 SEARCH: cmp PALETTE,x beq OK inx cpx ALOC_COLORS bne SEARCH ; Color not allocated already. cpx #MAX_COLORS beq ERR ; No more palette entries available sta PALETTE,x ; Now, set the palette ... hardware dependent inc ALOC_COLORS OK: txa rts ERR: lda #255 ; Return 255 on error rts So, it's about 30 bytes for the full definition. And instead of a tgi_free_color, simply a "tgi_free_all_colors" that sets ALOC_COLORS back to 0. Also, in Atari, the already existing COLOR_XXX macros list palette color values, so the implementation above is complete if using the OS shadow palette registers as PALETTE. Daniel. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Wed Oct 28 00:12:33 2009
This archive was generated by hypermail 2.1.8 : 2009-10-28 00:12:36 CET