annotate level2/modules/rammer.asm @ 1631:ec6fb5543b22

Robert Gault's modifications for correcting timing errors
author boisy
date Mon, 12 Jul 2004 01:38:08 +0000
parents 46c68f878889
children f77ac3ae8a43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
732
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
1 ********************************************************************
1424
32f1dae476b7 Fixed references in source from OS-9 to NitrOS-9 where appropriate
boisy
parents: 1348
diff changeset
2 * Rammer - NitrOS-9 Level 2 RAM Disk
732
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
3 *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
4 * $Id$
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
5 *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
6 * Alan DeKok's version of RAMMER - Based on original Keving Darling version
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
7 *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
8 * NOTE: For some reason, when DEINIZing /r0, the INIT routine gets called...
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
9 * but it still deallocates memory!
1348
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
10 *
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
11 * Edt/Rev YYYY/MM/DD Modified by
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
12 * Comment
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
13 * ------------------------------------------------------------------
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
14 * 4 ????/??/?? ???
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
15 * Original Kevin Darling Version.
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
16 *
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
17 * 5 2000/03/14 L. Curtis Boyle
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
18 * Several changes
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
19 *
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
20 * 5r2 2000/05/09 L. Curtis Boyle
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
21 * Allowed driver to go past 400K, attempted some fixes for handling /MD,
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
22 * so that setting vfy=0 on /R0 would not completely crash the system.
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
23 * Fixed some error reporting bugs that would crash the system, and
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
24 * moved entry table to between READ/WRITE to allow short branches to both.
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 732
diff changeset
25
732
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
26
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
27 * Following CAN be set higher, but will take another page of system RAM then.
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
28 * 200 will allow maximum of 1,638,400 byte RAM drive.
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
29 MAXBLOCK set 201 Maximum # of MMU blocks allowed in RAM drive
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
30
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
31 nam Rammer
1424
32f1dae476b7 Fixed references in source from OS-9 to NitrOS-9 where appropriate
boisy
parents: 1348
diff changeset
32 ttl NitrOS-9 Level 2 RAM Disk
732
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
33
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
34 ifp1
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
35 use defsfile
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
36 endc
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
37
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
38 tylg set Drivr+Objct
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
39 atrv set ReEnt+rev
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
40 rev set $02
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
41 edition set 5
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
42
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
43 mod eom,name,tylg,atrv,start,size
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
44
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
45 * Device mem stuff - can make MMUTable bigger, but will take 2 pages of system
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
46 * RAM then for device memory
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
47 u0000 rmb DRVBEG+DRVMEM Reserve room for 1 entry drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
48 MDFlag rmb 1 0=R0 descriptor, <>0=MD descriptor
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
49 numofBlk rmb 1 # of MMU blocks allocated for RAM drive
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
50 MMUTable rmb MAXBLOCK Table of MMU Block #'s being used.
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
51 size equ .
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
52
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
53 fcb DIR.+SHARE.+PREAD.+PWRIT.+PEXEC.+READ.+WRITE.+EXEC.
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
54
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
55 name fcs /Rammer/
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
56 fcb edition
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
57
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
58 * Terminate routine - deallocates RAM
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
59 L0024 lda <numofBlk,u Get # blocks we had allocated
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
60 beq L003D If none, exit
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
61 leay <MMUTable,u Point to MMU block table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
62 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
63 clre Hi byte of block # to allocate (always 0)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
64 L002E ldf ,y Get block #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
65 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
66 L002E ldb ,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
67 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
68 clr ,y+ Zero it out in table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
69 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
70 tfr w,x Block # to deallocate
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
71 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
72 pshs a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
73 clra
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
74 tfr d,x
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
75 puls a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
76 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
77 ldb #$01 1 block to deallocate
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
78 os9 F$DelRAM Deallocate the block
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
79 deca Dec # of blocks to clean out
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
80 bne L002E Do until entire RAM drive is deallocated
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
81 L003D clrb Exit w/o error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
82 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
83
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
84 * Deallocate RAM allocated so far, exit with no RAM error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
85 L003F bsr L0024 Deallocate all RAM Drive ram blocks
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
86 L0041 comb Exit no RAM left error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
87 ldb #E$MemFul
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
88 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
89
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
90 * Init routine - only gets called once per driver inited.
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
91 * Called if you INIZ the device as well
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
92 * Entry: Y=Address of device descriptor
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
93 * U=Device mem area
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
94 * NOTE: All of device mem (Except V.PORT) is cleared to 0's
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
95 Init lda #1
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
96 sta V.NDRV,u only can handle 1 drive descriptor
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
97 leax DRVBEG,u Point to start of drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
98 sta DD.TOT+2,x Set DD.TOT to non 0 value
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
99 lda <M$Opt,y Get # of bytes in device descriptor table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
100 deca
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
101 * Following is if 1st access to RAMMER is on /MD
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
102 beq GetStat 0 (/MD desciptor), then exit w/o error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
103 ldb <IT.CYL+1,y Get LSB of # of cylinders
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
104 lda <IT.SID,y Get # of heads
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
105 mul Calculate # head/cyls total
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
106 lda <IT.SCT+1,y Get # of sectors/track
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
107 mul Calculate # of sectors for RAM drive
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
108 subd <IT.SCT,y Subtract 1 tracks worth
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
109 addd <IT.T0S,y Add in the special track 0's # sectors/track
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
110 std DD.TOT+1,x Save as # sectors on drive
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
111 addd #$001F Round up to nearest 8K block
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
112 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
113 rold Shift # of 8K blocks needed into A
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
114 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
115 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
116 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
117 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
118 rola
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
119 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
120 rola
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
121 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
122 rola
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
123 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
124 cmpa #MAXBLOCK If higher than max, exit with mem full error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
125 bhi L0041
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
126 leax <MMUTable,u Point to RAM block table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
127 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
128 tfr a,e # blocks left to allocate
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
129 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
130 L0078 ldb #$01 Try to allocate 1 8K RAM block
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
131 IFEQ H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
132 pshs a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
133 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
134 os9 F$AllRAM
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
135 IFEQ H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
136 puls a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
137 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
138 bcs L003F If error, deallocate RAM, and exit
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
139 inc <numofBlk,u Bump up # of blocks allocated
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
140 stb ,x+ Save MMU block # allocated in table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
141 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
142 dece Do until done all blocks requested
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
143 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
144 deca
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
145 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
146 bne L0078
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
147 clrb No error & return
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
148 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
149
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
150 * Entry: B:X=LSN to read (only X will be used, even with 2 MB)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
151 * Y=Path dsc. ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
152 * U=Device mem ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
153 Read pshs y,x Preserve path & device mem ptrs
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
154 bsr L00C8 Calculate MMU block & offset for sector
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
155 bcs L00A5 Error, exit with it
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
156 bsr L00AE Transfer sector from RAM drive to PD.BUF
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
157 puls y,x Restore ptrs
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
158 leax ,x Sector 0?
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
159 bne GetStat No, exit without error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
160 ldx PD.BUF,y Get buffer ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
161 leay DRVBEG,u Point to start of drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
162 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
163 ldw #DD.SIZ Copy the info we need into drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
164 tfm x+,y+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
165 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
166 ldb #DD.SIZ Copy the info we need into drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
167 ReadLp lda ,x+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
168 sta ,y+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
169 decb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
170 bne ReadLp
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
171 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
172 * GetStat/SetStat - no calls, just exit w/o error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
173 GetStat clrb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
174 L00A7 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
175
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
176 L00A5 puls y,x,pc
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
177
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
178 start bra Init
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
179 nop
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
180 bra Read
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
181 nop
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
182 bra Write
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
183 nop
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
184 bra GetStat
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
185 nop
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
186 bra GetStat Actually SetStat (no calls, so same routine)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
187 nop
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
188 lbra L0024 Terminate (returns memory)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
189
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
190 * Entry: B:X = LSN to write
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
191 * Y=Path dsc. ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
192 * U=Device mem ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
193 Write bsr L00C8 Calculate MMU Block & offset for sector
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
194 bcs L00A7 Error,exit with it
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
195 exg x,y X=Sector buffer ptr, Y=Offset within MMU block
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
196 * Transfer between RBF sector buffer & RAM drive image sector buffer
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
197 * Called by both READ and WRITE (with X,Y swapping between the two)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
198 L00AE orcc #IntMasks Shut IRQ's off
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
199 pshs x Preserve X
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
200 ldx <D.SysDAT Get ptr to system DAT image
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
201 ldb 1,x Get original System MMU block #0
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
202 puls x Get X back
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
203 sta >$FFA0 Map in RAM drive block into block #0
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
204 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
205 ldw #$0100 256 byte transfer
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
206 tfm x+,y+ Copy between the two buffers
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
207 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
208 clrb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
209 WriteLp lda ,x+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
210 sta ,y+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
211 decb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
212 bne WriteLp
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
213 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
214 stb >$FFA0 Remap in system block 0
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
215 andcc #^(IntMasks+Carry) Turn IRQ's back on & no error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
216 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
217
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
218 * Subroutine to calculate MMU block # and offset based on sector # requested
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
219 * Entry: Y=path dsc. ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
220 * U=device mem ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
221 * B:X=LSN to calculate for
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
222 * Exit: A=MMU block # we need to map in
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
223 * X=offset within MMU block to get sector from (always <8K)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
224 * Y=Sector buffer ptr for RBF
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
225 * MDFlag,u=0 if NOT MD, else MD
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
226 L00C8 clr MDFlag,u Flag that we are on "real" RAM Drive
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
227 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
228 ldw PD.DEV,y Get our Device table entry ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
229 ldw V$DESC,w Get device descriptor ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
230 lda M$Opt,w Get size of options table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
231 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
232 pshs x
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
233 ldx PD.DEV,y Get our Device table entry ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
234 ldx V$DESC,x Get device descriptor ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
235 lda M$Opt,x Get size of options table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
236 puls x
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
237 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
238 deca
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
239 bne L00DB Not MD, skip ahead
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
240 inc MDFlag,u Flag we are on MD
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
241 sta <PD.SIZ,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
242 sta <PD.SIZ+3,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
243 sta <PD.SSZ,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
244 ldd <D.BlkMap+2 Get end of block memory ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
245 subd <D.BlkMap Calc # of blocks of RAM
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
246 lda #32 * 32 for # of 'sectors'
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
247 mul
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
248 std <PD.SIZ+1,y Save as middle word of file size
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
249 std <PD.SSZ+1,y Save as segment size
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
250 bra L00DE Skip ahead (sector # will allow all 2 MB)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
251
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
252 L00DB tstb Test MSB of sector #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
253 bne L010F <>0, exit with Sector error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
254 L00DE pshs x Preserve LSW of sector #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
255 ldd ,s Load it again into D
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
256 tst MDFlag,u We on MD?
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
257 bne L00EE Yes, skip ahead
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
258 leax DRVBEG,u Point to drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
259 cmpd DD.TOT+1,x LSW of sector compared to table's # of sectors
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
260 bhs L010E Sector # too large, exit with error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
261 L00EE equ *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
262 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
263 rold A=MMU block offset in RAM drive image
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
264 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
265 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
266 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
267 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
268 rola
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
269 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
270 rola
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
271 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
272 rola
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
273 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
274 tst MDFlag,u We on /MD?
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
275 bne L0100 Yup, skip calculating MMU stuff
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
276 leax <MMUTable,u Point to MMU table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
277 lda a,x Get MMU block # we want
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
278 beq L010E If 0, exit with sector error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
279 L0100 pshs a Save block #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
280 clrb Calculate offset within 8k block we want
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
281 lda 2,s
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
282 anda #$1F Mask out all but within 8K address offset
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
283 std 1,s Save offset
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
284 ldy PD.BUF,y Get sector buffer address
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
285 puls x,a,pc Get offset, MMU block & return
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
286
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
287 L010E leas 2,s Eat X on stack
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
288 L010F comb Exit with bad sector #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
289 ldb #E$Sect
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
290 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
291
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
292 emod
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
293 eom equ *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
294 end