Monday, October 21, 2013

Launching 68k project

So Z80 project is considered completed.
I'm not going to stop poking the soldering iron to Z80, for sure, but now I want to implement 68k project.
The idea is mostly the same.

We'll boot it from AVR, sure ;-)
AVR will also always click the clocks (for stage 1) and serve as UART (for stage 1 and 2)
This is the start of desiging.

Stage 1: chips: AVR (Atmega8, I suppose, CPU (68008), SRAM chip), DTACK grounded

Stage 2: same with external quartz and the ability of cpu to turn on external quartz or switch back to AVR clock. This will be needed when we use AVR as UART. So before accessing AVR, we'll switch to AVR clock, write/read AVR, switch to fast clock.
No need to use DTACK.
SPI port. SD card.

Stage 3: same with external UART. DTACK will be grounded always except external UART accessing. So some BGERR logic is planned.

MMU is not planned, so the best I'll be able to run here is CP/M 68, not NetBSD.


[UPD error: R//W line should be inverted before going to OR to atmega; it should catch /Reads, not /Writes]

The first stage and booting logic follows:

Main program for avr -
- Hold down RESET & HALT lines, click the clock for some time.
- clock the clk line. If we have data on data line and /DS got high, put data in hi-impedance mode.

On RESET, Trigger should set 0 on Q line [/BOOTMODE], and in every read access to 0-1FFFF it will generate an INT0 on avr.
Getting the interrupt, AVR will put the byte data from the program to data line:
LEA $800,A0
LOOP: MOVE.B #$BYTE_FROM_A_PROGRAM_TO_BE_BOOTED,(A0+)
BRA LOOP
BRA $800 (and turn off the boot mode!)
(or like that)
and pausing for clicking clock until interrupt ends.

While beeing in BOOTMODE (and Q is not active) if we /write anything to 0-1FFFF the data will go to RAM. And when the bootmode ends, every access to the 0-1FFFF will go there.

Accessing D0000 - FFFFF from CPU will end boot mode. Really, now it's not clear to me should boot mode be terminated by CPU or AVR. [UPD 20140313 Later this idea was significantly simpified]

Tuesday, April 23, 2013

Found one more SD card not working

Sandisk SDSB002G B35. Enters SPI mode, but unable to reset. Going to dig this out.
So it extends the list of known not working cards which consisted of a single record Toshiba SD-M16

Known working:
Apacher AP1GSD60
Kingston SK4112-966A001F

Searle Grant's BIOS v1.0 and IOBYTE

Yesturday I've found that at Jan '13 Searle Grant released BIOS v 1.0 with IOBYTE support. And more - that my SGSBCSD is based on previous version. So today I've synced my code and v 1.0 and got something which will be named sgsbcsd2340 or 2350. I have a working code, but I have to ensure it works stable.

Saturday, April 13, 2013

Some unrelarted idea of booting IBM PC compatible

..using SD card attached to printer port:
Imagine you have some old 86/88+ IBM PC. You probably do not have floppy drive (or unwilling to use it). Here is the idea how to boot it/use it.
Attach SD to printer port somehow according SPI.
Take an Network card (or any other) with ROM socket. Write an BIOS extension with loader which will boot from LPT/SPI and plug it into that socket.
Sure, CP/M 86 can be booted this way, and, with modification of CP/M BIOS (which must be located in the boot SD card) it will run.
More, I bet this also can be done with Linux/xBSD and 386+ (but I havent seen SD card support over printer port in kernel; strange, that's a clear idea, why does not it exist?) and some hacking of lilo or other loader.

It's really unclear am I the first man who thought about it or what?
What all the other hummanity is thinking about? World crisis? Gay marriage? North Korea nuclear bomb? (I do not mind if this will not affect RAM prices)
Where to send notification I will accept a Nobel prise or two?
UPD: about the second one. This idea may be extended to OpenFirmware computers (Suns, Power-based Macs, RS/6000,what else?) - in this case you do not need and bios extension, cause it should be much easy to write an OF/Forth loader.
Definitely, two Nobel prises, not less!

UPD: 130414 this Indian Guy implemented an Parralel Printer Port/SPI kernel driver for linux. I'll try it.


Интересно почему никому не приходило в голову бутить писюк методом втыкания в него какой-нибудь карточки с дыркой под boot-rom (например, сетевухи), засовывания в нее прошивки которая бутила бы систему с SD карточки, засунутой в принтерный порт по SPI?

Хакануть CP/M 86 BIOS по моему опыту дело на пару вечеров (ну, не считая того что я не знаю 86ого асма), но ведь небось на трешке (386) так и Linux поднять как нефиг ссать?

Интересно почему в Linux нет драйвера работы с SDшкой через LPT порт?
Интересно мне первому эта идея в голову пришла?
О чем, блядь, думает прогрессивное человечество? О топоте котов?
Где блядь Нобелевку дают? Дайте две!
UPD: кстати, о второй. Берем любую тачу с OpenFirmware (Sun, PowerMac, RS/6000) и цинично лабаем этот лоадер на форте. Это вообще как два байта переслать.
Точняк, меньше двух нобелевок не предлагать!

Sunday, February 24, 2013

Some notes on accessing track 0 on SGSBCSD

Well, I've told that C000h TPA (strictly speaking, not TPA, but start of CCP) based CP/M image starts from track 0 / sector 0, the C200h system should start from SD offset 200h - i.e. track 0 / sector 1,D000h TPA - from track 0 / sector 8 That leads to a significant problem: everything works until you do not try to rewrite/regenerate CP/M itself inside of SBC, because the changes will we written to track 0 / sector 0 which will led to unusable boot image. So, if you want to do system change inside of SBC - use C000h based systems for now. In future I plan to change the algorythm of accessing track 0. Saying we have C800h TPA system starting from sector 4 and trying to write track 0/sector 0. I will add 4 to sector number so you'll access sector 4 as expected. That will lead to the situation you will not be able to access track 0 sector 0-3 at all. I think this is not a significant loss.

Wednesday, February 6, 2013

Tuesday, February 5, 2013

Bugfix release 2322

I had an awfull error writing sector. I waited just 255 times for non-zero byte after SD_CMD24 command.
It was wrong. Now I wait for FFFF ticks max - that works with my Apacer 1G card.

I hope next weekend I'll go to the Mitino market and buy a pocket of the most strange SD and MMC cards to test.
The release, as usually, here

UPD: I've attached c-kermit (version 2.2/IOBYTE) on the disk image inside of distribution. And it's even possible to transmit something.
On the CP/M side, tell kermit
set port tty
On unix side, tell your local kermit
set streaming off
and something somehows transmits, but with a huge number of errors. That's a topic to be explored.

Saturday, February 2, 2013

Monday, January 28, 2013

Searle Grant's SBC and SD - current status

I have good news. I've implemented read sector, write sector and looks like things work. I haven't implemented reload CCP yet, but this is just a question of time and work - everything is clear for me, currently I have to reload CCP by full reload. Not so good news. TPA will be as low as 48K for the first public version. Only SD (up to 2GB) and MMC will be supported (MMC is unclear; I do not have one, but it should) - I mean no SDHC and SDXC support, bit I think at least SDHC will be added soon. The initial loader will be distributed in .HEX file to be load from terminal from $5000; ROM image - in the nearest future (but after SDHC code)

Sunday, January 13, 2013

Searle Grant's SBC - lets boot from SD

That's easy


Это просто

First, assemble a scheme I described here .
Next, get the file.
Then, let's write something to SD card, saying

org $D000 ; this is the place program will load from the card - do not be confused with $5000!
start:
ld a,'*'
rst 8
jp start
org $FFFE
db $00,$0D ; this is a jump vector address

Assemble, move it to sd card the way ld a,'*' will be the first two bytes, and 00 0D should locate at 2FFE offset.
Under linux, dd is your's friend.
And - type test.out into terminal window and run it by G5000.
You should see how the card is booted and get a lot of *'s.
Warning: the program (loader) generates a HUGE debug info.


Собираем это .
Берем файлец .
Далее, напишем что-нибудь на SD карту, например

org $D000 ; это куда мы будем грузить с карты
start:
ld a,'*'
rst 8
jp start
org $FFFE
db $00,$0D ; это собственно ровно вектор куда прыгать

Ассемблите, пишите на SDшку так что ld a,'*' будут двумя первыми байтами, а 00 0D должны находиться по оффсету 2FFE.
Под linux это делается командой dd.
Далее грузим из терминала test.out и запускаем его командой G5000.
Далее будет видно как оно будет грузится (там КУУУУЧА дебага) и потом должны увидеть кучку звездочек.

Sunday, January 6, 2013

Searle Grant's SBC - lets start with SD

I tried. Trust me, I tried.
But I am unable to make CF interface to work properly.
So I started to implement fn SD interface


Я честно старался, но опять нихуя не вышло!
Короче CF интерефейс компа Searle Grantа у меня нормально не работает, поэтому я решил начать имплементить SD.

The Idea: lets' try to build it.
The Scheme:

The software: here
The results: at least, CF answers properly to "GO IDLE STATE" command
The note: by a strange reason, Z84C0006 (CMOS one) does not hear open collector (yes, inverted) input (at least in my cheme), SHARP LH0080A does. At least for now. And I use 1K resistors instead of 680 ohm resistors - I have no 680 resistors around.
Testing it all:
Plug off SD/MMC, load basic, say
OUT 16,0
check zeroes on triggers.
Repeat OUT 16,7 and OUT 16, anything and check for triggers
Then, shorten data out line to ground and
PRINT INP(16)
Lower bit should be 1 (this is an inverted data)
Leave data NC or plug it somewhere to +5 and repeat, you should get lower bit 0.
If it does not, change CMOS CPU to NMOS.... At least that's what I do for now, that's weird, but I'll think about it later.

As for CF interface, yes, it was very hard to solder it, and ONCE it even loaded, but I mostly got a strange hang after reading sector $38 (I wrote a debug program showing me how does it loads). I've tried to change all the logic chips to HCT, make my wires shorter - same result.

UPD 20130108: The purpose of the led (that should be a RED led) is to drop voltage from +5 to somewhere from +2.8 to 3.3. I saw this recipe in inet, but I do not remember where. Note: before CS goes down, this led will not be turned on.
Keep in mind I run SBC at 2.7 Mhz // 38400 baud, I do not know if this is significant for now
UPD 20130108.2: That's a proper scheme! I'm able to read 512 block from an SD card, but that will be in the other post
UPD 20130114: Install 8 pullup resistors on data bus (4.7k to 5). That's a right idea. After that, Z84C00 works.


Схема:

Софт: тут
Результат: как минимум, CF загоняется в SPI mode командой "GO IDLE STATE" и отвечает правильно
Соображения: Какого то хуя Z84C0006 не слышит моего (да-да, инвертированного) открытого коллектора, а вот SHARP LH0080A - легко и непринудженно. Как минимум в ходе текущих исследований. А, еще я сунул 1k резисторы вместо 680, у меня их прям щаз нет.
Тестирование:
Не суйте СFку, грузаните BASIC, пишите
OUT 16,0
На выходах триггеров ясный пень должны быть нули.
Суньте туда вместо нулей 255, 7 или еще чего-нибудь и посмотрите что там на триггерах.
Теперь закоротите data out (у нас инверсный вход),
PRINT INP(16)
должен в младшем бите показать 1. Выдерните или коротните на +5 - в младшем бите должен быть 0.
Если ничего не получается - поменяйте проц на nmosный, старье какое-нибудь. Ну во всяком случае я сейчас так делаю, потом подумаю как делать не так.

А CFка не работает следующим образом. Кроме того что я заебался ее распаивать, (и, кстати, разочек она так таки загрузилась), она стабильно виснет при чтении сектора $38. Я налабал программку с дебагом чтобы она показывала что она делает - так вот, она показывает именно это. Я менял все чипы на HCTшные, делал провода короткими насколько можно - хуев мне лукошко, а не работающий CF.

UPD 20130108: Светодиод на power линии - это не просто так светодиод (он обязан быть красным), эта штука жрет так чтобы на CFке оказалось от +2.8 до +3.3. Это я спер [как собственно и 90% всего что я делаю] у каких-то чуваков в сети, но забыл где. Кстати, пока не переведете CS вниз, то оно ничего и не жрет.
Еще кстати - я на 2.7Mhz // 38400, не уверен что это все не будет работать на 7Mhz, проверю - отпишу.

UPD 20130108.2: Схема кстати правильная - я смог прочитать блок из 512 байт с SDшки. Но об этом - в следущем посте.
UPD 20130114: 8 резисторов дата - 4.7k - +5 - очень правильная идея. Z84C00 после этого заработал в этой схеме.