💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2023-01-29 at 10:13:33.
-=-=-=-=-=-=-
In article <1113701775.491447.262350@f14g2000cwb.googlegroups.com>, aiiadict@gmail.com wrote: > can someone please post code that will > accomplish the following from Prodos > in assembly language? > > bload file,a$2000 > > Rich SOURCE FILE #01 =>BLOAD.S 0000: 2000 1 FSTART EQU $2000 0000: 8000 2 FBUF1 EQU $8000 0000: BF00 3 MLI EQU $BF00 Call MLI 0000: FD0C 4 GETKEY EQU $FD0C 0000: FD8E 5 CROUT EQU $FD8E 0000: FDDA 6 PRBYTE EQU $FDDA 0000: FDED 7 COUT EQU $FDED ----- NEXT OBJECT FILE NAME IS TEST 0800: 0800 8 ORG $0800 0800: 9 * Open the file 0800:A9 91 10 LDA #>FNAME1 0802:8D 66 08 11 STA ONAME 0805:A9 08 12 LDA #<FNAME1 0807:8D 67 08 13 STA ONAME+1 080A:20 00 BF 14 JSR MLI 080D:C8 15 DB $C8 OPEN command 080E:65 08 16 DW OPENLIST 0810:B0 31 0843 17 BCS ERROR 0812: 18 * Get end of file mark 0812:AD 6A 08 19 LDA REFNO Use the REFNO supplied 0815:8D 6C 08 20 STA EREF by the call to OPEN 0818:20 00 BF 21 JSR MLI 081B:D1 22 DB $D1 GET EOF command 081C:6B 08 23 DW EOFLIST 081E:B0 23 0843 24 BCS ERROR 0820: 25 * Read the file 0820:AD 6A 08 26 LDA REFNO Use the REFNO again 0823:8D 71 08 27 STA RREF 0826:AD 6D 08 28 LDA EPOS Use the length supplied 0829:8D 74 08 29 STA RLENGTH by the call to GET EOF 082C:AD 6E 08 30 LDA EPOS+1 082F:8D 75 08 31 STA RLENGTH+1 0832:20 00 BF 32 JSR MLI 0835:CA 33 DB $CA READ command 0836:70 08 34 DW READLIST 0838:B0 09 0843 35 BCS ERROR 083A: 36 * Close the file 083A:20 00 BF 37 JSR MLI 083D:CC 38 DB $CC CLOSE command 083E:78 08 39 DW CLOSLIST 0840:B0 01 0843 40 BCS ERROR 0842:60 41 RTS 0843: 42 * Handle fatal error 0843:48 43 ERROR PHA A Save the error code 0844:20 8E FD 44 JSR CROUT Print RETURN 0847:AC 81 08 45 LDY ERRMSG Print error message 084A:A2 01 46 LDX #1 084C:BD 81 08 47 ERR1 LDA ERRMSG,X 084F:09 80 48 ORA #$80 0851:20 ED FD 49 JSR COUT 0854:E8 50 INX 0855:88 51 DEY 0856:D0 F4 084C 52 BNE ERR1 0858:68 53 PLA A Restore error code 0859:20 DA FD 54 JSR PRBYTE Print it 085C:20 0C FD 55 JSR GETKEY Wait for it 085F:20 00 BF 56 JSR MLI Die horribly 0862:65 57 DB $65 QUIT command 0863:7A 08 58 DW QLIST 0865: 59 * "Open" parameter list 0865:03 60 OPENLIST DB 3 Parameter count 0866:91 08 61 ONAME DW FNAME1 File name pointer 0868:00 80 62 DW FBUF1 File #1 buffer addr. 086A:00 63 REFNO DB 0 Reference number 086B: 64 * "End of File" parameter list 086B:02 65 EOFLIST DB 2 Parameter count 086C:00 66 EREF DB 0 Reference number 086D:00 00 00 67 EPOS DB 0,0,0 File position 0870: 68 * "Read" parameter list 0870:04 69 READLIST DB 4 Parameter count 0871:00 70 RREF DB 0 Reference number 0872:00 20 71 RDATA DW FSTART Data buffer addr. 0874:00 00 72 RLENGTH DW 0 Requested length 0876:00 00 73 DW 0 Actual length 0878: 74 * "Close" parameter list 0878:01 75 CLOSLIST DB 1 Parameter count 0879:00 76 CREF DB 0 087A: 77 * "Quit parameter list 087A:04 00 00 00 78 QLIST DFB 4,0,0,0,0,0,0 0881: 79 * String storage 0881:0F 50 52 4F 80 ERRMSG STR "PRODOS ERROR: $" 0891:0E 2F 6D 79 81 FNAME1 STR "/mydisk/myfile" 0878 CLOSLIST FDED COUT ?0879 CREF FD8E CROUT 086B EOFLIST 086D EPOS 086C EREF 084C ERR1 0881 ERRMSG 0843 ERROR 8000 FBUF1 0891 FNAME1 2000 FSTART FD0C GETKEY BF00 MLI 0866 ONAME 0865 OPENLIST FDDA PRBYTE 087A QLIST ?0872 RDATA 0870 READLIST 086A REFNO 0874 RLENGTH 0871 RREF