PofoWiki

Die ultimative Informationsquelle zum ATARI Portfolio

Benutzer-Werkzeuge

Webseiten-Werkzeuge


hardware:doku:techrefguide:anhangc

Dies ist eine alte Version des Dokuments!


ANHANG C: Beispiel einer Peripherieschaltung

Zur Illustrierung einer Atari Portfolio typischen Erweiterung haben wir eine Erweiterung entwickelt die eine LED bei jedem System-Tick aufleuchten lässt. Um dem Benutzer die Funktionsweise transparent darstellen zu können haben wir eine ROM-Extension verwendet.

SPEZIFIKATIONEN DER ERWEITERUNG

  • eine einzige LED die im System-Takt blinkt
  • mit einer PID von 64H
  • mit sämtlicher Software auf einem Extension-ROM
  • Nur bei eingeschaltenem Gerät betreibbar
  • als Terminating Peripheral
  • Erweiterung schaltet sich mit ausgeschaltener LED ein

Hardwareentwicklung (siehe Schaltplan und Abschnitte 2.6 und 2.7)

  • es ist eine Dekodierlogik vorhanden um die PID in 807FH einzulesen. (Da es nicht nötig ist festzustellen ob die LED an ist, wird der Latch für eienen Schreibvorgang in 807FH dekodiert um Dekodier-Logik zu sparen.)
  • jeder weitere Schreibvorgang in 807FH schaltet die LED ein oder aus
  • Wenn der Latch gesetzt ist leuchtet die LED
  • Wenn der Latch zurückgesetzt wird geht die LED aus
  • Die Schaltung wird von 5VS gespeißt
  • Die Puffersignale ABUF/BBUF und PDET werden ebenfalls benutzt

Softwareentwicklung (siehe PDEM.ASM)

  • Es wird eine ROM-Extension verwendet um ein TSR in den Int 1CH zu hängen
  • Jeder Aufruf von Int 1CH wird durch Schreiben in I/O 807FH die LED ein- oder ausschalten
  • Das TSR deinstalliert sich selbst wenn die Erweiterung entfernt wird
  • Es wird vorausgesetzt, dass biem Einschlaten die LED zurückgesetzt wird

ROM-Extensions (siehe XROM.ASM)

Dieses Programm illustriert wie eine einfache ROM-Extension entwickelt wird. Es kann entweder als spezifische BIOS, DOS, oder als allgemeine Erweiterung dienen, dem ID-Code bei 0C000:0 entsprechend. Jedes Erweiterungsmodul gibt sich zu erkennen und wo es aufgerufen wurde. Es ist eine gute Ausführung um die Möglichkeiten der ROM-Extensions darzustellen.

Anmerkung: ROM-Extensions dürfen AL niemals mit einem Wert von 0 zurücklassen. Dieser Gebrauch ist Atari und DIP vorbehalten.

;***************************************************************;
;								;
;	Module:		PDEM.ASM				;
;	Copyright:	DIP Ltd, 1989				;
;								;
;	DIP Pocket PC Peripheral ROM Extension			;
;								;
;***************************************************************;
 
name		XROM
 
		assume	cs:cseg,ds:dseg
 
DOSX		equ	055aaH			;Specific DOS extension
 
cseg		segment
 
		org	0H			;Extension Vector table
 
xrom_main	label	near			;Start label for MASM
 
bixt_type	dw	DOSX			;Identification code
 
bixt_size	db	0			;Num 512 byte blocks in ROM
 
		org	3H
bixt_gdos	label	byte			;Specific DOS extension
		jmp	genx_vect		;Specific extension vector
 
		org	40H
bixt_user	label	byte			;OEM user text
		db	'Crt Plant Periph'
 
		;The plan is to allocate some memory, Copy a section
		; of code to memory, and then point the Specified
		; vector to that code.
 
xrom_proc	proc	FAR
 
INTR_NUMB	equ	1cH			;TIMER TICK
 
genx_vect	label	near
 
		push	ax			;Preserve registers
		push	bx			; required to set up
		push	ds			; local stack
 
		;Allocate User RAM. Note that this can ONLY be done
		; after DOS initialisation.
 
		mov	bx,(ALOC_SIZE+0fH)/10H	;Paras to allocate
		mov	ah,48H			;Allocate memory
		int	21H
 
		mov	ds,ax			;Set DS to allocated RAM
		mov	stak_save,ss		;Preserve Caller stack
		mov	stak_save+2,sp
 
		shl	bx,1			;Convert size to bytes
		shl	bx,1
		shl	bx,1
		shl	bx,1
 
		;Set up User stack.
 
		mov	ss,ax			;Set up stack at top
		mov	sp,bx			; of allocated memory
 
		push	cx			;Preserve registers
		push	dx			; YOU MUST ALWAYS PRESERVE
		push	si			; ALL USER REGS
		push	di
		push	bp
		push	es
 
		;Copy the ISR to the allocated area
 
		push	ds			;Preserve DS
 
		push	cs			;Set up Source
		pop	ds
		mov	si,offset tick_code
 
		push	ss			;Set up destination
		pop	es
		mov	di,offset load_base
 
		mov	cx,CODE_SIZE		;Bytes to copy
		cld				;Initialise flag
		rep	movsb			;Copy TSR to RAM
 
		pop	ds			;Restore DS
 
		;Get the specified vector, and set it to the ISR
 
		mov	ax,3500H+INTR_NUMB	;Get current Int 1CH
		int	21H
 
		mov	tick_vect,bx		;Preserve vector
		mov	tick_vect+2,es
 
		mov	ax,2500H+INTR_NUMB	;Set interrupt vector
		mov	dx,offset load_base
		int	21H
 
		mov	ax,1501H		;Generate Confidence BEEP
		int	61H
 
		pop	es			;Restore registers
		pop	bp
		pop	di
		pop	si
		pop	dx
		pop	cx
 
		mov	ss,stak_save		;Restore Caller STACK
		mov	sp,stak_save+2
 
		pop	ds			;Restore remaining regs
		pop	bx
		pop	ax
 
		ret				;FAR return to caller
 
xrom_proc	endp
 
		;Interrupt Service Routine (ISR)
 
PID_CODE	equ	64H			;Peripheral PID code
LEDS_PORT	equ	807fH			;LEDs I/O address
 
tick_code	label	byte			;TSR code
 
		push	ax			;Preserve registers
		push	dx
		push	bx
		push	ds
		push	es
 
		mov	ah,1aH			;Get Peripheral PID
		int	61H
		or	al,al			;Peripheral installed?
		jz	tick_none		;No, so uninstall
 
		cmp	ah,PID_CODE		;Correct peripheral?
		jne	tick_none		;No, so uninstall
 
		;Peripheral installed, so toggle LEDs
 
		mov	dx,LEDS_PORT		;Toggle LED address
		out	dx,al			;AL unimportant
		jmp	short tick_exit		;Exit
tick_none:
		assume	cs:dseg			;Force DSEG offset
 
		;Invalid Peripheral, so uninstall TSR
 
		mov	ax,2500H+INTR_NUMB	;Set interrupt vector
		mov	bx,offset tick_vect	;Get old vector
		mov	ds,cs:[bx+2]
		mov	dx,cs:[bx]
		int	21H
 
		;Now vector reset, free allocated memory
 
		push	cs			;Segment of block
		pop	es
		mov	ah,49H			;Free memory
		int	21H
tick_exit:
		pop	es			;Restore registers
		pop	ds
		pop	dx
		pop	bx
		pop	ax
 
		jmp	dword ptr cs:tick_vect	;Jump to old TSR
 
CODE_SIZE	equ	$-tick_code		;Size of ISR
 
cseg		ends
 
		;Data segment TEMPLATE (No initialised data here!)
 
dseg		segment
 
data_sptr	label	byte			;Start of Data
 
stak_save	dw	?			;Caller stack stored here
		dw	?
 
tick_vect	dw	?			;Old vector stored here
		dw	?
 
load_base	label	byte			;Start of ISR
 
LOAD_SIZE	equ	($-data_sptr)+CODE_SIZE	;Load module size
ALOC_SIZE	equ	LOAD_SIZE+100H		;Load module + Stack
 
dseg		ends
 
		end	xrom_main
hardware/doku/techrefguide/anhangc.1185485902.txt.gz · Zuletzt geändert: 16/02/2024 17:02 (Externe Bearbeitung)