From 6ff3a8076d684e77233edcef987f766870bcb3c5 Mon Sep 17 00:00:00 2001 From: bkw777 Date: Thu, 1 Feb 2024 18:10:42 -0500 Subject: [PATCH] docs, comments, macro constant names --- constants.h | 8 +++++--- dl.c | 37 +++++++------------------------------ junk.pdd2 | Bin 0 -> 206880 bytes 3 files changed, 12 insertions(+), 33 deletions(-) create mode 100644 junk.pdd2 diff --git a/constants.h b/constants.h index 4a2797e..317f2d1 100644 --- a/constants.h +++ b/constants.h @@ -167,7 +167,9 @@ #define SMT_OFFSET 1240 #define PDD1_SMT 0x80 #define PDD2_SMT 0xC0 -#define PDD2_ID_ADDR 0x8004 +#define RAM_ADDR 0x8000 +#define RAM_LEN 0x1000 +#define PDD2_ID_ADDR (RAM_ADDR+0x0004) #define PDD2_MEM_READ_MAX 252 // real drive absolute limit #define PDD2_MEM_WRITE_MAX 127 // real drive absolute limit @@ -191,8 +193,8 @@ // TPDD2 sysinfo data: 80 13 05 00 10 E1 #define SECTOR_CACHE_START_MSB 0x80 #define SECTOR_CACHE_START_LSB 0x13 -#define SECTOR_CACHE_LEN_MSB 0x05 -#define SECTOR_CACHE_LEN_LSB 0x00 +//#define SECTOR_CACHE_LEN_MSB 0x05 // SECTOR_SIZE_MSB +//#define SECTOR_CACHE_LEN_LSB 0x00 // SECTOR_SIZE_LSB #define SYSINFO_CPU 0x10 // 0x10 = HD6301 //#define MODEL 0xE1 diff --git a/dl.c b/dl.c index 23eb6ca..2bc93fa 100644 --- a/dl.c +++ b/dl.c @@ -156,11 +156,10 @@ char bootstrap_fname[PATH_MAX] = {0x00}; int opr_mode = 1; uint8_t dme = 0; bool dme_disabled = false; -char ch[2] = {0xFF}; // 0x00 is a valid OPR command, so init to 0xFF -//uint8_t img_header_len = SECTOR_HEADER_LEN; +char ch[2] = {0xFF}; // 0x00 is a valid Operation-mode command, so init to 0xFF const uint16_t fdc_logical_size_codes[] = FDC_LOGICAL_SIZE_CODES; const char fdc_cmds[] = FDC_CMDS; -uint8_t rb[2048] = {0x00}; // disk image record buffer / virtual pdd2 ram +uint8_t rb[RAM_LEN] = {0x00}; // disk image record buffer / virtual pdd2 ram FILE_ENTRY* cur_file; int dir_depth=0; @@ -302,9 +301,8 @@ int check_disk_image () { if (disk_img_fname[0]) { struct stat info; stat(disk_img_fname, &info); - // allow missing or zero-byte file, - // we will create it if client issues format command - // but if file exists, sanity check based on size + // If file exists >0 bytes, sanity check based on size, + // otherwise allow missing/empty, & format command will create as needed if (info.st_size) { if (model==1 && info.st_size != PDD1_IMG_LEN) { dbg(0,"Expected TPDD1 disk image file size %u\n",PDD1_IMG_LEN); @@ -316,32 +314,11 @@ int check_disk_image () { dbg(0,"\"%s\" is %u\n",disk_img_fname,info.st_size); return 1; } - //printf("%s: size=%ld\n", disk_img_fname, info.st_size); - //if (model==2 && info.st_size == PDD2_TRACKS*PDD2_SECTORS*(OLD_PDD2_HEADER_LEN+SECTOR_DATA_LEN)) { - // img_header_len = OLD_PDD2_HEADER_LEN; - // dbg(0,"Detected OLD TPDD2 disk image file format\n"); - //} } } return 0; } -// TODO - search for likely TTY(s) automatically -/* -void guess_client_tty () { - struct dirent *files; - char path[] = "/dev/"; - DIR *dir = opendir(path); - if (dir == NULL){dbg(0,"Cannot open \"%s\"",path); return;} - int i; - while ((files = readdir(dir)) != NULL) { - for (i=strlen(files->d_name);files->d_name[i]!='/';i--); - if (!strcmp(files->d_name+i+1,match)) dbg(0," %s",files->d_name); - } - closedir(dir); -} -*/ - void resolve_client_tty_name () { dbg(3,"%s()\n",__func__); switch (client_tty_name[0]) { @@ -685,7 +662,7 @@ void req_fdc_read_sector(uint8_t tp,uint8_t tl) { ret_fdc_std(ERR_FDC_SUCCESS,tp,l); // 1st stage response char t=0x00; read_client_tty(&t,1); // read 1 byte from client - if (t==0x0D) write_client_tty(rb,l); // if it's \r send data + if (t==0x0D) write_client_tty(rb,l); // if it's \r send data, else silently abort } // ref/search_id_section.txt @@ -1644,8 +1621,8 @@ void ret_sysinfo() { gb[1]=0x06; gb[2]=SECTOR_CACHE_START_MSB; gb[3]=SECTOR_CACHE_START_LSB; - gb[4]=SECTOR_CACHE_LEN_MSB; - gb[5]=SECTOR_CACHE_LEN_LSB; + gb[4]=SECTOR_SIZE_MSB; + gb[5]=SECTOR_SIZE_LSB; gb[6]=SYSINFO_CPU; gb[7]=MODEL; gb[8]=checksum(gb); diff --git a/junk.pdd2 b/junk.pdd2 new file mode 100644 index 0000000000000000000000000000000000000000..6a5a4a9a4c26b512bebf2a4b3bc1b22721b17189 GIT binary patch literal 206880 zcmeIyF%7^l6hpzH2!AMH)>3$Dt;_5ozAyQ_k4Jz2fn9+cs~uw)rNjsj_@%&&zdkW1 zMt}f;X#rz6eO~1V5U2viuu91hATTXp45!bl903AVz!+93IRXTx1&rbJd6gqTpb8kn zDkVpNz_frdoIbB|1PD|CV_2o+2oRVSFox6TRgM6GDqsw&lpFy9(*nkD`n<{!AW#L2 zVU?02Kww(H7*3y8IRXT#fHAC6as&uW3mC)c^D0MxKou~CRZ5NkfoTC_IDKB_2oR_O z#;{7s5g;%vU<{|vs~iCWRlpclDLDcJrUi`Q^m&ydK%fd3!zv|5fWWkXF`PcHas&ue z0b^LD=T(jXfhu4OtCSo80@DJ-9QgQ?cObZyp>GLW_fIt;6hE+o?Y

a{0>-dP$q^thEnp0%&#N2( z0#(2mRw+3G1f~Uy;q-ZxBS4@E7{e+hM}WYzfH9mtuW|$kQ~_gHrQ`?@m=-XG)8|!= z0D&rC46BqJ0Rqzk#&G()$`K$?1&m>pk|RK1TEG}ipI12o1gd~BtWt6W2uuqY!|C%X zM}R;TFoso1jsSsa0b@9QUgZc7r~<~YO34u*FfCvVr_ZY#0RmOP7*;7c0tBW7jN$Zo zl_Nl)3K+vGB}ah3w16?3KCf~F2vh-MSf%6$5SSJ)hSTR&jsSrwU<|92903B;0>*Iq zyvh+EPz8)(m69VsU|PT!PM=pf0tBjnF|1N@1PDwE7{lrFDo21o6)=WXN{#@5X#rz6 zeO~1V5U2viuu91hAT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