石原 博の覚書

電子工作に関する日々の覚書を記載します

avrcpmが動いた

2020-09-20 17:56:18 | 日記

avr で CP/M を動かす記事(https://spritesmods.com/?art=avrcpm)を参考に作成した。

注意点

 インターネット上で複数の記事があるが、途中でpin接続が変更になっている

 初期にはポートCの接続が以下のようになっていたが、

=== avrcpm-0.1.tgz ===
;Port C
.equ ram_d1 = 0
.equ ram_w = 1
.equ ram_d2 = 2
.equ ram_d4 = 3
.equ ram_d3 = 4
.equ ram_cas= 5

dram_getnibble:
 andi temp,0xf0
 sbic pinc,ram_d1
  ori temp,0x1
 sbic pinc,ram_d2
  ori temp,0x2
 sbic pinc,ram_d3
  ori temp,0x4
 sbic pinc,ram_d4
  ori temp,0x8
 ret

 

ある時期を境に以下のように変更されている。

avrcpm_upd2

===config.inc===

;Port C
.equ RAM_D0 = 0
.equ RAM_D1 = 1
.equ RAM_D2 = 2
.equ RAM_D3 = 3
.equ RAM_W = 4
.equ RAM_CAS = 5

=== z80.asm ===
dram_read:
 cli
 DRAM_SETADDR xh, ~0,(1<<ram_ras), ~(1<<ram_a8), (1<<ram_oe)
 cbi P_RAS,ram_ras
 DRAM_SETADDR xl, ~(1<<ram_ras),0, ~((1<<ram_oe)), (1<<ram_a8)
 cbi P_CAS,ram_cas
 cbi P_A8,ram_a8
 dram_wait DRAM_WAITSTATES ;
 in  temp,P_DQ-2  ; PIN
 sbi P_CAS,ram_cas

 cbi P_CAS,ram_cas
 andi temp,0x0f
 swap temp
 dram_wait DRAM_WAITSTATES ;
 in  temp2,P_DQ-2 ; PIN
 andi temp2,0x0f
 or  temp,temp2

 sbi P_OE,ram_oe
 sbi P_CAS,ram_cas
 sbi P_RAS,ram_ras
 sei
 ret

 

micro SDは以下の手順でパーティションを切り、fat16とし、https://www.mikrocontroller.net/articles/AVR_CP/M より

CPMDSK_A.IMG〜CPMDSK_C.IMGをダウンロードし書き込みを行った。

 

# /sbin/fdisk /dev/sdb

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xd9d7c804.

Command (m for help): p
Disk /dev/sdb: 28.9 GiB, 30979129344 bytes, 60506112 sectors
Disk model: Flash Reader    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd9d7c804

Command (m for help): p

Disk /dev/sdb: 28.9 GiB, 30979129344 bytes, 60506112 sectors
Disk model: Flash Reader    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd9d7c804

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)

Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-60506111, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-60506111, default 60506111): +100M

Created a new partition 1 of type 'Linux' and of size 100 MiB.

Command (m for help): p
Disk /dev/sdb: 28.9 GiB, 30979129344 bytes, 60506112 sectors
Disk model: Flash Reader    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd9d7c804

Device     Boot Start    End Sectors  Size Id Type
/dev/sdb1        2048 206847  204800  100M 83 Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 6
Changed type of partition 'Linux' to 'FAT16'.

Command (m for help): p
Disk /dev/sdb: 28.9 GiB, 30979129344 bytes, 60506112 sectors
Disk model: Flash Reader    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd9d7c804

Device     Boot Start    End Sectors  Size Id Type
/dev/sdb1        2048 206847  204800  100M  6 FAT16

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

# /sbin/mkfs.vfat /dev/sdb1
mkfs.fat 4.1 (2017-01-24)

 



最新の画像もっと見る

コメントを投稿