1000 REM "FileOps" 1010[OPT Pass 1020.Bget 1030 Cpy #input_handle 1040 Beq dobget 1050 JSR dobrk 1060 EQUB Channel_error 1070 EQUS "Bad channel to BGET" 1080 BRK 1090.dobget 1100 Tya:Pha:Txa:Pha 1110 Lda #ASC("!"): Jsr SendCom 1120 Jsr GetHex \ Carry set if else clear. May on error 1130 Sta zp0 1140 Php:Pla: Sta zp1 1150 Pla:Tax:Pla:Tay 1160 Lda zp1:Pha:Plp 1170 Lda zp0 1180 Rts 1190.Bput 1200 Cpy #output_handle 1210 Beq dobput 1220 Jsr dobrk 1230 EQUB Channel_error 1240 EQUS "Bad channel to BPUT" 1250 BRK 1260.dobput 1261 Sta scratch0 1262 Pha:Tya:Pha:Txa:Pha 1270 Lda scratch0:Pha 1280 Lsr A:Lsr A:Lsr A:Lsr A 1290 Clc: Adc #ASC("0") 1300 Jsr SendCom 1310 Pla 1320 And #&0F 1321 CLC: ADC #ASC("0") 1330 Jsr SendCom 1340 jsr verify 1350 Pla:tax:Pla:tay:Pla 1360 Rts 1370.OsFind \ preserve X, Y, A (if not handle) 1380 Cmp #0 1390 beq close 1400 Cmp #&40 1410 Beq openin 1420 Cmp #&C0 1430 Beq openin 1440 Cmp #&80 1450 beq openout 1460 JSR dobrk 1470 EQUB 124 1480 EQUS "Bad code to OSFIND" 1490 BRK 1500 Rts 1510 1520.close 1530 Cpy #input_handle 1540 Beq close_input 1550 Cpy #output_handle 1560 Beq close_output 1570 Cpy #0 1580 Beq close_all 1620 Jsr dobrk 1630 EQUB Channel_error 1640 EQUS "Bad channel to CLOSE" 1650 BRK 1660.close_input 1661 Txa:Pha 1670 Lda #ASC("{") 1680 Jsr SendCom 1690 Jsr verify 1691 Pla:Tax 1700 Lda #0: Ldy #input_handle 1701 Rts 1710.close_output 1711 Txa:Pha 1720 Lda #ASC("}") 1730 Jsr SendCom 1740 Jsr verify 1741 Pla:Tax 1750 Lda #0: Ldy #output_handle 1751 Rts 1760.close_all 1770 Jsr close_input 1780 Jsr close_output 1781 Tay \ 0 1790 Rts 1820 1830.openout 1840 Lda #output_handle 1850 Pha 1860 Lda #ASC("O"): Sta scratch0 1870 Jmp openeither 1880.openin 1890 Lda #input_handle 1900 Pha 1910 Lda #ASC("I"): Sta scratch0 1920 Jmp openeither 1930.openeither 1940 Txa:Pha:Tya:Pha 1950 Stx zp0 1960 Sty zp1 1970 Ldy scratch0 1980 Jsr transact 1990 jsr verify 2000 Pla:Tay:Pla:Tax 2010 Pla 2020 Rts 2030] 2040RETURN