mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 08:29:25 +00:00
diskdir
This commit is contained in:
parent
af6731c9c8
commit
6f78a32e64
@ -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
|
||||
|
51
examples/diskdir.p8
Normal file
51
examples/diskdir.p8
Normal file
@ -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
|
||||
ldy #>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 "$"
|
||||
}}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user