📄 podule.html
字号:
ENDIF ENDIFNEXTREM Once we know our base address, we can set up some offsets.REM The down conversion changes our podule access methods.visionheader% = visionbase% - &180000 : REM Base, slow accessvisionctrl% = visionheader% + &102800 : REM Control, fast accessvisiondata% = visionheader% + &103800 : REM Data, fast accessvisionstat% = visionheader% + &100080 : REM Status, fast accessvisionrst% = visionheader% + &2000 : REM Reset, slow accessREM Code to reset, check, and fetch image removedREM not necessary for this exampleENDDEFPROCassemble DIM code% 76 FOR loop% = 0 TO 2 STEP 2 P% = code% [ OPT loop% \ On entry, R1 = base address \ On exit, R2 = 1 if Vision, else 0 .find_podule% ; Stash R14 and enter SVC mode. STMFD R13!, {R14} SWI "OS_EnterOS" ; Set flag to TRUE. If a test fails, flag will be FALSified. <g> MOV R0, #1 ; Is +12 &AF? LDRB R2, [R1, #12] CMP R2, #&AF MOVNE R0, #0 ; Is +16 &00? LDRB R2, [R1, #16] CMP R2, #&00 MOVNE R0, #0 ; Is +20 &2D? LDRB R2, [R1, #20] CMP R2, #&2D MOVNE R0, #0 ; Is +24 &00? LDRB R2, [R1, #24] CMP R2, #&00 MOVNE R0, #0 TEQP PC, #0 MOV R0, R0 LDMFD R13!, {PC} ] NEXTENDPROC</pre>For an interesting look at the Vision digitiser in use, you can either see the Willow (AlysonHannigan) area of my website at<a href="http://www.heyrick.co.uk/willow/">http://www.heyrick.co.uk/willow/</a> <font color = "red" size = "-1">[EXTERNAL LINK]</font>, or, maybe evenmore interesting, a person has taken pictures of the moon with a video camera and digitised themwith a monochrome Vision, at <a href="http://www.newtownbreda.demon.co.uk/ruadhan/asmoon.html">http://www.newtownbreda.demon.co.uk/ruadhan/asmoon.html</a> <font color = "red" size = "-1">[EXTERNAL LINK]</font>.<p> <p><h2>SMC37C665</h2><img src = "../images/assembler/37c665.jpeg" width=209 height=314 alt="JPEG; 16K" align="right" border="0" vspace="2">The name may not make much sense to you, but if you are using a RiscPC then it is a veryimportant name. The 37C665 (pictured) is the device that handles your parallel port, serial port,floppy disc, IDE bus...<br>The original Archimedes machines used seperate integrated circuits for these facilities; the A310having no harddisc as standard, the A3000 having no harddisc or serial port as standard.<br>The A5000 / A4 machines were the first to utilise an off-the-shelf 'combo chip' for the standardinterfacing. The chip was the 82C710.<br>The RiscPC decided to alter the combo chip to be a 37C665. My personal suspicion is that the37C665 was preferred because it features on-chip protection circuitry so your serial and parallelports can be wired without additional filters. It is clean, it is simple. Both devices conformto the ISA specification for memory locations in a PC (ie, where COM1 and LPT1 live), so bothwill be memory-mapped kinda similar.<br>What I don't get, for what it's worth, is why Acorn didn't bother to fit a second serial port?If you've ever opened your RiscPC (who hasn't?), you'll notice the serial hardware is reallyquite simple (see the serial port, see the little chip just below it - that's the 37C665). The37C665 supports TWO serial ports, right there in the hardware. Or maybe 1 serial port and oneMIDI port (differing configurations). It's just a shame Acorn didn't take advantage of this!<br>Later machines (Mico, RiscStation, Bush internet box, etc) appear to use a 37C669 which allowsfor the I/O addresses to be altered in software.<p>In order to read the configuration of the 37C665, we need to write &55 (85) to port &3F0.However, we don't yet know where in memory the device is located. There are two ways to determinethe location of the device:<ul> <li> The easy way - ask somebody that knows. Theo Markettos told me to poke around &03010000+(ISAaddress<<2) for the devices.<br> (thanks Theo!) <br> <br> <li> We've already seen the "Parallel_HardwareAddress" SWI. This returns the value <code>&30109E0</code>.<br> We know (from the 37C665 datasheet or just know-how about PCs) that LPT1 is located at &278 (remember - the 37C665 is an ISA bus chip, so that junk that AMIBIOS shows you at boot time is suddenly looking like it might be useful!).<br> Because the bottom two bits are zero in the hardware access (ie, word addressing) then we need to shift the LPT1 address left twice. This gives us <code>&278 << 2</code> which is <code>&9E0</code>.<br> Subtract &9E0 from the parallel address, we have our device based at &3010000.</ul><p>So, port &3F0 (which becomes &FC0 when shifted) is where we write &55 to set thedevice into configuration mode. Two consecutive writes must be made, so it is worth switchingoff interrupts.<br><b><i>This will only work on the RiscPC, and you <u>MUST</u> release yourself from configurationmode before attempting to use your computer. It goes without saying that you ONLY read theconfiguration registers, never write to them!</i></b><p>Once we are in configuration mode, we write a register number (0-15) to &3F0 and we can thenread the value of that register from &3F1. It is simple to whizz through the registers,dumping the contents to memory as we go.<p>To leave configuration mode, we write &AA to &3F0. This must be done or your computer'sI/O will just cease to function.<p>This code will <i>ONLY</i> work on the 37C665 fitted into the RiscPC. It is worth noting that the37C666 (basically a 665 but uses hardware links to configure it, the sort of thing you'd find ona cheap ISA combo-card) uses the magic value &66 to enter configuration mode. If your machinehas a different I/O chip, like the RiscStation or A7000, you might like to try a differentmachine value if &55 doesn't work. Maybe &99? This is speculation though, as my datasheet doesn't cover the 37C669. Please email me if you discover a sequence that works.<p><i>November 2001:<br>A friend has got a Bush Internet box for me, Toy-R-Us are apparently selling them for TWENTYPOUNDS!!! Anyway, when I've paid him and taken delivery of it, I'll play around, see what isinside it. If you have a Bush internet box, then you might like to know that it should bepossible to boot the thing into the command line (or BASIC?) by holding down the Shift key whilebooting.</i><p> <p>This takes place in SVC mode, with interrupts disabled. The code is pretty basic really. I rathersuspect that the final <code>TEQP</code> could be combined into the <code>MOVS PC, R14</code> torestore the flags <i>and</i> interrupt state. But doing it this way makes sure... The code is not32bit compliant.<p><pre>ON ERROR PRINT REPORT$+" at line "+STR$(ERL/10) : ENDDIM code% 128FOR l% = 0 TO 2 STEP 2 P% = code% [ OPT l% STR R14, [R13, #-4]! SWI "OS_EnterOS" TEQP PC, #&0C000003 ; interrupts disabled LDR R0, base_address MOV R1, #&55 STRB R1, [R0, #&FC0] ; port &3F0 STRB R1, [R0, #&FC0] ; Now in 37C665 software configuration mode ADR R2, registers ; Where to store registers MOV R3, #0 ; Register number (& offset) .read_loop ; Write desired register number to address &3F0 STRB R3, [R0, #&FC0] ; Now read register contents from address &3F1 LDRB R1, [R0, #&FC4] ; Store it in our register block STRB R1, [R2, R3] ADD R3, R3, #1 CMP R3, #16 BLT read_loop MOV R1, #&AA STRB R1, [R0, #&FC0] ; Now out of software configuration mode TEQP PC, #&08000000 ; interrupts enabled, USR mode MOV R0, R0 LDR R14, [R13], #4 MOVS PC, R14 .base_address EQUD &03010000 .registers EQUD 0 EQUD 0 EQUD 0 EQUD 0 ]NEXTPRINT "Examining multi-I/O chip configuration...";CALL code%PRINT "done."''PRINT "Device identification ";CASE registers?13 OF WHEN &65 : PRINT "FDC37C665GT"; WHEN &66 : PRINT "FDC37C666GT"; : REM Different magic value, so should not happen!OTHERWISE : PRINT "Error! Device ID "+STR$~(registers?13)+" unrecognised!" : ENDENDCASEPRINT ", revision "+STR$(registers?14)END</pre><p>Briefly, the registers are:<ol start = "0"> <li> IDE status, floppy status, oscillator status <li> Parallel status, COM 3 & 4 status <li> Primary and secondary serial status <li> Floppy mode <li> Parallel mode / prim/sec serial clock (for MIDI) <li> IDE mode, floppy <li> Floppy drive types <li> Floppy boot / media ID <li> ADRx address decoder (lower eight bits) <li> ADRx address decoder (upper three bits) <li> ECP FIFO threshold <li> (reserved) <li> (reserved) <li> Device ID (should be &65) <li> Device revision (should be &02) <li> (reserved - sets up test modes)</ol>You'll need the <a href="http://www.smsc.com/main/datasheets/37c665gt.pdf">SMC37C665 devicedatasheet</a> <font color = "red" size = "-1">[EXTERNAL LINK]</font> if you care to fiddle around with the registers, find out what is where...<br><p> <p><hr size = "3"><a href="index.html#12">Return to assembler index</a><hr size = "3"><address>Copyright © 2001 Richard Murray</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -