Skip to content

Commit

Permalink
Merge pull request #22 from simoninns/dev-0311
Browse files Browse the repository at this point in the history
Dev 0311
  • Loading branch information
Simon Inns authored Mar 24, 2019
2 parents 93e9058 + 872852f commit dde3257
Show file tree
Hide file tree
Showing 22 changed files with 509 additions and 728 deletions.
22 changes: 12 additions & 10 deletions BeebSCSI_AVR/BeebSCSI_AVR/BeebSCSI_AVR.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@
<BootSegment>2</BootSegment>
<eraseonlaunchrule>0</eraseonlaunchrule>
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.31.0" />
</dependencies>
</framework-data>
<framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.34.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<ResetRule>0</ResetRule>
<EraseKey />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
Expand Down
8 changes: 3 additions & 5 deletions BeebSCSI_AVR/BeebSCSI_AVR/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BeebSCSI serial debug functions
BeebSCSI - BBC Micro SCSI Drive Emulator
Copyright (C) 2018 Simon Inns
Copyright (C) 2018-2019 Simon Inns
This file is part of BeebSCSI.
Expand Down Expand Up @@ -132,17 +132,15 @@ void debugSectorBufferHex(uint8_t *buffer, uint16_t numberOfBytes)

for (uint16_t byteNumber = 0; byteNumber < numberOfBytes; byteNumber += 16)
{
for (i = 0; i < index; i++)
{
for (i = 0; i < index; i++) {
printf("%02x ", buffer[i + byteNumber]);
}
for (uint16_t spacer = index; spacer < width; spacer++)
printf(" ");

printf(": ");

for (i=0; i < index; i++)
{
for (i=0; i < index; i++) {
if (buffer[i + byteNumber] < 32 || buffer[i + byteNumber] >126) printf(".");
else printf("%c",buffer[i + byteNumber]);
}
Expand Down
2 changes: 1 addition & 1 deletion BeebSCSI_AVR/BeebSCSI_AVR/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BeebSCSI serial debug functions
BeebSCSI - BBC Micro SCSI Drive Emulator
Copyright (C) 2018 Simon Inns
Copyright (C) 2018-2019 Simon Inns
This file is part of BeebSCSI.
Expand Down
80 changes: 27 additions & 53 deletions BeebSCSI_AVR/BeebSCSI_AVR/fcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BeebSCSI F-Code emulation functions
BeebSCSI - BBC Micro SCSI Drive Emulator
Copyright (C) 2018 Simon Inns
Copyright (C) 2018-2019 Simon Inns
This file is part of BeebSCSI.
Expand Down Expand Up @@ -53,8 +53,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
if (debugFlag_scsiFcodes) debugString_P(PSTR("F-Code: Received bytes:"));

// Write out the buffer until a CR character is found
for (byteCounter = 0; byteCounter < 256; byteCounter++)
{
for (byteCounter = 0; byteCounter < 256; byteCounter++) {
if (debugFlag_scsiFcodes) debugStringInt8Hex_P(PSTR(" "), scsiFcodeBuffer[byteCounter], false);
if (scsiFcodeBuffer[byteCounter] == 0x0D) break;
fcodeLength++;
Expand All @@ -63,14 +62,12 @@ void fcodeWriteBuffer(uint8_t lunNumber)


// F-Code decoding for debug output
if (debugFlag_scsiFcodes)
{
if (debugFlag_scsiFcodes) {
// Display the F-Code command value
debugStringInt8Hex_P(PSTR("F-Code: Received F-Code "), scsiFcodeBuffer[0], false);

// Display the F-Code command function
switch(scsiFcodeBuffer[0])
{
switch(scsiFcodeBuffer[0]) {
case 0x21: // !xy
debugString_P(PSTR(" = Sound insert (beep)\r\n"));
break;
Expand All @@ -80,8 +77,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x24: // $0, $1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Replay switch disable\r\n"));
break;
Expand All @@ -101,8 +97,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x29: // )0, )1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Transmission delay off\r\n"));
break;
Expand All @@ -118,8 +113,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x2A: // *
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case 0x0D:
// No parameter, assume default
debugString_P(PSTR(" = Halt (still mode)\r\n"));
Expand All @@ -136,8 +130,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x2C: // ,
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Standby (unload)\r\n"));
break;
Expand Down Expand Up @@ -165,8 +158,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x3F: // ?
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case 'F':
debugString_P(PSTR(" = Picture number request\r\n"));
break;
Expand Down Expand Up @@ -198,8 +190,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x41: // A0, A1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Audio-1 off\r\n"));
break;
Expand All @@ -215,8 +206,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x42: // B0, B1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Audio-2 off\r\n"));
break;
Expand All @@ -232,8 +222,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x43: // C0, C1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Chapter number display off\r\n"));
break;
Expand All @@ -249,8 +238,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x44: // D0, D1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Picture number/time code display off\r\n"));
break;
Expand All @@ -266,8 +254,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x45: // E
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Video off\r\n"));
break;
Expand All @@ -287,8 +274,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x48: // H
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Remote control not routed to computer\r\n"));
break;
Expand All @@ -304,8 +290,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x49: // I
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Local front panel buttons disabled\r\n"));
break;
Expand All @@ -321,8 +306,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x4A: // J
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Remote control disabled for player control\r\n"));
break;
Expand Down Expand Up @@ -374,11 +358,9 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x56: // V, VP
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case 'P':
switch(scsiFcodeBuffer[2])
{
switch(scsiFcodeBuffer[2]) {
case '1':
debugString_P(PSTR(" = Video overlay mode 1 (LaserVision video only)\r\n"));
break;
Expand Down Expand Up @@ -432,8 +414,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x5B: // [0, [1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Audio-1 from internal\r\n"));
break;
Expand All @@ -449,8 +430,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x5C: // '\'
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Video from internal\r\n"));
break;
Expand All @@ -466,8 +446,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x5D: // ]0, ]1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Audio-2 from internal\r\n"));
break;
Expand All @@ -483,8 +462,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
break;

case 0x5F: // _0, _1
switch(scsiFcodeBuffer[1])
{
switch(scsiFcodeBuffer[1]) {
case '0':
debugString_P(PSTR(" = Teletext from disc off\r\n"));
break;
Expand All @@ -508,8 +486,7 @@ void fcodeWriteBuffer(uint8_t lunNumber)
// If the F-Code is a user code request (?U), we need to send the user-code via
// the UART (as this is the only way the external F-Code emulation can know
// the right code to send back
if (scsiFcodeBuffer[0] == 0x3F && scsiFcodeBuffer[1] == 0x55)
{
if (scsiFcodeBuffer[0] == 0x3F && scsiFcodeBuffer[1] == 0x55) {
// Get the user code for the target LUN
filesystemReadLunUserCode(lunNumber, userCode);

Expand Down Expand Up @@ -542,22 +519,19 @@ void fcodeReadBuffer(void)

// Ensure we have a full F-code response terminated with
// 0x0D (CR) before we send it to the host
if (uartPeekForString())
{
if (uartPeekForString()) {
if (debugFlag_scsiFcodes) debugString_P(PSTR("F-Code: Transmitting F-Code bytes: "));

// Copy the UART Rx buffer to the F-Code buffer
for (byteCounter = 0; byteCounter < availableBytes; byteCounter++)
{
for (byteCounter = 0; byteCounter < availableBytes; byteCounter++) {
scsiFcodeBuffer[byteCounter] = (char)(uartRead() & 0xFF);
if (debugFlag_scsiFcodes) debugStringInt8Hex_P(PSTR(" "), scsiFcodeBuffer[byteCounter], false);
}
if (debugFlag_scsiFcodes) debugString_P(PSTR("\r\n"));
}
// If there is nothing to send we should reply with only a CR according
// to page 40 of the VP415 operating instructions (C8H Read F-code reply)
else
{
else {
if (debugFlag_scsiFcodes) debugString_P(PSTR("F-Code: No response from host; sending empty CR terminated response.\r\n"));
scsiFcodeBuffer[0] = 0x0D;
}
Expand Down
2 changes: 1 addition & 1 deletion BeebSCSI_AVR/BeebSCSI_AVR/fcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BeebSCSI F-Code emulation functions
BeebSCSI - BBC Micro SCSI Drive Emulator
Copyright (C) 2018 Simon Inns
Copyright (C) 2018-2019 Simon Inns
This file is part of BeebSCSI.
Expand Down
Loading

0 comments on commit dde3257

Please sign in to comment.