home *** CD-ROM | disk | FTP | other *** search
-
- *
- * This file is the interface between the software
- * and the hardware of GALer. The routines of this file
- * control the hardware.
- * register parameter, 32 bit integer
- *
- * used Assembler: assembler of SAS-C 6.0
- * assemble: asm Port.asm
- *
-
-
-
- GAL16V8 EQU 1 ; GAL-Typ
- GAL20V8 EQU 2
-
- IC1 EQU 3 ; IC-Nummer
- IC3 EQU 0
- IC4 EQU 1
- IC5 EQU 2
- IC6 EQU 0
- IC7 EQU 1
-
- ON EQU 1 ; für LED-Steuerung
- OFF EQU 0
-
- PROG EQU 1 ; Edit-Mode für GAL
- VERIFY EQU 0
-
-
-
- ciaaprb EQU $BFE101
- ciaaddrb EQU $BFE301
- ciabpra EQU $BFD000
- ciabddra EQU $BFD200
-
-
-
- SECTION code,CODE
-
-
- XDEF @InitParPort ; Parallel-Port initialisieren
- XDEF @RestoreParPort ; Parallel-Port restaurieren
- XDEF @InitGALer ; GALer initialisieren
- XDEF @WriteByte ; Byte in Schiebereg. schreiben
- XDEF @ReadByte ; Byte aus Schiebereg. lesen
- XDEF @SetGAL ; GAL-Type festlegen
- XDEF @VeditOn ; Edit-Spannung aufbauen
- XDEF @VeditOff ; Edit-Spannung abschalten
- XDEF @LED ; LED ansteuern
- XDEF @EnableVcc ; Vcc anlegen
- XDEF @DisableVcc ; Vcc abschalten
- XDEF @EnableVEdit ; Edit-Spannung anlegen
- XDEF @DisableVEdit ; Edit-Spannung abschalten
- XDEF @EnableOutput ; Ausgangs-Treiber aktivieren
- XDEF @DisableOutput ; Ausgangs-Treiber deaktiviern
- XDEF @SetRow ; Adresse an RAG0-RAG5 anlegen
- XDEF @SDIn ; Lege ein Bit an SDIn-Eingang
- XDEF @SDOut ; Bit vom SDOut-Ausgang holen
- XDEF @Clock ; Clock-Impuls an SCLK-Eingang
- XDEF @STRImpuls ; STR-Impuls erzeugen
- XDEF @EditMode ; setzt Bits für Edit-Mode
- XDEF @ExitEditMode ; Edit-Mode verlassen und Vcc weg
- XDEF @SetPV ; VERIFY oder PROG
- XDEF @SetVolt ; Edit-Spannung einstellen
-
-
- XREF _GALType
- XREF _outIC1
- XREF _outIC3
- XREF _outIC4
- XREF _outIC5
-
- XREF @WaitForTimer
-
- XREF _LVOForbid
- XREF _LVOPermit
-
- XREF _prog_volt
-
-
-
-
- * initialisiere den Parallel-Port
- @InitParPort:
- move.b ciaaddrb,cia_addrb ; Datenrichtung der CIAs
- move.b ciabddra,cia_bddra ; merken
-
- move.b #%11111111,ciaaddrb ; Datenleitungen auf Ausgang schalten
- and.b #%11111110,ciabddra ; BUSY auf Eingang
- rts
-
-
- * Parallel-Port restaurieren
- @RestoreParPort:
- move.b cia_addrb,ciaaddrb ; Datenrichtungen der CIAs restau-
- ; rieren. Der Zustand der Ausgänge
- move.b cia_bddra,d0 ; wird nicht wieder hergestellt, da
- and.b #%11111110,ciabddra ; sonst der angeschlossene GAL-Brenner
- and.b #%00000001,d0 ; ein unerwünchstes Signal empfangen
- or.b d0,ciabddra ; könnte (z.B. Vcc oder VEdit anlegen)
- rts
-
-
-
- * GALer initialisieren: alle Ausgänge von IC1 auf LOW (kein OutputEnable
- * für IC3,4,5 aber Register-Inhalt von IC3,4,5 auf LOW stellen)
- * Parameter: keine
- @InitGALer:
- or.b #%00001000,ciaaprb ; PD3=H: Adressdecoder deaktivieren!
- and.b #%00001000,ciaaprb ; alle anderen Datenleitungen auf LOW
- ; ACHTUNG!!!: PD3 darf nur auf LOW-Pegel gehen
- ; (Adressdecoder aktiviert werden), wenn durch PD0 und
- ; PD1 das IC, das angesprochen werden soll, bereits
- ; selektiert ist. Ansonsten bekommt ein IC einen Takt-
- ; impuls und beim nächsten Strobe liegen dann die
- ; falschen Daten an.
- move.l #IC1,d1
- moveq #0,d0
- bsr @WriteByte ; Ausgänge von IC1 auf LOW
-
- move.l #IC3,d1
- moveq #0,d0
- bsr @WriteByte ; Ausgänge von IC3 auf LOW
-
- move.l #IC4,d1
- moveq #0,d0
- bsr @WriteByte ; Ausgänge von IC4 auf LOW
-
- move.l #IC5,d1
- moveq #0,d0
- bsr @WriteByte ; Ausgänge von IC5 auf LOW
- rts
-
-
-
- * SetGAL:
- * Setzte GAL-Type fest (GAL16V8, GAL20V8)
- * Aufruf: SetGAL(type);
- *
- @SetGAL:
- move.l d0,_GALType
- rts
-
-
-
- * VeditOn:
- * schaltet den Sperrwandler an (IC9); siehe auch VeditOff
- * Auruf: VeditOn();
- @VeditOn:
- move.l #IC1,d1
- or.l #%00001,_outIC1 ; Q1 von IC1 auf HIGH => VeditOn
- move.l _outIC1,d0
- bsr @WriteByte ; IC1 setzen
- rts
-
-
- * VeditOff:
- * schaltet den Sperrwandler aus (IC9); siehe auch VeditOn
- * Auruf: VeditOff();
- @VeditOff:
- move.l #IC1,d1
- and.l #%11111110,_outIC1 ; Q1 von IC1 auf LOW => VeditOff
- move.l _outIC1,d0
- bsr @WriteByte ; IC1 setzen
- rts
-
-
- * EnableVEdit:
- * schaltet die Edit-Spannung (+16.5V) auf Pin 2 oder Pin 4 vom Textool
- * (abhänging vom eingestellten GAL-Typ)
- * Aufruf: EnableVEdit();
- @EnableVEdit:
- move.l #IC1,d1 ; IC1 einstellen
- cmp.l #GAL16V8,_GALType ; 16V8 eingestellt?
- bne.s 1$ ; nein, dann wird 20V8 angenommen!
- moveq #%00000100,d0 ; Q3 von IC1 auf HIGH
- bra.s 2$
- 1$ moveq #%00000010,d0 ; Q2 von IC1 auf HIGH
- 2$ or.l d0,_outIC1
- move.l _outIC1,d0
- bsr @WriteByte
- rts
-
-
- * DisableVEdit:
- * schaltet die Edit-Spannung (+16.5V) an Pin 2 oder Pin 4 aus
- * (abhänging vom eingestellten GAL-Typ)
- * Aufruf: DisableVEdit();
- @DisableVEdit:
- move.l #IC1,d1 ; IC1 einstellen
- cmp.l #GAL16V8,_GALType ; 16V8 eingestellt?
- bne.s 1$ ; nein, dann wird 20V8 angenommen!
- move.l #%11111011,d0 ; Q3 von IC1 auf LOW
- bra.s 2$
- 1$ move.l #%11111101,d0 ; Q2 von IC1 auf low
- 2$ and.l d0,_outIC1
- move.l _outIC1,d0
- bsr @WriteByte
- rts
-
-
-
-
- * LED:
- * schaltet die LED aus bzw. an
- * Aufruf: LED(ON/OFF);
- @LED:
- cmp.l #ON,d0
- bne.s 2$
- or.l #%01000000,_outIC1
- bra.s 1$
- 2$ and.l #%10111111,_outIC1
- 1$ move.l #IC1,d1
- move.l _outIC1,d0
- bsr @WriteByte ; IC1 setzen
- rts
-
-
-
- * EnableVcc:
- * schaltet die Spannungsversorgung ein; siehe auch DisableVcc
- * bei GAL16V8: Pin22 vom Textool-Sockel
- * bei GAL20V8: Pin24 vom Textool-Sockel
- * Aufruf: EnableVcc();
- @EnableVcc:
- movem.l d0-d7/a0-a6,-(sp) ; Register retten
- move.l #300000,d0 ; 300 ms warten
- jsr @WaitForTimer
- movem.l (sp)+,d0-d7/a0-a6
-
- move.l #IC1,d1 ; IC1 selektieren
- cmp.l #GAL16V8,_GALType ; 16V8 eingestellt?
- bne.s 1$ ; nein, dann wird 20V8 angenommen!!!
- moveq #%00011000,d0 ; Q4,5 von IC1 auf HIGH=>+5V an Pin22
- bra.s 2$
- 1$ moveq #%00010000,d0 ; Q5 auf HIGH => +5V an Pin 24
- 2$ or.l d0,_outIC1
- move.l _outIC1,d0
- bsr @WriteByte ; IC1 setzen
- rts
-
-
- * DisableVcc:
- * schaltet die Spannungsversorgung aus; siehe auch EnableVcc
- * bei GAL16V8: Pin22 vom Textool-Sockel
- * bei GAL20V8: Pin24 vom Textool-Sockel
- * Aufruf: DisableVcc();
- @DisableVcc:
- movem.l d0-d7/a0-a6,-(sp) ; Register retten
- move.l #50000,d0 ; sicherheitshalber 50mS warten, bis
- jsr @WaitForTimer ; das GAL die letzte Aktion richtig
- movem.l (sp)+,d0-d7/a0-a6
-
- move.l #IC1,d1 ; IC1 selektieren
- cmp.l #GAL16V8,_GALType ; 16V8 eingestellt?
- bne.s 1$ ; nein, dann wird 20V8 angenommen!!!
- move.l #%11100111,d0 ; Q4,5 von IC1 auf LOW
- bra.s 2$
- 1$ move.l #%11101111,d0 ; Q5 auf HIGH
- 2$ and.l d0,_outIC1
- move.l _outIC1,d0
- bsr @WriteByte ; IC1 setzen
- rts
-
-
-
- * EnableOutput:
- * OutputEnable-Eingang (OE) von IC3, IC4, IC5 auf HIGH
- * Aufruf: EnableOutput();
- @EnableOutput:
- move.l #IC1,d1
- or.l #%00100000,_outIC1
- move.l _outIC1,d0
- bsr @WriteByte
- rts
-
- * DisableOutput:
- * OutputEnable-Eingang (OE) von IC3, IC4, IC5 auf LOW
- * Aufruf: DisableOutput();
- @DisableOutput:
- move.l #IC1,d1
- and.l #%11011111,_outIC1
- move.l _outIC1,d0
- bsr @WriteByte
- rts
-
-
-
- * ReadByte:
- * lese ein Byte aus dem IC "ICx", wobei ICx=IC6 (nur ein Bit) oder IC7 ist
- * Aufruf: byte=ReadByte(IC);
- * PD3 ist bereits HIGH (muß es auch!, siehe InitGAL und Beschreibung zu PD3)
- @ReadByte:
- cmp.l #IC6,d0 ; IC6 angesprochen?
- bne.s IC7$ ; nein, dann IC7
- or.b #%00000001,ciaaprb ; PD0 auf HIGH=>HIGH am Clk vom IC7
- ; PD0 auf HIGH setzen=>IC6a selektiert
-
- movem.l d0-d7/a0-a6,-(sp) ; Register retten
- move.l #1,d0 ; 1 us warten
- jsr @WaitForTimer
- movem.l (sp)+,d0-d7/a0-a6
-
- moveq #0,d0
- move.b ciabpra,d0
- not.b d0 ; invertieren
- and.b #%00000001,d0 ; BUSY-Bit ausmaskieren
- bra.s ready$ ; Pin22 (über IC6) ist ausgelesen
- IC7$
- moveq #0,d0
-
- and.b #%11111110,ciaaprb ; PD3 ist HIGH=>Lesen möglich
- nop
- or.b #%00000100,ciaaprb ; PD2 (Strobe) auf HIGH-> Daten werden
- and.b #%11111011,ciaaprb ; vom Eingangsreg. in das Schiebereg.
- ; übernommen. Dann PD2 wieder auf LOW.
- ; PD3 ist auf HIGH=>Lesen ist möglich
- move.l d2,-(sp)
- moveq #7,d2 ; Schleifenzähler
- l$ rol.b #1,d0
- move.b ciabpra,d1 ; BUSY-Bit holen
- and.b #%00000001,d1 ; BUSY-Bit ausmaskieren
- or.b d1,d0 ; BUSY-Bit in D0 eintragen
- and.b #%11111110,ciaaprb ; PD0 auf LOW=>LOW am Clk-Eingang (IC7)
- or.b #%00000001,ciaaprb ; PD0 auf HIGH=>HIGH am Clk-Eingang
- ; ==> nächstes Bit steht am Ausgang
- nop
- nop
- and.b #%11111110,ciaaprb ; PD0 auf LOW=>IC6b ist selektiert (=>lesen möglich)
- dbf d2,l$ ; 8 Bits auslesen
- not.b d0 ; invertieren
- move.l (sp)+,d2
- ready$
- rts ; D0=Rückgabewert (gelesenes Byte)
-
-
-
-
- * WriteByte:
- * schreibt das Byte "byte" in das IC "IC", wobei IC=IC1, IC3, IC4 oder IC5
- * sein kann
- * zuerst wird das MSB übertragen!!!
- * Aufruf: WriteByte(byte,IC)
- @WriteByte:
- movem.l d2/d3,-(sp) ; Register retten
- ; Datenbyte in D0
- ; IC in D1
- ; geschriebenes Byte mitprotokolieren
- cmp.l #IC1,d1
- bne.s 1$
- move.l d0,_outIC1
- bra.s cont$
- 1$ cmp.l #IC3,d1
- bne.s 2$
- move.l d0,_outIC3
- bra.s cont$
- 2$ cmp.l #IC4,d1
- bne.s 3$
- move.l d0,_outIC4
- bra.s cont$
- 3$ move.l d0,_outIC5
- cont$
-
- and.b #%11111100,ciaaprb ; PD0 und PD1 setzen (IC aus-
- or.b d1,ciaaprb ; wählen)
- and.b #%11110111,ciaaprb ; Adressdecoder aktivieren
-
- moveq #7,d3 ; Schleifenzähler
- ror.b #3,d0 ; MSB nach D4 (Datenleitung)
-
- loop$ move.b d0,d2 ; Datenbyte sichern
- and.b #%00010000,d2 ; Datenbit ausmaskieren
- or.b d2,ciaaprb ; Datenbit (PD4) vom Par.-Port setzen
-
- or.b #%00001000,ciaaprb ; Clock-Impuls durch PD3 geben
- and.b #%11110111,ciaaprb ; LOW-HIGH Übergang
-
- and.b #%11101111,ciaaprb ; Datenbit (PD4) auf LOW
-
- rol.b #1,d0 ; nächstniedrigeres Bit senden
- dbf d3,loop$
-
- or.b #%00001000,ciaaprb ; Adressdecoder wieder deaktivieren!!!
- ; (sehr WICHTIG, siehe InitGAL:)
- or.b #%00000100,ciaaprb ; PD2 (Strobe) auf HIGH-> Daten werden
- and.b #%11111011,ciaaprb ; vom Schieberegister in das Datenreg.
- ; übernommen. Dann PD2 wieder auf LOW.
- movem.l (sp)+,d2/d3
- rts
-
-
- * SetRow:
- * Adresse an RAG0-RAG5 anlegen
- * Aufruf: SetRow(row);
- * row: zu adressierende Zeile (0-63)
- @SetRow:
-
- ; RAG5 setzen (Pin bei 16 und 20V8 gleich)
- move.l d0,-(sp) ; Row (D0) auf Stack
-
- and.l #$fe,_outIC5 ; Bit0(=RAG5) löschen
- asr.b #5,d0 ; Bit0 von D0=RAG5
- or.l d0,_outIC5 ; RAG5=Bit von D0=> RAG5 gesetzt
-
- cmp.l #GAL16V8,_GALType ; GAL16V8?
- bne.s GAL20V8$ ; nein, dann GAL20V8 annehmen
- GAL16V8$ ; RAG0 setzen
- move.l (sp),d0 ; row holen
- and.l #$ef,_outIC3 ; Bit4(=RAG0) löschen
- and.l #1,d0 ; Bit0 von "row" ausmaskieren
- asl.b #4,d0
- or.l d0,_outIC3 ; Bit4(=RAG0) setzen
- ; RAG1-RAG4 setzen
- move.l (sp),d0 ; row holen
- and.l #$0f,_outIC4 ; Bit4-7(=RAG1-RAG4) löschen
- and.l #%00011110,d0 ; Bit1-4 von "row" ausmaskieren
- asl.l #3,d0 ; an Bit4-7 schieben
- or.l d0,_outIC4 ; RAG1-RAG4 setzen
- bra.s write$
- GAL20V8$ ; RAG0 für GAL20V8 setzen
- move.l (sp),d0 ; row holen
- and.l #%11011111,_outIC3 ; Bit5(=RAG0) löschen
- and.l #1,d0 ; Bit0 von "row" ausmaskieren
- asl.b #5,d0
- or.l d0,_outIC3 ; Bit5(=RAG0) setzen
- ; RAG4 setzen
- move.l (sp),d0 ; row holen
- and.l #%01111111,_outIC4 ; Bit7(=RAG4) löschen
- and.l #%00010000,d0 ; Bit4 von "row" ausmaskieren
- asl.l #3,d0
- or.l d0,_outIC4 ; Bit7(=RAG4) setzen
- ; RAG1-RAG3 setzen
- move.l (sp),d0 ; row holen
- and.l #%11100011,_outIC4 ; Bit2-4(=RAG1-RAG3) löschen
- and.l #%00001110,d0 ; Bit1-3 aus "row" ausmaskieren
- asl.l #1,d0
- or.l d0,_outIC4 ; RAG1-RAG3 setzen
-
- write$ ; errechnete Werte in ICs schreiben
- move.l #IC3,d1
- move.l _outIC3,d0
- bsr @WriteByte
-
- move.l #IC4,d1
- move.l _outIC4,d0
- bsr @WriteByte
-
- move.l #IC5,d1
- move.l _outIC5,d0
- bsr @WriteByte
-
- addq.l #4,sp ; Stack korrigieren
- rts
-
-
-
- * SDIn:
- * lege ein Bit an den SDIn-Eingang (Pin 11 vom Textool-Sockel)
- * Aufruf: SDIn(bit); bit: 0=LOW; 1=HIGH
- @SDIn:
- ; Bit steht in d0
- asl.b #2,d0 ; an die richtige Stelle schieben
- and.l #%11111011,_outIC5 ; SDIn-Bit löschen
- or.l d0,_outIC5 ; Bit auf LOW oder HIGH setzen
- move.l #IC5,d1
- move.l _outIC5,d0
- bsr @WriteByte
- rts
-
-
- * SDOut:
- * ein Bit aus dem SDOut-Ausgang lesen
- * Pin 14 (GAL16V8), Pin 15 (GAL20V8) am Textool-Sockel
- * Aufruf: bit=SDOut();
- * bit: 0: SDOut-Pin ist LOW; 1: SDOut-Pin ist HIGH
- @SDOut:
- move.l #IC7,d0 ; ein Byte aus IC7 holen
- bsr @ReadByte ; Bit0=Pin14, Bit1=Pin15
-
- cmp.l #GAL16V8,_GALType ; GAL16V8 eingestellt?
- bne.s 1$ ; nein, dann GAL20V8
- and.l #1,d0 ; Bit0 ausmaskieren
- bra.s 2$ ; D0=Bit
- ; GAL20V8
- 1$ asr.l #1,d0 ; SDOut-Bit an Bit-Pos. 0
- and.l #1,d0
- 2$ ; 32-Bit-Ergebnis in D0
- rts
-
-
-
-
- * Clock:
- * erzeuge Clock-Impuls (Low-High-Low-Übergang) am SCLK-Eingang (Pin 10
- * vom Textool-Sockel
- * Aufruf: Clock();
- @Clock:
- or.l #%00000010,_outIC5 ; SCLK-Bit auf HIGH
- move.l #IC5,d1
- move.l _outIC5,d0
- bsr @WriteByte
-
- and.l #%11111101,_outIC5 ; SCLK-Bit auf LOW
- move.l #IC5,d1
- move.l _outIC5,d0
- bsr @WriteByte
-
- rts
-
-
-
- * STRImpuls:
- * setzt /STR-Eingang (Pin 13 am Textool-Socker) für die Dauer von "STRLength"
- * auf LOW
- * Aufruf: STRImpuls(long STRLength);
- * STRLength: Dauer des Low-Impulses in Mikrosekunden (Langwort!)
- @STRImpuls:
- movem.l d0-d7/a0-a6,-(sp) ; Register retten
-
- move.l 4,a6
- jsr _LVOForbid(a6)
-
- and.l #%11110111,_outIC5 ; STR-Pin auf LOW
- move.l #IC5,d1
- move.l _outIC5,d0
- bsr @WriteByte
-
- cmp.l #100,(sp) ; bis ein Wert in ein IC getaktet wird
- bls.s 1$ ; vergehen ca. 100us => keinen Timer
- move.l (sp),d0 ; Dauer des Impulses in Mikrosekunden
- jsr @WaitForTimer ; Low-Impuls
- 1$
- or.l #%00001000,_outIC5 ; STR-Pin wieder auf HIGH
- move.l #IC5,d1
- move.l _outIC5,d0
- bsr @WriteByte
-
- jsr _LVOPermit(a6)
-
- movem.l (sp)+,d0-d7/a0-a6 ; Registerinhalte zurückholen
- rts
-
-
-
- * SetPV:
- * Legt am P/V-Pin den entsprechenden Pegel für "Programmieren" bzw.
- * "Verify" an.
- * Aufruf: SetPV(mode);
- * mode : VERIFY (lesen, P/V low), PROG (schreiben, P/V high)
- @SetPV:
- ; Mode steht in D0
- cmp.l #GAL16V8,_GALType ; GAL16V8?
- bne.s 1$ ; nein, dann 1
-
- move.l _outIC3,d1
- and.l #%11111011,d1
- asl.b #5,d0 ; Mode-Bit zu Bit 5 schieben
- or.l d0,d1
- move.l d1,d0 ; P/V setzen
- move.l #IC3,d1 ; IC3 setzen
- bsr @WriteByte
- bra.s 2$
- 1$
- move.l _outIC3,d1
- and.l #%11111101,d1
- asl.b #6,d0 ; Mode-Bit zu Bit 6 schieben
- or.l d0,d1
- move.l d1,d0 ; P,/V-Bit setzen
- move.l #IC3,d1 ; IC3 setzen
- bsr @WriteByte
- 2$
- rts
-
-
-
-
-
- * Edit-Mode:
- * schaltet das GAL in den Edit-Mode; /STR auf HIGH; P/V auf LOW
- * Aufruf: EditMode(mode);
- * mode: PROG oder VERIFY (für Spannungseinstellung)
- @EditMode:
- movem.l d0-d7/a0-a6,-(sp) ; Register sichern
-
- ; GAL-Typ auswählen
- cmp.l #GAL16V8,_GALType ; GAL16V8?
- bne.s 1$ ; nein, dann 1
-
- move.l #IC3,d1 ; IC3, P/V auf LOW
- move.l #%00000000,d0
- bsr @WriteByte
-
- move.l #IC4,d1
- move.l #%00000000,d0 ; IC4 initialisieren
- bsr @WriteByte
-
- move.l #IC5,d1 ; /STR auf HIGH
- move.l #%00011000,d0 ; IC5 initialisieren
- bsr @WriteByte
- bra.s 2$
- 1$ ; GAL20V8
- move.l #IC3,d1 ; IC3, P/V auf LOW
- move.l #%00000000,d0
- bsr @WriteByte
-
- move.l #IC4,d1
- move.l #%00000000,d0 ; IC4 initialisieren
- bsr @WriteByte
-
- move.l #IC5,d1 ; /STR auf HIGH
- move.l #%00101000,d0 ; IC5 initialisieren
- bsr @WriteByte
- 2$
-
- ; richtige Spannung auswählen
- cmp.l #VERIFY,(sp) ; Lesen?
- bne.s 3$ ; nein, dann Programmieren!
- move.l #4,d0 ; ja, dann 12.00 Volt einstellen
- bsr @SetVolt
- bra.s 4$
- 3$
- move.l _prog_volt,d0 ; Programmierspannung einstellen
- bsr @SetVolt
- 4$
-
- bsr @VeditOn ; Edit-Spannung aufbauen
-
- move.l #50000,d0 ; 50 ms warten, bis sich die
- jsr @WaitForTimer ; Edit-Spannung aufgebaut hat
-
- bsr @EnableOutput ; Bits anlegen
- bsr @EnableVcc ; Vcc anlegen
-
- move.l #100000,d0 ; Prellzeit der Relais überbrücken
- jsr @WaitForTimer
-
- bsr @EnableVEdit ; Edit-Spannung anlegen
- ; GAL befindet sich jetzt im Edit-Mode
- move.l #5,d0 ; 5 us warten bevor nächste Aktion
- jsr @WaitForTimer ; erlaubt ist
-
- movem.l (sp)+,d0-d7/a0-a6 ; Registerinhalte zurückholen
- rts
-
-
-
- * ExitEditMode:
- * Schaltet zuerst VEdit und VCC ab, dann wird der Inhalt der ICs
- * zurückgesetzt.
- * Aufruf: ExitEditMode();
- @ExitEditMode:
- movem.l d0-d7/a0-a6,-(sp) ; Register sichern
-
- bsr @DisableVEdit
-
- bsr @DisableVcc
-
- bsr @InitGALer
-
- bsr @EnableOutput
-
- movem.l (sp)+,d0-d7/a0-a6
- rts
-
-
-
- * SetVolt:
- * selektiert durch IC 10 und IC11 die gewünschte Spannung
- * Aufruf: SetVolt(value);
- * value: 0=16.50 Volt; 1=15.75 Volt; 2=14.5 Volt; 3=14.00 Volt; 4=12.00 Volt
- *
- @SetVolt:
- ; Parameter in D0
- move.l d0,-(sp) ; Wert sichern
-
- and.l #%00000001,d0
- rol.l #7,d0
- and.l #%01111111,_outIC1
- or.l d0,_outIC1 ; Q8 (Pin 11) von IC1 setzen
- move.l _outIC1,d0
- move.l #IC1,d1
- bsr @WriteByte
-
- move.l (sp)+,d0
- and.l #%00000110,d0
- rol.l #5,d0
- and.l #%00111111,_outIC5
- or.l d0,_outIC5 ; Q7 und Q8 von IC5 setzen
- move.l _outIC5,d0
- move.l #IC5,d1
- bsr @WriteByte
-
- rts
-
-
-
-
- SECTION data,DATA
-
-
- ; Zwischenspeicher, um Register zu retten ohne den Stack zu benützen
-
- cia_addrb: dc.b 0
- cia_bddra: dc.b 0
-
- END
-