I thought I'd post it here so those like me who know nothing about graphics can analyze, discuss and study it.
This is my modified source. I extracted the ATARI 8-Bit font, made a blue background, and printed a white READY on the screen
Next step is to display a white block beneath the READY
Code: Select all
#ifndef _TYPES_H
#define _TYPES_H
/* Attention: sizeof(int)==sizeof(long) */
#define uint8_t unsigned char
#define byte unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define int8_t char
#define int16_t short
#define int32_t int
#endif
Code: Select all
#include <jaguar.h>
#include "types.h"
#include "atarifnt.h"
#define CLUT16 (uint16_t *)CLUT
extern void *vidmem;
byte *jagscreen=(byte *)&vidmem;
void loopUntilBitIsSet32(void *adr, uint32_t bitmask)
{
uint32_t val;
do
{
val = *(uint32_t *)(adr);
} while (val & bitmask == 0);
}
void *memset(void *str, byte c, uint16_t n)
{
loopUntilBitIsSet32(B_CMD, 1 << 0);
*A1_BASE = (uint32_t)str;
*A1_PIXEL = 0;
*A1_FLAGS = PIXEL8 | XADDPIX | PITCH1;
*B_PATD = c;
*B_COUNT = 0x010000 | n;
*B_CMD = PATDSEL;
return str;
}
uint16_t toRgb16(byte r, byte g, byte b)
{
r &= 0x1f;
g &= 0x3f;
b &= 0x1f;
return (r << 11) | (b << 6) | g;
}
void DrawChar(uint16_t x, uint16_t y, byte ch)
{
loopUntilBitIsSet32(B_CMD, 1 << 0);
*A1_BASE = (uint32_t)jagscreen;
*A1_FLAGS = PIXEL8 | XADDPIX | WID320 | PITCH1;
*A1_PIXEL = (y << 16) | x;
*A1_STEP = 0x010000 | (uint16_t)-8;
*A2_BASE = (uint32_t)(textfont + (ch << 3));
*A2_FLAGS = PIXEL1 | XADDPIX | WID8 | PITCH1;
*A2_PIXEL = 1;
*A2_STEP = 0x010000 | (uint16_t)-1;
*B_COUNT = 0x080008;
*B_PATD = 1;
*B_DSTD = 0;
*B_CMD = SRCENX | UPDA1 | UPDA2 | PATDSEL | BCOMPEN | BKGWREN | DSTEN;
}
void DrawString (int x, int y, char *str)
{
while (*str)
{
DrawChar(x, y, *str++);
x += F_WIDTH;
}
}
void __main(void)
{
*CLUT16 = toRgb16(0x00, 0x00, 0xff);
*(CLUT16 + 1) = toRgb16(0xff, 0xff, 0xff);
memset(jagscreen, 0, 64000);
DrawString(8, 16, "READY");
for (;;); /* Infinite Loop. Alpine users can delete this. */
}