RAMdisk next version! (was bbs: ram_disk)
ZXNet echo conference «code.zx»
From Denis Parinov → To Aleksandr Majorov 24 June 1997
* Message from gate SpbZxNet<=>FidoNet.
The other day, June 21, 97, at 04:16, Aleksandr Majorov wrote to Denis Parinov:
Glad to welcome you, Aleksandr!
AM>>> I will give a list of all restarts later...
DP>> Kada?
AM> soon, soon...
AM> SO you will regret this...
Z8-( ) Already regretted it!!!
AM> --------------- henceva ---------------
[skip]
LD L,A
LD H,0 ; We count
ADD HL,HL ; initial
ADD HL,HL ; address(offset)
ADD HL,HL ; on ramdisk
ADD HL,HL
EX AF,AF'
ADD A,L
JP NC,L000
INC H
L000 LD L,A
AM> -------------- to here ----------------
AM> ps-s-s!
AM> Glitch: as far as I understand, you are the sector number
AM> [E] add to junior. byte address?
AM> So the size of the sec is 256 bytes = #0100
Well, I knew that there was someone in my creation
will get confused :( in HL we have an offset in sectors
see below, not in bytes.
AM> Next: by counting this type we lose
AM> there are 7 sectors on the ram disk! 1792 bytes!!!
AM> (tkr0, sec 9...15)!!!Well, I already asked - a regular disk or a custom format.
AM> And now to the point:
AM> just the main 128K touch nizz, i.e.
AM> the ram disk takes over the upper memory =>
AM> there is no need for a page label.
Hehe, how can I not touch it, but how can I load it into it?
Okay, let's repeat:
FIRST_B EQU 8 ; RAMdisk starts with
; logic bank 8
POINT1 RET ; Reserve for propeller
NOP
NOP
POINT2 LD A,E ; Entry point.
EX AF,AF'
LD A,D ; Take track 'D'
PUSH HL
EXX
LD L,A ; We count
LD H,0 ; how much
ADD HL,HL ; it will be
ADD HL,HL ; in sectors
ADD HL,HL ;
ADD HL,HL ;
EX AF,AF'
ADD A,L ; add
JP NC,L000 ; sectors from 'E'
INC H ; in HL we have a displacement
L000 LD L,A ; _in sectors_
; LD DE,7
; AND A
; SBC HL,DE
; somewhere here 7 sectors must be taken away
; if the track is not zero, so that the memory
; save money ;)
EXX
LD A,C ; remember the command
EX AF,AF' ; read/write
LD A,B
LD C,#10 ; we do
ADD A,E ; E + B = Total sectors
L001 CCFSUB C; take away the track
JP C,L002 ; if the tracks are over!
INC D ; otherwise we'll sell it.
JP L001
L002 ADD A,C
LD E,A ; put in 'E'
EXX
LD BC,#0040 ; we think
LD A,FIRST_B ; bank
NBANK SBC HL,BC ; - #40 sectors (bank)
JP C,BANK_OK
INC A
JP NBANK
BANK_OK ADD HL,BC
LD (FROMRAM+1),A ;read from the received bank
LD A,(IY+5) ; bank to which
AND #07
LD (TORAM+1),A ; read/write
LD H,L ; in HL offset in sectors
LD L,0 ; within one bank
LD DE,#C000 ; multiply by 256 add
ADD HL,DE ; bank start address
EX AF,AF' ; in HL we have an address on RAM
OR A ; What kind of team was it?
JP Z,NOSAVE ; reading.
EX (SP),HL ; no entry.
LD A,(FROMRAM+1)
LD (TORAM+1),A ; change parameters
LD A,(IY+5) ; on the contrary
AND #07
LD(FROMRAM+1),A
NOSAVE EXX
LD A,B
EXX
LOADING EX AF,AF'
CALL FROMRAM ; Source bank
LD DE,BUF
LD BC,#0100
LDIR
BIT 7,H ; this was the last one.
CALL Z, INCFROM ; bank sector
EX (SP),HL
EX DE,HL
CALL TORAM ; Destination bank
LD HL,BUFLD BC,#0100
LDIR
EX DE,HL
BIT 7,H
CALL Z,INCTO
EX (SP),HL
EX AF,AF'
DEC A
JP NZ,LOADING
LD BC,#1FFD ; Off расширенную память
XOR A
OUT (C),A
LD A,(IY+5)
OR #10
LD B,#7F
OUT (C),A
EXX
POP HL
RET
INCTO LD A,(TORAM+1)
INC A
LD (TORAM+1),A
SET 7,H
SET 6,H
RET
TORAM LD A,#00
PUSH HL
PUSH BC
LD B,0
LD C,A
LD HL,RAMS
ADD HL,BC
LD BC,#1FFD
LD A,(HL)
LD L,A
RLCA
AND #10
OUT (C),A
LD A,L
LD B,#7F
AND #07
OR #10
OUT (C),A
POP BC
POP HL
RET
INCFROM LD A,(FROMRAM+1)
INC A
LD (FROMRAM+1),A
SET 7,H
SET 6,H
RET
FROMRAM LD A,#00
PUSH HL
PUSH BC
LD B,0
LD C,A
LD HL,RAMS
ADD HL,BC
LD BC,#1FFD
LD A,(HL)
LD L,A
RLCA
AND #10
OUT (C),A
LD B,#7F
LD A,L
AND #07
OR #10
OUT (C),A
POP BC
POP HL
RET
RAMS DB #00,#01,#03,#04,#05,#06,#07 ;128K memory
DB #0F,#0E,#0D,#0C,#0B,#0A,#09,#08 ;перевернутый RAMdisk; What about the table, IMHO it’s better with it
; then you can configure the RAMdisk
; so as not to erase the shadow!
BUF DS 256.0 ; sector buffer
I made the program on Scorpion, but _didn’t test it_! Sprinter here
I'll make friends with the debugger then it will be a different matter.
P.S. By the way, what if your computer has a 14 or 28 MHz processor?
MMDshku make friends? Please put on the brakes :(? Reluctantly!
AM> And I...this one, what's my name?.... Ah!
AM> Aleksandr (*MAS*)
Best regards, Denis.
-+- ZX WORD 2.5+
+ Origin: SpbZxNet.org (812/08.16)