Difference between revisions of "ABOOTSIM.ASM"
(Initial creation) |
(Add Category:Imsai) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <syntaxhighlight lang="asm"> | ||
+ | ; JHA 8/1/2018 | ||
+ | ; OCR'ed from IMSAI_CPM_System_Users_Guide_Version_1.31_Rev_2_Mar77.pdf | ||
;ABOOTSIM.ASM VERSION 1.0 10/27/76 JRB | ;ABOOTSIM.ASM VERSION 1.0 10/27/76 JRB | ||
− | + | ; IMSAI CP/M SIMULATOR FOR AUTOMATIC BOOTSTRAP | |
;THIS PROGRAM IS ONLY NEEDED TO START CP/M COLD | ;THIS PROGRAM IS ONLY NEEDED TO START CP/M COLD | ||
Line 7: | Line 10: | ||
;THE FUNCTION OF THIS PROGRAM IS TO READ DRIVE 0, | ;THE FUNCTION OF THIS PROGRAM IS TO READ DRIVE 0, | ||
− | + | ; TRACK a, SECTOR I INTO RAM LOCATIONS | |
; a To 7FH THEN JMP To 0. | ; a To 7FH THEN JMP To 0. | ||
Line 13: | Line 16: | ||
; SUITABLE FOR USE IN ROM AND WITH ERROR RECOVERY. | ; SUITABLE FOR USE IN ROM AND WITH ERROR RECOVERY. | ||
− | BBASE EQU | + | BBASE EQU 4000H ;ORIGIN AND STARTING ADDRESS |
− | EXIT EQU | + | EXIT EQU 0 ;wHERE THIS PROGRAM EXITS To |
− | DISK EQU | + | DISK EQU 0FDH ;COMMAND PORT FOR FLOPPY DISC |
− | BCMD EQU 80H ;BEGINNING OF DISC COMMAND STRING | + | BCMD EQU 80H ;BEGINNING OF DISC COMMAND STRING |
;AND COMMAND BYTE THEREOF | ;AND COMMAND BYTE THEREOF | ||
− | BSTAT EQU BCMD+1 ;STATUS BYTE... I | + | BSTAT EQU BCMD+1 ;STATUS BYTE... I |
− | BTRK EQU BCMD+2 ;TRACK (2 BYTES) | + | BTRK EQU BCMD+2 ;TRACK (2 BYTES) |
− | IBSECT EQU | + | IBSECT EQU BCMD+4 ;SECTOR |
− | BBUFAD EQU BCMD+5 ;BUFFER ADDRESS | + | BBUFAD EQU BCMD+5 ;BUFFER ADDRESS |
ORG BBASE | ORG BBASE | ||
− | + | ; | |
; START HERE | ; START HERE | ||
− | + | ; | |
− | + | ; SET FLOPPY DISC INTERFACE STRING POINTER | |
− | MVI A, | + | MVI A,10H ;COMMAND TO SET STRING POINTER 0 |
− | + | OUT DISK ;SEND IT ‘ | |
− | LXI H,BCMD ;POINT H AT COMMAND STRING | + | LXI H,BCMD ;POINT H AT COMMAND STRING |
+ | MOV A,L ;LO ORDER STRING ADDRESS | ||
+ | OUT DISK | ||
+ | MOV A,H ;HI ORDER STRING ADDRESS | ||
+ | OUT DISK | ||
− | + | ; ABOOTSIM.ASM CONTINUED | |
− | + | ;SET UP STRING IN RAM | |
− | + | MVI M,21H ;COMMAND TO READ SECTOR, UNIT 0 | |
+ | INX H ;POINT AT STATUS BYTE | ||
+ | ;(STATUS BYTE WILL BE ZEROED LATER) | ||
− | + | INX H ;POINT AT HI ORDER TRACK | |
− | + | XRA A ;GET 0 IN A | |
− | + | MOV M,A ;ZERO HIGH ORDER TRACK | |
− | + | INX H | |
− | + | MOV M,A ;ZERO LO ORDER TRACK | |
− | + | INX H | |
− | + | MVI M,1 ;SECTOR 1 | |
− | + | INX H | |
− | + | MOV M,A ;ZERO LO ORDER BUFFER ADDRESS | |
− | INX H | + | INX H |
− | + | MOV M,A ;ZERO HIGH ORDER BUF ADDRESS | |
− | ; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | XRA A ; | ||
− | |||
− | |||
− | |||
− | INX H | ||
− | |||
− | |||
− | |||
− | INX H | ||
− | |||
− | MVI M,1 ;SECTOR 1 | ||
− | |||
− | INX H | ||
− | |||
− | |||
− | INX H | ||
− | |||
− | |||
; INITIALIZATION COMPLETE. NOW READ SECTOR. | ; INITIALIZATION COMPLETE. NOW READ SECTOR. | ||
− | REPEAT: LXI | + | REPEAT: LXI H,BSTAT |
− | + | XRA A | |
− | + | MOV M,A ;STATus MUST BE 0 BEFORE COMMAND | |
− | + | ;N. B. A=o IS DISK COMMAND TO EXECUTE STRING 0 | |
− | H,BSTAT | + | OUT DISK ;TELL DISK TO GO! |
− | XRA A | + | WAIT: ADD M ;LOOK FOR NON-0 STATUS |
− | MOV M,A ;STATus MUST BE 0 BEFORE COMMAND | + | JZ WAIT ;KEEP LOOKING TILL IT COMES |
− | ;N. B. A=o IS DISK COMMAND TO EXECUTE STRING 0 | + | CPI 1 ;ONLY CORRECT RETURN VALUE IS 1 |
− | + | JZ EXIT ;ON SUCCESS, TRANSFER CONTROL | |
− | OUT DISK | + | ;CP/M BOOTSTRAP ROUTINE READ IN FROM DISK |
− | |||
− | ADD M ;LOOK FOR NON-0 STATUS | ||
− | |||
− | JZ WAIT ;KEEP LOOKING TILL IT COMES | ||
− | |||
− | CPI | ||
− | |||
− | |||
− | ;CP/M BOOTSTRAP ROUTINE READ IN FROM DISK | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | OUT | + | ; |
− | MVI A,21H ;RESTORE DRIVE 1 - IT HELPS! | + | ; DISK ERROR HAS OCCURED. |
+ | ; DISPLAY ERROR CODE IN LIGHTS AND KEEP TRYING. | ||
+ | ;THUS IF DISK IS NOT READY, | ||
+ | ;CP/M WILL BOOT AS SOON AS IT COMES READY. | ||
+ | ; | ||
+ | CMA ;LIGHTS DISPLAL COMPLEMENT | ||
+ | OUT 0FFH ;OUTPUT A TO "PROG OUTPUT" LIGHTS | ||
+ | MVI A,21H ;RESTORE DRIVE 1 - IT HELPS! | ||
+ | OUT DISK ;SEND RESTORE COMMAND TO DISK | ||
+ | JMP REPEAT ;TRY AGAIN (AND AGAIN, AND ...) | ||
− | + | END BBASE | |
− | |||
− | + | </syntaxhighlight> | |
+ | [[Category:Code]] | ||
+ | [[Category:Imsai]] |
Latest revision as of 02:34, 3 August 2018
; JHA 8/1/2018
; OCR'ed from IMSAI_CPM_System_Users_Guide_Version_1.31_Rev_2_Mar77.pdf
;ABOOTSIM.ASM VERSION 1.0 10/27/76 JRB
; IMSAI CP/M SIMULATOR FOR AUTOMATIC BOOTSTRAP
;THIS PROGRAM IS ONLY NEEDED TO START CP/M COLD
; IF YOU DO NOT YET HAVE THE NEW AUTOMATIC BOOTSTRAP
; FIRMWARE INSTALLED IN YOUR DISC INTERFACE.
;THE FUNCTION OF THIS PROGRAM IS TO READ DRIVE 0,
; TRACK a, SECTOR I INTO RAM LOCATIONS
; a To 7FH THEN JMP To 0.
;THIS IS THE FANCY VERSION,
; SUITABLE FOR USE IN ROM AND WITH ERROR RECOVERY.
BBASE EQU 4000H ;ORIGIN AND STARTING ADDRESS
EXIT EQU 0 ;wHERE THIS PROGRAM EXITS To
DISK EQU 0FDH ;COMMAND PORT FOR FLOPPY DISC
BCMD EQU 80H ;BEGINNING OF DISC COMMAND STRING
;AND COMMAND BYTE THEREOF
BSTAT EQU BCMD+1 ;STATUS BYTE... I
BTRK EQU BCMD+2 ;TRACK (2 BYTES)
IBSECT EQU BCMD+4 ;SECTOR
BBUFAD EQU BCMD+5 ;BUFFER ADDRESS
ORG BBASE
;
; START HERE
;
; SET FLOPPY DISC INTERFACE STRING POINTER
MVI A,10H ;COMMAND TO SET STRING POINTER 0
OUT DISK ;SEND IT ‘
LXI H,BCMD ;POINT H AT COMMAND STRING
MOV A,L ;LO ORDER STRING ADDRESS
OUT DISK
MOV A,H ;HI ORDER STRING ADDRESS
OUT DISK
; ABOOTSIM.ASM CONTINUED
;SET UP STRING IN RAM
MVI M,21H ;COMMAND TO READ SECTOR, UNIT 0
INX H ;POINT AT STATUS BYTE
;(STATUS BYTE WILL BE ZEROED LATER)
INX H ;POINT AT HI ORDER TRACK
XRA A ;GET 0 IN A
MOV M,A ;ZERO HIGH ORDER TRACK
INX H
MOV M,A ;ZERO LO ORDER TRACK
INX H
MVI M,1 ;SECTOR 1
INX H
MOV M,A ;ZERO LO ORDER BUFFER ADDRESS
INX H
MOV M,A ;ZERO HIGH ORDER BUF ADDRESS
; INITIALIZATION COMPLETE. NOW READ SECTOR.
REPEAT: LXI H,BSTAT
XRA A
MOV M,A ;STATus MUST BE 0 BEFORE COMMAND
;N. B. A=o IS DISK COMMAND TO EXECUTE STRING 0
OUT DISK ;TELL DISK TO GO!
WAIT: ADD M ;LOOK FOR NON-0 STATUS
JZ WAIT ;KEEP LOOKING TILL IT COMES
CPI 1 ;ONLY CORRECT RETURN VALUE IS 1
JZ EXIT ;ON SUCCESS, TRANSFER CONTROL
;CP/M BOOTSTRAP ROUTINE READ IN FROM DISK
;
; DISK ERROR HAS OCCURED.
; DISPLAY ERROR CODE IN LIGHTS AND KEEP TRYING.
;THUS IF DISK IS NOT READY,
;CP/M WILL BOOT AS SOON AS IT COMES READY.
;
CMA ;LIGHTS DISPLAL COMPLEMENT
OUT 0FFH ;OUTPUT A TO "PROG OUTPUT" LIGHTS
MVI A,21H ;RESTORE DRIVE 1 - IT HELPS!
OUT DISK ;SEND RESTORE COMMAND TO DISK
JMP REPEAT ;TRY AGAIN (AND AGAIN, AND ...)
END BBASE