diff --git a/averybreakout.asm b/averybreakout.asm index c1f5e63..69a7643 100644 --- a/averybreakout.asm +++ b/averybreakout.asm @@ -68,6 +68,11 @@ statusBuffer score=statusBuffer+33 HiScore=statusBuffer+17 Lives=statusBuffer+8 + +;-------------------------------------------------- + icl 'fileio.asm' +;-------------------------------------------------- + ;-------------------------------------------------- .proc vint ;-------------------------------------------------- @@ -1291,7 +1296,8 @@ Level000_data :14 .byte ' ##################################',155 .byte 0 LevelFileBuff - .ds (screenWidth*maxLines)+20 ; Buffer for data from the level file +LevelFileBuffLen=(screenWidth*maxLines)+20 + .ds LevelFileBuffLen ; Buffer for data from the level file ;-------------------------------------------------- BigBrickFlag .byte 0 diff --git a/fileio.asm b/fileio.asm new file mode 100644 index 0000000..2c8415f --- /dev/null +++ b/fileio.asm @@ -0,0 +1,51 @@ +.IF *>0 ;this is a trick that prevents compiling this file alone + +;-------------------------------------------------- +.proc open +;-------------------------------------------------- +; OPEN #1,4,0,"D:LEVEL000.DAT" + + ldx #$10 ;IOCB #1 + lda #$03 ;komenda: OPEN + sta iccmd,x + lda #fname + sta icbufa+1,x + lda #04 ;kod dostępu: $04 odczyt, $08 zapis, $09 dopisywanie, $0c odczyt/zapis + sta icax1,x + lda #$00 ;dodatkowy parametr, $00 jest zawsze dobre + sta icax2,x + jmp ciov +fname .byte "D:LEVEL000.DAT",$9b +.endp +;-------------------------------------------------- +.proc bget +;-------------------------------------------------- +; BGET #1,LevelFileBuff,LevelFileBuffLen-2 + + ldx #$10 ;IOCB #1 + lda #$07 ;komenda: GET BYTES / BINARY READ + sta iccmd,x + lda #LevelFileBuff + sta icbufa+1,x + lda #<(LevelFileBuffLen-2) ;wielkosc bloku danych w bajtach + sta icbufl,x + lda #>(LevelFileBuffLen-2) + sta icbufl+1,x + jmp ciov +.endp +;-------------------------------------------------- +.proc close +;-------------------------------------------------- +; CLOSE #1 + ldx #$10 ;IOCB #1 + lda #$0c ;komenda: CLOSE + sta iccmd,x + jmp ciov +.endp + + +.ENDIF \ No newline at end of file