annotate level2/modules/rammer.asm @ 1099:b77631456f91

Change to makefile
author roug
date Wed, 09 Apr 2003 19:02:19 +0000
parents 339845ea3507
children 8e804211cb25
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 ********************************************************************
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
2 * Rammer - OS-9 Level Two RAM Disk
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 * Ed. Comments Who YY/MM/DD
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
9 * ------------------------------------------------------------------
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
10 * 4 Original Kevin Darling Version
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
11 * 5 Several changes by L. Curtis Boyle LCB 00/03/14
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
12 * 1) Allowed driver to go past 400K 00/05/09
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
13 * 2) Attempted some fixes for handling /MD, so
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
14 * that setting vfy=0 on /R0 would not
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
15 * completely crash the system.
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
16 * 3) Fixed some error reporting bugs that would
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
17 * crash the system
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
18 * 4) Moved entry table to between READ/WRITE to
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
19 * allow short branches to both
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
20 *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
21 * 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
22 * but it still deallocates memory!
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
23
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
24 * 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
25 * 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
26 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
27
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
28 nam Rammer
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
29 ttl OS-9 Level Two RAM Disk
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 ifp1
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
32 use defsfile
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
33 use rbfdefs
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
34 endc
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
35
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
36 tylg set Drivr+Objct
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
37 atrv set ReEnt+rev
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
38 rev set $02
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
39 edition set 5
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
40
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
41 mod eom,name,tylg,atrv,start,size
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 * 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
44 * RAM then for device memory
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
45 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
46 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
47 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
48 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
49 size equ .
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
50
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
51 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
52
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
53 name fcs /Rammer/
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
54 fcb edition
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
55
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
56 * Terminate routine - deallocates RAM
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
57 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
58 beq L003D If none, exit
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
59 leay <MMUTable,u Point to MMU block table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
60 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
61 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
62 L002E ldf ,y Get block #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
63 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
64 L002E ldb ,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
65 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
66 clr ,y+ Zero it out in table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
67 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
68 tfr w,x Block # to deallocate
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
69 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
70 pshs a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
71 clra
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
72 tfr d,x
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
73 puls a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
74 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
75 ldb #$01 1 block to deallocate
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
76 os9 F$DelRAM Deallocate the block
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
77 deca Dec # of blocks to clean out
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
78 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
79 L003D clrb Exit w/o error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
80 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
81
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
82 * 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
83 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
84 L0041 comb Exit no RAM left error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
85 ldb #E$MemFul
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
86 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
87
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
88 * 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
89 * Called if you INIZ the device as well
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
90 * Entry: Y=Address of device descriptor
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
91 * U=Device mem area
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
92 * 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
93 Init lda #1
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
94 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
95 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
96 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
97 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
98 deca
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
99 * 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
100 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
101 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
102 lda <IT.SID,y Get # of heads
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
103 mul Calculate # head/cyls total
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
104 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
105 mul Calculate # of sectors for RAM drive
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
106 subd <IT.SCT,y Subtract 1 tracks worth
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
107 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
108 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
109 addd #$001F Round up to nearest 8K block
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
110 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
111 rold Shift # of 8K blocks needed into A
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
112 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
113 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
114 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
115 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
116 rola
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 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
122 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
123 bhi L0041
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
124 leax <MMUTable,u Point to RAM block table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
125 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
126 tfr a,e # blocks left to allocate
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
127 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
128 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
129 IFEQ H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
130 pshs a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
131 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
132 os9 F$AllRAM
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
133 IFEQ H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
134 puls a
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
135 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
136 bcs L003F If error, deallocate RAM, and exit
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
137 inc <numofBlk,u Bump up # of blocks allocated
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
138 stb ,x+ Save MMU block # allocated in table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
139 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
140 dece Do until done all blocks requested
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
141 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
142 deca
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
143 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
144 bne L0078
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
145 clrb No error & return
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
146 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
147
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
148 * 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
149 * Y=Path dsc. ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
150 * U=Device mem ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
151 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
152 bsr L00C8 Calculate MMU block & offset for sector
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
153 bcs L00A5 Error, exit with it
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
154 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
155 puls y,x Restore ptrs
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
156 leax ,x Sector 0?
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
157 bne GetStat No, exit without error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
158 ldx PD.BUF,y Get buffer ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
159 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
160 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
161 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
162 tfm x+,y+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
163 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
164 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
165 ReadLp lda ,x+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
166 sta ,y+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
167 decb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
168 bne ReadLp
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
169 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
170 * 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
171 GetStat clrb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
172 L00A7 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
173
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
174 L00A5 puls y,x,pc
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 start bra Init
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
177 nop
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
178 bra Read
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 Write
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 GetStat
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 Actually SetStat (no calls, so same routine)
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 lbra L0024 Terminate (returns memory)
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
187
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
188 * Entry: B:X = LSN to write
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
189 * Y=Path dsc. ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
190 * U=Device mem ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
191 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
192 bcs L00A7 Error,exit with it
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
193 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
194 * 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
195 * 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
196 L00AE orcc #IntMasks Shut IRQ's off
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
197 pshs x Preserve X
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
198 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
199 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
200 puls x Get X back
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
201 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
202 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
203 ldw #$0100 256 byte transfer
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
204 tfm x+,y+ Copy between the two buffers
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
205 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
206 clrb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
207 WriteLp lda ,x+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
208 sta ,y+
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
209 decb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
210 bne WriteLp
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
211 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
212 stb >$FFA0 Remap in system block 0
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
213 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
214 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
215
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
216 * 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
217 * Entry: Y=path dsc. ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
218 * U=device mem ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
219 * B:X=LSN to calculate for
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
220 * 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
221 * 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
222 * Y=Sector buffer ptr for RBF
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
223 * MDFlag,u=0 if NOT MD, else MD
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
224 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
225 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
226 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
227 ldw V$DESC,w Get device descriptor ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
228 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
229 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
230 pshs x
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
231 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
232 ldx V$DESC,x Get device descriptor ptr
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
233 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
234 puls x
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
235 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
236 deca
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
237 bne L00DB Not MD, skip ahead
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
238 inc MDFlag,u Flag we are on MD
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
239 sta <PD.SIZ,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
240 sta <PD.SIZ+3,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
241 sta <PD.SSZ,y
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
242 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
243 subd <D.BlkMap Calc # of blocks of RAM
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
244 lda #32 * 32 for # of 'sectors'
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
245 mul
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
246 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
247 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
248 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
249
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
250 L00DB tstb Test MSB of sector #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
251 bne L010F <>0, exit with Sector error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
252 L00DE pshs x Preserve LSW of sector #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
253 ldd ,s Load it again into D
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
254 tst MDFlag,u We on MD?
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
255 bne L00EE Yes, skip ahead
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
256 leax DRVBEG,u Point to drive table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
257 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
258 bhs L010E Sector # too large, exit with error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
259 L00EE equ *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
260 IFNE H6309
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
261 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
262 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
263 rold
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
264 ELSE
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
265 rolb
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
266 rola
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 ENDC
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
272 tst MDFlag,u We on /MD?
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
273 bne L0100 Yup, skip calculating MMU stuff
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
274 leax <MMUTable,u Point to MMU table
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
275 lda a,x Get MMU block # we want
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
276 beq L010E If 0, exit with sector error
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
277 L0100 pshs a Save block #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
278 clrb Calculate offset within 8k block we want
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
279 lda 2,s
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
280 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
281 std 1,s Save offset
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
282 ldy PD.BUF,y Get sector buffer address
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
283 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
284
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
285 L010E leas 2,s Eat X on stack
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
286 L010F comb Exit with bad sector #
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
287 ldb #E$Sect
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
288 rts
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
289
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
290 emod
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
291 eom equ *
339845ea3507 Backported rammer.asm from NitrOS-9 to OS-9 Level Two
boisy
parents:
diff changeset
292 end