mirror of
https://github.com/a2-4am/4cade.git
synced 2024-06-14 03:29:38 +00:00
64 lines
2.2 KiB
Plaintext
64 lines
2.2 KiB
Plaintext
;license:MIT
|
|
;(c) 2017-8 by 4am
|
|
;
|
|
; ProRWTS2 glue functions
|
|
;
|
|
; Public functions
|
|
; - LoadFile
|
|
;
|
|
|
|
;------------------------------------------------------------------------------
|
|
; LoadFile
|
|
; load a file into memory all at once, using ProRWTS2
|
|
; uses file's load address
|
|
;
|
|
; in: stack contains 2 bytes of parameters:
|
|
; +1 address of filename
|
|
; out: all flags clobbered
|
|
; all registers clobbered
|
|
; stack set to next instruction after parameters
|
|
;------------------------------------------------------------------------------
|
|
LoadFile
|
|
+PARAMS_ON_STACK 2
|
|
+LDPARAM 1
|
|
+STAY namlo ; set filename
|
|
lda #$FF ; read entire file (ProRWTS2 will figure out exact size)
|
|
sta sizelo
|
|
sta sizehi
|
|
lda #0 ; 0 = read into main memory
|
|
sta auxreq
|
|
lda #cmdread ; read (instead of write)
|
|
sta reqcmd
|
|
jmp hddopendir ; exit via ProRWTS2
|
|
|
|
;------------------------------------------------------------------------------
|
|
; LoadDHRFile
|
|
; load .A2FC file (uncompressed double hi-res graphics) into memory
|
|
; all at once, using ProRWTS2
|
|
; first $2000 bytes of file are loaded into auxiliary memory $2000..$3FFF
|
|
; second $2000 bytes of file are loaded into main memory $2000..$3FFF
|
|
;
|
|
; in: stack contains 2 bytes of parameters:
|
|
; +1 address of filename
|
|
; out: all flags clobbered
|
|
; all registers clobbered
|
|
; stack set to next instruction after parameters
|
|
;------------------------------------------------------------------------------
|
|
LoadDHRFile
|
|
+PARAMS_ON_STACK 2
|
|
+LDPARAM 1
|
|
+STAY namlo ; set filename
|
|
lda #$00 ; read first $2000 bytes
|
|
sta sizelo
|
|
lda #$20
|
|
sta sizehi
|
|
lda #1 ; 1 = read into aux memory
|
|
sta auxreq
|
|
lda #cmdread ; read (instead of write)
|
|
sta reqcmd
|
|
jsr hddopendir ; call ProRWTS2
|
|
lda #$20 ; read next $2000 bytes
|
|
sta sizehi
|
|
dec auxreq ; 0 = read into main memory
|
|
jmp hddrdwrpart ; call ProRWTS2
|