On Wednesday, October 24, 2018 at 7:15:00 AM UTC-7,
dr_...@ntlworld.com wrote:
> You need Aztec C to compile my port of STevie. No reason, other than I
> was using it at the time of my first attempt on a TRS-80 Model 4 with
> Montezuma CP/M.
Here's a quickie hack window.c that lets the thing be built to run in a
command window so you can play with it on Windows. I call it, imaginatively
enough, windows.c.
This alone is not sufficient to build the thing for a modern compiler, but
most everything else involves just dealing with the errors or warnings
displayed by the compiler. A bit of pushing things about and you can get it
to go through either Visual C or Open Watcom.
In addition to that, there are a couple of things that need to be done for
basic usability on Windows. Accepting 0x0d as a synonym for 0x0a is one.
Also there's a bit of fiddling about with the insertion of carriage return,
not all of which I've figured out(one issue is that, since STevie doesn't
open the file in binary mode, another carriage return gets inserted by
the C library when the file is written).
>>>>>>>>>>>>>>>>>> snip snip <<<<<<<<<<<<<<<<<<<<
/***
*
* 2018-11-02 rli: windows services for stevie
*
***/
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "stevie.h"
/***/
void beep( void );
void windclear( void );
void windexit( int );
int windgetc( void );
void windgoto( int, int );
void windinit( void );
void windstr( char * );
void windputc( int );
void windrefresh( void );
/***/
void windinit( void )
{
CONSOLE_SCREEN_BUFFER_INFO Info;
HANDLE Output;
Output = GetStdHandle( STD_OUTPUT_HANDLE );
GetConsoleScreenBufferInfo( Output, &Info );
Rows = Info.srWindow.Bottom + 1;
Columns = Info.srWindow.Right + 1;
return;
}
void windgoto( int r, int c )
{
COORD Position;
CONSOLE_SCREEN_BUFFER_INFO Info;
HANDLE Output;
Output = GetStdHandle( STD_OUTPUT_HANDLE );
GetConsoleScreenBufferInfo( Output, &Info );
Position.X = c + Info.srWindow.Left;
if( Position.X < Info.srWindow.Left ) Position.X = Info.srWindow.Left;
if( Position.X > Info.srWindow.Right ) Position.X = Info.srWindow.Right;
Position.Y = r + Info.srWindow.Right;
if( Position.Y < Info.srWindow.Top ) Position.Y = Info.srWindow.Top;
if( Position.Y > Info.srWindow.Bottom ) Position.Y = Info.srWindow.Bottom;
SetConsoleCursorPosition( Output, Position );
return;
}
void windexit( int r )
{
exit( r );
}
void windclear( void )
{
CONSOLE_SCREEN_BUFFER_INFO Info;
HANDLE Output;
DWORD CharsWritten;
int Length;
windgoto( 0, 0 );
Output = GetStdHandle( STD_OUTPUT_HANDLE );
GetConsoleScreenBufferInfo( Output, &Info );
Length = Info.dwSize.X * Info.dwSize.Y;
FillConsoleOutputCharacter( Output, ' ', Length, Info.dwCursorPosition,
&CharsWritten );
FillConsoleOutputAttribute( Output, Info.wAttributes, Length,
Info.dwCursorPosition, &CharsWritten );
return;
}
int windgetc( void )
{
return _getch();
}
void windstr( char *s )
{
printf( "%s", s );
fflush( stdout );
return;
}
void windputc( int c )
{
putchar( c );
fflush( stdout );
return;
}
void windrefresh( void )
{
fflush( stdout );
return;
}
void beep( void )
{
return;
}
>>>>>>>>>>>>>>>>>>>>> snip snip <<<<<<<<<<<<<<<<<<<
enjoy.
--
roger ivie
roger...@gmail.com