Skip to content

Commit

Permalink
Changed pitch of disk images in flash
Browse files Browse the repository at this point in the history
As reported in #15 the version 1.2 of esptool.py wont write to
non-sector aligned addresses.
  • Loading branch information
mengstr committed Mar 28, 2017
1 parent 6a367a5 commit ad5e557
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions code/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ EMULATIONBAUD = 9600
PORT = 23

DISKSIZE = 0x3E900 # 256256 bytes (IMB 8-inch 26sec, 77trk, SS)
DISKPITCH = 0x3F000 # esptool1.2 won't write at non-sector boundries

ifeq (NOSDK, $(BUILD))
DISKS = A B C D E F G H I J K L M N O
Expand Down Expand Up @@ -222,8 +223,8 @@ readdisk$(1) :
endef

$(foreach DSK,$(DISKS), \
$(eval $(call WRITEDISK,$(DSK), $(DISKSIZE), $(DISKSIZE), $(DISKADDR) )); \
$(eval $(call READDISK,$(DSK), $(DISKSIZE), $(DISKSIZE), $(DISKADDR) )); \
$(eval $(call WRITEDISK,$(DSK), $(DISKPITCH), $(DISKSIZE), $(DISKADDR) )); \
$(eval $(call READDISK,$(DSK), $(DISKPITCH), $(DISKSIZE), $(DISKADDR) )); \
)

WRITEDISKTARGETS=$(foreach DSK,$(DISKS), writedisk$(DSK) )
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed code/disks/B/zexall.com
Binary file not shown.
Binary file removed code/disks/B/zexdoc.com
Binary file not shown.
Binary file removed code/disks/E/EDIT.COM
Binary file not shown.
Binary file removed code/disks/E/EDIT.OVY
Binary file not shown.
Binary file removed code/disks/E/MIX.COM
Binary file not shown.
Binary file removed code/disks/E/SETEDIT.COM
Binary file not shown.
Binary file removed code/disks/M/Z80ASM.COM
Binary file not shown.
5 changes: 3 additions & 2 deletions code/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define SECTORSPERTRACK 26 // A standard 8" IBM disk have 26 sectors...
#define TRACKSPERDISK 77 // ... and 77 tracks
#define DISKSIZE (SECTORSIZE*SECTORSPERTRACK*TRACKSPERDISK)
#define DISKPITCH 0x3f000 // Disks must be at sector boundries

#ifdef NOSDK
#define DISKFLASHOFFSET 0x3c0000 // Location in flash for first disk going backwards
Expand Down Expand Up @@ -57,7 +58,7 @@ void ICACHE_FLASH_ATTR ReadDiskBlock(uint16_t mdest, uint8_t sectorNo,
if (sectorNo > (SECTORSPERTRACK - 1)) sectorNo = SECTORSPERTRACK - 1;

uint32_t lba = SECTORSPERTRACK * trackNo + sectorNo;
uint32_t flashloc = (DISKFLASHOFFSET - DISKSIZE * diskNo) + SECTORSIZE * lba;
uint32_t flashloc = (DISKFLASHOFFSET - DISKPITCH * diskNo) + SECTORSIZE * lba;
uint16_t myFlashSectorNo = flashloc / FLASHBLOCKSIZE;
uint16_t fl = flashloc % FLASHBLOCKSIZE;

Expand Down Expand Up @@ -105,7 +106,7 @@ void ICACHE_FLASH_ATTR WriteDiskBlock(uint16_t msrc, uint8_t sectorNo,
if (sectorNo > (SECTORSPERTRACK - 1)) sectorNo = SECTORSPERTRACK - 1;

uint32_t lba = SECTORSPERTRACK * trackNo + sectorNo;
uint32_t flashloc = (DISKFLASHOFFSET - DISKSIZE * diskNo) + SECTORSIZE * lba;
uint32_t flashloc = (DISKFLASHOFFSET - DISKPITCH * diskNo) + SECTORSIZE * lba;
uint16_t myFlashSectorNo = flashloc / FLASHBLOCKSIZE;
uint16_t fl = flashloc % FLASHBLOCKSIZE;

Expand Down

0 comments on commit ad5e557

Please sign in to comment.