terug.gif
; ****************************************************************************
;                        A T O M I S A . I N C
; **************************************************************************
; Use this module if your Atom-in-PC board is plugged into your workstation.
; All entries are supported, although some routines have No Operation.
; Entries:  AUTO_DETECT   tries to find your Atom-in-PC within the address
;                         range 300h-31Ch. The address must be placed in
;                         PPI_ADDR. If auto-detect fails or no Atom-in-PC
;                         is installed then PPI_ADDR should be 0000h.
;           NEW_ADDRESS   changes the auto-detected address into the
;                         address passed by the DX register. The address must
;                         be placed in PPI_ADDR.
;           HW_INIT       initializes the hardware
;           HW_RESET      resets the hardware
;           LEESBYTE      reads a byte from the Atom-in-PC board
;           ZENDBYTE      sends a byte to the Atom-in-PC board
;           SW_VERSION    returns the version to the Atom-in-PC board
;           INFOPAR       is the routine used by the /? parameter
;           error0        holds your copyright line and textual version info
;           SHUTDOWN      unused by ATOMISA but should be used by RemoteAtom
; **************************************************************************
; Author:   Roland Leurs
; Date:     july 10th, 1999
; **************************************************************************

AUTO_DETECT     PROC    NEAR
                MOV     DX,0322H        ; PROBEER BASISADRES TE BEPALEN
DETECT1:        SUB     DX,4
                IN      AL,DX           ; LEES I/O BYTE
                CMP     AL,0FFH         ; TEST OF POORT AANWEZIG
                JNE     DETECT2         ; SPRING INDIEN GEVONDEN
                CMP     DX,0302H        ; ADRESBEREIK DOORLOPEN
                JNE     DETECT1         ; NEE, DAN PROBEER VOLGEND ADRES
                MOV     DX,0002H        ; ZET DUMMY ADRES INDIEN NIET GEVONDEN
DETECT2:        DEC     DX
                DEC     DX
                MOV     PPI_ADDR,DX     ; BERG OP IN GEHEUGEN
                RET
AUTO_DETECT     ENDP

NEW_ADDRESS     PROC    NEAR
                MOV     PPI_ADDR,DX     ; ZET ADRES IN GEHEUGEN
                RET                     ; EINDE ROUTINE
NEW_ADDRESS     ENDP

HW_INIT         PROC    NEAR
                MOV     DX,PPI_ADDR     ; LAADT ADRES COMMAND REGISTER 8255
                ADD     DX,3
                MOV     AL,0B4H         ; LAADT INSTELLING
                OUT     DX,AL           ; STEL PPI IN
                MOV     AL,0FH          ; MAAK PC7 HOOG (resetlijn 6502)
                OUT     DX,AL
                RET
HW_INIT         ENDP

HW_RESET        PROC    NEAR
                MOV     DX,PPI_ADDR     ; LAADT ADRES COMMAND REGISTER 8255
                ADD     DX,3
                MOV     AL,0EH          ; GEEF RESETPULS
                OUT     DX,AL           ; PC7 LAAG
                MOV     CX,00FFH        ; WACHT KORTE TIJD
RESETPAUSE:     LOOP    RESETPAUSE
                MOV     AL,0FH          ;
                OUT     DX,AL           ; PC7 HOOG
                RET
HW_RESET        ENDP

LEESBYTE        PROC    NEAR
                PUSH    DX              ; SAVE GEBRUIKTE REGISTERS
LEESBYTE1:      MOV     DX,PPI_ADDR     ; LAADT STATUSREGISTER ADRES
                ADD     DX,2
                IN      AL,DX           ; LEES STATUSREGISTER
                TEST    AL,00100000B    ; TEST OP INPUT BUFFER FULL
                JNZ     LEESBYTE2       ; SPRING INDIEN EEN BYTE ONTVANGEN
                JMP     SHORT LEESBYTE1
LEESBYTE2:      SUB     DX,2            ; POORTADRES VERLAGEN
                IN      AL,DX           ; LEES DATA
                POP     DX              ; HERSTEL DX REGISTER
                RET                     ; EINDE ROUTINE
LEESBYTE        ENDP

ZENDBYTE        PROC    NEAR
                PUSH    DX              ; SAVE GEBRUIKTE REGISTERS
                PUSH    AX
                MOV     DX,PPI_ADDR     ; LAADT ADRES STATUSREGISTER
                ADD     DX,2
ZENDBYTE1:      IN      AL,DX           ; LEES STATUSREGISTER
                TEST    AL,00000010B    ; TEST OP OUTPUT BUFFER EMPTY
                JZ      ZENDBYTE1       ; SPRING ALS VORIG TEKEN NIET GELEZEN
                DEC     DX              ; POORTADRES VERLAGEN
                POP     AX              ; HAAL DATA VAN STACK
                OUT     DX,AL           ; VERSTUUR DATA
                POP     DX              ; HERSTEL DX
                RET                     ; EINDE ROUTINE
ZENDBYTE        ENDP

SW_VERSION      PROC    NEAR
                MOV     AL,25           ; STUUR LAGE DEEL NAAR ATOM
                CALL    ZENDBYTE
                MOV     AL,04           ; STUUR HOGE DEEL NAAR ATOM
                CALL    ZENDBYTE
                RET
SW_VERSION      ENDP

INFOPAR         PROC    NEAR
                MOV     DX,OFFSET INFOTEKST1
                MOV     AH,09H          ; DRUK TEKST AF MET INT 21 FN 9
                INT     21H
                MOV     DX,PPI_ADDR     ; ZET ADRES 8255 IN DX
                MOV     AL,DH           ; DRUK ADRES HEXADECIMAAL AF
                PUSH    DX
                CALL    HEX
                POP     DX
                MOV     AL,DL
                CALL    HEX
                MOV     DX,OFFSET INFOTEKST2
                MOV     AH,09H
                INT     21H
                XOR     AH,AH
                MOV     AL,VIDEOKAART   ; LAADT CODE MET VIDEO KAART
                SHR     AL,1
                SHR     AL,1
                MOV     DX,OFFSET INFOTEKST3
                ADD     DX,AX
                MOV     AH,09H
                INT     21H
                MOV     DX,OFFSET INFOTEKST4
                MOV     AH,09H
                INT     21H
                LEA     DX,ENDSTACK
                MOV     AL,DH
                CALL    HEX
                MOV     AL,DL
                CALL    HEX
                RET
INFOPAR         ENDP

SHUTDOWN        PROC    NEAR
                RET                     ; DOET NIETS BIJ ISABUS
SHUTDOWN        ENDP
                

INFOTEKST1:
db      10,10,13
db      'Aanroep: ATOM [/A:aaa] [/V:vvv] [/R:rrr] [/X:xxx]',10,10,13
db      'Waarbij aaa = basisadres (hexadecimaal) van Atomkaart',10,13
db      '        vvv = video kaart: CGA, EGA, VGA of HGC',10,13
db      '        rrr = DEL, ESC of F12 voor CTRL-ALT-rrr als Atom reset',10,13
db      '        xxx = hoeveelheid XMS memory in kB (max 4096)',10,10,13
db      'Vermoedelijk basisadres van Atomkaart is $'
INFOTEKST2:
DB      'h',10,13
DB      'Automatisch gedetecteerde videokaart is $'
INFOTEKST3:
DB      'CGA$EGA$VGA$Hercules$'
INFOTEKST4:
DB      10,13,'Benodigd geheugen in bytes (hex) is $'

error0:
DB      'Acorn Atom Terminal V4.25 - (c) Roland Leurs'
DB      '       servicecode APC4259907101ISA$'

terug.gif