pcmaudio: add routine/external procedure to read sample file

This commit is contained in:
slederer 2026-03-30 00:43:31 +02:00
parent 819c808c50
commit 0d9db023a1
3 changed files with 23 additions and 9 deletions

View file

@ -302,3 +302,22 @@ SMPLQ_I_XT2:
DROP
LOADREG IR ; jump via interrupt return register
JUMP
; args: file ptr, ptr to SndBuf (i.e. a String)
READSAMPLE:
; buf ptr + 0: addr of cur size header field
; buf ptr + 4: addr of max size header field
; buf ptr + 8: start of raw data
; copy max size to current size header field of SndBuf
INC.S1.X2Y 4 ; [ file ptr, buf ptr, buf ptr+4 ]
LOADI ; [ file ptr, buf ptr, max size ]
STOREI 8 ; [ file ptr, buf ptr+8 ]
; put max size back on ToS
DUP ; [ file ptr, buf ptr+8, buf ptr+8]
DEC 4 ; [ file ptr, buf ptr+8, buf ptr+4]
LOADI ; [ file ptr, buf ptr+8, max size ]
LOADCP READFS
CALL
RET