mirror of
https://github.com/dwsJason/xrick2gs.git
synced 2025-01-17 13:29:53 +00:00
Update Makefile to assembling files in asm directory, with ORCA assembler, update LZ4.s to work with ORCA assembler, update LZ4.s so it can be called from ORCA/C, add code to xrick.c to prove that it works
This commit is contained in:
parent
4daa62fde9
commit
cf7eac86cc
9
Makefile
9
Makefile
@ -36,7 +36,9 @@
|
||||
|
||||
VPATH = src:obj
|
||||
SOURCEFILES = $(wildcard src/*.c)
|
||||
ASMFILES = $(wildcard asm/*.s)
|
||||
OBJFILES = $(patsubst src/%.c,obj/%.a,$(SOURCEFILES))
|
||||
OBJFILES += $(patsubst asm/%.s,obj/%.a,$(ASMFILES))
|
||||
CC = iix compile
|
||||
CFLAGS = cc=-DIIGS=1 cc=-Iinclude cc=-Isrc
|
||||
# List of directories to create
|
||||
@ -58,10 +60,11 @@ help:
|
||||
xrick.lib: $(OBJFILES)
|
||||
@echo Y | del xrick.lib
|
||||
iix makelib -P xrick.lib $(patsubst %,+%,$(OBJFILES))
|
||||
# iix makelib -P xrick.lib test.obj
|
||||
|
||||
xrick.sys16: xrick.lib
|
||||
# iix link +L obj\xrick xrick.lib keep=xrick.sys16
|
||||
iix link obj\xrick xrick.lib keep=xrick.sys16
|
||||
iix link obj\xrick xrick.lib data.lib keep=xrick.sys16
|
||||
|
||||
gs: xrick.sys16
|
||||
|
||||
@ -93,5 +96,9 @@ obj/%.a : src/%.c
|
||||
@echo Compiling $(<F)
|
||||
@$(CC) -P -I +O $< keep=$(basename $@) $(CFLAGS)
|
||||
|
||||
obj/%.a : asm/%.s
|
||||
@echo Assembling $(<F)
|
||||
@$(CC) -P -I +O $< keep=$(basename $@) $(CFLAGS)
|
||||
|
||||
# Create all the directories
|
||||
$(shell if not exist $(DIRS) mkdir $(DIRS))
|
||||
|
93
asm/LZ4.s
93
asm/LZ4.s
@ -1,8 +1,77 @@
|
||||
*
|
||||
* ORCA/M Format!!
|
||||
* LZ4 Decompress by Brutal Deluxe!!!
|
||||
*
|
||||
case on
|
||||
longa on
|
||||
longi on
|
||||
|
||||
MX %00
|
||||
Dummy1 start ASMCODE
|
||||
end
|
||||
|
||||
*
|
||||
* int LZ4_Unpack(u8* pDest, u8* pPackedSource);
|
||||
*
|
||||
|
||||
LZ4_Unpack start ASMCODE
|
||||
|
||||
pDest equ 5
|
||||
pPackedSource equ 9
|
||||
|
||||
phb
|
||||
phk
|
||||
plb
|
||||
|
||||
sep #$20
|
||||
lda pPackedSource+2,s ; Pull out the src/dst banks
|
||||
xba
|
||||
lda pDest+2,s ; Pull out the src/dst banks
|
||||
|
||||
rep #$31
|
||||
tax ; Temp save in X
|
||||
|
||||
lda pDest,s
|
||||
sta LZ4_Dst+1
|
||||
|
||||
lda pPackedSource+1,s ; address of packed source + 4, is the unpacked len
|
||||
sta upl+2
|
||||
|
||||
lda pPackedSource,s
|
||||
adc #12
|
||||
sta upl+1
|
||||
|
||||
upl lda >0 ; packed length
|
||||
adc #16 ; 16 bytes for packed buffer header
|
||||
adc pPackedSource,s ; start of packed buffer
|
||||
tay ; y has the pack data stop address
|
||||
|
||||
anop ; 1st packed Byte offset
|
||||
lda pPackedSource,s ; skip 16 byte header on the source
|
||||
adc #16
|
||||
pha
|
||||
txa
|
||||
plx
|
||||
|
||||
jsr ASM_LZ4_Unpack
|
||||
tay
|
||||
|
||||
anop ; Copy the Return address
|
||||
lda 1,s
|
||||
sta pPackedSource,s
|
||||
lda 3,s
|
||||
sta pPackedSource+2,s
|
||||
|
||||
tsc
|
||||
sec
|
||||
sbc #-8
|
||||
tcs
|
||||
tya ; return length
|
||||
|
||||
plb
|
||||
rtl
|
||||
|
||||
*-------------------------------------------------------------------------------
|
||||
LZ4_Unpack STA LZ4_Literal_3+1 ; Uncompress a LZ4 Packed Data buffer (64 KB max)
|
||||
ASM_LZ4_Unpack STA LZ4_Literal_3+1 ; Uncompress a LZ4 Packed Data buffer (64 KB max)
|
||||
SEP #$20 ; A = Bank Src,Bank Dst
|
||||
STA LZ4_Match_5+1 ; X = Header Size = 1st Packed Byte offset
|
||||
STA LZ4_Match_5+2 ; Y = Pack Data Size
|
||||
@ -13,8 +82,8 @@ LZ4_Unpack STA LZ4_Literal_3+1 ; Uncompress a LZ4 Packed Data buffer (6
|
||||
REP #$30
|
||||
STY LZ4_Limit+1
|
||||
*--
|
||||
LDY #$0000 ; Init Target unpacked Data offset
|
||||
LZ4_ReadToken LDAL $AA0000,X ; Read Token Byte
|
||||
LZ4_Dst LDY #$0000 ; Init Target unpacked Data offset
|
||||
LZ4_ReadToken LDA >$AA0000,X ; Read Token Byte
|
||||
INX
|
||||
STA LZ4_Match_2+1
|
||||
*----------------
|
||||
@ -24,12 +93,12 @@ LZ4_Literal AND #$00F0 ; >>> Process Literal Bytes <<<
|
||||
BNE LZ4_Literal_1
|
||||
JSR LZ4_GetLengthLit ; Compute Literal Length with next bytes
|
||||
BRA LZ4_Literal_2
|
||||
LZ4_Literal_1 LSR ; Literal Length use the 4 bit
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LZ4_Literal_1 LSR A ; Literal Length use the 4 bit
|
||||
LSR A
|
||||
LSR A
|
||||
LSR A
|
||||
*--
|
||||
LZ4_Literal_2 DEC ; Copy A+1 Bytes
|
||||
LZ4_Literal_2 DEC A ; Copy A+1 Bytes
|
||||
LZ4_Literal_3 MVN $AA,$BB ; Copy Literal Bytes from packed data buffer
|
||||
PHK ; X and Y are auto incremented
|
||||
PLB
|
||||
@ -39,7 +108,7 @@ LZ4_Limit CPX #$AAAA ; End Of Packed Data buffer ?
|
||||
*----------------
|
||||
LZ4_Match TYA ; >>> Process Match Bytes <<<
|
||||
SEC
|
||||
LZ4_Match_1 SBCL $AA0000,X ; Match Offset
|
||||
LZ4_Match_1 SBC >$AA0000,X ; Match Offset
|
||||
INX
|
||||
INX
|
||||
STA LZ4_Match_4+1
|
||||
@ -63,7 +132,7 @@ LZ4_Match_5 MVN $BB,$BB ; Copy Match Bytes from unpacked data bu
|
||||
*----------------
|
||||
LZ4_GetLengthLit LDA #$000F ; Compute Variable Length (Literal or Match)
|
||||
LZ4_GetLengthMat STA LZ4_GetLength_2+1
|
||||
LZ4_GetLength_1 LDAL $AA0000,X ; Read Length Byte
|
||||
LZ4_GetLength_1 LDA >$AA0000,X ; Read Length Byte
|
||||
INX
|
||||
AND #$00FF
|
||||
CMP #$00FF
|
||||
@ -78,3 +147,5 @@ LZ4_GetLength_3 ADC LZ4_GetLength_2+1
|
||||
LZ4_End TYA ; A = Length of Unpack Data
|
||||
RTS
|
||||
*-------------------------------------------------------------------------------
|
||||
end
|
||||
|
||||
|
25
src/xrick.c
25
src/xrick.c
@ -21,13 +21,38 @@
|
||||
//extern void waitkey();
|
||||
//extern void fbuffer();
|
||||
|
||||
extern char title_lz4;
|
||||
|
||||
char *VIDEO = (char*)0xE1C029;
|
||||
|
||||
extern int LZ4_Unpack(char* pDest, char* pPackedSource);
|
||||
|
||||
/*
|
||||
* main
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
//char *pChar = &testtext;
|
||||
|
||||
printf("Hello from xrick IIgs\n");
|
||||
|
||||
printf("Unpacking Splash!");
|
||||
|
||||
LZ4_Unpack((char*)(0xE12000), &title_lz4);
|
||||
|
||||
//while (pChar[0])
|
||||
//{
|
||||
// pChar[0]|=0x80;
|
||||
// pChar++;
|
||||
//}
|
||||
|
||||
// printf("%s\n", &testtext);
|
||||
|
||||
// SHR ON
|
||||
*VIDEO|=0xC0;
|
||||
|
||||
|
||||
// waitkey();
|
||||
// fbuffer();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user