rive l is undefined. drivem equ 0ffh ; drive m is undefined. driven equ 0ffh ; drive n is undefined. driveo equ 0ffh ; drive o is undefined. drivep equ 0ffh ; drive p is undefined. ; define disk control variables for system. hlab equ 8 ; fdc head load: 8=before, 0=after, seek. stprat equ 1 ; fdc seek rate: 0=3ms, 1=6ms, 2=10ms, 3=20ms. pctrk equ 43 ; pre-compensation above this track. ibmtpd equ 40 ; ibm tracks per 5-inch floppy. rtcnt equ 10 ; fdc read/write, fail retry count. srtcto-memory command. fdmawt equ 016a6h ; memory-to-floppy command. ; additional system equates. fresh equ 1 ; bdos fresh disk access bit mask. eof equ 1ah ; end of file value. cr equ 0dh ; ascii carriage return. lf equ 0ah ; ascii line feed. tab equ 09h ; ascii tab. spc equ 20h ; ascii space. ; equates for Sector Blocking / Deblocking ; CP/M to host disk constants ; blksiz equ 4096 ;CP/M allocation size hstsiz equ 512 ;host disk sector size hstspt equ 16 ;host disk sectorsbase dma operations. jmp retsegt ; return offset of memory descriptor table jmp retiobt ; return i/o byte value. jmp setiobt ; set i/o byte value. ; ********************************************************* ; ******************* cold-start entry ******************** ; ********************************************************* coldstart: ; initialize system. cli ; disable interrupts during ini. mov ax,cs ; use segment passed with jmpf. mov ss,ax ; stack segment. to match. if (not loader) and sizmem push es ; save extra segment. mov ax,cs ; get base segment of cp/m. add ax,tpaseg ; add offset to tpa segment. push ax ; save tpa segment. mov es,ax ; into extra segment. mov si,0000h ; offset of 0. fndtop: mov bx,es:[si] ; save contents of memory. mov ax,5555h ; get test pattern. mov es:[si],ax ; write it to memory. cmp es:[si],ax ; same as test pattern? jne topfnd ; no, must be top of ram. mov es:[si],bx ; same, res************* ; ********************** trap entry *********************** ; ********************************************************* if not loader ; start condition (loader_false). int_trap: ; this is a bad place to be, tell'em so and die. cli ; disable interrupts during service. mov ax,cs mov ds,ax ; get our data segment. mov bx,(offset trpmsg) call prtmsg ; print trap message. hlt ; hard stop. endif ; end condition (loader_false). ; *******************it with al=00 if not ready. mov dx,lptinp ; get input port address. in al,dx ; read input port. test al,lptdsr ; look at dsr bit. mov al,0 ; default is zero. jnz ps_ext ; exit with zero if not ready. not al ; else make it ff for ready. ps_ext: pop dx ; restore dx. endif ret ; return from printer status (flag in al). ; printer output. lstout: if not loader call pollpt ; get status. or al,al ; see if ready. jz lstout ; wait for ready if not. mov al,cl ; get cmov ds,ax ; data segment. mov es,ax ; extra segment. mov sp,(offset stkbase) ; use local stack for ini. cld ; use incrementing indexes. xor ax,ax mov iobyte,al ; ini iobyte (tty: for consistancy). push ds ; save data segment. mov ds,ax ; clear data segment. if not loader mov es,ax ; clear extra segment. mov int0_offset,(offset int_trap) ; set int 0 vector. mov int0_segment,cs mov di,4 ; start at int 1. mov si,0 ; come from int 0. mov cx,510 ; do rest oftore memory location. mov ax,es ; get segment base. cmp ax,0fc00h ; last possible segment? jae topfnd ; yes, stop. add ax,400h ; no, bump es by 16k. mov es,ax ; set new base. jmps fndtop ; loop till top of ram memory. topfnd: mov ax,es ; get last good segment. pop bx ; get base of tpa segment. mov tpabas,bx ; put in segtable. sub ax,bx ; calculate segment length. sub ax,bx ; remove cp/m offset. mov memlen,ax ; put in segtable. pop es ; recover extra seg************************************** ; ****** console, printer, punch, & reader handlers ******* ; ********************************************************* ; console status check. const: if not loader push dx ; save port register. mov dx,consts ; get status port adr. in al,dx ; read status port. pop dx ; restore dx. and al,conrda ; test for ready. jz cs_ext ; result zero, exit test (00=not ready). or al,255 ; not zero, set al (ff=ready). cs_ext: endif ret ; retuharacter from cl. push dx ; save dx. mov dx,lptdat ; get printer data port adr. out dx,al ; print character. pop dx ; restore dx. endif ret ; return from printer output. ; punch output is same as printer output. punch: jmps lstout ; reader input uses printer input port. reader: if not loader push dx ; save dx. mov dx,lptsts ; get printe