1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Merge branch 'kim1' of github.com:davepl/cc65

This commit is contained in:
Rutger van Bergen 2022-09-19 23:58:26 +02:00
commit 61f48f7620
4 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
; ---------------------------------------------------------------------------
;
; KIM-1 definitions
; KIM-1 definitions
;
; ---------------------------------------------------------------------------

View File

@ -27,10 +27,10 @@ function reference for more information.
<sect>Binary format<p>
The output format generated by the linker for the KIM-1 target is a raw binary BIN file, which
is essentially a memory image. You can convert this to a papertape format file using
Convert8bithexformat or KIMPaper, which are open-source conversion utility programs.
A papertape format files can be transferred to the KIM-1 using the RS-232 terminal port (TTY),
just as if the machine-code was entered by hand. Enter 'L' in the TTY and start the paper tape file
is essentially a memory image. You can convert this to a papertape format file using
Convert8bithexformat or KIMPaper, which are open-source conversion utility programs.
A papertape format files can be transferred to the KIM-1 using the RS-232 terminal port (TTY),
just as if the machine-code was entered by hand. Enter 'L' in the TTY and start the paper tape file
transfer.
<p>
@ -45,8 +45,8 @@ system configuration before compiling and linking user programs.
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points
for useful subroutines in the KIM-1 monitor ROM. cc65 generated programs compiled and linked
using 4k config run in the memory range of &dollar;200 - &dollar;0FFF. The 60k config expands
this range to &dollar;DFFF. The starting memory location and entry point for running the program is
&dollar;200, so when the program is transferred to the KIM-1, it is executed by typing '200 G'.
this range to &dollar;DFFF. The starting memory location and entry point for running the program is
&dollar;200, so when the program is transferred to the KIM-1, it is executed by typing '200 G'.
Special locations:

View File

@ -9,14 +9,14 @@
#include <stdio.h>
#include <kim1.h>
int main (void)
int main (void)
{
char str[100];
char c = 0x00;
printf ("\nHello World!\n\n");
printf ("Type a line and press ENTER, please.\n\n");
gets( str );
printf ("\n\nThanks: %s\n\n", str);

View File

@ -8,11 +8,11 @@ typedef unsigned long int ulong;
#define LIMIT 100000L
// BITARRAY
//
//
// My bit-access macros pre-divide by two on the presumption that you'll never
// try try access both odd and even bits!
#define GETBIT(array, bit) (array[bit >> 4] & (1 << ((bit >> 1) & 7)))
#define GETBIT(array, bit) (array[bit >> 4] & (1 << ((bit >> 1) & 7)))
#define SETBIT(array, bit) (array[bit >> 4] |= (1 << ((bit >> 1) & 7)))
#define CLRBIT(array, bit) (array[bit >> 4] &= ~(1 << ((bit >> 1) & 7)))
@ -65,7 +65,7 @@ int main(void)
RepeatChar('*', 70);
puts("\r\n** Prime Number Sieve - Dave Plummer 2022 **");
RepeatChar('*', 70);
printf("\r\n\r\nCalculating primes to %ld using a sqrt of %ld...\r\n", LIMIT, rootOfLimit);
// Calculate how much memory should be allocated
@ -80,7 +80,7 @@ int main(void)
else
{
printf("Allocated %ld bytes for %ld slots\r\n", numBytesAllocated, LIMIT);
// Preset all the bits to true
for (iNumber = 0; iNumber < numBytesAllocated; iNumber++)
@ -102,7 +102,7 @@ int main(void)
break;
}
}
for (n = (ulong) currentFactor * currentFactor; n <= LIMIT; n += currentFactor * 2)
CLRBIT(array, n);