Changes for page API контроллеров AZ®
Last modified by Max on 2025/03/02 15:18
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -15,7 +15,6 @@ 15 15 * 177224 - Primary Boot Register (BOOT1) 16 16 * 177226 - Alternate Boot Register (BOOT2) 17 17 18 - 19 19 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. 20 20 \\Writing to registers is done only in words; byte writing is not allowed. 21 21 \\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. ... ... @@ -113,59 +113,60 @@ 113 113 114 114 115 115 To perform these actions, you must send the required part of the block number bits to DR and then send the command code to CSR, after which you must check for an error. The commands are instantaneous, i.e. they are executed in one QBUS access cycle. 116 -\\Example of a program - 16-bit version : 115 +\\Example of a program - 16-bit version block number: 117 117 118 118 {{code language="assembler"}} 119 119 ;....................................... 120 120 121 -SetBlk=002; Символическоенаименованиекоманды122 -; " Установитьмладшие16разрядовномераблока"120 +SetBlk=002; Symbolic name of the command 121 +; "Set the lower 16 bits of the block number" 123 123 124 -; Отпредыдущегофрагмента в R3 остался адресDR125 -; (177222) 126 -; Считаем,чтовячейкесметкойBLCURнаходится16-127 -; разрядныйдисковыйадрес(номерблока,подлежащего128 -; вводуиливыводу).Процедураполученияэтогономеране129 -; показана123 +; The address DR 124 +; (177222) remained in R3 from the previous fragment 125 +; We assume that the cell labeled BLCUR contains the 16- 126 +; bit disk address (the block number to be 127 +; input or output). The procedure for obtaining this number is not 128 +; shown 130 130 131 - MOV BLCUR,@R3; ПомещаемвDRномерблока,132 - ; подлежащего обмену.130 + MOV BLCUR,@R3;We place the block number to be exchanged in DR. 131 + 133 133 134 - MOV #SetBlk,-(R3); ПосылаемкомандувCSR135 -; незабываем,адресвR3передпересылкойуменьшится на136 -; 2 итакимостанется133 + MOV #SetBlk,-(R3); We send the command to the CSR 134 +; do not forget that the address in R3 will decrease by 135 +; 2 before sending and will remain so 137 137 138 - TST @R3; Проверяемнаошибку137 + TST @R3; We check for an error 139 139 140 140 BMI ERR3 141 141 142 -; В32-разрядномвариантетежедействияследует143 -; повторитьдлястарших16разрядов(на самом деле,144 -; старших7,остальныедолжныбытьнулями,ибомаксимум145 -; размерапсевдодиска-4Г)дисковогоадреса.141 +; In the 32-bit version, the same actions should be 142 +; repeat for the senior 16 bits (actually, 143 +; senior 7, the rest should be zeros, because the maximum 144 +; size of a pseudo disk is 4G) of the disk address. 146 146 147 -; Обратитевнимание,чтовR3осталсяадресCSR,ане148 -; DR, каквдвухпредыдущихфрагментах.Этосделано149 -; специально.146 +; Note that in R3 the CSR address remains, and not 147 +; DR, as in the two previous fragments. This is done 148 +; on purpose. 150 150 151 151 ;....................................... 152 152 {{/code}} 153 153 154 154 155 -== **003:ОткрытьоглавлениеHFS**==154 +== 003: Open HFS Table of Contents == 156 156 157 -Последовательность действий 158 -\\• [[сбросить контроллер>>doc:||anchor="H000:A042143144043E44143A43E43D44244043E43B43B435440430"]] 159 -• подать в CSR команду "Принять блок данных в буфер" и передать пословно всю строку с полным текстом пути (Full Path) к требуемому оглавлению. Строка должна завершаться нулевым байтом (0х00) и быть не длиннее 384 байт (192 слов). 160 -• переслать в CSR код команды "Открыть оглавление" 161 -• дождаться ее окончания (команда длительная) 162 -• проверить на ошибку 156 +Sequence of actions: 163 163 164 -[[**//Пример утилиты - AZDIR//**>>url:https://forum.maxiol.com/index.php?s=&showtopic=5605&view=findpost&p=59418]] 158 +• reset the controller 159 +• send the command "Accept data block to buffer" to the CSR and transmit the entire line with the full path text (Full Path) to the required table of contents word by word. The line must end with a zero byte (0x00) and be no longer than 384 bytes (192 words). 160 +• send the "Open table of contents" command code to the CSR 161 +• wait for it to finish (the command is long) 162 +• check for errors 165 165 164 +[[Example utility - AZDIR>>url:https://forum.maxiol.com/index.php?s=&showtopic=5605&view=findpost&p=59418]] 166 166 167 -Пример программы: 168 168 167 +Example program: 168 + 169 169 {{code language="assembler"}} 170 170 ;............................. 171 171 AZ$CSR = 177220 ... ... @@ -173,46 +173,44 @@ 173 173 OpnDir = 003 174 174 175 175 MOV #AZ$CSR,R3 176 - 177 -; Ячейка DirPtr содержит указатель на начало поля с Full 178 -; Path. Считаем, что строка завершается тремя нулевыми 179 -; байтами, чтобы распознать по нулю окончание пересылки 180 -; строки пословно. Действительно, если количество 181 -; символов в строке четное, то следующие два байта нулей 182 -; образуют нулевое слово; если же нечетное, то один ноль 183 -; уйдет вместе с последним символом строки, а нулевое 184 -; слово образуют второй и третий нулевые байты, 185 -; оканчивающие строку. То есть, такое окончание строки, 186 -; передаваемой пословно, вполне надежно. 176 +; The DirPtr cell contains a pointer to the beginning of the field with Full 177 +; Path. We assume that the string is terminated by three zero 178 +; bytes in order to recognize the end of the transfer of the 179 +; string word by word by zero. Indeed, if the number of 180 +; characters in the string is even, then the next two bytes of zeros 181 +; form a zero word; if it is odd, then one zero 182 +; will go away with the last character of the string, and the zero 183 +; word is formed by the second and third zero bytes, 184 +; ending the string. That is, such an end of the string, 185 +; transferred word by word, is quite reliable. 187 187 MOV DirPtr,R2 188 188 189 - MOV #WrBuf,(R3)+; Подаемкоманду"Записьв190 - ; буфер"ипередаемстроку191 -11$: MOV (R2)+,@R3; пословно,дотех пор,192 - BNE 11$ ; поканеперешлется ноль188 + MOV #WrBuf,(R3)+; We issue the "Write to 189 + ; buffer" command and transmit the string 190 +11$: MOV (R2)+,@R3; word by word, 191 + BNE 11$ ;until zero is sent, 193 193 194 - MOV #OpnDir,-(R3); Подаемкоманду"Открыть195 - ; оглавление"193 + MOV #OpnDir,-(R3); We issue the "Open 194 + ; table of contents" command 196 196 197 -12$: TSTB @R3; иждем,когдаконтроллерее198 - BPL 12$; выполнит,199 - TST @R3; послечегопроверяемнаошибку.200 - BMI Err10; Ошибка-->196 +12$: TSTB @R3; and wait for the controller to 197 + BPL 12$; execute it, 198 + TST @R3; after which we check for an error. 199 + BMI Err10; Error --> 201 201 ;............................. 202 202 {{/code}} 203 203 204 -== **004:Монтироватьдиск**==203 +== 004: Mount a disk == 205 205 206 -Порядок действий: 207 -• [[Сбросить контроллер>>doc:||anchor="H000:A042143144043E44143A43E43D44244043E43B43B435440430"]] 208 -• Переслать в контроллер строку с записью, подобной строкам описания дисков в файле AZ.INI 209 -• Выдать команду "Монтировать диск" 210 -• Дождаться ее окончания (команда длительная) 211 -• Проверить на ошибки 212 -На выбранный накопитель AZnn НЕ ДОЛЖЕН быть смонтирован диск. Если он таки смонтирован, перед монтированием туда нового диска следует размонтировать старый - команда 014 213 - 205 +Sequence of actions: 206 +• Reset the controller 207 +• Send a line to the controller with a record similar to the lines describing the disks in the AZ.INI file 208 +• Issue the "Mount disk" command 209 +• Wait for it to finish (the command is long) 210 +• Check for errors 211 +The selected AZnn drive MUST NOT have a disk mounted. If it is mounted, the old disk should be unmounted before mounting a new one - command 014 214 214 215 - Примерпрограммы:213 +Example program: 216 216 217 217 {{code language="assembler"}} 218 218 ;.................. ... ... @@ -222,20 +222,20 @@ 222 222 MOV #AZ$CSR,R3 223 223 224 224 20$: CLR @R3; 225 - TSTB @R3; Сбросимконтроллер223 + TSTB @R3; Reset the controller 226 226 BPL 20$; 227 227 228 - MOV #WrBuf,(R3)+; Перешлемвнегостроку229 - MOV #MDTXT,R2; скомандойназначения226 + MOV #WrBuf,(R3)+; Send it a string 227 + MOV #MDTXT,R2; with the assignment command 230 230 MOV #MDLEN/2,R1; 231 231 21$: MOV (R2)+,@R3; 232 232 SOB R1,21$; 233 233 234 - MOV #AZMNT,-(R3); иотдадимеена235 -22$: TSTB @R3 ; исполнение232 + MOV #AZMNT,-(R3); and pass it to 233 +22$: TSTB @R3 ; execution 236 236 BPL 22$ ; 237 237 238 - TST @R3; послечегопроверимнаошибку236 + TST @R3; then check for an error 239 239 BMI Err11; 240 240 ;......................... 241 241 ... ... @@ -244,57 +244,57 @@ 244 244 ;.................. 245 245 {{/code}} 246 246 247 - Вэтомфрагментенадиск AZ4 монтируется файл-образ51SYS_DS.DSK,лежащийвпапкеSYSTEM,котораялежитвпапкеDISKS,лежащейвкорневомоглавлениикарточкимикро-SD.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. 248 248 249 249 250 -== **005:Чтениеблокавбуфер**==248 +== 005: Reading block into buffer == 251 251 252 - Уконтроллераимеется[[встроенныйбуферна256слов(512байт).>>doc:||anchor="H411443444435440430"]]Фактически,эточастьоперативнойпамятимикроконтроллераSTM32,выделеннаявегопрограммеподэтотбуфер.Весьобменвосновномблокекомандидетчерезэтотбуфер.253 -\\ ПамятьдисковAZпредставлена,какнаборблоковобъемом512байткаждый.Такойблок-единственнаядоступнаяединицадляобменаданнымисдискамиAZ.Блокипронумерованыотнулядо65533для16-разрядноговариантаилидо8388607для32-разрядного-этоприиспользованиинакопителейAZмаксимальнодопустимойемкости.Никтонемешаетиспользоватьнакопителименьшейемкости-фактическийразмернакопителяравенразмеруфайл-образа,смонтированногонаэтотнакопитель.Припопыткеобратитьсязапределыфайл-образабудетзарегистрированаошибка.254 -\\ Команда005 -чтениеблокасMicroSDв [[буфер>>doc:||anchor="Micro"]].СпсевдодискаAZn,выбранногоранеекомандой"Выборустройства"запускаетсяначтениеблок,номеркоторогопереданкомандой(командами) "Установканомераблока".Командадлительногодействия.255 -\\ Фактически,блокскарточкиMicroSDчитается,примерно,500-800мкс.Наэтовремяконтроллерпереходитвсостояние,котороевовремяобсужденияпроектаполучилоназвание"Думаю,прошунемешать."А именно,навсевремяееисполненияотключаютсявсерегистрыустройства,кромеCSR,вкоторомсчитываетсянольдотехпор,покаконтроллерзанятисполнениемэтойкоманды.ПоокончаниисчитыванияблокакМПИподключаютсяостальныерегистрыконтроллера,взводитсябитD7 (готовность)вCSRи,еслибылустановлен битD6 (разрешениепрерываний)вCSR,вырабатываетсяпрерываниесвектором0174.256 -\\ Примербезпрерыванийтривиален: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: 257 257 258 258 {{code language="assembler"}} 259 259 ;................................... 260 260 261 -CmdRea=005; символическое наименование команды "Читать 262 -; блок" 259 +CmdRea=005; symbolic name of the "Read block" command 263 263 264 -; ВR3унасотпредыдущегофрагментаосталсяадресCSR.265 -; Пересылаемтудакодкомандычтения261 +; In R3 we have the CSR address left from the previous fragment. 262 +; We send the read command code there 266 266 MOV #CmdRea,@R3 267 -2$: TSTB @R3 ;Проверимбитготовности268 - BPL 2$; Неготово->уходимпроверятьеще269 - раз270 - TST @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 271 271 BMI ERR4 272 -; Здесьу нас опять,вотличиеотфрагментовпп. 3.1и273 -; 3.2, вR3осталсяадресCSR,анеDR.269 +; Here again, unlike the fragments of pp. 3.1 and 270 +; 3.2, we have the CSR address left in R3, not DR. 274 274 275 275 ;................................... 276 276 {{/code}} 277 277 278 278 279 -== **006:Записатьблокизбуферанадиск**==276 +== 006: Write block from buffer to disk == 280 280 281 -Код команды 006. Содержимое буфера пишется на выбранный псевдодиск по заданному дисковомк адресу (номеру блока). Перед записью выполняются проверки (1) "была ли запись в буфер?", если нет, выдается ошибка и (2) "заполнен ли буфер полностью?", если нет (для последнего укороченного блока файла), остаток буфера очищается нулями. Далее производится запись блока на носитель. Операция длительная, после ее запуска контроллер, как и при чтении переходит в состояние "Думаю, прошу не мешать". И так же, как и при чтении окончания этой операции надо дождаться, теми же средствами, как и при чтении. 282 -\\Пример программы без прерываний: 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. 283 283 280 + 281 +Example of a program without interrupts: 282 + 284 284 {{code language="assembler"}} 285 285 ;............................................................... 286 286 287 -CmdWri=006; символическоенаименованиекоманды"Писать288 - блок"286 +CmdWri=006; symbolic name of the "Write 287 +; block" command 289 289 290 -; ВR3унасотпредыдущегофрагментаосталсяадресDR.291 -; ИсправляемегонаCSRипересылаемтуда код команды292 -; записи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 293 293 MOV #CmdWri,-(R3) 294 -5$: TSTB @R3 ; Проверим бит готовности 295 - BPL 5$; Не готово -> уходим проверять еще 296 - ; раз 297 - TST @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 298 298 BMI ERR5 299 299 300 300 ;.................................................................... ... ... @@ -301,14 +301,14 @@ 301 301 {{/code}} 302 302 303 303 304 -== **007:Получитьразмерпсевдодиска**==302 +== 007: Get disk size == 305 305 306 - Естьдвекомандыполученияразмерапсевдодиска,т.е.смонтированногонавыбранныйпсевдоприводAZnфайл-образа.307 -\\ ЕслииспользуемаяОС(илипрограмма,работающаясдискамибезОС)умеетработатьсбольшими(больше32М)дисками,следуетпользоваться[[командойскодом 017>>doc:||anchor="H017:A041F43E43B44344743844244C44043043743C43544043F44143543243443E43443844143A4302C43143E43B44C44843E439"]].Последовательностьдействий:сброситьконтроллер(команда000),выбратьнакопитель(п. 3.2)ипереслатьвCSRкод017,азатем,безкаких-либоожиданий,считатьизDRсначаламладшее,иследомзанимстаршеесловоразмеравыбранногонакопителя(файл-образа).308 -\\ ЕслииспользуемаяОСнеумеетработатьсдискамибОльшими,чем32М(RT-11),следуетпользоватьсякомандой007 -получитьразмерпсевдодискасограничениемдо32М.Действияпохожие:сбрасываемконтроллер,выбираемдиск,посылаемвCSRкод007исчитываемизDRоднословоразмерапсевдодиска.Еслиразмерфайл-образа,смонтированногонавыбранныйпсевдопривод,больше65534блоков,вместоэтого"большого"размера,контроллервозвращает число65534.Напоминаем,чточисло65535кое-гдеиспользуетсявспециальныхцеляхинеможетбытьразмеромдиска.309 -\\ Такженапоминаем,чтоеслинаэтотнакопительнесмонтированфайл-образ,последовательностьдействийнепройдет(команда001выборустройства)иисполнениепрограммыдоэтогоместапростонедойдет.Поэтомуошибокуэтихкоманднепредусмотрено.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. 310 310 311 - Примерпрограммыс"малыми"дисками309 +Example of a program with "small" disks 312 312 313 313 {{code language="assembler"}} 314 314 ;......................................