forked from chapmajs/glitchworks_monitor
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbtsdrom.inc
106 lines (90 loc) · 2.6 KB
/
btsdrom.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;BTSDROM -- Tarbell 1011 ROM Boot Handler
;
;Cold boot routines for Tarbell 1011 single-density floppy
;controller. These routines run from zero wait state ROM.
;
;Modified for use with GWMON 2019-02-23 by Glitch Works, LLC
;
;Updated 2/3/2016 by Mike Douglas
;
;Original work by:
; MICHAEL J. KARAS
; MICRO RESOURCES
; These days Mike can be reached at
; [email protected] (2009-03-23)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SYSTEM EQUATES FOR TARBELL CONTROLLER
DWAIT EQU 0FCH ;WAIT FOR DISK PORT
DCOM EQU 0F8H ;DISK COMMAND PORT
DDATA EQU 0FBH ;DISK DATA PORT
DSTAT EQU 0F8H ;DISK STATUS PORT
DSEC EQU 0FAH ;DISK SECTOR PORT
DTRK EQU 0F9H ;DISK TRACK PORT
DSEL EQU 0FCH ;DISK SELECT PORT
;SYSTEM VARIABLES AND ADDRESS POINTERS
SBOOT EQU 007DH ;SINGLE DENSITY BOOT ENTRY
RDCMD EQU 008CH ;READ COMMAND FOR 1771 CONTROLLER
BTSDRM: MVI A, 0F2H ;SELECT DISK A: AT SINGLE DENSITY
OUT DSEL
MVI A, 0D0H ;CLEAR ANY PENDING COMMAND
OUT DCOM
NOP ;ALLOW TIME FOR COMMAND SETTLING
NOP
NOP
NOP
HOME: IN DSTAT ;GET STATUS
RRC
JC HOME ;WAIT FOR NOT BUSY COMPLETION
MVI A, 002H ;ISSUE RESTORE CMND (10 MSEC. STEP RATE)
OUT DCOM
NOP ;ALLOW TIME FOR COMMAND SETTLING
NOP
NOP
NOP
IN DWAIT ;WAIT FOR COMPLETION
ORA A ;SET FLAGS FOR ERROR ON "DRQ",NOT "INTRQ"
JM DRQER
IN DSTAT ;GET DISK STATUS
ANI 004H ;MASK FOR TRACK 00 STATUS BIT
JZ TK0ER
XRA A ;ZERO ACCUMULATOR
MOV L, A ;SETUP MEMORY LOAD ADDRESS 0000H
MOV H, A
INR A ;SETUP FOR SECTOR 01
OUT DSEC
MVI A, RDCMD ;SETUP READ COMMAND
OUT DCOM
NOP ;ALLOW TIME FOR COMMAND SETTLING
NOP
NOP
NOP
RLOOP: IN DWAIT ;WAIT FOR DISK CONTROLLER
ORA A ;SET FLAGS
JP RDONE ;ARE WE DONE YET
IN DDATA ;GET DATA FORM DISK
MOV M, A ;MOVE IT INTO MEMORY
INX H ;INCREMENT MEMORY POINTER
JMP RLOOP ;GO GET NEXT BYTE
RDONE: IN DSTAT ;GET DISK READ STATUS
ORA A ;CHECK FOR ERRORS
JZ SBOOT ;NO ERRORS? JUMP TO CP/M
LXI H, LEMSG$ ;PRINT BOOT LOAD ERROR
JMP LERR
DRQER: LXI H, RQMSG$ ;PRINT COMMAND ERROR
JMP LERR
TK0ER: LXI H, REMSG$ ;PRINT RESTORE ERROR
LERR: PUSH PSW ;PUSH ERROR CODE TO STACK
CALL PRTCLS
LXI H, ERRSFX$ ;PRINT "ERR=" SUFFIX
CALL PRTSTR
POP PSW ;GET ERROR CODE OFF STACK
CALL PRTHEX ;DISPLAY ERROR CODE
RET ;BACK TO THE MONITOR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Cold boot error message strings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LEMSG$: DB 'LOA', 'D' + 80H
RQMSG$: DB 'COMMAN', 'D' + 80H
REMSG$: DB 'TK0 RESTOR', 'E' + 80H
ERRSFX$: DB 'ERR', '=' + 80H