title start entry devinit, device? entry genstack entry ipaginit, noint ext os, devlist ext hladdr list nogen, nocond *include jsysequ.z80 ; ----------------------------------------------------------------------------- ; Jump to the beginning of the IOP operating system start: jp os ; ----------------------------------------------------------------------------- ; Reserve space for the list of devices. (See the module DEVLIST.Z80.) NDEVS equ 7 ; count of device types (i.e., count ; of different major device numbers) rept NDEVS ds 2 ; device number ds 2 ; device command table mend dw 0000 ; end of list ; ----------------------------------------------------------------------------- subttl device initialization devinit: ; initialize all the devices in the device list ; (this routine is called once at boot time) ; alters: af, hl ld hl,devlist ; hl -> the list of devices di1: inc hl ld a,(hl) ; is the major device number zero? and a,a ret z ; if so, done inc hl ; no ld a,(hl) inc hl push hl ld h,(hl) ld l,a ; hl -> device command table ld a,(hl) inc hl ld h,(hl) ld l,a ; hl -> device init routine call hladdr ; execute it pop hl inc hl ; next entry in list jr di1 ; ----------------------------------------------------------------------------- subttl default interrupt routine org start + 40h ; the address of NOINT (4040h) is initially loaded into all locations ; on the Ipage noint: ei reti ; ----------------------------------------------------------------------------- subttl copywrite & general stack *include copyrite.z80 ; allow room for the copyright message which will be placed here ; by the device packages (e.g., CROMIX.IOP, TAPE.IOP) which use LIBOS copyrt 00,00,'Cromix IOP System version 00.00\n'; official version no. fv: db 'Version 00.00.00' ; fine resolution version no. fvlen equ $ - fv ; ----------------------------------------------------------------------------- ; general stack which is used only while booting & while switching processes rept 40h - fvlen ; stack depth db 0ffh ; filler mend rept genstack: ds 0 ; ----------------------------------------------------------------------------- subttl device location device?: ; find device in the list of devices ; call with: de = device number ; returns: cy set & a = ?NODEVICE if device not in list ; o/w, hl -> the device command table ; (its init routine) ; alters: af, b, hl ld hl,devlist ; hl -> the list of devices dv1: inc hl ld a,(hl) ; get major device number from list. inc hl cp a,d ; do the major device numbers match? jr z,dvx inc hl ; no. get ready for next entry. inc hl and a,a ; end of list? jr nz,dv1 ld a,?nodevice ; yes. device not found. scf ret dvx: ld a,(hl) ; found it. get the address inc hl ; of the device command table. ld h,(hl) ; ld l,a ; hl -> device command table ret ; ----------------------------------------------------------------------------- subttl interrupt vector page ipaginit: ; initialize the Ipage ; returns: hl = address of the Ipage ld hl,ipage push hl ld de,noint ; load the address NOINT into each vector ld b,100h/2 ; in the Ipage pg2: ld (hl),e inc hl ld (hl),d inc hl djnz pg2 pop hl ret org start + 100H ipage: ds 100h db 40h ; extend the Ipage fill by one byte ; The Ipage contains the interrupt vectors for quadarts. ; There are 4 quadarts, 2 SIOs per quadart, 2 channels per SIO, ; and 4 vectors per channel. The structure of the Ipage is as follows: struct 0 ; Quadart 0 ds 2 ; Channel 1 , TBE ds 2 ; Channel 1 , External/Status change ds 2 ; Channel 1 , RDA ds 2 ; Channel 1 , Special Receive Condition ds 2 ; Channel 0 , TBE ds 2 ; Channel 0 , External/Status change ds 2 ; Channel 0 , RDA ds 2 ; Channel 0 , Special Receive Condition ds 2 ; Channel 3 , TBE ds 2 ; Channel 3 , External/Status change ds 2 ; Channel 3 , RDA ds 2 ; Channel 3 , Special Receive Condition ds 2 ; Channel 2 , TBE ds 2 ; Channel 2 , External/Status change ds 2 ; Channel 2 , RDA ds 2 ; Channel 2 , Special Receive Condition ; Quadart 1 ds 2 ; Channel 5 , TBE ds 2 ; Channel 5 , External/Status change ds 2 ; Channel 5 , RDA ds 2 ; Channel 5 , Special Receive Condition ds 2 ; Channel 4 , TBE ds 2 ; Channel 4 , External/Status change ds 2 ; Channel 4 , RDA ds 2 ; Channel 4 , Special Receive Condition ds 2 ; Channel 7 , TBE ds 2 ; Channel 7 , External/Status change ds 2 ; Channel 7 , RDA ds 2 ; Channel 7 , Special Receive Condition ds 2 ; Channel 6 , TBE ds 2 ; Channel 6 , External/Status change ds 2 ; Channel 6 , RDA ds 2 ; Channel 6 , Special Receive Condition ; Quadart 2 ds 2 ; Channel 9 , TBE ds 2 ; Channel 9 , External/Status change ds 2 ; Channel 9 , RDA ds 2 ; Channel 9 , Special Receive Condition ds 2 ; Channel 8 , TBE ds 2 ; Channel 8 , External/Status change ds 2 ; Channel 8 , RDA ds 2 ; Channel 8 , Special Receive Condition ds 2 ; Channel 11 , TBE ds 2 ; Channel 11 , External/Status change ds 2 ; Channel 11 , RDA ds 2 ; Channel 11 , Special Receive Condition ds 2 ; Channel 10 , TBE ds 2 ; Channel 10 , External/Status change ds 2 ; Channel 10 , RDA ds 2 ; Channel 10 , Special Receive Condition ; Quadart 3 ds 2 ; Channel 13 , TBE ds 2 ; Channel 13 , External/Status change ds 2 ; Channel 13 , RDA ds 2 ; Channel 13 , Special Receive Condition ds 2 ; Channel 12 , TBE ds 2 ; Channel 12 , External/Status change ds 2 ; Channel 12 , RDA ds 2 ; Channel 12 , Special Receive Condition ds 2 ; Channel 15 , TBE ds 2 ; Channel 15 , External/Status change ds 2 ; Channel 15 , RDA ds 2 ; Channel 15 , Special Receive Condition ds 2 ; Channel 14 , TBE ds 2 ; Channel 14 , External/Status change ds 2 ; Channel 14 , RDA ds 2 ; Channel 14 , Special Receive Condition mend ; =============================================================================