forked from cadaver/c64loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadunpacked.s
47 lines (43 loc) · 1.44 KB
/
loadunpacked.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;-------------------------------------------------------------------------------
; Covert Bitops Loadersystem V3.x, unpacked loading
;-------------------------------------------------------------------------------
; Load unpacked file with specified load address
;
; Parameters: A filenumber, X/Y load address
; Returns: C=0 if OK, C=1 if failed to load
; Modifies: A,X,Y,zpDestLo-Hi
LoadUnpackedRaw:stx zpDestLo
sty zpDestHi
jsr OpenFile
lda fileOpen
beq LoadUnpackedError
bne LoadUnpackedCommon
; Load unpacked file with load address from 2 first bytes of file
;
; Parameters: A filenumber
; Returns: C=0 if OK, C=1 if failed to load
; Modifies: A,X,Y,zpDestLo-Hi
LoadUnpacked: jsr OpenFile
lda fileOpen
beq LoadUnpackedError
jsr GetByte
sta zpDestLo
jsr GetByte
sta zpDestHi
LoadUnpackedCommon:
ldy #$00
LoadUnpackedLoop:
lda fileOpen
beq LoadUnpackedDone
jsr GetByte
sta (zpDestLo),y
iny
bne LoadUnpackedLoop
inc zpDestHi
bne LoadUnpackedLoop
LoadUnpackedDone:
clc
rts
LoadUnpackedError:
sec
rts