home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar Extras 3
/
Ex3side2.d64
/
dtext9.asm
< prev
next >
Wrap
Assembly Source File
|
2022-08-28
|
5KB
|
432 lines
*--------------------------------
* LOADSTAR DTEXT 12/02/96
*
* By Gene Barker
* Courtesy of Mad Man Software
*--------------------------------
ORG $2800
*--------------------------------
* LABELS
*--------------------------------
STATUS = $90
EAL = $AE
*
SETLFS = $FFBA
SETNAM = $FFBD
OPEN = $FFC0
CLOSE = $FFC3
CHKIN = $FFC6
CHKOUT = $FFC9
CHROUT = $FFD2
CLRCHN = $FFCC
CHRIN = $FFCF
*--------------------------------
* JUMP TABLE
*--------------------------------
JMP GETSTUFF
JMP XSETLFS
JMP XSETNAM
JMP XLOADE
JMP RAMLOAD
JMP PLOAD
JMP PRAM
PRAM LDA #255
STA PMODE
JMP RAMLOAD
*--------------------------------
* GET STUFF (JEFF'S JUNK)
*--------------------------------
GETSTUFF JSR GSTRING
JSR XSETNAM
JSR GNUMBER
TYA
TAX
LDA #2
LDY #0
JSR XSETLFS
JSR GNUMBER
LDA #0
LDX $14
LDY $15
JSR XLOAD
LDY #0
TYA
JSR ROMOUT
STA (EAL),Y
JMP ROMIN
ROMIN PHA
LDA #$77
STA 1
CLI
PLA
RTS
ROMOUT PHA
LDA #$74
SEI
STA 1
PLA
RTS
*--------------------------------
* GSTRING
*--------------------------------
GSTRING JSR $AEFD
JSR $AD9E
JSR $B6A3
LDX $22
LDY $23
RTS
*--------------------------------
* GNUMBER
*--------------------------------
GNUMBER JSR $AEFD
JSR $AD8A
JMP $B7F7
*--------------------------------
* RAMLOAD
*
* decompress data from one loc
* to another.
*--------------------------------
RAMLOAD JSR GNUMBER
STY 251
STA 252
* get source
JSR GNUMBER
STY EAL
STA EAL+1
JSR GNUMBER
STY 253
LDA 53280
PHA
LDA #0
STA COUNT
TAY
RAMLOOP JSR ROMOUT
LDA (251),Y
CMP 253
BEQ RLOUT
JSR ROMIN
INC 53280
JSR XCIN1
LDA #1
CLC
ADC 251
STA 251
LDA #0
TAY
ADC 252
STA 252
JMP RAMLOOP
RLOUT JSR ROMIN
LDY #0
TYA
STA (EAL),Y
PLA
STA 53280
RTS
*--------------------------------
* SETLFS
*
* Save file number & secondary
* address, then do Kernal SETLFS
*--------------------------------
XSETLFS STA FILE
STY SECADD
TAY
JMP SETLFS
*--------------------------------
* SETNAM
*
* Store away the filename
*--------------------------------
XSETNAM STA NAMESZ
STX XLOAD1+1
STY XLOAD1+2
RTS
*--------------------------------
* LOAD
*
* decompress text from disk
*--------------------------------
*
* setup force load address
*
XLOADE PHA
LDA #0
STA PMODE
PLA
JMP XLOAD
PLOAD LDA #255
STA PMODE
XLOAD STX EAL
STY EAL+1
*
* build filename
*
LDX #0
XLOAD1 LDA $FFFF,X
STA NAME,X
INX
CPX NAMESZ
BCC XLOAD1
LDY #0
XLOAD1A LDA EXT,Y
STA NAME,X
INX
INY
CPY #4
BCC XLOAD1A
STX NAMESZ
*
* open the file for reading
*
LDA NAMESZ
LDX #<NAME
LDY #>NAME
JSR SETNAM
JSR OPEN
LDX FILE
JSR CHKIN
*
* get load address
*
JSR CHRIN
TAY
JSR CHRIN
TAX
*
* check if a force load
*
LDA SECADD
BEQ XLOAD2
*
* if not, update load address
*
STY EAL
STX EAL+1
*
* initialize decomp variables
*
XLOAD2 LDA #0
STA COUNT
STA STATUS
*-
* decompress text file into
* memory loop
*-
XLOAD3 JSR XCHRIN
LDA STATUS
BEQ XLOAD3
*
* close the text file
*
LDA FILE
JSR CLOSE
JSR CLRCHN
*
LDA #0
STA PMODE
RTS
*
FILE DFB 0
SECADD DFB 0
NAMESZ DFB 0
NAME DS 20
EXT USR 'A',p,r'
*--------------------------------
* CHRIN
*
* decompress data on the fly and
* place in memory
*--------------------------------
*
* get character from file
*
XCHRIN JSR CHRIN
*
* check for a disk error
*
LDX STATUS
BEQ XCIN1
CPX #%01000000
BEQ XCIN1
*
RTS
*
* check for 4th ch of run length
*
XCIN1 LDX COUNT
CPX #3
BNE XCIN2
*
* check for zero repeats
*
TAX
BEQ XCIN1C
*
* place the repeated ch's
*
LDA LAST
LDY #0
XCIN1A JSR JSTASH
INC EAL
BNE XCIN1B
INC EAL+1
XCIN1B DEX
BNE XCIN1A
*
* reset counter
*
XCIN1C STX COUNT
RTS
*
* check for normal ASCII
*
XCIN2 CMP #$60
BCC XCIN2A
CMP #$C1
BCC XCIN4A
CMP #$DC
BCC XCIN3A
CMP #$F7
BCC XCIN4B
BCS XCIN3A
*
* check for a remapped character
*
XCIN2A CMP #$00
BEQ XCIN3A
CMP #$0D
BCS XCIN3A
*
* remap the character
*
TAX
LDA REMAPA-1,X
*
* got an ASCII - adjust counter
*
XCIN3A LDX COUNT
BEQ XCIN3B
CMP LAST
BEQ XCIN3C
XCIN3B LDX #0
STA LAST
XCIN3C INX
STX COUNT
*
* place the ch
*
XCINSUB LDY #0
JSR JSTASH
INC EAL
BNE XCIN3D
INC EAL+1
*
XCIN3D RTS
*
* got a diatomic #1 - adjust
* pointer
*
XCIN4A SEC
SBC #$60
BCS XCIN4C
*
* got a diatomic #2 - adjust
* pointer
*
XCIN4B SEC
SBC #$7B
*
* reset counter
*
XCIN4C LDX #0
STX COUNT
*
* place 1st ch
*
TAX
LDA CH1LIST,X
JSR XCINSUB
*
* place 2nd ch
*
LDA CH2LIST,X
JMP XCINSUB
*
JSTASH BIT PMODE
BPL REGULAR
PHA
TXA
PHA
TYA
PHA
JSR CLRCHN
LDX #4
JSR CHKOUT
PLA
TAY
PLA
TAX
PLA
JSR CHROUT
PHA
TXA
PHA
TYA
PHA
JSR CLRCHN
LDX FILE
JSR CHKIN
PLA
TAY
PLA
TAX
PLA
RTS
REGULAR PHA
LDA #$74
SEI
STA 1
PLA
STA (EAL),Y
LDA #$77
STA 1
CLI
RTS
PMODE DFB 0
COUNT DFB 0
LAST DFB 0
*
REMAPA DFB 146,163,171,173
DFB 174,176,177,178
DFB 179,189,192,221
*
CH1LIST USR 'A' '
USR 'A' a'
USR 'A'aaaaaaaabb'
USR 'A'cccccdddee'
USR 'A'eeeeeeeffg'
USR 'A'ghhhhhiiii'
USR 'A'iiiiikkkll'
USR 'A'lllllmmmmn'
USR 'A'nnnnoooooo'
USR 'A'ooopprrrrr'
USR 'A'rssssssttt'
USR 'A'tttttuuuvw'
USR 'A'wwyy'
*
CH2LIST USR 'A'abcdefghil'
USR 'A'mnoprstwy '
USR 'A'cdilnrsteo'
USR 'A'aehko ei a'
USR 'A'delnrst o '
USR 'A'e aeiocgkl'
USR 'A'mnrst ei a'
USR 'A'eiloy aeo '
USR 'A'degt fnors'
USR 'A'tuweo aeio'
USR 'A's ehist ae'
USR 'A'hiorslrtea'
USR 'A'ei o'