More progress on ProRWTS.

This commit is contained in:
Martin Haye 2017-01-04 15:05:43 -08:00
parent dd061c37c3
commit e21f6cb423
8 changed files with 52 additions and 43 deletions

View File

@ -1240,7 +1240,6 @@ class A2PackPartitions
assert compressedLen > 0
// If we saved at least 10 bytes, take the compressed version.
println "TODO: Put back compression"
if (false && (uncompressedLen - compressedLen) >= 10) {
if (debugCompression)
println String.format(" Compress. rawLen=\$%x compLen=\$%x", uncompressedLen, compressedLen)

View File

@ -12,7 +12,7 @@ import java.util.Arrays;
public class Lx47Algorithm
{
static final int MAX_OFFSET = 16384; /* range 1..65536 */
static final int MAX_LEN = 256; /* range 2..65536 */
static final int MAX_LEN = 255; /* range 2..65536 */
static final int OFFSET_EXP_BITS = 6;
LinkedList<String> debugs = new LinkedList<String>();
@ -421,15 +421,6 @@ public class Lx47Algorithm
}
public byte[] compress(byte[] input_data) {
if (false) {
input_data = "hellohelloabchello".getBytes();
byte[] testComp = compressOptimal(optimize(input_data), input_data);
byte[] testDecomp = new byte[input_data.length];
decompress(testComp, 0, testDecomp, 0, input_data.length);
assert Arrays.equals(input_data, testDecomp);
System.out.println("Good!");
System.exit(1);
}
return compressOptimal(optimize(input_data), input_data);
}
}

View File

@ -1709,8 +1709,8 @@ hddsetaux sta CLRAUXRD, x
sta blokhi
pla
sta sizehi
dec adrhi
dec adrhi
; dec adrhi ; MH: this causes the F800 buffer (containing the key block contents)
; dec adrhi ; to be read instead of FA00 (containing the file's data)
hddcopycache
!if enable_seek = 1 {
ldy reqcmd

View File

@ -35,16 +35,38 @@ pRun = $82 ; len 2
decomp = $DF00
init ; Init pointer to blocks we're going to move/decompress
lda #<dataStart
init ; Put something interesting on the screen :)
sta clr80Vid
jsr ROM_setnorm
jsr ROM_setkbd
jsr ROM_setvid
jsr ROM_home
ldy #0
- lda .welcomeText,y
beq +
jsr ROM_cout
iny
bne -
.welcomeText: !text "Welcome to LegendOS.",$8D,0
; Init pointer to blocks we're going to move/decompress
+ lda #<dataStart
sta pData
lda #>dataStart
sta pData+1
; temporary: copy ROM so we can debug decompressor
ldy #0
; First is the decompressor itself (special: just copy one page)
bit setLcWr+lcBank1 ; read from ROM, write to LC ram
bit setLcWr+lcBank1
; temporary: copy monitor ROM so we can debug decompressor
ldy #0
sty pSrc
ldx #$f8
-- stx pSrc+1
- lda (pSrc),y
sta (pSrc),y
iny
bne -
inx
bne --
; First is the decompressor itself (special: just copy one page)
jsr getBlk
- lda (pSrc),y
.st sta decomp,y

View File

@ -62,8 +62,8 @@ reseek_0 = $18 ; to reset seek ptr, zero out these 3 locs
reseek_1 = $1B
reseek_2 = $1C
proRWTS = $F600
opendir = proRWTS
rdwrpart = opendir+3
rdwrpart = proRWTS
opendir = rdwrpart+3
; Memory buffers
fileBuf = $4000 ; len $400
@ -83,27 +83,18 @@ gcHash_dstHi = $5500
;------------------------------------------------------------------------------
; Relocate all the pieces to their correct locations and perform patching.
relocate:
; Put something interesting on the screen :)
jsr ROM_home
ldy #0
- lda .welcomeText,y
beq +
jsr ROM_cout
iny
bne -
.welcomeText: !text "Welcome to LegendOS.",$8D,0
; special: clear most of the lower 48k and the ProDOS bank of the LC
+ bit setLcRW+lcBank1
bit setLcRW+lcBank1
ldy #0
bit setLcRW+lcBank1
tya
ldx #8
.clr1 stx .clrst1+2
stx .clrst2+2
ldy #0
.clrst1 sta $800,y
.clrst2 sta $880,y
iny
bpl .clrst1
bpl .clrst1 ; yes, bpl not bne, because we're doing 128 bytes per loop
inx
cpx #$40 ; skip our own unrelocated code $4000.4FFF
bne +
@ -172,6 +163,7 @@ relocate:
;------------------------------------------------------------------------------
init: !zone
; KLUDGE ALERT! Turning off IIc keyboard buffer as an experiment
; FIXME: This depends on ProDOS machine ID byte. ProRWTS doesn't have such a byte. Hmm...
lda $BF98 ; machine ID byte
and #$C8 ; mask just the machine bits
cmp #$88 ; Apple IIc?
@ -1324,11 +1316,7 @@ saneStart: !zone {
}
saneCheck: !zone {
lda $BF00
cmp #$4C
beq +
+internalErr 'S'
+ lda $E1
lda $E1
cmp #$BE
bcc +
+internalErr 's'
@ -1953,13 +1941,14 @@ openPartition: !zone
sta reqLen
lda #0
sta reqLen+1
lda #0 ; cmdread, for drive 1
lda #cmdread ; no hi bit => go to drive 1
sta tmp
jsr opendir
lda tmp+1 ; get status
bne .insert ; zero=ok, 1=err
jsr disk_reseek ; by opening, we did an implicit seek
lda #2 ; and we read 2 bytes
sta curMarkPos+1 ; by opening we did an implicit seek to zero
sta curMarkPos+2
lda #2 ; and then we read 2 bytes
sta curMarkPos
; read the full header
.opened lda headerBuf ; grab header size
@ -1969,11 +1958,13 @@ openPartition: !zone
lda headerBuf+1 ; hi byte too
sbc #0
sta reqLen+1
lda #<headerBuf
lda #<(headerBuf+2)
sta pDst
lda #>headerBuf
lda #>(headerBuf+2)
sta pDst+1
jmp disk_read
jsr disk_read
inc partFileOpen ; remember we've opened it now
rts
; ask user to insert the disk
; TODO: handle dual drive configuration
.insert +safeHome

View File

@ -36,6 +36,12 @@ clrAuxWr = $C004
setAuxWr = $C005
clrAuxZP = $C008
setAuxZP = $C009
clrC3Rom = $C00A
setC3Rom = $C00B
clr80Vid = $C00C
set80Vid = $C00D
clrAltCh = $C00E
setAltCh = $C00F
kbdStrobe = $C010
rdLCBnk2 = $C011 ;reading from LC bank $Dx 2
rdLCRam = $C012 ;reading from LC RAM