/*
* JR-IDE Project
* - (c) 2017 Alan Hightower
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "jride.h"
#include "flash_api.h"
volatile uint8_t far *ide_window;
volatile uint8_t far *bios_window;
#define LOGERR(fmt, ...) fprintf(stderr, "\nERROR: " fmt "\n\n", ## __VA_ARGS__)
int main (int argc, char *argv[])
{
int done = 0;
uint16_t segment;
if (!(jride_flash_poll (&segment, NULL)))
{
fprintf (stderr, "\nERROR: Unable to locate BIOS address\n\n");
return 0;
}
printf ("\nJR-IDE Raspberry Pi Zero Console - BIOS @ %04X0\n", segment);
printf (" ***** Press F10 to exit *****\n\n");
bios_window = (volatile uint8_t far *) MK_FP(segment, 0x0000);
ide_window = (uint8_t far *) &bios_window[JRIDE_IDE_REG_BASE];
while (!done)
{
while (ide_window[IDE_REG_UART_STS])
{
uint8_t reg = ide_window[IDE_REG_UART_DATA];
// ANSI.SYS will take care of escape codes
printf ("%c", (char *) reg);
}
fflush(stdout);
if (kbhit())
{
char c;
if ((c = getch()))
{
// Allow normal alpha-numerics through w/o mod
ide_window[IDE_REG_UART_DATA] = c;
}
else
{
switch ((c = getch()))
{
case 0x44: // F10
done = 1;
break;
case 0x3b: // F1
case 0x3c: // F2
case 0x3d: // F3
case 0x3e: // F4
case 0x3f: // F5
case 0x40: // F6
case 0x41: // F7
case 0x42: // F8
case 0x43: // F9
case 0x47: // HOME
case 0x48: // UP
case 0x49: // PGUP
case 0x4b: // LEFT
case 0x4d: // RIGHT
case 0x4f: // END
case 0x50: // DOWN
case 0x51: // PGDN
case 0x52: // INS
case 0x53: // DEL
default:
printf ("Unknown special '%c' (%d)\n", c, c);
break;
}
}
}
}
return 0;
}