Last modified by Max on 2025/03/02 15:18

From version 2.2
edited by Max
on 2025/02/25 11:56
Change comment: (Autosaved)
To version 1.10
edited by Max
on 2025/02/25 11:31
Change comment: (Autosaved)

Summary

Details

Page properties
Content
... ... @@ -15,6 +15,7 @@
15 15  * 177224 - Primary Boot Register (BOOT1)
16 16  * 177226 - Alternate Boot Register (BOOT2)
17 17  
18 +
18 18  The CSR register accepts commands in bits D0-D5 and the interrupt enable bit in bit D6, all write only, always zero is read. In bit D7, the readiness bit is read. One in it means that the previous command has been executed and the controller is ready for exchange. Zero means that the controller is busy executing the previous operation, the other registers are disabled, access to any of them will cause Trap to 4. If the execution of the previous command caused an error, bit D15 is set simultaneously with bit D7.
19 19  \\Writing to registers is done only in words; byte writing is not allowed.
20 20  \\All data exchange is conducted via DR. For commands with a single-word argument, this argument should be sent to DR, and then the command should be sent to CSR. For commands exchanging with the controller buffer, on the contrary, the command should be issued and only after it a data block of a certain length should be received or transmitted.
... ... @@ -200,7 +200,7 @@
200 200  ;.............................
201 201  {{/code}}
202 202  
203 -== 004: Mount a disk ==
204 +== **004: Монтировать диск** ==
204 204  
205 205  Sequence of actions:
206 206  • Reset the controller
... ... @@ -220,20 +220,20 @@
220 220   MOV #AZ$CSR,R3
221 221  
222 222  20$: CLR @R3;
223 - TSTB @R3; Reset the controller
224 + TSTB @R3; Сбросим контроллер
224 224   BPL 20$;
225 225  
226 - MOV #WrBuf,(R3)+; Send it a string
227 - MOV #MDTXT,R2; with the assignment command
227 + MOV #WrBuf,(R3)+; Перешлем в него строку
228 + MOV #MDTXT,R2; с командой назначения
228 228   MOV #MDLEN/2,R1;
229 229  21$: MOV (R2)+,@R3;
230 230   SOB R1,21$;
231 231  
232 - MOV #AZMNT,-(R3); and pass it to
233 -22$: TSTB @R3 ; execution
233 + MOV #AZMNT,-(R3); и отдадим ее на
234 +22$: TSTB @R3 ; исполнение
234 234   BPL 22$ ;
235 235  
236 - TST @R3; then check for an error
237 + TST @R3; после чего проверим на ошибку
237 237   BMI Err11;
238 238  ;.........................
239 239  
... ... @@ -242,57 +242,57 @@
242 242  ;..................
243 243  {{/code}}
244 244  
245 -In this fragment, the 51SYS_DS.DSK image file is mounted on the AZ4 disk, located in the SYSTEM folder, which is located in the DISKS folder, which is located in the root directory of the micro-SD card.
246 +В этом фрагменте на диск AZ4 монтируется файл-образ 51SYS_DS.DSK, лежащий в папке SYSTEM, которая лежит в папке DISKS, лежащей в корневом оглавлении карточки микро-SD.
246 246  
247 247  
248 -== 005: Reading block into buffer ==
249 +== **005: Чтение блока в буфер** ==
249 249  
250 -The controller has a built-in buffer for 256 words (512 bytes). In fact, this is part of the STM32 microcontroller's RAM, allocated in its program for this buffer. All exchange in the main command block goes through this buffer.
251 -\\The AZ disk memory is represented as a set of blocks, each 512 bytes in size. Such a block is the only available unit for exchanging data with AZ disks. The blocks are numbered from zero to 65533 for the 16-bit version or up to 8388607 for the 32-bit version - this is when using AZ drives of the maximum permissible capacity. No one prevents you from using drives of a smaller capacity - the actual size of the drive is equal to the size of the file-image mounted on this drive. An error will be registered if you try to access beyond the file-image.
252 -\\Command 005 - reading a block from MicroSD to the buffer. From the pseudo-disk AZn, previously selected by the command "Select device", the block whose number is transmitted by the command (commands) "Set block number" is started for reading. Long-term command.
253 -\\In fact, a block from a MicroSD card is read in about 500-800 µs. During this time, the controller goes into a state that during the discussion of the project was called "I think, please do not interfere." Namely, for the entire time of its execution, all device registers are disabled, except for CSR, in which zero is read as long as the controller is busy executing this command. After the block is read, the remaining controller registers are connected to the QBUS, bit D7 (ready) is set in CSR and, if bit D6 (interrupt enable) was set in CSR, an interrupt with vector 0174 is generated.
254 -\\An example without interruptions is trivial:
251 +У контроллера имеется [[встроенный буфер на 256 слов (512 байт).>>doc:||anchor="H411443444435440430"]] Фактически, это часть оперативной памяти микроконтроллера STM32, выделенная в его программе под этот буфер. Весь обмен в основном блоке команд идет через этот буфер.
252 +\\Память дисков AZ представлена, как набор блоков объемом 512 байт каждый. Такой блок - единственная доступная единица для обмена данными с дисками AZ. Блоки пронумерованы от нуля до 65533 для 16-разрядного варианта или до 8388607 для 32-разрядного - это при использовании накопителей AZ максимально допустимой емкости. Никто не мешает использовать накопители меньшей емкости - фактический размер накопителя равен размеру файл-образа, смонтированного на этот накопитель. При попытке обратиться за пределы файл-образа будет зарегистрирована ошибка.
253 +\\Команда 005 - чтение блока с MicroSD в [[буфер>>doc:||anchor="Micro"]]. С псевдодиска AZn, выбранного ранее командой "Выбор устройства" запускается на чтение блок, номер которого передан командой (командами) "Установка номера блока". Команда длительного действия.
254 +\\Фактически, блок с карточки MicroSD читается, примерно, 500-800 мкс. На это время контроллер переходит в состояние, которое во время обсуждения проекта получило название "Думаю, прошу не мешать." А именно, на все время ее исполнения отключаются все регистры устройства, кроме CSR, в котором считывается ноль до тех пор, пока контроллер занят исполнением этой команды. По окончании считывания блока к МПИ подключаются остальные регистры контроллера, взводится бит D7 (готовность) в CSR и, если был установлен бит D6 (разрешение прерываний) в CSR, вырабатывается прерывание с вектором 0174.
255 +\\Пример без прерываний тривиален:
255 255  
256 256  {{code language="assembler"}}
257 257  ;...................................
258 258  
259 -CmdRea=005; symbolic name of the "Read block" command
260 +CmdRea=005; символическое наименование команды "Читать
261 +; блок"
260 260  
261 -; In R3 we have the CSR address left from the previous fragment.
262 -; We send the read command code there
263 +; В R3 у нас от предыдущего фрагмента остался адрес CSR.
264 +; Пересылаем туда код команды чтения
263 263   MOV #CmdRea,@R3
264 -2$: TSTB @R3 Let's check the ready bit
265 - BPL 2$; Not ready -> we go to check again
266 -; once
267 - TST @R3; Let's check for an error
266 +2$: TSTB @R3 ; Проверим бит готовности
267 + BPL 2$; Не готово -> уходим проверять еще
268 + ; раз
269 + TST @R3; Проверим на ошибку
268 268   BMI ERR4
269 -; Here again, unlike the fragments of pp. 3.1 and
270 -; 3.2, we have the CSR address left in R3, not DR.
271 +; Здесь у нас опять, в отличие от фрагментов пп. 3.1 и
272 +; 3.2, в R3 остался адрес CSR, а не DR.
271 271  
272 272  ;...................................
273 273  {{/code}}
274 274  
275 275  
276 -== 006: Write block from buffer to disk ==
278 +== **006: Записать блок из буфера на диск** ==
277 277  
278 -Command code 006. The buffer contents are written to the selected pseudo-disk at the specified disk address (block number). Before writing, checks are performed (1) "was there a write to the buffer?", if not, an error is returned and (2) "is the buffer completely filled?", if not (for the last shortened block of the file), the rest of the buffer is cleared with zeros. Then the block is written to the media. The operation is lengthy, after it is started the controller, as with reading, goes into the "I think, please do not interfere" state. And just as with reading, you must wait for the end of this operation, by the same means as with reading.
280 +Код команды 006. Содержимое буфера пишется на выбранный псевдодиск по заданному дисковомк адресу (номеру блока). Перед записью выполняются проверки (1) "была ли запись в буфер?", если нет, выдается ошибка и (2) "заполнен ли буфер полностью?", если нет (для последнего укороченного блока файла), остаток буфера очищается нулями. Далее производится запись блока на носитель. Операция длительная, после ее запуска контроллер, как и при чтении переходит в состояние "Думаю, прошу не мешать". И так же, как и при чтении окончания этой операции надо дождаться, теми же средствами, как и при чтении.
281 +\\Пример программы без прерываний:
279 279  
280 -
281 -Example of a program without interrupts:
282 -
283 283  {{code language="assembler"}}
284 284  ;...............................................................
285 285  
286 -CmdWri=006; symbolic name of the "Write
287 -; block" command
286 +CmdWri=006; символическое наименование команды "Писать
287 + ; блок"
288 288  
289 -; In R3 we have the DR address left over from the previous fragment.
290 -; We correct it to the CSR and send the
291 -; write command code there
289 +; В R3 у нас от предыдущего фрагмента остался адрес DR.
290 +; Исправляем его на CSR и пересылаем туда код команды
291 +; записи
292 292   MOV #CmdWri,-(R3)
293 -5$: TSTB @R3 ; Let's check the ready bit
294 - BPL 5$; Not ready -> we go and check again once
295 - TST @R3; Let's check for an error
293 +5$: TSTB @R3 ; Проверим бит готовности
294 + BPL 5$; Не готово -> уходим проверять еще
295 + ; раз
296 + TST @R3; Проверим на ошибку
296 296   BMI ERR5
297 297  
298 298  ;....................................................................
... ... @@ -299,14 +299,14 @@
299 299  {{/code}}
300 300  
301 301  
302 -== 007: Get disk size ==
303 +== **007: Получить размер псевдодиска** ==
303 303  
304 -There are two commands for obtaining the size of a pseudo-disk, i.e. the AZn file-image mounted on the selected pseudo-drive.
305 -\\If the OS being used (or a program working with disks without an OS) can work with large (more than 32M) disks, you should use the command with the code 017. The sequence of actions: reset the controller (command 000), select the drive (p. 3.2) and send the code 017 to the CSR, and then, without any waiting, read from DR first the lower word, and then the higher word of the size of the selected drive (image file).
306 -\\If the OS you are using cannot work with disks larger than 32M (RT-11), you should use the 007 command - get the pseudo-disk size with a limit of up to 32M. The steps are similar: reset the controller, select the disk, send the 007 code to the CSR and read one word of the pseudo-disk size from DR. If the size of the image file mounted on the selected pseudo-drive is larger than 65534 blocks, the controller returns the number 65534 instead of this "large" size. We remind you that the number 65535 is used in some places for special purposes and cannot be the disk size.
307 -\\We also remind you that if the image file is not mounted on this drive, the sequence of actions will not work (command 001 select device) and the program execution will simply not reach this point. Therefore, these commands do not provide for errors.
305 +Есть две команды получения размера псевдодиска, т.е. смонтированного на выбранный псевдопривод AZn файл-образа.
306 +\\Если используемая ОС (или программа, работающая с дисками без ОС) умеет работать с большими (больше 32М) дисками, следует пользоваться [[командой с кодом 017>>doc:||anchor="H017:A041F43E43B44344743844244C44043043743C43544043F44143543243443E43443844143A4302C43143E43B44C44843E439"]]. Последовательность действий: сбросить контроллер (команда 000), выбрать накопитель (п. 3.2) и переслать в CSR код 017, а затем, без каких-либо ожиданий, считать из DR сначала младшее, и следом за ним старшее слово размера выбранного накопителя (файл-образа).
307 +\\Если используемая ОС не умеет работать с дисками бОльшими, чем 32М (RT-11), следует пользоваться командой 007 - получить размер псевдодиска с ограничением до 32М. Действия похожие: сбрасываем контроллер, выбираем диск, посылаем в CSR код 007 и считываем из DR одно слово размера псевдодиска. Если размер файл-образа, смонтированного на выбранный псевдопривод, больше 65534 блоков, вместо этого "большого" размера, контроллер возвращает число 65534. Напоминаем, что число 65535 кое-где используется в специальных целях и не может быть размером диска.
308 +\\Также напоминаем, что если на этот накопитель не смонтирован файл-образ, последовательность действий не пройдет (команда 001 выбор устройства) и исполнение программы до этого места просто не дойдет. Поэтому ошибок у этих команд не предусмотрено.
308 308  
309 -Example of a program with "small" disks
310 +Пример программы с "малыми" дисками
310 310  
311 311  {{code language="assembler"}}
312 312  ;......................................