; Dissassembly of CP/M 2.2 boot sector ; (track 0, side 0, sector &41) on side 4 of CPC6128 system discs ; Boot sector for CP/M 2.2 ; ; Entry values as defined by AMSDOS ROM: ; ; Note actual values could change, but the meaning will be the same: ; ; BC = &C17F - C/PM BIOS calls in AMSDOS ROM ; SP = &AD33 ; DE = &C163 -> interrupt handler ; HL = &100 - start address of boot sector ;; copy CPM BIOS into RAM from ROM 0100 60 ld h,b 0101 69 ld l,c 0102 110005 ld de,&0500 0105 013300 ld bc,&0033 0108 edb0 ldir ;; read track 0, side 0, sector &42 to &300 in RAM 010a 0e42 ld c,&42 010c 110000 ld de,&0000 010f 210003 ld hl,&0300 0112 cd89be call &be89 ; BIOS READ SECTOR 0115 3006 jr nc,&011d ;; NC = load fail, C = load succeeded 0117 cd5001 call &0150 ;; check valid, perform expansion buffer, configure cpm 011a c30305 jp &0503 ;; WBOOT 011d cd5902 call &0259 ;; display inline message 0120 defb 13,10,"Failed to load the configuration sector",13,10,10,"$" 014d c30305 jp &0503 ;; WBOOT 0150 cd5902 call &0259 ;; display inline message 0153 defb 4,2,"$" 0156 2a0003 ld hl,(&0300) ;; some kind of check ;; HL = &1235 0159 11cbed ld de,&edcb 015c 19 add hl,de 015d 7c ld a,h 015e b5 or l 015f 2826 jr z,&0187 0161 cd5902 call &0259 ;; display inline message 0164 defb 13,10,"Illegal configuration sector",13,10,10,"$" 0186 c9 ret 0187 2a0203 ld hl,(&0302) 018a 223d02 ld (&023d),hl ;; motor on timeout in 20 millisecond units 018d 2a0403 ld hl,(&0304) 0190 223f02 ld (&023f),hl ;; motor off timeout in 20 millisecond unots 0193 3a0603 ld a,(&0306) 0196 324302 ld (&0243),a ;; step rate in 1 millisecond units 0199 213d02 ld hl,&023d 019c cd83be call &be83 ;; BIOS_SETUP_DISC 019f 3a0703 ld a,(&0307) 01a2 320300 ld (&0003),a ;; IOBYTE 01a5 3a0803 ld a,(&0308) 01a8 cd80be call &be80 ;; BIOS_SET_MESSAGE 01ab 3a0903 ld a,(&0309) 01ae cd9ebe call &be9e ;; SET_REG_SAVE 01b1 210a03 ld hl,&030a 01b4 cda1be call &bea1 ;; SET_SIO 01b7 216403 ld hl,&0364 01ba cd5f02 call &025f ; display message terminated with $ ;;......? 01bd 7e ld a,(hl) 01be 23 inc hl 01bf b7 or a 01c0 280c jr z,&01ce 01c2 47 ld b,a 01c3 4e ld c,(hl) 01c4 23 inc hl 01c5 e5 push hl 01c6 c5 push bc 01c7 cd0f05 call &050f ;; LIST 01ca c1 pop bc 01cb e1 pop hl 01cc 10f5 djnz &01c3 01ce eb ex de,hl 01cf 2127bb ld hl,&bb27 ;; KM SET TRANSLATE 01d2 cd4602 call &0246 01d5 212dbb ld hl,&bb2d ;; KM SET SHIFT 01d8 cd4602 call &0246 01db 2133bb ld hl,&bb33 ;; KM SET CONTROL 01de cd4602 call &0246 01e1 eb ex de,hl 01e2 7e ld a,(hl) 01e3 23 inc hl 01e4 b7 or a 01e5 2850 jr z,&0237 01e7 57 ld d,a 01e8 46 ld b,(hl) 01e9 23 inc hl 01ea 4e ld c,(hl) 01eb 23 inc hl 01ec e5 push hl 01ed d5 push de 01ee c5 push bc 01ef cd0fbb call &bb0f ;; KM SET EXPAND 01f2 c1 pop bc 01f3 d1 pop de 01f4 e1 pop hl 01f5 383a jr c,&0231 01f7 cd5902 call &0259 ;; display inline message 01fa defb 13,10,"Expansion buffer full or illegal token specified",13,10,10,"$" 0230 c9 ret 0231 0600 ld b,&00 0233 09 add hl,bc 0234 15 dec d 0235 20b1 jr nz,&01e8 0237 3a1603 ld a,(&0316) 023a c3a4be jp &bea4 ;; SET_CMND_BUFFER ;; params for BIOS SETUP DISC 023d defw 0 ;; motor on timeout defw 0 ;; motor off timeout defw &af ;; write current off time in 10 microsecond units defb &1e ;; head settle time in 1 millisecond units defb &00 ;; step rate time in 1 millisecond units defb &1 ;; head unload delay (as per uPD765A SPECIFY command) defb &3 ;; bits 7..1: head load delay, bit 0: non DMA mode ;; DE points to some data ;; ;; 1: count ;; then pairs of values ;; B = first value (new token or character), A = second value (key number) 0246 1A ld a,(de) 0247 4f ld c,a 0248 13 inc de 0249 b7 or a 024a c8 ret z 024b 1a ld a,(de) 024c 47 ld b,a 024d 13 inc de 024e 1a ld a,(de) 024f 13 inc de 0250 e5 push hl 0251 cd6c02 call &026c ;; effectively: CALL (HL) 0254 e1 pop hl 0255 0d dec c 0256 20f3 jr nz,&024b 0258 c9 ret ;; display message ;; ;; message follows CALL, and execution returns to the instruction after the end ;; of the message 0259 e3 ex (sp),hl ;; HL = address of message 025a cd5f02 call &025f ; display message terminated with $ ;; HL = byte after end of message 025d e3 ex (sp),hl 025e c9 ret ;; display message terminated with '$' char 025f 7e ld a,(hl) 0260 23 inc hl 0261 fe24 cp '$' ;; end of string marker 0263 c8 ret z 0264 4f ld c,a 0265 e5 push hl 0266 cd0c05 call &050c ;; CONOUT 0269 e1 pop hl 026a 18f3 jr &025f ; display message terminated with $ 026c e9 jp (hl) ;; rest of sector is filled with &cf rept &300-&26d defb &cf endm