-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:FujiNetWIFI/fujinet-platformio
- Loading branch information
Showing
15 changed files
with
286 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
paths: | ||
font_path: /file? | ||
css_path: /file?css | ||
js_path: /file?js | ||
components: | ||
network: true | ||
hardware: true | ||
hosts_list: true | ||
mount_list: true | ||
printer_settings: true | ||
modem_settings: false | ||
hsio_settings: false | ||
timezone: true | ||
udp_stream: true | ||
program_recorder: false | ||
disk_swap: true | ||
boot_settings: true | ||
apetime: false |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef PINMAP_IEC_NUGGET_H | ||
#define PINMAP_IEC_NUGGET_H | ||
|
||
#ifdef PINMAP_IEC_NUGGET | ||
|
||
/* SD Card */ | ||
// pins 12-15 are used to interface with the JTAG debugger | ||
// so leave them alone if we're using JTAG | ||
#ifndef JTAG | ||
#define PIN_CARD_DETECT GPIO_NUM_12 // fnSystem.h | ||
#define PIN_CARD_DETECT_FIX GPIO_NUM_15 // fnSystem.h | ||
#endif | ||
|
||
#define PIN_SD_HOST_CS GPIO_NUM_4 // LOLIN D32 Pro | ||
#define PIN_SD_HOST_MISO GPIO_NUM_19 | ||
#define PIN_SD_HOST_MOSI GPIO_NUM_23 | ||
#define PIN_SD_HOST_SCK GPIO_NUM_18 | ||
|
||
/* UART */ | ||
#define PIN_UART0_RX GPIO_NUM_3 // fnUART.cpp | ||
#define PIN_UART0_TX GPIO_NUM_1 | ||
#define PIN_UART1_RX GPIO_NUM_9 | ||
#define PIN_UART1_TX GPIO_NUM_10 | ||
#define PIN_UART2_RX GPIO_NUM_33 | ||
#define PIN_UART2_TX GPIO_NUM_21 | ||
|
||
/* Buttons */ | ||
#define PIN_BUTTON_A GPIO_NUM_NC // keys.cpp | ||
#define PIN_BUTTON_B GPIO_NUM_NC | ||
#define PIN_BUTTON_C GPIO_NUM_NC | ||
|
||
/* LEDs */ | ||
#define PIN_LED_WIFI GPIO_NUM_5 // led.cpp | ||
#define PIN_LED_BUS GPIO_NUM_2 // 4 FN | ||
|
||
// pins 12-15 are used to interface with the JTAG debugger | ||
// so leave them alone if we're using JTAG | ||
#ifndef JTAG | ||
#define PIN_LED_BT GPIO_NUM_13 | ||
#else | ||
#define PIN_LED_BT GPIO_NUM_5 // LOLIN D32 PRO | ||
#endif | ||
|
||
/* Audio Output */ | ||
#define PIN_DAC1 GPIO_NUM_25 // samlib.h | ||
|
||
/* Commodore IEC Pins */ | ||
//#define IEC_HAS_RESET // Reset line is available | ||
|
||
#define PIN_IEC_RESET GPIO_NUM_34 | ||
#define PIN_IEC_ATN GPIO_NUM_32 | ||
#define PIN_IEC_CLK_IN GPIO_NUM_33 | ||
#define PIN_IEC_CLK_OUT GPIO_NUM_33 | ||
#define PIN_IEC_DATA_IN GPIO_NUM_14 | ||
#define PIN_IEC_DATA_OUT GPIO_NUM_14 | ||
#define PIN_IEC_SRQ GPIO_NUM_27 | ||
|
||
#endif // PINMAP_IEC_NUGGET | ||
#endif // PINMAP_IEC_NUGGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#ifdef BUILD_APPLE | ||
|
||
#include "mediaTypeDO.h" | ||
|
||
#include <cstring> | ||
#include "utils.h" | ||
#include "../../include/debug.h" | ||
|
||
#define BYTES_PER_BLOCK 512 | ||
#define BLOCKS_PER_TRACK 8 | ||
#define BYTES_PER_SECTOR 256 | ||
#define BYTES_PER_TRACK 4096 | ||
|
||
// .DO (DOS ordered) disk images are stored in DOS 3.3 logical sector order. | ||
// Each 512 byte ProDOS block is stored as two 256 byte DOS sectors. | ||
// see https://retrocomputing.stackexchange.com/questions/15056/converting-apple-ii-prodos-blocks-to-dos-tracks-and-sectors | ||
|
||
// This table maps ProDOS blocks to pairs of DOS logical sectors. | ||
static const int prodos2dos[8][2] = { {0, 14}, {13, 12}, {11, 10}, {9, 8}, {7, 6}, {5, 4}, {3, 2}, {1, 15} }; | ||
|
||
bool MediaTypeDO::read(uint32_t blockNum, uint16_t *count, uint8_t* buffer) | ||
{ | ||
bool err = false; | ||
uint32_t track = blockNum / BLOCKS_PER_TRACK; | ||
const int* sectors = prodos2dos[blockNum % BLOCKS_PER_TRACK]; | ||
|
||
err = read_sector(track, sectors[0], buffer); | ||
|
||
if (!err) | ||
err = read_sector(track, sectors[1], &buffer[BYTES_PER_SECTOR]); | ||
|
||
return err; | ||
} | ||
|
||
bool MediaTypeDO::read_sector(int track, int sector, uint8_t* buffer) | ||
{ | ||
Debug_printf("\r\nMediaTypeDO read track %d sector %d", track, sector); | ||
|
||
bool err = false; | ||
uint32_t offset = (track * BYTES_PER_TRACK) + (sector * BYTES_PER_SECTOR); | ||
|
||
err = fseek(_media_fileh, offset, SEEK_SET) != 0; | ||
|
||
if (!err) | ||
err = fread(buffer, 1, BYTES_PER_SECTOR, _media_fileh) != BYTES_PER_SECTOR; | ||
|
||
return err; | ||
} | ||
|
||
bool MediaTypeDO::write(uint32_t blockNum, uint16_t *count, uint8_t* buffer) | ||
{ | ||
// Return an error if we're trying to write beyond the end of the disk | ||
if (blockNum >= num_blocks) | ||
{ | ||
Debug_printf("\r\nwrite block BEYOND END %lu > %lu", blockNum, num_blocks); | ||
return true; | ||
} | ||
|
||
bool err = false; | ||
uint32_t track = blockNum / BLOCKS_PER_TRACK; | ||
const int* sectors = prodos2dos[blockNum % BLOCKS_PER_TRACK]; | ||
|
||
err = write_sector(track, sectors[0], buffer); | ||
|
||
if (!err) | ||
err = write_sector(track, sectors[1], &buffer[BYTES_PER_SECTOR]); | ||
|
||
return err; | ||
} | ||
|
||
bool MediaTypeDO::write_sector(int track, int sector, uint8_t* buffer) | ||
{ | ||
Debug_printf("\r\nMediaTypeDO write track %d sector %d", track, sector); | ||
|
||
bool err = false; | ||
uint32_t offset = (track * BYTES_PER_TRACK) + (sector * BYTES_PER_SECTOR); | ||
|
||
err = fseek(_media_fileh, offset, SEEK_SET) != 0; | ||
|
||
if (!err) | ||
err = fwrite(buffer, 1, BYTES_PER_SECTOR, _media_fileh) != BYTES_PER_SECTOR; | ||
|
||
return err; | ||
} | ||
|
||
bool MediaTypeDO::format(uint16_t *respopnsesize) | ||
{ | ||
return false; | ||
} | ||
|
||
mediatype_t MediaTypeDO::mount(FILE *f, uint32_t disksize) | ||
{ | ||
diskiiemulation = false; | ||
_media_fileh = f; | ||
num_blocks = disksize / BYTES_PER_BLOCK; | ||
return MEDIATYPE_DO; | ||
} | ||
|
||
#endif // BUILD_APPLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef _MEDIATYPE_DO_ | ||
#define _MEDIATYPE_DO_ | ||
|
||
#include <stdio.h> | ||
|
||
#include "mediaType.h" | ||
|
||
class MediaTypeDO : public MediaType | ||
{ | ||
private: | ||
bool read_sector(int track, int sector, uint8_t* buffer); | ||
bool write_sector(int track, int sector, uint8_t* buffer); | ||
|
||
public: | ||
virtual bool read(uint32_t blockNum, uint16_t *count, uint8_t* buffer) override; | ||
virtual bool write(uint32_t blockNum, uint16_t *count, uint8_t* buffer) override; | ||
|
||
virtual bool format(uint16_t *respopnsesize) override; | ||
|
||
virtual mediatype_t mount(FILE *f, uint32_t disksize) override; | ||
|
||
virtual bool status() override {return (_media_fileh != nullptr);} | ||
}; | ||
|
||
|
||
#endif // _MEDIATYPE_DO_ |
Oops, something went wrong.