💾 Archived View for mirrors.apple2.org.za › archive › apple2.caltech.edu › 8bit › games › inmate › d… captured on 2024-12-17 at 23:26:20.
View Raw
More Information
-=-=-=-=-=-=-
.LISTOF
SAVE DUDOBJ.ED
- SOURCE TO DUDOBJ
- FOR S-C MACRO ASSEMBLER
- COPYRIGHT 1991 BY PHIL GOETZ
.OR $1280 CLOSE TO APPLESOFT PROGRAM!
.TF DUDOBJ
LOW .EQ $1400 CLOSE TO END OF DUDOBJ!
HI .EQ $1800 LEAVES ABOUT $180 FOR STRINGS. MUST BE PAGE START.
SECTORS .EQ $19 BASIC PROGRAM POKES #SECTORS/PASS INTO HERE
- NEXT 6 LINES MUST NOT BE CHANGED
- AS THEY PASS INFO TO BASIC PROGRAM
JMP RWT
JMP PACK
JMP UNPACK
.DA LOW
.DA HI
FINDIOB JSR $3E3
STY $6
STA $7
RTS RTS
RWT JSR FINDIOB
LDY #$5 SECTOR
LDA #$F
STA (6),Y
.1 JSR $3E3
JSR $3D9
LDY #9 BUFFER
LDA (6),Y
SEC
SBC #1
STA (6),Y
LDY #5 SECTOR
LDA (6),Y
BEQ RTS
SEC
SBC #1
STA (6),Y
JMP .1
INPTR .EQ 6
OUTPTR .EQ 8
PACK LDA #HI
STA INPTR
LDA /HI
STA INPTR+1
LDA #LOW
STA OUTPTR
LDA /LOW
STA OUTPTR+1
LDA #0
STA DONE
LDA HI 1ST BYTE
STA RECENT
LDA #1
STA COUNT
LOOP LDY #0
INC INPTR
BNE .1
INC INPTR+1
LDA INPTR+1
SEC
SBC SECTORS
CMP /HI
BNE .1
LDA #1
STA DONE
BNE .3
.1 LDA (INPTR),Y
CMP RECENT
BNE .3
INC COUNT
BNE LOOP
DEC COUNT
.3 PHA
LDA RECENT
LDX COUNT
CMP #$37 IF FLAG BYTE,
BEQ .4 RUN-LENGTH ENCODE NO MATTER HOW MANY
CPX #4
BCC OTTOUT
.4 JSR BYTEOUT
TXA COUNT
JSR BYTEOUT
LDA #$37 FLAG
JSR BYTEOUT
NEXT PLA
STA RECENT
LDA #1
STA COUNT
LDA DONE
BEQ LOOP
RTS
OTTOUT JSR BYTEOUT
DEX
BNE OTTOUT
BEQ NEXT
BYTEOUT LDY #0
STA (OUTPTR),Y
INC OUTPTR
BNE .1
INC OUTPTR+1
.1 RTS
REVOUT LDY #0
STA (OUTPTR),Y
DEC OUTPTR
LDY OUTPTR
CPY #$FF
BNE .1
DEC OUTPTR+1
.1 RTS
UNPACK
LDA #HI-1
STA OUTPTR
LDA /HI-1
CLC
ADC SECTORS
STA OUTPTR+1
LDA #LOW-1
CLC
ADC $AA60 LENGTH OF FILE
STA INPTR
LDA /LOW-1
ADC $AA61
STA INPTR+1
.1 JSR GET
PHP
.2 CMP #$37
BNE .4
JSR GET
- NO NEED TO CHECK FOR END OF INPUT
TAX
JSR GET
.3 JSR REVOUT
DEX
BNE .3
BEQ .5
.4 JSR REVOUT
.5 PLP
BCC .1 NOT DONE
RTS
- MUST NOT CHANGE X
- ON EXIT, C=1 IF DONE WITH INPUT
GET LDY #0
LDA (INPTR),Y
DEC INPTR
LDY INPTR
CPY #$FF
BNE .0
DEC INPTR+1
.0 DEC $AA60
CLC
BNE .1
DEC $AA61
LDY $AA61
CPY #$FF
.1 RTS
RECENT .EQ * LAST BYTE FOUND
COUNT .EQ RECENT+1 # OF RECENT FOUND
DONE .EQ COUNT+1