mirror of
https://github.com/cc65/cc65.git
synced 2024-06-08 15:29:37 +00:00
Remove dangling spaces
This commit is contained in:
parent
af2956284b
commit
4dff412f28
|
@ -73,10 +73,10 @@ kimHello.bin: kimHello.c
|
|||
|
||||
# Convert a C64/PET ROM font binary into a C table we can use for looking up character definitions
|
||||
|
||||
ramfont.c: font.rom
|
||||
ramfont.c: font.rom
|
||||
cat font.rom | python -c "import sys; print('unsigned char font8x8_basic[256][8] = {'); \
|
||||
[print(' {' + ', '.join([f'0x{byte:02x}' for byte in row]) + f'}}, // PETSCII code {i}') for i, row in \
|
||||
enumerate(iter(lambda: sys.stdin.buffer.read(8), b''), 0)]; print('};')" > ramfont.c
|
||||
enumerate(iter(lambda: sys.stdin.buffer.read(8), b''), 0)]; print('};')" > ramfont.c
|
||||
|
||||
# To build an intel-format file for the CORSHAM SD card reader
|
||||
|
||||
|
@ -86,7 +86,7 @@ kimLife.hex: kimLife.bin
|
|||
kimTest.hex: kimTest.bin
|
||||
srec_cat kimTest.bin -binary -offset 0x2000 -o kimTest.hex -Intel -address-length=2
|
||||
|
||||
kimGFX.hex: kimGFX.bin ramfont.c
|
||||
kimGFX.hex: kimGFX.bin ramfont.c
|
||||
srec_cat kimGFX.bin -binary -offset 0x2000 -o kimGFX.hex -Intel -address-length=2
|
||||
|
||||
# To build a paper tape file for uploading to the KIM-1 via terminal
|
||||
|
@ -114,4 +114,4 @@ clean:
|
|||
@$(DEL) kimGFX.hex 2>$(NULLDEV)
|
||||
@$(DEL) ramfont.c 2>$(NULLDEV)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ int CursorY = 0;
|
|||
#define CHARSPERROW (SCREEN_WIDTH / CHARWIDTH)
|
||||
#define ROWSPERCOLUMN (SCREEN_HEIGHT / CHARHEIGHT)
|
||||
|
||||
// SETPIXEL
|
||||
//
|
||||
// SETPIXEL
|
||||
//
|
||||
// 0 <= x < 320
|
||||
// 0 <= y < 200
|
||||
//
|
||||
|
@ -47,7 +47,7 @@ void SETPIXEL(int x, int y, byte b)
|
|||
byte * pb = screen;
|
||||
pb += x >> 3;
|
||||
pb += y * BYTESPERROW;
|
||||
|
||||
|
||||
if (b)
|
||||
*(pb) |= (0b10000000 >> (x & 7));
|
||||
else
|
||||
|
@ -96,7 +96,7 @@ const unsigned char petToAscTable[256] =
|
|||
//
|
||||
// Translation lookup table to go from ASCII to PETSCII
|
||||
|
||||
const unsigned char ascToPetTable[256] =
|
||||
const unsigned char ascToPetTable[256] =
|
||||
{
|
||||
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x14,0x20,0x0d,0x11,0x93,0x0a,0x0e,0x0f,
|
||||
0x10,0x0b,0x12,0x13,0x08,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
|
||||
|
@ -121,7 +121,7 @@ const unsigned char ascToPetTable[256] =
|
|||
// 0 <= x < 40
|
||||
// 0 <= y < 25
|
||||
//
|
||||
// Draws an ASCII character at char location x, y
|
||||
// Draws an ASCII character at char location x, y
|
||||
|
||||
void DrawChar(int x, int y, char petscii)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ void DrawChar(int x, int y, char petscii)
|
|||
|
||||
if (x < 0 || y < 0 || x >= CHARSPERROW || y >= ROWSPERCOLUMN)
|
||||
return;
|
||||
|
||||
|
||||
pb += y * BYTESPERCHARROW;
|
||||
pb += x;
|
||||
|
||||
|
@ -198,13 +198,13 @@ void DrawLine(int x0, int y0, int x1, int y1, byte val)
|
|||
break;
|
||||
|
||||
e2 = err;
|
||||
|
||||
if (e2 > -dx)
|
||||
|
||||
if (e2 > -dx)
|
||||
{
|
||||
err -= dy;
|
||||
x0 += sx;
|
||||
}
|
||||
if (e2 < dy)
|
||||
if (e2 < dy)
|
||||
{
|
||||
err += dx;
|
||||
y0 += sy;
|
||||
|
@ -213,16 +213,16 @@ void DrawLine(int x0, int y0, int x1, int y1, byte val)
|
|||
}
|
||||
|
||||
// DrawCircle
|
||||
//
|
||||
//
|
||||
// Draw a circle without sin, cos, or floating point!
|
||||
|
||||
void DrawCircle(int x0, int y0, int radius, byte val)
|
||||
void DrawCircle(int x0, int y0, int radius, byte val)
|
||||
{
|
||||
int x = radius;
|
||||
int y = 0;
|
||||
int err = 0;
|
||||
|
||||
while (x >= y)
|
||||
while (x >= y)
|
||||
{
|
||||
SETPIXEL(x0 + x, y0 + y, val);
|
||||
SETPIXEL(x0 + y, y0 + x, val);
|
||||
|
@ -259,8 +259,8 @@ unsigned char reverse_bits(unsigned char octet)
|
|||
}
|
||||
|
||||
// MirrorFont
|
||||
//
|
||||
// RAM font is backwards left-right relative to the way memory is laid out on the KIM-1, so we swap all the
|
||||
//
|
||||
// RAM font is backwards left-right relative to the way memory is laid out on the KIM-1, so we swap all the
|
||||
// bytes in place by reversing the order of the bits in every byte
|
||||
|
||||
void MirrorFont()
|
||||
|
@ -273,7 +273,7 @@ void MirrorFont()
|
|||
}
|
||||
|
||||
// DrawScreenMoire
|
||||
//
|
||||
//
|
||||
// Draws a moire pattern on the screen without clearing it first
|
||||
|
||||
void DrawScreenMoire(int left, int top, int right, int bottom)
|
||||
|
@ -296,12 +296,12 @@ void DrawScreenMoire(int left, int top, int right, int bottom)
|
|||
int main (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// Clear the screen memory
|
||||
ClearScreen();
|
||||
|
||||
// Draw the welcome banner at the top of the screen
|
||||
DrawTextAt(0, 0, " *** COMMODORE KIM-1 SYSTEM ***");
|
||||
DrawTextAt(0, 0, " *** COMMODORE KIM-1 SYSTEM ***");
|
||||
DrawTextAt(0, 2, " 60K RAM SYSTEM. 49152 BYTES FREE.");
|
||||
DrawTextAt(0, 4, "READY.\n");
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef unsigned char byte;
|
|||
#define NUMBYTES 8000
|
||||
#define DENSITY 50
|
||||
|
||||
// Screen memory is placed at 8000, our world copy at A000, and they use the same layout so
|
||||
// Screen memory is placed at 8000, our world copy at A000, and they use the same layout so
|
||||
// that we can memcpy from one to the other without translating
|
||||
|
||||
byte * world = (byte *) 0x8000;
|
||||
|
@ -83,7 +83,7 @@ void RandomFillWorld()
|
|||
}
|
||||
|
||||
// CountNeighbors
|
||||
//
|
||||
//
|
||||
// Count the number of live cells around the given spot, excluding the actual spot specified
|
||||
|
||||
int CountNeighbors(int x, int y)
|
||||
|
@ -113,14 +113,14 @@ void UpdateWorld()
|
|||
{
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < HEIGHT; y++)
|
||||
for (y = 0; y < HEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < WIDTH; x++)
|
||||
for (x = 0; x < WIDTH; x++)
|
||||
{
|
||||
int neighbors = CountNeighbors(x, y);
|
||||
if (GETPIXEL(world, x, y))
|
||||
SETPIXEL(new_world, x, y, (neighbors == 2 || neighbors == 3));
|
||||
else
|
||||
else
|
||||
SETPIXEL(new_world, x, y, (neighbors == 3));
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ int main (void)
|
|||
printf("\r\nStarting Conway's Game of Life: Randomizing World...\r\n");
|
||||
RandomFillWorld();
|
||||
printf("World Ready, Running!\r\n");
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
UpdateWorld();
|
||||
|
|
|
@ -33,24 +33,24 @@ void RepeatChar(char c, size_t count)
|
|||
* within that region. The address (and hence the
|
||||
* memory region) is selected by the caller.
|
||||
*
|
||||
* Returns: 0 if the test succeeds.
|
||||
* Returns: 0 if the test succeeds.
|
||||
* A non-zero result is the first pattern that failed.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
byte memTestDataBus(volatile byte * address)
|
||||
{
|
||||
byte pattern;
|
||||
|
||||
// Perform a walking 1's test at the given address.
|
||||
|
||||
|
||||
for (pattern = 1; pattern != 0; pattern <<= 1)
|
||||
{
|
||||
// Write the test pattern.
|
||||
*address = pattern;
|
||||
|
||||
// Read it back and check it
|
||||
if (*address != pattern)
|
||||
if (*address != pattern)
|
||||
{
|
||||
printf("\r\nmemTestDataBus: FAILED at %04x with pattern %02x\r\n", address, pattern);
|
||||
return (pattern);
|
||||
|
@ -73,12 +73,12 @@ byte memTestDataBus(volatile byte * address)
|
|||
*
|
||||
* Notes: For best results, the selected base address should
|
||||
* have enough LSB 0's to guarantee single address bit
|
||||
* changes. For example, to test a 64-Kbyte region,
|
||||
* select a base address on a 64-Kbyte boundary. Also,
|
||||
* select the region size as a power-of-two--if at all
|
||||
* changes. For example, to test a 64-Kbyte region,
|
||||
* select a base address on a 64-Kbyte boundary. Also,
|
||||
* select the region size as a power-of-two--if at all
|
||||
* possible.
|
||||
*
|
||||
* Returns: NULL if the test succeeds.
|
||||
* Returns: NULL if the test succeeds.
|
||||
* A non-zero result is the first address at which an
|
||||
* aliasing problem was uncovered. By examining the
|
||||
* contents of memory, it may be possible to gather
|
||||
|
@ -97,14 +97,14 @@ byte * memTestAddressBus(volatile byte * baseAddress, unsigned long nBytes)
|
|||
|
||||
|
||||
//Write the default pattern at each of the power-of-two offsets.
|
||||
|
||||
|
||||
for (offset = 1; (offset & addressMask) != 0; offset <<= 1)
|
||||
{
|
||||
baseAddress[offset] = pattern;
|
||||
}
|
||||
|
||||
// Check for address bits stuck high.
|
||||
|
||||
|
||||
testOffset = 0;
|
||||
baseAddress[testOffset] = antipattern;
|
||||
|
||||
|
@ -121,9 +121,9 @@ byte * memTestAddressBus(volatile byte * baseAddress, unsigned long nBytes)
|
|||
|
||||
baseAddress[testOffset] = pattern;
|
||||
|
||||
|
||||
|
||||
// Check for address bits stuck low or shorted.
|
||||
|
||||
|
||||
for (testOffset = 1; (testOffset & addressMask) != 0; testOffset <<= 1)
|
||||
{
|
||||
baseAddress[testOffset] = antipattern;
|
||||
|
@ -144,7 +144,7 @@ byte * memTestAddressBus(volatile byte * baseAddress, unsigned long nBytes)
|
|||
baseAddress[testOffset] = pattern;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
|
@ -152,7 +152,7 @@ byte * memTestAddressBus(volatile byte * baseAddress, unsigned long nBytes)
|
|||
*
|
||||
* Description: Test the integrity of a physical memory device by
|
||||
* performing an increment/decrement test over the
|
||||
* entire region. In the process every storage bit
|
||||
* entire region. In the process every storage bit
|
||||
* in the device is tested as a zero and a one. The
|
||||
* base address and the size of the region are
|
||||
* selected by the caller.
|
||||
|
@ -185,7 +185,7 @@ byte * memTestDevice(volatile byte * baseAddress, unsigned long nBytes)
|
|||
for (pattern = 1, offset = 0; offset < nWords; pattern++, offset++)
|
||||
{
|
||||
if (offset % 1024 == 0)
|
||||
printf("%04X ", (int) &baseAddress[offset]);
|
||||
printf("%04X ", (int) &baseAddress[offset]);
|
||||
|
||||
if (baseAddress[offset] != pattern)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ byte * memTestDevice(volatile byte * baseAddress, unsigned long nBytes)
|
|||
for (pattern = 1, offset = 0; offset < nWords; pattern++, offset++)
|
||||
{
|
||||
if (offset % 1024 == 0)
|
||||
printf("%04X ", (int) &baseAddress[offset]);
|
||||
printf("%04X ", (int) &baseAddress[offset]);
|
||||
|
||||
antipattern = ~pattern;
|
||||
if (baseAddress[offset] != antipattern)
|
||||
|
@ -214,11 +214,11 @@ byte * memTestDevice(volatile byte * baseAddress, unsigned long nBytes)
|
|||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// TestMemory
|
||||
//
|
||||
// Run all three memory tests
|
||||
// Run all three memory tests
|
||||
|
||||
byte TestMemory(byte * startAddress, unsigned long size)
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ byte TestMemory(byte * startAddress, unsigned long size)
|
|||
else
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main (void)
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
; (c) Plummer's Software Ltd, 04/25/2023 Created
|
||||
; David Plummer
|
||||
;-----------------------------------------------------------------------------------
|
||||
;
|
||||
; File: subs.asm Assembly language subroutines for KIMGFX
|
||||
;
|
||||
; File: subs.asm Assembly language subroutines for KIMGFX
|
||||
;
|
||||
;-----------------------------------------------------------------------------------
|
||||
|
||||
|
@ -28,7 +28,7 @@ src_hi = src+1
|
|||
_ClearScreen:
|
||||
lda #$00
|
||||
|
||||
ldx #<SCREEN
|
||||
ldx #<SCREEN
|
||||
stx dest_lo
|
||||
ldx #>SCREEN
|
||||
stx dest_hi
|
||||
|
@ -56,7 +56,7 @@ _ScrollScreen:
|
|||
sta src_hi
|
||||
lda #<SCREEN
|
||||
sta dest_lo
|
||||
lda #>SCREEN
|
||||
lda #>SCREEN
|
||||
sta dest_hi
|
||||
|
||||
ldy #$00
|
||||
|
@ -66,7 +66,7 @@ _ScrollScreen:
|
|||
iny
|
||||
bne :-
|
||||
|
||||
inc dest_hi ; When the source hits $BF00 we're done, as we've copied
|
||||
inc dest_hi ; When the source hits $BF00 we're done, as we've copied
|
||||
inc src_hi ; everything up to that point so far
|
||||
ldx src_hi
|
||||
cpx #$BE
|
||||
|
@ -74,7 +74,7 @@ _ScrollScreen:
|
|||
|
||||
lda #$00 ; Clear the last line (320 bytes, or A0 twice)
|
||||
ldy #$A0
|
||||
: sta SCREEN+$1EA0, y
|
||||
: sta SCREEN+$1EA0, y
|
||||
sta SCREEN+$1E00, y
|
||||
dey
|
||||
bne :-
|
||||
|
|
Loading…
Reference in New Issue
Block a user