Difference between revisions of "ABOOTSIM.ASM"

From TheRetroWagon
Jump to: navigation, search
(Add syntaxhighlight)
(1st Corections)
Line 1: Line 1:
 +
<syntaxhighlight lang="asm">
 
<syntaxhighlight lang="asm">
 
<syntaxhighlight lang="asm">
 
;ABOOTSIM.ASM VERSION 1.0 10/27/76 JRB
 
;ABOOTSIM.ASM VERSION 1.0 10/27/76 JRB
3 IMSAI CP/M SIMULATOR FOR AUTOMATIC BOOTSTRAP
+
; 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 8: Line 9:
  
 
;THE FUNCTION OF THIS PROGRAM IS TO READ DRIVE 0,
 
;THE FUNCTION OF THIS PROGRAM IS TO READ DRIVE 0,
3 TRACK a, SECTOR I INTO RAM LOCATIONS
+
; TRACK a, SECTOR I INTO RAM LOCATIONS
 
; a To 7FH THEN JMP To 0.
 
; a To 7FH THEN JMP To 0.
  
Line 14: Line 15:
 
; SUITABLE FOR USE IN ROM AND WITH ERROR RECOVERY.
 
; SUITABLE FOR USE IN ROM AND WITH ERROR RECOVERY.
  
BBASE EQU ROOOH ;ORIGIN AND STARTING ADDRESS
+
BBASEE  QU 4OOOH ;ORIGIN AND STARTING ADDRESS
EXIT EQU o ;wHERE THIS PROGRAM EXITS To
+
EXIT   EQU 0 ;wHERE THIS PROGRAM EXITS To
DISK EQU OFDH ;COMMAND PORT FOR FLOPPY DISC
+
DISK   EQU OFDH ;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 GCMD+4 ;SECTOR
+
IBSECT EQU GCMD+4 ;SECTOR
BBUFAD EQU BCMD+5 ;BUFFER ADDRESS
+
BBUFAD EQU BCMD+5 ;BUFFER ADDRESS
 
ORG BBASE
 
ORG BBASE
  
3
+
;
 
; START HERE
 
; START HERE
3
+
;
  
3 SET FLOPPY DISC INTERFACE STRING POINTER
+
; SET FLOPPY DISC INTERFACE STRING POINTER
  
MVI A,IOH ;COMMAND TO SET STRING POINTER 0
+
MVI A,10H ;COMMAND TO SET STRING POINTER 0
our DISK ;SEND IT ‘
+
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
Mov A,L 5L0 ORDER STRING ADDRESS
 
 
 
 
OUT DISK
 
OUT DISK
 
 
Mov A,H ;HI ORDER STRING ADDRESS
 
Mov A,H ;HI ORDER STRING ADDRESS
 
 
OUT DISK
 
OUT DISK
  
Line 47: Line 44:
 
;SET UP STRING IN RAM
 
;SET UP STRING IN RAM
  
5
+
MVI M,21H   ;COMMAND TO READ SECTOR, UNIT 0
 
+
INX H      ;POINT AT STATUS BYTE
MVI M,21H
+
            ;5(3TATUS BYTE WILL BE ZEROED LATER)
INX H
 
 
 
;COMMAND TO READ SECTOR, UNIT 0
 
,POINT AT STATUS BYTE
 
5(3TATUS BYTE WILL BE ZEROED LATER)
 
  
 
INX H ,POINT AT HI ORDER TRACK
 
INX H ,POINT AT HI ORDER TRACK
Line 118: Line 110:
  
 
END BBASE
 
END BBASE
 +
 +
</syntaxhighlight>
 +
  
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 20:42, 1 August 2018

<syntaxhighlight lang="asm">
;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.

BBASEE  QU 4OOOH ;ORIGIN AND STARTING ADDRESS
EXIT    EQU 0 ;wHERE THIS PROGRAM EXITS To
DISK    EQU OFDH ;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 GCMD+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
            ;5(3TATUS BYTE WILL BE ZEROED LATER)

INX H ,POINT AT HI ORDER TRACK

XRA A ;CET 0 IN A

Mov M,A 3ZERO HIGH ORDER TRACK

INX H

MOv M,A ;ZERO LO ORDER TRACK

INX H

MVI M,1 ;SECTOR 1

INX H

Mov M,A ;2ERO LO ORDER BUFFER ADDRESS
INX H

Mov M,A ;ZERO HIGH ORDER BUF ADDRESS

; INITIALIZATION COMPLETE. NOW READ SECTOR.

REPEAT: LXI

WAIT:

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 3TELL DISK TO GO!

ADD M ;LOOK FOR NON-0 STATUS

JZ WAIT ;KEEP LOOKING TILL IT COMES

CPI I ;ONLY CORRECT RETURN VALUE IS 1
J2 EXIT ;ON SUCCESS, TRANSFER CONTROL

;CP/M BOOTSTRAP ROUTINE READ IN FROM DISK

; DISK ERROR HAS OCCURED. -

3 DISPLAY ERROR CODE IN LIGHTS AND KEEP TRYING.

V. 50 5.

THUS IF DISK IS NOT READY,
CP/M WILL BOOT AS SOON AS IT COMES READY.

CMA 5LIGHTS DISPLAL COMPLEMENT

OUT OFFH 5OUTPUT A TO "PROG OUTPUT" LIGHTS
MVI A,21H ;RESTORE DRIVE 1 - IT HELPS!

OUT DISK ;SEND RESTORE COMMAND TO DISK

JMP REPEAT 3TRY AGAIN (AND AGAIN, AND ...)

END BBASE


</syntaxhighlight>