smaller references

This commit is contained in:
Kamila Szewczyk 2023-11-12 19:29:17 +01:00
parent f337457b94
commit 42fae5dd39
Signed by: Palaiologos
GPG Key ID: E34D7BADA3DACC14
10 changed files with 942 additions and 42565 deletions

View File

@ -27,13 +27,13 @@ function do_stat {
# 20MB cutoff.
ss=$(du ref_$1 | cut -f-1)
bz_stat=$(cat ref_$1 $src | head -c 20000000 | bzip3 -eb $size | wc -c)
bz_ref=$(cat ref_$1 | bzip3 -eb $size | wc -c)
bz_sim=$(python3 -c "print(1/((($bz_stat - min($bz_ref, $bz3)) / (max($bz_ref, $bz3)))-1))")
bz_stat=$(cat ref_$1 $src | head -c 20000000 | bzip3 -cefb $size | wc -c)
bz_ref=$(cat ref_$1 | bzip3 | wc -c)
bz_sim=$(python3 -c "print(100*($bz_stat - min($bz_ref, $bz3)) / (max($bz_ref, $bz3)))")
lz_stat=$(cat ref_$1 $src | head -c 20000000 | lz4 -1c | wc -c)
lz_ref=$(cat ref_$1 | lz4 -1c | wc -c)
lz_sim=$(python3 -c "print(1000*($ss/$abs)*(1-($lz_stat - min($lz_ref, $lz4)) / (max($lz_ref, $lz4))))")
lz_sim=$(python3 -c "print(100*($lz_stat - min($lz_ref, $lz4)) / (max($lz_ref, $lz4)))")
echo "BZ3: $bz_sim, LZ4: $lz_sim"
}

708
ref_6502
View File

@ -1,706 +1,8 @@
*=$1000
LDA #$00
STA REV
JSR Init_6551
CHESS CLD
LDX #$FF
TXS
LDX #$C8
STX SP2
OUT JSR pout
JSR KIN
CMP #$43
BNE NOSET
LDX #$1F
WHSET LDA SETW,X
STA BOARD,X
DEX
BPL WHSET
LDX #$1B
STX OMOVE
LDA #$CC
BNE CLDSP
NOSET CMP #$45
BNE NOREV
JSR REVERSE
SEC
LDA #$01
SBC REV
STA REV
LDA #$EE
BNE CLDSP
NOREV CMP #$40
BNE NOGO
JSR GO
CLDSP STA DIS1
STA DIS2
STA DIS3
BNE CHESS
NOGO CMP #$0D
BNE NOMV
JSR MOVE
JMP DISP
NOMV CMP #$41
BEQ DONE
JMP INPUT
DONE JMP $FF00
JANUS LDX STATE
BMI NOCOUNT
COUNTS LDA PIECE
BEQ OVER
CPX #$08
BNE OVER
CMP BMAXP
BEQ XRT
OVER INC MOB,X
CMP #$01
BNE NOQ
INC MOB,X
NOQ BVC NOCAP
LDY #$0F
LDA SQUARE
ELOOP CMP BK,Y
BEQ FOUN
DEY
BPL ELOOP
FOUN LDA POINTS,Y
CMP MAXC,X
BCC LESS
STY PCAP,X
STA MAXC,X
LESS CLC
PHP
ADC CC,X
STA CC,X
PLP
NOCAP CPX #$04
BEQ ON4
BMI TREE
XRT RTS
ON4 LDA XMAXC
STA WCAP0
LDA #$00
STA STATE
JSR MOVE
JSR REVERSE
JSR GNMZ
JSR REVERSE
LDA #$08
STA STATE
JSR UMOVE
JMP STRATGY
NOCOUNT CPX #$F9
BNE TREE
LDA BK
CMP SQUARE
BNE RETJ
LDA #$00
STA INCHEK
RETJ RTS
TREE BVC RETJ
LDY #$07
LDA SQUARE
LOOPX CMP BK,Y
BEQ FOUNX
DEY
BEQ RETJ
BPL LOOPX
FOUNX LDA POINTS,Y
CMP BCAP0,X
BCC NOMAX
STA BCAP0,X
NOMAX DEC STATE
LDA #$FB
CMP STATE
BEQ UPTREE
JSR GENRM
UPTREE INC STATE
RTS
INPUT CMP #$08
BCS ERROR
JSR DISMV
DISP LDX #$1F
SEARCH LDA BOARD,X
CMP DIS2
BEQ HERE
DEX
BPL SEARCH
HERE STX DIS1
STX PIECE
ERROR JMP CHESS
GNMZ LDX #$10
GNMX LDA #$00
CLEAR STA COUNT,X
DEX
BPL CLEAR
GNM LDA #$10
STA PIECE
NEWP DEC PIECE
BPL NEX
RTS
NEX JSR RESET
LDY PIECE
LDX #$08
STX MOVEN
CPY #$08
BPL PAWN
CPY #$06
BPL KNIGHT
CPY #$04
BPL BISHOP
CPY #$01
BEQ QUEEN
BPL ROOK
KING JSR SNGMV
BNE KING
BEQ NEWP
QUEEN JSR LINE
BNE QUEEN
BEQ NEWP
ROOK LDX #$04
STX MOVEN
AGNR JSR LINE
BNE AGNR
BEQ NEWP
BISHOP JSR LINE
LDA MOVEN
CMP #$04
BNE BISHOP
BEQ NEWP
KNIGHT LDX #$10
STX MOVEN
AGNN JSR SNGMV
LDA MOVEN
CMP #$08
BNE AGNN
BEQ NEWP
PAWN LDX #$06
STX MOVEN
P1 JSR CMOVE
BVC P2
BMI P2
JSR JANUS
P2 JSR RESET
DEC MOVEN
LDA MOVEN
CMP #$05
BEQ P1
P3 JSR CMOVE
BVS NEWP
BMI NEWP
JSR JANUS
LDA SQUARE
AND #$F0
CMP #$20
BEQ P3
JMP NEWP
SNGMV JSR CMOVE
BMI ILL1
JSR JANUS
ILL1 JSR RESET
DEC MOVEN
RTS
LINE JSR CMOVE
BCC OVL
BVC LINE
OVL BMI ILL
PHP
JSR JANUS
PLP
BVC LINE
ILL JSR RESET
DEC MOVEN
RTS
REVERSE LDX #$0F
ETC SEC
LDY BK,X
LDA #$77
SBC BOARD,X
STA BK,X
STY BOARD,X
SEC
LDA #$77
SBC BOARD,X
STA BOARD,X
DEX
BPL ETC
RTS
CMOVE LDA SQUARE
LDX MOVEN
CLC
ADC MOVEX,X
STA SQUARE
AND #$88
BNE ILLEGAL
LDA SQUARE
LDX #$20
LOOP DEX
BMI NO
CMP BOARD,X
BNE LOOP
CPX #$10
BMI ILLEGAL
LDA #$7F
ADC #$01
BVS SPX
NO CLV
SPX LDA STATE
BMI RETL
CMP #$08
BPL RETL
CHKCHK PHA
PHP
LDA #$F9
STA STATE
STA INCHEK
JSR MOVE
JSR REVERSE
JSR GNM
JSR RUM
PLP
PLA
STA STATE
LDA INCHEK
BMI RETL
SEC
LDA #$FF
RTS
RETL CLC
LDA #$00
RTS
ILLEGAL LDA #$FF
CLC
CLV
RTS
RESET LDX PIECE
LDA BOARD,X
STA SQUARE
RTS
GENRM JSR MOVE
GENR2 JSR REVERSE
JSR GNM
RUM JSR REVERSE
UMOVE TSX
STX SP1
LDX SP2
TXS
PLA
STA MOVEN
PLA
STA PIECE
TAX
PLA
STA BOARD,X
PLA
TAX
PLA
STA SQUARE
STA BOARD,X
JMP STRV
MOVE TSX
STX SP1
LDX SP2
TXS
LDA SQUARE
PHA
TAY
LDX #$1F
CHECK CMP BOARD,X
BEQ TAKE
DEX
BPL CHECK
TAKE LDA #$CC
STA BOARD,X
TXA
PHA
LDX PIECE
LDA BOARD,X
STY BOARD,X
PHA
TXA
PHA
LDA MOVEN
PHA
STRV TSX
STX SP2
LDX SP1
TXS
RTS
CKMATE LDY BMAXC
CPX POINTS
BNE NOCHEK
LDA #$00
BEQ RETV
NOCHEK LDX BMOB
BNE RETV
LDX WMAXP
BNE RETV
LDA #$FF
RETV LDX #$04
STX STATE
PUSH CMP BESTV
BCC RETP
BEQ RETP
STA BESTV
LDA PIECE
STA BESTP
LDA SQUARE
STA BESTM
RETP LDA #"."
Jmp syschout
GO LDX OMOVE
BMI NOOPEN
LDA DIS3
CMP OPNING,X
BNE END
DEX
LDA OPNING,X
STA DIS1
DEX
LDA OPNING,X
STA DIS3
DEX
STX OMOVE
BNE MV2
END LDA #$FF
STA OMOVE
NOOPEN LDX #$0C
STX STATE
STX BESTV
LDX #$14
JSR GNMX
LDX #$04
STX STATE
JSR GNMZ
LDX BESTV
CPX #$0F
BCC MATE
MV2 LDX BESTP
LDA BOARD,X
STA BESTV
STX PIECE
LDA BESTM
STA SQUARE
JSR MOVE
JMP CHESS
MATE LDA #$FF
RTS
DISMV LDX #$04
DROL ASL DIS3
ROL DIS2
DEX
BNE DROL
ORA DIS3
STA DIS3
STA SQUARE
RTS
STRATGY CLC
LDA #$80
ADC WMOB
ADC WMAXC
ADC WCC
ADC WCAP1
ADC WCAP2
SEC
SBC PMAXC
SBC PCC
SBC BCAP0
SBC BCAP1
SBC BCAP2
SBC PMOB
SBC BMOB
BCS POS
LDA #$00
POS LSR
CLC
ADC #$40
ADC WMAXC
ADC WCC
SEC
SBC BMAXC
LSR
CLC
ADC #$90
ADC WCAP0
ADC WCAP0
ADC WCAP0
ADC WCAP0
ADC WCAP1
SEC
SBC BMAXC
SBC BMAXC
SBC BMCC
SBC BMCC
SBC BCAP1
LDX SQUARE
CPX #$33
BEQ POSN
CPX #$34
BEQ POSN
CPX #$22
BEQ POSN
CPX #$25
BEQ POSN
LDX PIECE
BEQ NOPOSN
LDY BOARD,X
CPY #$10
BPL NOPOSN
POSN CLC
ADC #$02
NOPOSN JMP CKMATE
POUT jsr pout9
jsr pout13
JSR POUT10
LDY #$00
JSR POUT5
POUT1 lDA #"|"
JSR syschout
LDX #$1F
POUT2 TYA
match
CMP BOARD,X
BEQ POUT4
type
DEX
BPL POUT2
tya
and #$01
sta temp
tya
lsr
lsr
lsr
lsr
and #$01
clc
adc temp
square color
and #$01
bne pout25
lda #"*"
.byte $2c
POUT25 LDA #$20
JSR syschout
JSR syschout
POUT3 INY
TYA
AND #$08
BEQ POUT1
LDA #"|"
JSR syschout
jsr pout12
JSR POUT9
JSR POUT5
CLC
TYA
ADC #$08
TAY
CPY #$80
BEQ POUT8
BNE POUT1
POUT4 LDA REV
BEQ POUT41
LDA cpl+16,X
BNE POUT42
POUT41 LDA cpl,x
POUT42 JSR syschout
lda cph,x
jsr syschout
BNE POUT3
POUT5 TXA
PHA
LDX #$19
LDA #"-"
POUT6 JSR syschout
DEX
BNE POUT6
PLA
TAX
JSR POUT9
RTS
POUT8 jsr pout10
LDA $FB
JSR syshexout
LDA #$20
JSR syschout
LDA $FA
JSR syshexout
LDA #$20
JSR syschout
LDA $F9
JSR syshexout
POUT9 LDA #$0D
JSR syschout
LDA #$0A
JSR syschout
RTS
pout10 ldx #$00
POUT11 lda #$20
jsr syschout
txa
jsr syshexout
INX
CPX #$08
BNE POUT11
BEQ POUT9
POUT12 TYA
and #$70
JSR syshexout
rts
Pout13 ldx #$00
Pout14 lda banner,x
beq POUT15
jsr syschout
inx
bne POUT14
POUT15 rts
KIN LDA #"?"
JSR syschout
JSR syskin
AND #$4F
RTS
Init_6551 lda #$1F
sta ACIActl
lda #$0B
dtr active low
sta ACIAcmd
rts
syskin lda ACIASta
and #$08
beq syskin
Lda ACIAdat
RTS
syschout PHA
ACIA_Out1 lda ACIASta
and #$10
beq ACIA_Out1
PLA
sta ACIAdat
RTS
syshexout PHA
LSR
LSR
LSR
LSR
JSR PrintDig
PLA
PrintDig PHY
AND #$0F
TAY
LDA Hexdigdata,Y
PLY
jmp syschout
TMP EQU $6
WEEKDAY:
CPX #3
BCS MARCH
DEY
MARCH EOR #$7F
CPY #200
ADC MTAB-1,X
STA TMP
TYA
JSR MOD7
SBC TMP
STA TMP
TYA
LSR
LSR
CLC
ADC TMP
MOD7 ADC #7
BCC MOD7
RTS
AST 32
JSR SAVE
PLA
STA R15L
PLA
STA R15H
SW16B JSR SW16C
JMP SW16B
SW16C INC R15L
BNE SW16D
INC R15H
SW16D LDA >SET
PHA
LDY $0
LDA (R15L),Y
AND $F
ASL
TAX
LSR
EOR (R15L),Y
BEQ TOBR
STX R14H
LSR
LSR
LSR
TAY
LDA OPTBL-2,Y
PHA
RTS
TOBR INC R15L
BNE TOBR2
INC R15H
TOBR2 LDA BRTBL,X
PHA
LDA R14H
LSR
RTS
RTNZ PLA
PLA
JSR RESTORE
JMP (R15L)
SETZ LDA (R15L),Y
STA R0H,X
DEY
LDA (R15L),Y
STA R0L,X
TYA
SEC
ADC R15L
STA R15L
BCC SET2
INC R15H
SET2 RTS
OPTBL DFB SET-1
BRTBL DFB RTN-1
DFB LD-1
DFB BR-1
DFB ST-1
DFB BNC-1
DFB LDAT-1
DFB BC-1
DFB STAT-1
DFB BP-1
DFB LDDAT-1
DFB BM-1
DFB STDAT-1
DFB BZ-1
DFB POP-1
DFB BNZ-1
DFB STPAT-1
DFB BM1-1
DFB ADD-1
DFB BNM1-1
DFB SUB-1
DFB BK-1
DFB POPD-1
DFB RS-1
DFB CPR-1
DFB BS-1
DFB INR-1
DFB NUL-1
DFB DCR-1
DFB NUL-1
DFB NUL-1
DFB NUL-1
ADC AND ASL BCC BCS BEQ BIT BMI BNE BPL BRA BRK BVC BVS
CLC CLD CLI CLV CMP CPX CPY DEC DEX DEY EOR INC INX INY
JMP JSR LDA LDX LDY LSR NOP ORA PHA PHP PHX PHY PLA PLP
PLX PLY ROL ROR RTI RTS SBC SEC SED SEI STA STP STX STY
STZ TAX TAY TRB TSB TSX TXA TXS TYA WAI
SET BPL SETZ
LD LDA R0L,X
BK EQU *-1

2012
ref_apl

File diff suppressed because it is too large Load Diff

3403
ref_c

File diff suppressed because it is too large Load Diff

3876
ref_cpp

File diff suppressed because it is too large Load Diff

8377
ref_java

File diff suppressed because it is too large Load Diff

7284
ref_sh

File diff suppressed because it is too large Load Diff

3144
ref_x64

File diff suppressed because it is too large Load Diff

4575
ref_x86

File diff suppressed because it is too large Load Diff

9114
ref_z80

File diff suppressed because it is too large Load Diff