Skip to content

Commit

Permalink
use new values for bdos extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidly committed Jul 2, 2024
1 parent 357d877 commit 080f5c7
Show file tree
Hide file tree
Showing 14 changed files with 928 additions and 2,239 deletions.
296 changes: 148 additions & 148 deletions aztec/rssrdr.c
Original file line number Diff line number Diff line change
@@ -1,148 +1,148 @@
#include <stdio.h>

#define ITEMS_SHOWN_BEFORE_RELOAD 200 /* 200 * 10 seconds average = ~30 minutes */

char * g_feeds[] =
{
"https://rss.nytimes.com/services/xml/rss/nyt/World.xml",
"https://www.theguardian.com/world/rss",
"https://feeds.washingtonpost.com/rss/world",
"https://feeds.npr.org/1001/rss.xml",
0, /* mark the end of the list */
};

char g_rss_item[ 2048 ]; /* set to the bdos DMA address for storing an RSS item */
int g_sleep = 1;

void bdos_sleep( ms ) unsigned int ms;
{
bdos( 106, ms );
} /*bdos_sleep*/

int bdos_feed_load_rss( pfeeds ) char * pfeeds[];
{
return bdoshl( 107, pfeeds );
} /*bdos_feed_load_rss*/

int bdos_item_load_rss( item ) int item;
{
bdos( 26, g_rss_item ); /* set dma address */
return bdos( 108, item );
} /*bdos_item_load_rss*/

int bdos_kbhit()
{
return bdos( 6, 0xff );
} /*bdos_kbhit*/

char * strchr( p, c ) char * p; char c;
{
while ( *p )
{
if ( *p == c )
return p;
p++;
}

return 0;
} /*strchr*/

int chars_to_sp( p ) char * p;
{
char * start = p;
while ( *p && ' ' != *p )
p++;

return p - start;
} /*chars_to_sp*/

void slow_print( p ) char * p;
{
int col = 1;
char * pnext, x;

while ( *p )
{
if ( bdos_kbhit() )
exit( 1 );

x = *p;
if ( x > 0 ) /* skip extended ascii characters */
{
if ( ' ' == x )
{
int nextsp = chars_to_sp( p + 1 );
if ( ( nextsp + col + 1 ) >= 80 )
{
col = 0;
putchar( '\n' );
p++;
continue;
}
}
col++;
putchar( x );
p++;
if ( g_sleep )
bdos_sleep( 33 );
}
}

putchar( '\n' );
} /*slow_print*/

int main( argc, argv ) int argc; char * argv[];
{
int count, ok, i, j, shown;
int feed_len, title_len;
char * ptitle, * pdescription;

if ( argc > 1 )
g_sleep = 0;

shown = ITEMS_SHOWN_BEFORE_RELOAD;

do
{
if ( shown >= ITEMS_SHOWN_BEFORE_RELOAD )
{
shown = 0;
puts( "<loading rss feeds>" );
count = bdos_feed_load_rss( g_feeds );

if ( 0 == count )
{
puts( "no rss results" );
exit( 1 );
}
}

for ( i = 0; i < count; i++ )
{
ok = bdos_item_load_rss( i );
if ( ok )
{
shown++;
feed_len = strlen( g_rss_item );
ptitle = g_rss_item + feed_len + 1;
title_len = strlen( ptitle );
pdescription = ptitle + title_len + 1;
slow_print( g_rss_item );
slow_print( ptitle );
slow_print( pdescription );
putchar( '\n' );

/* sleep for 2 seconds. exit if any key is pressed */

for ( j = 0; g_sleep && j < 20; j++ )
{
if ( bdos_kbhit() )
exit( 1 );
bdos_sleep( 100 );
}
}
}
} while ( 1 );

return 0;
} /*main*/
#include <stdio.h>

#define ITEMS_SHOWN_BEFORE_RELOAD 200 /* 200 * 10 seconds average = ~30 minutes */

char * g_feeds[] =
{
"https://rss.nytimes.com/services/xml/rss/nyt/World.xml",
"https://www.theguardian.com/world/rss",
"https://feeds.washingtonpost.com/rss/world",
"https://feeds.npr.org/1001/rss.xml",
0, /* mark the end of the list */
};

char g_rss_item[ 2048 ]; /* set to the bdos DMA address for storing an RSS item */
int g_sleep = 1;

void bdos_sleep( ms ) unsigned int ms;
{
bdos( 181, ms );
} /*bdos_sleep*/

int bdos_feed_load_rss( pfeeds ) char * pfeeds[];
{
return bdoshl( 182, pfeeds );
} /*bdos_feed_load_rss*/

int bdos_item_load_rss( item ) int item;
{
bdos( 26, g_rss_item ); /* set dma address */
return bdos( 183, item );
} /*bdos_item_load_rss*/

int bdos_kbhit()
{
return bdos( 6, 0xff );
} /*bdos_kbhit*/

char * strchr( p, c ) char * p; char c;
{
while ( *p )
{
if ( *p == c )
return p;
p++;
}

return 0;
} /*strchr*/

int chars_to_sp( p ) char * p;
{
char * start = p;
while ( *p && ' ' != *p )
p++;

return p - start;
} /*chars_to_sp*/

void slow_print( p ) char * p;
{
int col = 1;
char * pnext, x;

while ( *p )
{
if ( bdos_kbhit() )
exit( 1 );

x = *p;
if ( x > 0 ) /* skip extended ascii characters */
{
if ( ' ' == x )
{
int nextsp = chars_to_sp( p + 1 );
if ( ( nextsp + col + 1 ) >= 80 )
{
col = 0;
putchar( '\n' );
p++;
continue;
}
}
col++;
putchar( x );
p++;
if ( g_sleep )
bdos_sleep( 33 );
}
}

putchar( '\n' );
} /*slow_print*/

int main( argc, argv ) int argc; char * argv[];
{
int count, ok, i, j, shown;
int feed_len, title_len;
char * ptitle, * pdescription;

if ( argc > 1 )
g_sleep = 0;

shown = ITEMS_SHOWN_BEFORE_RELOAD;

do
{
if ( shown >= ITEMS_SHOWN_BEFORE_RELOAD )
{
shown = 0;
puts( "<loading rss feeds>" );
count = bdos_feed_load_rss( g_feeds );

if ( 0 == count )
{
puts( "no rss results" );
exit( 1 );
}
}

for ( i = 0; i < count; i++ )
{
ok = bdos_item_load_rss( i );
if ( ok )
{
shown++;
feed_len = strlen( g_rss_item );
ptitle = g_rss_item + feed_len + 1;
title_len = strlen( ptitle );
pdescription = ptitle + title_len + 1;
slow_print( g_rss_item );
slow_print( ptitle );
slow_print( pdescription );
putchar( '\n' );

/* sleep for 2 seconds. exit if any key is pressed */

for ( j = 0; g_sleep && j < 20; j++ )
{
if ( bdos_kbhit() )
exit( 1 );
bdos_sleep( 100 );
}
}
}
} while ( 1 );

return 0;
} /*main*/
8 changes: 4 additions & 4 deletions aztec/ttt.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,24 +429,24 @@ struct CPMTimeValue

void print_time_now()
{
/* This CP/M BDOS call of 105 is only implemented in NTVCM -- it's not a standard CP/M 2.2 call */
/* This CP/M BDOS call of 180 is only implemented in NTVCM -- it's not a standard CP/M 2.2 call */

struct CPMTimeValue t;
t.h = t.m = t.s = t.l = 0;

bdos( 105, &t );
bdos( 180, &t );
printf( "current time: %02d:%02d:%02d.%02d\n", t.h, t.m, t.s, t.l );
} /*print_time_now*/

long get_ms()
{
/* This CP/M BDOS call of 105 is only implemented in NTVCM -- it's not a standard CP/M 2.2 call */
/* This CP/M BDOS call of 180 is only implemented in NTVCM -- it's not a standard CP/M 2.2 call */

long h, m, s, l;
struct CPMTimeValue t;
t.h = t.m = t.s = t.l = 0;

bdos( 105, &t );
bdos( 180, &t );
h = t.h;
m = t.m;
s = t.s;
Expand Down
Loading

0 comments on commit 080f5c7

Please sign in to comment.