1; 2; THIS PROGRAM IS A SKELETAL OUTLINE FOR A 128-BYTE PRIMARY 3; BOOTSTRAP FOR AUTOMATICALLY BOOTING TO UCSD PASCAL (TM). 4; SET THE CORRECT ORIGIN FOR THIS PROGRAM FOR YOUR SYSTEM, SET 5; 'MSIZE' FOR THE APPROPRIATE NUMBER OF KILOBYTES OF RAM MEMORY 6; FOR YOUR SYSTEM, SET THE APPROPRIATE PARAMETERS DESCRIBING YOUR 7; DISK ENVIRONMENT AND FINALLY WRITE A VERY LOW LEVEL DISK READ 8; ROUTINE TO ALLOW READING IN THE SECONDARY BOOTSTRAP AND YOUR 9; CBIOS OFF THE DISK AND INTO RAM. 10; THE PROGRAM 'CPMBOOT' ON THE UCSD PASCAL DISTRIBUTION DISK WILL 11; THEN USE THIS PROGRAM AND YOUR CBIOS TO GENERATE AN AUTOMATICALLY 12; BOOTING UCSD PASCAL SYSTEM. 13; 14; ADAPTED FOR IMSAI 8080, JANUARY 2017, UDO MUNK 15; USE 8080 INSTRUCTIONS ONLY 16; 17BOOT EQU 8200H ; SECONDARY BOOTSTRAP LOADED HERE 18MSIZE EQU 54 ; MEMORY SIZE FOR ASSEMBLY 19BIAS EQU (MSIZE*1024)-01900H 20CBIOS EQU 1500H+BIAS ; ORIGIN POINT 21SECNUM EQU 16 ; SECONDARY BOOTSTRAP IS 16 SECTORS LONG 22SECSEC EQU 3 ; SECONDARY BOOTSTRAP ON THIS SECTOR 23BIOSNUM EQU 8 ; CBIOS IS 8 SECTORS LONG 24BIOSSEC EQU 19 ; CBIOS IS ON THIS SECTOR 25; 26FIF EQU 80H ; FIF DISK DESCRIPTOR 27; 28; IMSAI 8080 I/O PORTS 29; 30FDC EQU 0FDH ; FDC PORT 31; 32 ORG 0 ; WHATEVER IS RIGHT FOR YOUR SYSTEM 33; 34PBOOT: LD A,10H ; SETUP FDC DISK DESCRIPTOR 35 OUT (FDC),A 36 LD A,FIF & 0FFH 37 OUT (FDC),A 38 LD A,FIF > 8 39 OUT (FDC),A 40 LD A,21H ; READ COMMAND UNIT 1 41 LD (FIF),A 42 LD HL,CBIOS ; CBIOS GOES HERE 43 LD SP,HL ; RESET THE STACK 44 LD D,BIOSNUM ; D - # OF SECTORS TO READ 45 LD E,BIOSSEC ; E - STARTING SECTOR 46 CALL READIT ; READ IN CBIOS 47 LD HL,BOOT ; LOAD BOOT BASE ADDRESS 48 LD D,SECNUM ; D - # OF SECTORS TO READ 49 LD E,SECSEC ; E - STARTING SECTOR 50 CALL READIT ; READ IN SECONDARY BOOTSTRAP 51 LD HL,128 ; MAXIMUM NUMBER OF BYTES PER SECTOR 52 PUSH HL 53 LD HL,26 ; MAXIMUM NUMBER OF SECTORS IN TABLE 54 PUSH HL 55 LD HL,0 ; TRACK-TO-TRACK SKEW 56 PUSH HL 57 LD HL,1 ; FIRST INTERLEAVED TRACK 58 PUSH HL 59 LD HL,1 ; 1:1 INTERLEAVING 60 PUSH HL 61 LD HL,128 ; BYTES PER SECTOR 62 PUSH HL 63 LD HL,26 ; SECTORS PER TRACK 64 PUSH HL 65 LD HL,77 ; TRACKS PER DISK 66 PUSH HL 67 LD HL,CBIOS-2 ; TOP OF MEMORY (MUST BE WORD BOUNDARY) 68 PUSH HL 69 LD HL,0100H ; BOTTOM OF MEMORY 70 PUSH HL 71 LD DE,CBIOS+3 ; START OF THE SBIOS (JMP WBOOT) 72 PUSH DE 73 PUSH HL ; STARTING ADDRESS OF INTERPRETER 74 JP BOOT ; ENTER SECONDARY BOOTSTRAP 75; 76; READIT MUST READ THE NUMBER OF SECTORS SPECIFIED IN THE D 77; REG, STARTING AT THE SECTOR SPECIFIED IN THE E REG, INTO THE 78; MEMORY LOCATION SPECIFIED IN THE HL PAIR. 79; 80READIT: 81; 82; PUT YOUR CODE IN HERE 83; 84L1: 85 LD A,E ; SELECT SECTOR 86 LD (FIF+4),A 87 LD A,L ; SET DMA ADDRESS LOW 88 LD (FIF+5),A 89 LD A,H ; SET DMA ADDRESS HIGH 90 LD (FIF+6),A 91 XOR A ; RESET RESULT 92 LD (FIF+1),A 93 OUT (FDC),A ; READ SECTOR 94L1A: LD A,(FIF+1) ; WAIT FOR FDC 95 OR A 96 JP Z,L1A 97 CP 1 ; RESULT = 1 ? 98 JP Z,L2 ; YES, CONTINUE 99 HALT ; FAILURE, HALT CPU 100L2: 101 DEC D ; SECTORS = SECTORS - 1 102 RET Z ; RETURN IF ALL SECTORS LOADED 103 INC E ; NEXT SECTOR TO READ 104 LD BC,128 ; 128 BYTES PER SECTOR 105 ADD HL,BC ; DMA ADDRESS + 128 106 JP L1 ; GO READ NEXT 107; 108 END 109