From 6f78a32e642e1a827b850612939c767acc159f13 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 22 Sep 2020 22:58:57 +0200 Subject: [PATCH] diskdir --- docs/source/todo.rst | 2 ++ examples/diskdir.p8 | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 examples/diskdir.p8 diff --git a/docs/source/todo.rst b/docs/source/todo.rst index e85032d9f..2df49ea85 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -10,6 +10,8 @@ TODO - make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_' - option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging) - see if we can group some errors together for instance the (now single) errors about unidentified symbols +- use VIC banking to move up the graphics bitmap memory location. Don't move it under the ROM though as that would require IRQ disabling and memory bank swapping for every bitmap manipulation +- add some primitives/support/examples for using custom char sets, copying the default charset. More optimizations diff --git a/examples/diskdir.p8 b/examples/diskdir.p8 new file mode 100644 index 000000000..21054043c --- /dev/null +++ b/examples/diskdir.p8 @@ -0,0 +1,51 @@ +%target c64 +%import textio +%import syslib +%zeropage dontuse + +; This example shows the directory contents of disk drive 8. + +main { + sub start() { + %asm {{ + lda #$01 + ldx #dirname + jsr c64.SETNAM + lda #$08 + sta $BA ; device #8 + lda #$60 + sta $B9 ; secondary chn + jsr $F3D5 ; open for serial bus devices ; SETLFS + OPEN? + jsr $F219 ; set input device + ldy #$04 +labl1 jsr c64.ACPTR ; input byte on serial bus + dey + bne labl1 ; get rid of Y bytes + lda $C6 ; key pressed? + ora $90 ; or EOF? + bne labl2 ; if yes exit + jsr c64.ACPTR ; now get the size of the file + pha + jsr c64.ACPTR + tay + pla + jsr txt.print_uw + lda #32 + jsr c64.CHROUT +labl3 jsr c64.ACPTR ; now the filename + jsr c64.CHROUT ; put a character to screen + cmp #0 + bne labl3 ; while not 0 encountered + lda #13 + jsr c64.CHROUT ; put a CR , end line + ldy #$02 ; set 2 bytes to skip + bne labl1 ; repeat +labl2 jsr $F642 ; close serial bus device + jsr c64.CLRCHN ; restore I/O devices to default + rts + +dirname .byte "$" + }} + } +}