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

From version 1.13
edited by Max
on 2025/02/25 11:46
Change comment: (Autosaved)
To version 2.1
edited by Max
on 2025/02/25 11:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -249,51 +249,51 @@
249 249  == 005: Reading block into buffer ==
250 250  
251 251  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.
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 -\\Пример без прерываний тривиален:
252 +\\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.
253 +\\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.
254 +\\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.
255 +\\An example without interruptions is trivial:
256 256  
257 257  {{code language="assembler"}}
258 258  ;...................................
259 259  
260 -CmdRea=005; символическое наименование команды "Читать
261 -; блок"
260 +CmdRea=005; symbolic name of the "Read block" command
262 262  
263 -; В R3 у нас от предыдущего фрагмента остался адрес CSR.
264 -; Пересылаем туда код команды чтения
262 +; In R3 we have the CSR address left from the previous fragment.
263 +; We send the read command code there
265 265   MOV #CmdRea,@R3
266 -2$: TSTB @R3 ; Проверим бит готовности
267 - BPL 2$; Не готово -> уходим проверять еще
268 - ; раз
269 - TST @R3; Проверим на ошибку
265 +2$: TSTB @R3 Let's check the ready bit
266 + BPL 2$; Not ready -> we go to check again
267 +; once
268 + TST @R3; Let's check for an error
270 270   BMI ERR4
271 -; Здесь у нас опять, в отличие от фрагментов пп. 3.1 и
272 -; 3.2, в R3 остался адрес CSR, а не DR.
270 +; Here again, unlike the fragments of pp. 3.1 and
271 +; 3.2, we have the CSR address left in R3, not DR.
273 273  
274 274  ;...................................
275 275  {{/code}}
276 276  
277 277  
278 -== **006: Записать блок из буфера на диск** ==
277 +== 006: Write block from buffer to disk ==
279 279  
280 -Код команды 006. Содержимое буфера пишется на выбранный псевдодиск по заданному дисковомк адресу (номеру блока). Перед записью выполняются проверки (1) "была ли запись в буфер?", если нет, выдается ошибка и (2) "заполнен ли буфер полностью?", если нет (для последнего укороченного блока файла), остаток буфера очищается нулями. Далее производится запись блока на носитель. Операция длительная, после ее запуска контроллер, как и при чтении переходит в состояние "Думаю, прошу не мешать". И так же, как и при чтении окончания этой операции надо дождаться, теми же средствами, как и при чтении.
281 -\\Пример программы без прерываний:
279 +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.
282 282  
281 +
282 +Example of a program without interrupts:
283 +
283 283  {{code language="assembler"}}
284 284  ;...............................................................
285 285  
286 -CmdWri=006; символическое наименование команды "Писать
287 - ; блок"
287 +CmdWri=006; symbolic name of the "Write
288 +; block" command
288 288  
289 -; В R3 у нас от предыдущего фрагмента остался адрес DR.
290 -; Исправляем его на CSR и пересылаем туда код команды
291 -; записи
290 +; In R3 we have the DR address left over from the previous fragment.
291 +; We correct it to the CSR and send the
292 +; write command code there
292 292   MOV #CmdWri,-(R3)
293 -5$: TSTB @R3 ; Проверим бит готовности
294 - BPL 5$; Не готово -> уходим проверять еще
295 - ; раз
296 - TST @R3; Проверим на ошибку
294 +5$: TSTB @R3 ; Let's check the ready bit
295 + BPL 5$; Not ready -> we go and check again once
296 + TST @R3; Let's check for an error
297 297   BMI ERR5
298 298  
299 299  ;....................................................................