1345
|
1 **************************************************
|
|
2 * System Call: F$LDAXY
|
|
3 *
|
|
4 * Function: Load A [X,[Y]]
|
|
5 *
|
|
6 * Input: X = Block offset
|
|
7 * Y = DAT image pointer
|
|
8 *
|
|
9 * Output: A = data byte at X offset of Y
|
|
10 *
|
|
11 * Error: CC = C bit set; B = error code
|
|
12 *
|
1145
|
13 FLDAXY ldx R$X,u Get offset within block (S/B $0000-$1FFF)
|
|
14 ldy R$Y,u Get ptr to DAT block entry
|
|
15 bsr L0AC8 Go get byte
|
|
16 sta R$A,u Save in caller's A reg.
|
|
17 rts
|
|
18
|
|
19 * Entry: X=offset ($0000-$1fff) to get from block pointed to by Y (DAT entry
|
|
20 * format)
|
|
21 L0AC8 lda 1,y Get MMU block # to get data from
|
|
22 clrb Clear carry/setup for STB
|
|
23 pshs cc Preserve interrupt status/settings
|
|
24 orcc #IntMasks shut IRQ's off
|
1241
|
25 sta >DAT.Regs Map block into $0000-$1FFF
|
|
26 IFNE H6309
|
1624
|
27 brn L0AC8 short delay
|
1241
|
28 ENDC
|
1145
|
29 lda ,x Get byte
|
1241
|
30 stb >DAT.Regs Map block 0 into $0000-$1FFF
|
|
31 IFNE H6309
|
1624
|
32 brn L0AC8 short delay
|
1241
|
33 ENDC
|
1145
|
34 puls pc,cc Get interrupt status/(or turn on) & return
|
|
35
|
|
36 * Get 1st byte of LDDDXY - also used by many other routines
|
|
37 * Increments X on exit; adjusts X for within 8K block & Y (DAT img ptr)
|
|
38 LDAXY lda 1,y Get MMU block #
|
|
39 pshs b,cc
|
|
40 clrb
|
|
41 orcc #IntMasks Shut off interrupts
|
1241
|
42 sta >DAT.Regs Map in MMU block into slot 0
|
1145
|
43 lda ,x+ Get byte
|
1241
|
44 stb >DAT.Regs
|
|
45 * clr >DAT.Regs Map in MMU block #0 into slot 0
|
1145
|
46 * andcc #^IntMasks
|
|
47 puls b,cc
|
|
48 bra AdjBlk0
|
|
49
|
|
50 L0AEA leax >-DAT.BlSz,x Bump offset ptr to start of block again
|
|
51 leay 2,y Bump source MMU block up to next on in DAT Image
|
|
52 AdjBlk0 cmpx #DAT.BlSz Going to wrap out of our block?
|
|
53 bhs L0AEA Yes, go adjust
|
|
54 rts No, return
|
|
55
|
1345
|
56
|
|
57 **************************************************
|
|
58 * System Call: F$LDDXY
|
|
59 *
|
|
60 * Function: Load D [D+X,[Y]]
|
|
61 *
|
|
62 * Input: D = Offset to offset
|
|
63 * X = Offset
|
|
64 * Y = DAT image pointer
|
|
65 *
|
|
66 * Output: D = bytes address by [D+X,Y]
|
|
67 *
|
|
68 * Error: CC = C bit set; B = error code
|
|
69 *
|
1145
|
70 FLDDDXY ldd R$D,u Get offset to offset within DAT Image
|
|
71 leau R$X,u Point U to Offset
|
|
72 pulu x,y Y=Offset within DAT Image, X=DAT Image ptr
|
|
73 bsr L0B02 Go get 2 bytes
|
|
74 std -(R$X+3),u Save into caller's X
|
|
75 clrb No error & return
|
|
76 rts
|
|
77 * Get 2 bytes for LDDDXY (also called by other routines)
|
|
78 * Should simply map in 2 blocks, and do a LDD (don't have to worry about wrap)
|
|
79 L0B02 pshs u,y,x Preserve regs
|
|
80 IFNE H6309
|
|
81 addr d,x Point X to X+D
|
|
82 ELSE
|
|
83 leax d,x
|
|
84 ENDC
|
|
85 bsr AdjBlk0 Wrap address around for 1 block
|
|
86 ldu <D.SysDAT Get sys DAT Image ptr
|
|
87 * lda 1,u Get MMU block #0
|
|
88 clra system block 0 =0 always
|
|
89 ldb 3,u Get MMU block #1
|
|
90 tfr d,u make U=blocks to re-map in once done
|
|
91 lda 1,y Get MMU block #0
|
|
92 ldb 3,y Get MMU block #1
|
|
93 pshs cc Preserve int. status
|
|
94 orcc #IntMasks shut off int.
|
1241
|
95 std >DAT.Regs Map in both blocks
|
1145
|
96 ldd ,x Get 2 bytes
|
1241
|
97 stu >DAT.Regs Map original blocks in
|
1145
|
98 * tfr y,w Restore W
|
|
99 puls pc,u,y,x,cc Restore regs & return
|