Advertisement
verz

Dir in Basic

Sep 30th, 2019
3,372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XBasic 1.43 KB | None | 0 0
  1. 10 open2,8,0,"$"
  2. 15 l=-1
  3. 20 if st and 254 goto 130
  4.  
  5. rem disassembly of 1541 rom
  6. rem 4 bytes at list beginning:  '1411'
  7. rem **asm** ECBC   LDA #$01      1
  8. rem **asm** ECBE   JSR $CFF1     write in buffer
  9. rem **asm** ECC1   LDA #$04      4, start address $0401
  10. rem **asm** ECC3   JSR $CFF1     write in buffer
  11. rem **asm** ECC6   LDA #$01      2 times 1
  12. rem **asm** ECC8   JSR $CFF1
  13. rem **asm** ECCB   JSR $CFF1     write in buffer as link address
  14. rem
  15. rem '0' at directory header:
  16. rem **asm** ECCE   LDA $0272     drive number
  17. rem **asm** ECD1   JSR $CFF1     write in buffer as line number
  18. rem **asm** ECD4   LDA #$00      line number hi
  19. rem **asm** ECD6   JSR $CFF1     in buffer
  20. 25 rem ** drops 2 bytes at list beginning
  21. 30 get#2,d$,d$
  22.  
  23. rem disassembly of 1541 rom
  24. rem 3 bytes for each line:  '011'; 0 is endline
  25. rem **asm** ECE5   LDA #$00
  26. rem **asm** ECE7   JSR $CFF1     0 as line end in buffer
  27. rem **asm** ECEA   LDA #$01
  28. rem **asm** ECEC   JSR $CFF1     2 times 1 as link address
  29. rem **asm** ECEF   JSR $CFF1
  30. 35 rem ** drops 2 bytes at each line beginning ('11')
  31. 40 get#2,d$,d$
  32.  
  33. 45 rem ** if eof exit
  34. 50 if st and 64 goto 130
  35. 55 rem ** reads 2 bytes file size lo/hi; if zero adds chr(0)
  36. 70 get#2,a$:if a$="" then a$=chr$(0)
  37. 80 get#2,b$:if b$="" then b$=chr$(0)
  38. 90 l=asc(b$)*256+asc(a$):li$=mid$(str$(l),2)+" "
  39. 95 rem ** reads directory line
  40. 100 get#2,c$
  41. 110 if c$ then li$=li$+c$:goto100
  42. 120 print li$:goto40
  43. 130 close 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement