LBSOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUNDINVALID KERNEL FILExةw,@  4  J  ȱ⩤i8#) ) 8Le The following 15 source program files and 1 documentation file comprise Gary Kato's Xmodem /// terminal program for the ///. It is a terminal program that you can use to call your favorite bbs (like ///'s Company), but also includes Ascii file transfer f+CONVER.TEXT :4+ASCIIS.TEXT :4*ALERT.TEXT:4MANUAL.P2KK(N:2+MYMACR.TEXTt :2 *IOERR.TEXTz:3*GPACK.TEXT~ :3+DIALOG.TEXT2b:3)DATA.TEXT70^:3(CRC.TEXT47 :4III.SRC.01RCEu' -XMODEM.SOURCE/:1:%+TXMODE.TEXT >:1+SOSERR.TEXT, :2+SETTIN.TEXT3":2+SAVESC.TEXTE :2+RXMODE.TEXTLm#im#iЛ#Lȱ  6L憦  Lsmm l y` @8(Je稽 ʈunctions AND Xmodem and Binary II error-free file transfer protocol functions. You will need the Pascal system to A)ssemble the source code that you capture here, and you will need the Makeinterp program to convert the assembled codefile into an interpret * return as an indication that you're done doing * ;* Xmodem. sigh. * ;************************************************** jmp $35 ; ; let recevier know that we're set up 256. & 0ff sta tempptr+1 jsr Makewindow jsr Drawframe outstr blkxfermsg ;************************************************** ;* Skip this next part since CIS takes a carriage * ;#1 sta pastvname lda #0 ;init blks xfered count sta xcount sta xcount+1 sta xcount+2 lda #emptywindow & 0ff sta tempptr lda #emptywindow / lda #1 sta access jsr tryopen bcc $15 sec rts $15 lda fileref sta infileref sta closeref ;show we have a file to close lda menunum sta inbuffer ; for clearing the Editbox jsr ShowFBox outstr txMsg jsr DoFbox lda inbuffer bne $10 rts $10 jsr Dofilename  !"#$%&'()*error message and abort ; lda #Not8bit & 0ff ldx #Not8bit / 256. & 0ff jsr Alert sec rts $1 lda #0 sta mitem sta selection sta sub; ; TXmodem - Transmit an Xmodem file ; TXmodem ; ; Make sure terminal is set for 8 bits, no parity! ; lda Rstatbuff+2 beq $1 ; yes, go ahead ; ; Put up to run the scrubber every month or so. Haven't had a hard drive fail yet on any of my AT's. Yep, I'm getting psyched for my trip to the Caymans. Adam and I are going to start our diving certification lessons next month, and take our four open water divyour hard disk under Catalyst or Selector ///. a copy. I'll keep my eyes open for you. Have a great Memorial Day Weekend!!!! Best Regards.......Ed able to measure any noticable speed improvement in my hard drives, but it does make me feel more secure processor. If all of this is beyond your capabilities, contact me via email and I will give you my address. You can send me a blank, formatted disk in a SAS disk mailer and I'll send you a copy of Xmodem /// that is ready to boot and run, or install on er. Makeinterp can be found in the the Programming - Pascal Programs topic area (#19). Detailed instructions for accomplishing all this is found in the beginning of the Xmodem /// documentation file, which can be edited and printed with your favorite word ; ldx rstartmsg stx temp ldx #1 $30 lda rstartmsg,x sta outmodchar SOS Write,outmodem inx cpx temp bne $30 $35 ; Set file transfer count to 128. lda #128. sta infileref+3 lda #132. sta outmodref+3 lda MAXRETRY sta foretry sta tmoretry sta errretry ; ; AssumXRETRY sta tmoretry sta errretry ; ; Read a sector from disk ; ; if EOF, Endsend ; SOS Read,Infile beq $20 cmp #EOFERR beq endNext ; ; Form a new packet ; inc outmodchar+1 ;bump block # lda outmodchar+1 eor #0ff ;make 1's complement sta outmodchar+2 lda MAinformation and stuff into packet ; SOS GetFinfo,fileinfo beq tag jsr ioerr jmp Stopsend tag jsr binpack jsr sendpacket bcc Sendnext rts So bne $130 beq dofile fileonly SOS GetFinfo,fileinfo beq $10 jsr ioerr jmp Stopsend $10 jsr justfname jmp tag dofile ; ; Get file +121. lda #0 adc outmodchar+122. sta outmodchar+122. lda #0 adc outmodchar+123. sta outmodchar+123. $130 jsr getdirname jsr senddir dec filestog20 jsr ioerr jmp Stopsend $120 clc lda fileinfo+15. adc outmodchar+120. sta outmodchar+120. lda fileinfo+16. adc outmodchar+121. sta outmodchar beq dofile sta filestogo sta outmodchar+120. ; ; Get file information and stuff into packet ; *** Dumb to do this call twice ; SOS GetFinfo,fileinfo beq $1ck ldx #127. $110 sta outmodchar+3.,x dex bne $110 ; check for directory handling first bit usedir bvc fileonly jsr getpastvname jsr countdirs lda #0 sta outmodchar+1 ; if Binary II, make first packet and send it lda usebinary bne $100 jmp Sendnext $100 lda #0 ; zero out binary II blod one more byte out modem sta doCRC bne $90 ; always taken $80 cmp #NAK bne $40 ; Not what I was waiting for. Throw away. $90 lda #SOH sta outmodchar jmp StopSend $70 cmp #43 bne $80 lda AttemptCRC ; Are we allowed to use CRC? beq $40 ; If not, pretend we didn't see it. inc outmodref+3 ; If so, need to sen50 dec tmoretry ; Timeout. See if retry possible bne $40 ; Yes. Try again. $60 ; ; If not CAN, NAK or 'C', keep waiting until maxtmoretry = 0 ; cmp #CAN bne $70RC ;assume no CRC to be used ; ; Wait for a char ; $40 jsr waitchar bcc $60 beq $50 ; Timeout or User abort? jmp StopSend ; User abort $e file is open and errretry and tmoretry are inited ; lda outmodref+1 clc adc #3 sta dataptr lda outmodref+2 adc #0 sta dataptr+1 lda #0 sta DoCTXDone jsr ioerr jmp Stopsend $20 ; ; Copy from filebuffer to packet ; ldx #127. $30 lda infilechar,x sta outmodchar+3,x dex bpl $30 ; ; if less then 128 bytes were read, zero out the leftovers ; lda infileref+5 sec sbc #128. beq $50 ; full buffer, so skip tay ldx #127. lda #0 $40 bcc $10 txa adc xcount+1 sta xcount+1 bcc $10 txa adc xcount+2 sta xcount+2 $10 cld ; position to correct place in emptybox lda #26. rts ; ; Doblockcount - increment block transfered counter and output it ; Doblockcount pha tya pha txa pha sed sec ldx #0 txa adc xcount sta xcount adc (dataptr),y dey bpl $10 rts ; ; CalacCrc16 ; CalcCrc16 jsr ICRC16 ldy #0 $10 lda (dataptr),y jsr CRC16 iny cpy #blocksize bne $10 ta outmodchar SOS Write,outmodem jsr Disposdialog ;drop blocks xfered Alert sec rts ; ; Calcsum - Calculate a checksum ; Calccsum lda #0 ldy #blocksize-1 $10 clc bcc $50 bne stopsend $50 cmp #CAN bne Waitreply StopSend ; ; Cancel the send ; lda #1 sta outmodref+3 ;send CAN to host lda #CAN s bne Sendpacket $30 ; ; CAN: ; cmp #CAN beq $40 ; ; Garbage, dec errretry, and ignore ; dec errretry bne Waitreply $40 jsr waitchar bne $20 jsr Doblockcount outstr blanks clc rts $20 cmp #NAK bne $30 ; ; NAK: ; outstr errorfound dec errretry beq Stopsend jsr waitchar bcc $10 bne Stopsend outstr timemsg dec tmoretry bne Sendpacket jmp Stopsend $10 ; ; ACK: ; Sendnext ; cmp #ACK StopSend ; Waitreply SOS Dstatus,modstatlist lda buffstatus+3 bne Waitreply ;wait for chars to leave output buffer jsr clearRSbuff ;get rid of extraneous chars C=0 if ok. ; Sendpacket ; ; Send packet ; SOS Write,Outmodem ; ; Wait for reply ; if timeout, see if retries left ; if so, Sendpacket ; if not, jmp Stopsend $10 cmp #NAK beq $1 cmp #ACK bne $1 jsr Disposdialog clc rts ; ; Sendpacket - send the Xmodem packet ; returns C=1 if, abort ; sful upload. Tell user so. Close file. ; lda #1 sta outmodref+3 lda #EOT sta outmodchar $1 SOS Write,outmodem jsr waitchar bcc $10 beq $10 +128.+3 sty outmodchar+128.+4 tya jmp $70 $60 jsr Calccsum sta outmodchar+128.+3 $70 jsr sendpacket bcc sendnext rts ; ; TXDone ; TXDone ; ; Succe sta outmodchar+3,x dey bne $40 $50 ; ; Form CRC or checksum ; lda DoCRC beq $60 jsr CalcCrc16 jsr GetCRC sta outmodchar jsr cout lda #13. jsr cout lda #3 jsr cout ldx #80 ldy #0 sty suppress0 ldy #2 $15 lda xcount,y pha and #0f0 bne $20 bit suppress0 bpl $30 $20 stx suppress0 lsr a lsr a lsr a lsr a adc #30 jmp $35 $30 lda #20 $35 jsr cout pastvname stx newend rts pastvname .byte 1 newend .byte 1 ; ; Countdirs - counts the number of directories in the pathname. ; Returns count in A. Trashes registers ; countdirs ldy ;'.' marks device name beq $10 cmp #2f ;'/' marks volume name bne $20 $10 inx lda filename,x cmp #2f ;find the next '/' bne $10 inx $20 stx sty outmodchar+128.+4 rts $60 jsr Calccsum sta outmodchar+128.+3 rts ; ; GetPastvname - find end of volume/device name ; getpastvname ldx #1 lda filename,x cmp #2e lda MAXRETRY sta tmoretry sta errretry ; ; Form CRC or checksum ; lda DoCRC beq $60 jsr CalcCrc16 jsr GetCRC sta outmodchar+128.+3 e to send ; lda filestogo sta outmodchar+130. ; ; Bump block number ; inc outmodchar+1 lda outmodchar+1 eor #0ff sta outmodchar+2 sta outmodchar+19. lda fileinfo+20. sta outmodchar+16. sta outmodchar+20. lda #2 ; another ID byte sta outmodchar+21. ; ; For now, assume only 1 fil sta outmodchar+13. sta outmodchar+17. ; Make creation date the same for now lda fileinfo+18. sta outmodchar+14. sta outmodchar+18. lda fileinfo+19. sta outmodchar+15. fileinfo+9 sta outmodchar+9 lda fileinfo+15. ; blocks used sta outmodchar+11. lda fileinfo+16. sta outmodchar+12. lda fileinfo+17. ; Last mod date/time lda fileinfo+7 ; file type sta outmodchar+7 lda fileinfo+10. ; storage type sta outmodchar+10. lda fileinfo+8 ; aux file type sta outmodchar+8 lda ; access code sta outmodchar+6 binrest lda #0a ; ID bytes sta outmodchar+3 lda #47 sta outmodchar+4 lda #4c sta outmodchar+5 y outmodchar+26. lda fileinfo+11. ; EOF sta outmodchar+23. lda fileinfo+12. sta outmodchar+24. lda fileinfo+13. sta outmodchar+25. lda fileinfo+6 1 ldx pastvname ldy #1 $10 lda filename,x ; filename sta outmodchar+26.,y iny inx cpx filename bcc $10 beq $10 dey st $15 pla tax pla tay pla rts ; ; Binpack ; binpack ldx #127. ; zero out packet lda #0 $1 sta outmodchar+3,x dex bne $ pla and #0f bne $40 bit suppress0 bpl $50 $40 stx suppress0 clc adc #30 jmp $55 $50 lda #20 $55 jsr cout dey bpl pastvnam lda #2f ; count the '/'s ldx #0 $10 cmp filename,y bne $20 inx $20 iny cpy filename bne $10 txa rts ; ; Getdirname - get newend to point past next directory name ; getdirname lda #2f ldx newend $10 cmp filename,x beq $20 inx bne $10 $20 inx stx newend rts ; ; Senddir ; senddir ldDIRFULL .equ 49 ;Directory full CPTERR .equ 4a ;Incompatible file format TYPERR .equ 4b ;Unsupported storage type EOFERR .equ 4c ;End of file would be exceeded POSNERR .equ 4d umber PATHNOTFND .equ 44 ;Path not found VNFERR .equ 45 ;Volume not found FNFERR .equ 46 ;File not found DUPERR .equ 47 ;Duplicate file name OVRERR .equ 48 ;Overrun on volume BADPATH .equ 40 ;Invalid pathname syntax CFCBFULL .equ 41 ;Character File Control Block full FCBFULL .equ 42 ;Block File or Volume Control Block full BADREFNUM .equ 43 ;Invalid file reference n BADOP .equ 26 ;Invalid operation IOERROR .equ 27 ;I/O error NOWRITE .equ 2B ;Device write-protected DISKSW .equ 2E ;Disk switched ; NOTE: Device errors 30 to 3F are device specific errors ;Invalid request code BADCTLCODE .equ 21 ;Invalid status or control code BADCTLPARM .equ 22 ;Invalid control parameter list NOTOPEN .equ 23 ;Device not open NORESRC .equ 25 ;Resources not available+-./01 ;Invalid SOS call parameter count BADSCBNDS .equ 5 ;SOS call pointer out of bounds ;* Device errors DNFERR .equ 10 ;Device not found BADDNUM .equ 11 ;Invalid device number BADREQCODE .equ 20 ; ; SOS Error numbers ; ;* General errors BADCSNUM .equ 1 ;Invalid SOS call number BADCZPAGE .equ 2 ;Invalid caller zero page BADXBYTE .equ 3 ;Invalid indirect pointer to X byte BADSCPCNT .equ 4 rts ; ; ClearRSbuff - Reset .RS232 to clear input/output buffers ; ClearRSbuff SOS Dcontrol,RSresetlist rts ; force read/write access sta outmodchar+6 lda #0 sta outmodchar+23. ; EOF sta outmodchar+24. sta outmodchar+25. jsr binrest jsr sendpacket ldx newend dex stx filename SOS Getfinfo,fileinfo beq $95 jsr ioerr rts $95 sty filename ;restore original filename length lda #3 y #1 ldx pastvname $20 lda filename,x sta outmodchar+26.,y iny inx cpx newend bne $20 dey sty outmodchar+26. ldy filename ;Position out of range ACCSERR .equ 4e ;Access not allowed BTSERR .equ 4f ;Buffer too small FILBUSY .equ 50 ;File busy DIRERR .equ 51 ;Directory error NOTSOS .equ 52 ;Not a SOS volume BADLSTCNT .equ 53 ;Length parameter invalid BUFTBLFULL .equ 55 ;Buffer table full BADSYSBUF .equ 56 ;Invalid system buffer parameter DUPVOL .equ 57 ;Duplicate Volume NOTBLKDEV .e dex bne $30 lda #precol sta col lda #prerow sta row outstr relmsg outstr prefix beq $20 $40 ; ; Process new prompt char ; rts $25 jsr doprefix bcc $40 ; ; New prefix didn't take. Redisplay the old one. ; ldx prefix stx newprefix $30 lda prefix,x sta newprefix,x outconschar SOS Write,outcons lda #5 ; turn on wrap-around sta outconschar SOS Write,outcons $20 jsr Processdialog bcc $25 jsr Disposdialog sta newprefix,x dex bne $10 lda #ftmenu & 0ff sta tempptr lda #ftmenu /256. & 0ff sta tempptr+1 jsr Showdialog lda #21. sta rompt char into Edit Box string ; lda promptchar sta pchar+1 ; ; Move current prefix into box's string ; ldx prefix stx newprefix $10 lda prefix,x lda linedelay jsr BtoDA lda #XValstr & 0ff sta tempptr lda #XValstr / 256. & 0ff sta tempptr+1 lda delay jsr BtoDA ; ; Move p ; usedir ; ; Move delay value into Edit box string ; Do binary to ascii conversion of delay ; lda #Valstr & 0ff sta tempptr lda #Valstr / 256. & 0ff sta tempptr+12456789:;<=>?@ABCction+1 lda attemptCRC sta selection+4 lda usebinary sta selection+5 lda usedir rol a rol a rol a and #3 sta selection+7 ; ; Settings Routines ; ; ; Doausettings ; Doausettings lda #0 sta selection sta submenunum ; ; Move Radio selections into selection ; lda useprompt sta sele not found BADSRCHMODE .equ 0e5 ;Invalid search_mode parameter BADCHGMODE .equ 0e6 ;Invalid change_mode parameter BADPGCOUNT .equ 0e7 ;Invalid pages parameter .equ 0e0 ;Invalid segment address SEGRQDN .equ 0e1 ;Segment request denied SEGTBLFULL .equ 0e2 ;Segment table full BADSEGNUM .equ 0e3 ;Invalid segment number SEGNOTFND .equ 0e4 ;Segmentqu 58 ;Not a block device LVLERR .equ 59 ;Invalid level BITMAPADDR .equ 5a ;Invalid bit map address ;* Utility Call error BADJOYMODE .equ 70 ;Invalid joy_mode parameter ;* Memory Call errors BADBKPG lda pchar+1 sta promptchar ; ; Process new delay value ; do ascii to binary conversion to linedelay ; if not a legal number, then use old value. ; lda #Valstr & 0ff sta tempptr lda #Valstr / 256. & 0ff sta tempptr+1 jsr DAtoB bcc $50 lda #lineng & 0ff ldx #lineng / 256. & 0ff jsr Alert jmp $20 $50 sta sec rts ; ; Dotermset - Handles Terminal settings dialog ; DoTermSet lda #Tsetmenu & 0ff sta tempptr lda #Tsetmenu /256. & 0ff sta tempptr+1 ; ; Here we'd load in thne $80 clc rts $80 ; ; *** Error: Error in prefix ; pha jsr Showgenerr outstr prefixerr pla jsr outa SOS Read,Incons jsr Disposdialog / 256. & 0ff jsr Alert sec rts $70 ; ; Prefix is legal so set it and then getprefix to ; get the voilume name (in case user gave a device name) ; SOS SetPrefix,Sprefixlist b storage type cmp #0d ;subdirectory? beq $70 cmp #0f ;volume directory? beq $70 ; ;*** Not a directory ; lda #needdir & 0ff ldx #needdir fileinfo+2 SOS Getfinfo,FileInfo pha lda #filename & 0ff sta fileinfo+1 lda #filename / 256. & 0ff sta fileinfo+2 pla bne $80 lda Fileinfo+10. ;check newprefix,x sta prefix,x dex bne $50 $60 ; ; Make sure prefix exists and is a directory ; lda #prefix & 0ff sta fileinfo+1 lda #prefix / 256. & 0ff sta #Pre2long & 0ff ldx #Pre2long / 256. & 0ff jsr Alert sec rts ; ; New Prefix. Replace whole thing. ; $40 ldx newprefix stx prefix $50 lda x tay ldx newprefix $20 lda newprefix,x sta prefix,y dey dex bne $20 jmp $60 ; set prefix $30 ; *** Error: Prefix too long ; lda ; ; No starting '.' or '/' so concat it to current prefix ; clc txa adc prefix ; check if total length < maxprefix cmp #maxprefix+1 bpl $30 sta prefi bne $10 ; if so, don't do set prrefix sec rts $10 lda newprefix+1 ; check if it starts with period cmp #2e ; or slash beq $40 cmp #2f beq $40 ; ; Doprefix - handle setting of a new prefix ; On entry, the new prefix is in the string "newprefix". ; Returns C=1 if there was an error ; doprefix ldx newprefix cpx #0 ; check for null prefix ection+5 sta usebinary lda selection+7 ;usedir for receive ror a ror a ror a and #0c0 sta usedir jsr Disposdialog rts jsr Alert jmp $20 $60 sta delay ; ; Store away Radio selections ; lda selection+1 sta useprompt lda selection+4 sta attemptCRC lda sellinedelay lda #XValstr & 0ff sta tempptr lda #XValstr / 256. & 0ff sta tempptr+1 jsr DAtoB bcc $60 lda #delayng & 0ff ldx #delayng / 256. & 0ff e current submenu selections and ; use Highlight to show them in inverse video. ; Also set the active submenu number ; lda Rstatbuff+1 ldx #8. $1 cmp stable,x beq $10 dex bne $1 $10 stx selection lda Rstatbuff+2 ldx #8. $20 cmp ftable,x beq $30 dex bne $20 $30 stx selection+1 lda halfdup beq $40 oddspace cmp (ptr1),y bne evenspace ;check backwards for non-space char dey bpl $10 ; ; Totally blank line ; gotEOL lda #0d ;put terminating CR in jsr sta ptr1 adc #40. sta ptr2 lda ssptr+1 sta ptr1+1 adc #0 sta ptr2+1 outloop lda #0a0 ;space ldy #39. $10 cmp (ptr2),y bne ;save original byte count pha lda #80 ;set to 128 sta outfile+4 ldy sstuff+2 iny ;get # of lines in viewport sty lines clc lda ssptr DFGHIJsslist ; ; strip trailing blanks, replace with CR, and pack lines together ; ; ldx #0 ;assume throughout that x indexes ;into output buffer lda outfile+4 ssptr .word sdata sslist .byte 3 .byte 0 .byte 18. .word sstuff sstuff .block 3 sdata .block 1023. .block 901. ; ; Capscreen - capture screen to disk ; Capscreen ; SOS Dstatus,utstr anykeymsg rts ; ; Showgenerr ; ; Put up a general errbox ; Showgenerr lda #emptywindow & 0ff sta tempptr lda #emptywindow / 256. & 0ff sta tempptr+1 jsr Makewindow jsr Drawframe o ;HALF $70 sta halfdup lda selection+3 sta sendlf $80 jsr Disposdialog rts ftable .byte 22,26,2a,2e,0,42,46,4a,4e stable .byte 3,4,6,7,8,9,0a,0c,0e ldx selection+1 ; set data format lda ftable,x sta Rstatbuff+2 sta format SOS DCONTROL,RSstatlist lda selection+2 beq $70 lda #80 sdialog bcs $80 ; user aborted dialog changes ; Take selections and use them ldx selection ; set speed lda stable,x sta Rstatbuff+1 sta speed lda #1 $40 sta selection+2 lda sendlf sta selection+3 lda #0 ; start with speed submenu sta submenunum jsr Showdialog jsr Proces inbuff jsr nextline ;get pointers to next line dec lines bne outloop ; see if we need to write out a partial buffer cpx #0 beq $10 stx outfile+4 ;output count SOS Write,outfile $10 pla ;restore original byte count sta outfile+4 rts ; all done evenspace clc bcc sscont oddspace tmoretry sta errretry lda #2 sta access ; always going to be writing lda #0ff sta checkspace lda usebinary sta dobinary bne $30 +1 jsr Makewindow jsr Drawframe outstr blkxfermsg ; Set file transfer count to 128. lda #128. sta outfilref+3 lda MAXRETRY sta foretry sta e lda #0 ;init blks xfered count sta xcount sta xcount+1 sta xcount+2 lda #emptywindow & 0ff sta tempptr lda #emptywindow / 256. & 0ff sta tempptr jsr ShowFBox outstr rxMsg jsr DoFbox lda inbuffer ;see if user wants to use his own filename bne $20 ; branch if so rts $20 jsr Dofilenamff+2 beq $10 ; yes, go ahead ; ; Put up error message and abort ; lda #Not8bit & 0ff ldx #Not8bit / 256. & 0ff jsr Alert sec rts $10 KMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr ; Returns: C = 0 File received ; C = 1 Error. File not received. ; RXMODEM ; ; Check if Format is 8 bits. Refuse to do ; Xmodem unless 8 bits is set up. ; lda Rstatbu; ; Receive Xmodem routines ; ;* ;* Equates ;* SOH .equ 1 EOT .equ 4 ACK .equ 6 NAK .equ 15 CAN .equ 18 .list ; ; Rxmodem - Receive a file by XMODEM protocol ; Assumes the file is already open. ptr1+1 adc #0 sta ptr1+1 lda ptr2 clc adc #80. sta ptr2 lda ptr2+1 adc #0 sta ptr2+1 rts buffer? bne $10 SOS Write,outfile bne $20 ldx #0 $10 rts $20 jsr ioerr rts ; ; nextline ; nextline lda ptr1 clc adc #80. sta ptr1 lda lda (ptr2),y jsr inbuff iny dec length bne $10 jmp gotEOL ; ; inbuff ; inbuff and #7f sta outfilchar,x inx cpx #80 ;full sec sscont php iny tya asl a plp sbc #0 sta length ldy #0 $10 lda (ptr1),y jsr inbuff dec length beq gotEOL ; Not binary II, so open file now. jsr trycreate bcc $25 jmp stopxrecv $25 lda fileref sta outfilref sta closeref ;show we have to close a file $30 lda #1 sta myblock lda outfilref+1 ;set up pointer for error checking sta dataptr ; routines lda outfilref+2 sta dataptr+1 lda #NAK SOS Write,Outfile beq $30 cmp #IOERROR bne $25 dec foretry bne saveblock $25 jsr ioerr jmp stopxrecv $30 jsr Doblockcount lda mtures ; to point to filename. ; jsr fixup $10 jsr Disposdialog ;Get rid of blocks transfered box clc rts ; ; send block out to disk ; saveblock saveblock bne $5 jmp stopxrecv $5 bmi timeout ; ; End of transfer ; alldone lda dobinary beq $10 ; ; if binary II was used, then reset file data struc outfilref sta closeref ;show we have a file to close jmp saveblock ;wasn't a binary II file $90 jmp binloop nakmore jsr naksend moreblock jsr getpacket bcc jsr createappbin bcc moreblock jmp stopxrecv $70 lda #0 sta dobinary lda #2 sta access jsr trycreate bcs $35 lda fileref stam lda outfilchar+4 cmp #0f bne $65 bit usedir bpl $90 ;ignore directories jsr Createdir ;use directories bcc $90 jmp Stopxrecv $65 ; ldx #blocksize-1 $60 lda outfilchar,x sta appstuff,x dex bpl $60 inc myblock jsr Doblockcount ; see if it's a subdirectory and user wants to use the 0ff ldx #nospace / 256. & 0ff jsr alert $35 jmp StopXrecv $40 lda #0 sta checkspace ;only check once $50 ; ; save for later processing r+8 lda free+1 sbc outfilchar+9 bcs $40 $30 ; ; Put up box saying not enough disk space ; Terminate Xmodem transfer after acknowledged ; jsr Disposdialog lda #nospace & $70 jsr getbinstuff bit checkspace bpl $50 ; ; Check to make sure all the files will fit ; jsr getfree sec lda free sbc outfilcha jmp saveblock ; not Binary II. Write to disk ; ; check to make sure it's a Binary II block. If not, then ; process it as a normal block and turn Binary II off. ; $20 jsr isbinary bne lda #0 sta doCRC ; host didn't acknowledge 'C' $85 jsr naksend outstr timemsg jmp binloop ;still have to see if Binary II or not $10 lda dobinary bne $20 $80 ; timeout beq $5 jmp alldone ; EOT $5 jmp stopxrecv ; user abort $80 bit checkspace ; do this only once! bpl $85 ldx attemptCRC stx doCRC beq $35 lda #43 ; send a C for Xmodem/CRC $35 sta outmodchar SOS Write,Outmodem binloop jsr getpacket bcc $10 bmiaxretry sta errretry ; reset retry count sta tmoretry sta foretry inc myblock ; prepare for next block lda dobinary beq moreblock jsr donecheck bcs $50 jmp moreblock $50 ; File done. ; SetEOF ; Close jsr cleanup dec filestogo jmp binloop timeout dec tmoretry beq stopxfileinfo+2 sta errname+1 bit usedir bmi $3 ldx outfilchar+23. ;get size lda #2f ; look for a '/' $11 cmp outfilchar+23.,x beq +1 sta destroylist+1 sta filelist+1 sta fileinfo+1 sta errname lda #/256.&0ff sta createlist+2 sta destroylist+2 sta filelist+2 sta char SOS Write,Outcons lda foo plp rts ; ; Createappbin ; createappbin ; ; use to create a file ; ; pathname lda # & 0ff sta createlist clc adc #7 $20 sta outconschar SOS Write,Outcons lda foo and #0f clc adc #30 cmp #3a bmi $30 clc adc #7 $30 sta outconsutput contents of A in hex onto .CONSOLE ; outa php sta foo ror a ror a ror a ror a and #0f clc adc #30 cmp #3a bmi $20 rts $40 pla tax pla tay lda #1 sec rts $50 pla tax pla tay SOS READ,Inmodem lda inmodemchar clc rts ; ; Outa - O bcs $40 ; user aborted. return with error. dey bne $20 dec dcount bne $10 ; no timeout pla tax pla tay lda #0 sec g but waste dec dcount ;time for the delay routine. clc clc clc dex bne $30 jsr modstat ;Got char from modem? bcs $50 jsr checkabort Z = 1 Timeout Error ; waitchar tya pha txa pha lda delay sta dcount $10 ldy #0aa $20 ldx #0ff $30 inc dcount ;These 2 lines don't do anythinlobal value delay ; ; Returns: ; C = 0 Got a a character from the modem. The character ; is in A. ; C = 1 Error return. ; Z = 0 User Aborted ; pha lda #ACK cmnsend sta outmodchar SOS WRITE, Outmodem pla rts ; ; Waitchar - Waits for a character to come in from the modem. Waits up ; to number of seconds in g sec ; Tell user RXmodem failed. rts ;* ;* Acksend and Naksend and Cansend ;* cansend pha lda #CAN bne cmnsend naksend pha lda #NAK bne cmnsend acksend nsend lda dobinary beq $10 jsr endfixup $10 ldx linedelay lda #2 sta linedelay ;delay 2 seconds jsr dodelay stx linedelay jsr ClearRSbuffrecv outstr timemsg jsr naksend jmp moreblock stopxrecv jsr Disposdialog ;Get rid of blocks transfered box jsr cansend ; Cancel Xmodem receive jsr cansend jsr ca $21 dex bne $11 beq $3 ;no '/' found. $21 ldy #1 $31 inx lda outfilchar+23.,x sta outfilchar+23.,y iny cpx outfilchar+23. bne $31 dey sty outfilchar+23. $3 lda #8 sta createlist+5 ;use all create options ; file_type lda outfilchar+4 sta croptlist ; aux_typedey bne $10 ; loop till end of prefix found $20 dex ; Don't copy initial '/' stx myvolname $30 lda prefix+1,x sta myvolname,x dex bne $30 rts info rts ; ; isolate volume name in prefix ; GetVname ldy prefix dey ldx #1 $10 lda prefix+1,x cmp #2f ; '/' ? beq $20 inx sta errname lda #filename / 256. & 0ff sta errname+1 sec rts ; ; Getfree - Get the number of free blocks on the volume ; Getfree jsr getvname jsr getv $20 pha jsr Disposdialog lda #outfilchar+23. & 0ff sta errname lda #outfilchar+23. / 256. & 0ff sta errname+1 pla jsr ioerr lda #filename & 0ff t+5 sta croptlist+6 sta croptlist+7 SOS Create,Createlist beq $10 cmp #DUPERR bne $20 ; abort on error other than DUP $10 clc rts ; storage_type lda #0d sta croptlist+3 ; aux_type lda #0 sta croptlist+1 sta croptlist+2 ; EOF sta croptlist+4 sta croptlis createlist+1 lda #/256.&0ff sta createlist+2 lda #8 sta createlist+5 ;use all create options ; file_type lda #0f sta croptlist a errname lda #filename / 256. & 0ff sta errname+1 rts ; ; Createdir ; createdir ; ; use to create a directory ; ; pathname lda # & 0ff sta prefix lda #prefix & 0ff sta sprefixlist+1 lda #prefix / 256. & 0ff sta sprefixlist+2 SOS Setprefix,sprefixlist beq $10 jsr ioerr $10 lda #filename & 0ff st we have a file to close jsr oldprefix clc rts $20 pha jsr Disposdialog pla jsr ioerr jsr oldprefix sec rts ; ; Oldprefix - Get back old prefix ; old jsr trycreate bcc $17 jsr oldprefix sec $5 rts $10 jsr tryopen bcs $5 $17 lda fileref sta outfilref sta closeref ;show0 cmp #DUPERR bne $20 ; abort on error other than DUP bit usedir bpl $15 jsr changewd ; ; use the name the user gave. ; $15 jsr fixup . sta croptlist+4 lda outfilchar+21. sta croptlist+5 lda outfilchar+22. sta croptlist+6 lda #0 sta croptlist+7 SOS Create,Createlist beq $1 lda outfilchar+5 sta croptlist+1 lda outfilchar+6 sta croptlist+2 ; storage_type lda outfilchar+7 sta croptlist+3 ; EOF lda outfilchar+20 ; ; GetVInfo - Get information about the volume with volname ; GetVInfo lda #myvolname & 0ff sta string1 lda #myvolname / 256. & 0ff sta string1+1 lda #volname & 0ff sta string2 lda #volname / 256. & 0ff sta string2+1 ldx #0 stx Dinfolist+1 $10 SOS D_Info,Dinfolist bne $20 bit Dinfolist+9 gewd ldx outfilchar+23. lda #2f $91 cmp outfilchar+23.,x beq $92 dex bne $91 beq $15 ;no path $92 stx newprefix ; copy old prefix into px filename bne $30 sty filename rts ; ; Changewd - Change working directory ; Get the Binary II path into newprefix and use it as ; the default prefix for now ; chan lda #2f ; look for a '/' $10 cmp filename,x beq moveup dex bne $10 rts moveup ldy #0 $30 inx iny lda filename,x sta filename,y ctogo ;check for count = 0 beq $10 clc ;not done rts $10 sec rts ; ; Justfilename - isolate the filename from the pathname ; justfname ldx filename ;get size #blocksize sta bytestogo lda bytestogo+1 sbc #0 sta bytestogo+1 lda bytestogo+2 sbc #0 sta bytestogo+2 bcc $10 ora bytestogo+1 ora bytesoutfilchar+22. sta bytestogo+2 rts ; ; Donecheck - See if the binary II file is donw ; If so, return with Carry =1 ; Donecheck sec lda bytestogo sbc ff - load up variables with Binary II stuff ; Getbinstuff lda outfilchar+127. sta filestogo lda outfilchar+20. sta bytestogo lda outfilchar+21. sta bytestogo+1 lda info+1 sta errname lda #filename/256.& 0ff sta createlist+2 sta destroylist+2 sta filelist+2 sta fileinfo+2 sta errname+1 $10 rts ; ; Getbinstuke sure all the SOS file data structures point ; back to the default filename string. ; fixup lda #filename & 0ff sta createlist+1 sta destroylist+1 sta filelist+1 sta file& 0ff sta sprefixlist+1 lda #prefix / 256. & 0ff sta sprefixlist+2 SOS Setprefix,sprefixlist beq $10 jsr ioerr $10 jsr fixup rts ; ; fixup - Ma #2 bne $10 lda outfilchar+126. bne $10 ; version 0 of Binary II only $10 rts ; ; Endfixup - like fixup but called only transfer stops ; endfixup lda #prefix inary lda outfilchar cmp #0a bne $10 lda outfilchar+1 cmp #47 bne $10 lda outfilchar+2 cmp #4c bne $10 lda outfilchar+18. cmp SOS Volume,VInfolist bne $20 jsr strcmp bne $20 ; no match, try next device clc rts ; ; Isbinary - Returns Z=1 if so, else Z=0 ; Isb ; find a block device bmi $30 $20 inc Dinfolist+1 ; check next device lda #19 cpx Dinfolist+1 bne $10 sec ; volume not found rts $30 new ldy #0 $97 iny lda prefix,y sta newprefix,y cpy prefix bne $97 ldx #0 $93 iny inx lda outfilchar+23.,x sta newprefix,y cpx newprefix bne $93 sty newprefix lda #newprefix & 0ff sta sprefixlist+1 sta errname lda #newprefix / 256. & 0ff sta sprefixlist+2 sta errname+1 e .equ 0cc flush .equ 0cd setmark .equ 0ce getmark .equ 0cf seteof .equ 0d0 geteof .equ 0d1 setlevel .equ 0d2 getlevel .equ 0d3 setbuf .equ 0df getbuf Setfinfo .equ 0c3 GetFinfo .equ 0c4 Volume .equ 0c5 setprefix .equ 0c6 getprefix .equ 0c7 open .equ 0c8 newline .equ 0c9 read .equ 0ca write .equ 0cb clos loadptr lda #%1 & 0ff sta %2 lda #%1 /256. & 0ff sta %2+1 .endm ;* ;* SOS equates ;* ; ;* File Calls ; Create .equ 0c0 Destroy .equ 0c1 rename .equ 0c2 macro outstr lda #%1+1 / 256. & 0ff sta outstrlist+3 lda #<%1+1> & 0ff sta outstrlist+2 lda %1 sta outstrlist+4 SOS Write,outstrlist .endm .macro sei lda ereg ora #80 sta ereg plp .endm .macro Set2Mhz php sei lda ereg and #7f sta ereg plp .endm .suvwx .macro pushword lda %1+1 pha lda %1 pha .endm .macro SOS brk .byte %1 .word %2 .endm .macro Set1Mhz php ;* ;* Mymacros ;* Macros and equates needed for assembly language programming ;* on the Apple /// ;* ereg .equ 0ffdf ; Environment register .macro popword pla sta %1 pla sta %1+1 .endm appropriate access SOS GetFInfo,fileinfo lda appstuff+3 ;get access sta fileinfo+6 SOS SetFInfo,fileinfo rts .nolist . sta seoflist+4 lda appstuff+22. sta seoflist+5 SOS Seteof,seoflist SOS Close,Closelist lda #0 sta closeref ;show we closed the file ; Set le and stuff after a Binary II file ; has been done ; cleanup lda fileref sta closeref sta seoflist+1 lda appstuff+20. sta seoflist+3 lda appstuff+21 SOS Setprefix,sprefixlist beq $15 jsr ioerr $15 lda #filename & 0ff sta errname lda #filename / 256. & 0ff sta errname+1 rts ; ; Cleanup - Close fi .equ 0d3 ; ;* Device Calls ; dstatus .equ 82 dcontrol .equ 83 getdevnum .equ 84 dinfo .equ 85 ; ;* Memory Calls ; requestseg .equ 40 findseg .equ 41 changeseg .equ 42 getseginfo .equ 43 getsegnum .equ 44 releaseseg .equ 45 ; ;* Utility Calls ; setfence .equ 60 getfence .equ 61 settime .equ 62 gettime .equ 63 getanalog .equ 64 terminate .block, check, doCRC, errretry ; Getpacket jsr waitchar ;Get SOH, CAN or EOT bcc firstok bne userabort lda #0ff ; timed out waiting for packet rts firstok cmp } A = 1 - EOT received. Xfer done. ; ; Subroutines used: ; waitchar, modstat, naksend, acksend, calccrc16, calccsum ; crc16, getcrc16 ; Global variables used: ; xblock, myblock, outfil; ; Getpacket - get an Xmodem packet ; ; Returns: C = 0 - packet received ok ; C = 1 ; A = -1 - Timeout ; A = 0 - Abort Xmodem ; sta ovrrow ; ; Wait for user to type something ; SOS Read,Incons jsr Disposdialog rts outname $50 pha outstr UNKemsg pla jsr outa outstr onmsg outname lda #5 sta ovrrow lda #24. sta halfwidth jsr outcname lda #1 cmp #OVRERR bne $30 outstr ovrmsg jmp outname $30 cmp #ACCSERR bne $40 outstr Accmsg jmp outname $40 cmp #FNFERR bne $50 outstr FNFMsg jmp submenunum jsr Showdialog pla cmp #IOERROR bne $10 outstr iomsg jmp outname $10 cmp #NOWRITE bne $20 outstr nowmsg jmp outname $20 y{| is for. ; ioerr pha ; ; Put up generic error box ; lda #errbox & 0ff sta tempptr lda #errbox / 256. & 0ff sta tempptr+1 lda #0 sta mitem sta ; ; ioerr - Output an I/O error message to the user. ; Prints out the appropriate error message along with the ; filename. ; A holds the SOS error number, filename holds the name of the ; file/volume/device the errorequ 65 #SOH beq GotSOH cmp #EOT ; Time to stop? beq $10 cmp #CAN ; Transmitter cancelling? bne getpacket ; Confirm CAN jsr modstat bcs getpacket ; another char so we're in the middle ; of something jsr naksend jsr waitchar bcs getpacket cmp #CAN bne getpacket rts $10 lda #0 rts dupflag .byte 0 r naksend ; tell sender to try again outstr errorfound jmp getpacket $10 sec lda #0 rts ; ; Got an error from waitchar ; goterr2 sec bne $10 lda #0ff h on SOH ; notblock outstr resynch dec errretry beq $10 jmp getpacket $10 sec rts ; ; checksum or CRC didn't match. Nak it. ; nomatch dec errretry beq $10 js ; yes. outstr blanks clc rts $60 outstr dupblks jmp getpacket ; ; block number is greater than the one we expected. Assume we came in ; at the middle of a block and we saw a false block start. Resync check ; checksums match? bne nomatch ; no $50 jsr acksend ; yes, tell sender bit dupflag ;was it a duplicate? bmi $60 heck if CRC matched ; jsr GetCRC bne nomatch tya bne nomatch beq $50 ; always taken $40 jsr calccsum ; calculate checksum cmp f CRC, get another byte bcc $30 jmp goterr2 $30 sta check+1 jsr CalcCrc16 lda check jsr CRC16 lda check+1 jsr CRC16 ; ; cbne Rdloop jsr waitchar bcc $20 jmp goterr2 $20 sta check lda doCRC ; CRC or checksum? beq $40 jsr waitchar ; ip ; always taken userabort lda #0 ; user aborted rts Rdloop jsr waitchar bcc $10 jmp goterr2 $10 sta outfilchar,y iny cpy #blocksize yblock ; is this the block we're suposed to get? beq Rdloop ; yes bcc $30 jmp notblock ; no $30 lda #80 sta dupflag ; no. Already have that one. bmi Rdloo bcc $20 jmp goterr2 $20 eor xblock cmp #0ff ; block number and com-blk ok? bne getpacket ldy #0 ; init index into buffer lda xblock cmp m rts GotSOH lda #0 sta dupflag jsr waitchar ; Get block number bcc $10 jmp goterr2 $10 sta xblock jsr waitchar ; Get complement of block number jsr naksend $20 jsr waitchar bcc $30 beq $20 ; ignore timeouts bne userabort $30 cmp #EOT bne getpacket jsr acksend sec lda #1 sec lda #0 rts $10 ; Confirm EOT jsr modstat bcs getpacket ; another char so we're in the middle ; of something ;****************** ; Dialog Routines * ;****************** ;======================================================================= ; Showdialog - Put up a dialog box from a dialog template ; Zero page pointer tempptr points to template. ; 0 jsr showedit ; show edit item jmp $100 $70 lda selection,x ; check if this is the selected item cmp count2 bne $80 ; branch if not ldade sta norm bne $60 ; always taken $50 jsr outmptr ; output submenu title $60 lda smtype ; check for editable text item cmp #EditBox bne $7e submenu? bne $50 ; branch if not lda #18. ; highlight active submenu title sta norm jsr outmptr lda #17. ; go back to normal output moitem ; save # items in submenu jsr incmptr lda (tempptr),y sta smtype ; save submenu type jsr incmptr ; cpx temp1 ; Reached activ inx txa asl a clc adc tempptr sta tempptr bcc $30 inc tempptr+1 $30 ldx #0 $40 ldy #0 sty count2 lda (tempptr),y sta maxy lda (submenutable),y ; point to the active submenu sta actsubmenu iny lda (submenutable),y sta actsubmenu+1 ldx maxsubmenu ; move tempptr past submenu table menunum ; submenunum holds # of active submenu stx temp1 lda selection,x ; mitem holds # of active item sta mitem ; of active submenu txa asl a ta tempptr+1 $20 jsr outmptr ; output dialog title lda tempptr ; Save pointer to submenu table sta submenutable lda tempptr+1 sta submenutable+1 ldx subp dialog ; jsr drawframe ; draw the box ldy #0 lda (tempptr),y sta maxsubmenu ; get how many submenus in the dialog inc tempptr bne $20 inc ;======================================================================= Showdialog jsr Makewindow ; Set up the new viewport bcc $10 rts ; error return $10 ; ; Put u ; Global Varaibles used: ; mitem, tempptr, maxsubmenu, actsubmenu, norm ; submenutable, submenunum, temp1, count2, smtype ; Calls: ; Makewindow, drawframe, outmptr, incmptr, showedit ; Called by: Variable submenunum should hold the number of the first ; active submenu. ; The active selections of the submenus are in selection ; Returns: ; Carry set if an error occured, else clear. #18. ; it is. Use inverse video sta norm jsr outmptr lda #17. ; set back to normal video sta norm jmp $90 $80 jsr outmptr ; output submenu item $90 inc count2 lda maxitem cmp count2 ; loop until all items done bpl $70 $100 inx cpx maxsubmenu ; loop until all submenus done bmi to by tempptr ; Returns: ; All registers preserved ; Global variables used: ; tempptr, temp2ptr, col, row, outstrlist ; Calls: ; incmptr ; Called by: ; ShowDialog ;============ort jsr cout clc ; Tell caller all went well rts ;======================================================================= ; ; Showedit - Put up the Editbox whose template is pointed adc #83 sta winsp lda winsp+1 sta Saveviewlist+4 adc #7 sta winsp+1 SOS DStatus,Saveviewlist lda #28. ; Home cursor and Clear viewp ; *Whew!* outstr Msetupstr ; Save viewport contents and update window data stack pointer (winsp) lda #18. sta Saveviewlist+2 lda winsp sta Saveviewlist+3 clc sets it as the new Viewport top, ; moves the cursor to the bottom right of the new ; viewport, sets it as the Viewport bottom, moves cursor ; to top left of new viewport and clears it, turns cursor back on. ; Reset the viewport jsr cout ; Msetupstr does the follwing: ; Saves the current viewport settings ; Turns the cursor off, moves the cursor to the top left ; of the new viewport, ; print everything normal sta norm ; Move tempptr past window data tya clc adc tempptr sta tempptr bcc $30 inc tempptr+1 $30 lda #1 ft iny lda (tempptr),y sta menutop iny lda (tempptr),y sta menuwidth iny lda (tempptr),y sta menuheight iny lda #17. Preserve Status Table" code sta Saveviewlist+2 SOS Dstatus,Saveviewlist ; ; Stuff new viewport coordinates into Msetupstr ; ldy #0 lda (tempptr),y sta menule clc adc #91. ;then bump it to next free space sta winsp lda winsp+1 sta Saveviewlist+4 adc #0 sta winsp+1 lda #1 ;"0 sec rts ; ignore $10 inc numwindows ; ; Save .Console status ; lda winsp ;use current value of winsp for status sta Saveviewlist+3 cout ; Called by: ; ShowDialog ;======================================================================= MakeWindow ; Set up new viewport ; lda numwindows cmp #MAXWINDOW bmi $1No errors ; Carry = 1 ; Error encountered. Window/dialog was not put up ; Global variables used: ; winsp, numwindows, Saveviewlist, tempptr, menuleft, ; menuright, menuheight, menuwidth ; Calls: ; $40 beq $40 rts ;======================================================================= ; Makewindow - Put up a dialog or window from the template pointed to ; by tempptr ; Returns: ; Carry = 0 ; =========================================================== Showedit pha tya pha ; position cursor jsr Poscurs ldy #1 ;skip max count lda (tempptr),y ;copy tempptr to temp2ptr sta temp2ptr iny lda (tempptr),y sta temp2ptr+1 iny tya ; update tempptr clc adc tempptr sta temp; tempptr ; Calls: ; Called by: ; ;======================================================================= IncMptr inc tempptr bne $10 inc tempptr+1 $10 rts .IF 1=0 ; ; *** Dodialo lda #1 sta Saveviewlist+2 SOS DControl,Saveviewlist $10 rts ;======================================================================= ; IncMptr - Increment tempptr ; Returns: ; Global variables used: ; Restore old viewport settings sec lda winsp sbc #91. sta winsp sta Saveviewlist+3 lda winsp+1 sbc #0 sta winsp+1 sta Saveviewlist+4 sbc #83 sta winsp sta Saveviewlist+3 lda winsp+1 sbc #7 sta winsp+1 sta Saveviewlist+4 lda #18. sta saveviewlist+2 SOS DControl,SaveViewlistlled by: ;======================================================================= Disposdialog ldx numwindows dex bmi $10 stx numwindows ; Restore Viewport Contents sec lda winsp rts ;======================================================================= ; Disposdialog - Dispose of the current dialog/window ; Returns: ; Global variables used: ; winsp, numwindows, Saveviewlist ; Calls: ; Ca======================================================== Poscurs ldy #0 lda (tempptr),y sta col jsr incmptr lda (tempptr),y sta row jsr incmptr outstr relmsg use for row and column. ; Returns: ; tempptr pointing beyond row and column information ; Global variables used: ; tempptr, row, col, relmsg ; Calls: ; incmptr ; Called by: ;===============c $10 inc tempptr+1 $10 pla tay pla rts ;======================================================================= ; Poscurs - Position the cursor on the screen. tempptr points to the ; values toda tempptr sta outstrlist+2 lda tempptr+1 sta outstrlist+3 SOS Write,outstrlist pla ; get ptr past string clc adc tempptr sta tempptr bc=================== outmptr pha tya pha jsr Poscurs ;Position the cursor ; Output the string lda (tempptr),y sta outstrlist+4 jsr incmptr pha lby tempptr ; Returns: ; All registers preserved ; Global variables used: ; col, row, tempptr, outstrlist ; Calls: ; incmptr ; Called by: ;==================================================== adc #0 sta outstrlist+3 SOS Write,outstrlist pla tay pla rts ;======================================================================= ; ; Outmptr - Output the string item pointed to ptr bcc $10 inc tempptr+1 $10 ; Output the string lda (temp2ptr),y sta outstrlist+4 lda temp2ptr clc adc #1 sta outstrlist+2 lda temp2ptr+1 g is a sample dialog routine ; Dodialog lda Testmenuptr sta tempptr lda Testmenuptr+1 sta tempptr+1 jsr Showdialog ; ; * Here we'd load in the current submenu selections and ; * use Highlight to show them in inverse video. ; * Also set the active submenu number ; lda #0 sta selection sta selection+1 sta selection+2 sta submenunum ldx #0 jmp $10 ; ; A dialog specific key has been hit. Go to the appropriate routine ; specific pha ldy #1 ; Get submenu type lda (actsubmenu),y Right arrow bne specific jsr outsm ; unhighlight old active title ldx submenunum lda mitem sta selection,x inx cpx maxsubmenu bmi $10 beq $10menu iny lda (submenutable),y sta actsubmenu+1 lda selection,x sta mitem jsr highsm ; highlight new active title jmp Ploop $20 cmp #21. ; ldx submenunum lda mitem sta selection,x dex bpl $10 ldx maxsubmenu $10 stx submenunum txa asl a tay lda (submenutable),y sta actsub ; Escape bne submchange pla sta halfdup sec rts submchange cmp #8 ; Left arrow bne $20 jsr outsm ; unhighlight old active title jsr Readcons cmp #0d ; Return bne $10 ldx submenunum lda mitem sta selection,x pla sta halfdup clc rts $10 cmp #1b light ; Called by: ; ;======================================================================= Processdialog lda halfdup pha lda #0 ; Set as Full Duplex (no echo) sta halfdup Ploop Carry = 1; if user hit escape ; Global variables used: ; halfdup, mitem, submenunum, maxsubmenu, submenutable, ; actsubmenu, selection, norm ; Calls: ; outsm, highsm, Editprocess, unhighlight, high and return for commiting to the dialog choices. ; If the user hits any other key, it and subsequent ; keystrokes are processed by the appropriate routine. ; Returns: ; Carry = 0; No errors ; ========================================= .ENDC ;======================================================================= ; Processdialog - processes the left and right cursor keys ; for submenu switching, escape for aborting ; Submenu title string ; Followed by submenu items ; ; Format of an item: ; Starting coordinates of the string ; Left ; Top ; Number of bytes in the string ; The string itself ; ;==============================pointers to submenus then the submenu records ; ; Format of a submenu record ; Number of items in the submenu - 1 ; Submenu type (Radio, EditBox) ; Coordinate of Submenu Title ; Left ; Top ; Size of submenu title ; Left ; Top ; Width ; Height ; Max number of submenus in the dialog - 1 ; Coordinate of dialog Title ; Left ; Top ; Size of dialog title ; dialog title string ; ; Follwed by ; *** Process dialog here *** jsr processdialog jsr disposdialog rts ;======================================================================= ; ; Format of a dialog is: ; Rectangle of dialog: ; tax pla cpx #radio beq radioprocess jsr Editprocess jmp Ploop Radioprocess cmp #11. ; Up arrow bne $20 jsr unhighlight dec mitem bpl $10 ldy #0 ;*** index to maxitem field lda (actsubmenu),y sta mitem $10 jsr highlight jmp Ploop $20 cmp #0a ; Down arrow beq $30 jmp Eloop2 ;======================================================================= ; Ebinit - Initialize an Editbox ; Returns: ; A is preserved ; Global variables used: ; actsubmenu, tempptr ; time processing dey bmi $70 ; nothing to delete, ignore jsr dobs jmp Eloop2 $70 ldy #0 jmp Eloop2 $80 jsr erasebox lda #80 sta firsttime sta outconschar SOS Write,Outcons iny dex bne $40 $50 rts $60 cmp #8 ; Backspace bne Eloop2 bit firsttime bpl $80 ; special first sta outconschar $30 SOS Write,outcons dey bne $30 $35 outstr relmsg ldy #0 lda (tempptr),y beq $50 tax iny $40 lda (tempptr),y r),y rts $20 cmp #1b ; Escape bne $60 ; ; Erase what user typed and replace with last value ; tya beq $35 outstr relmsg lda #20 n bne $20 ; ; copy user string to final destination ; tya pha iny $10 lda buff-1,y sta (tempptr),y dey bne $10 pla sta (tempptastlimit sta buff,y iny Eloop1 sta outconschar SOS Write,Outcons Eloop2 jsr Readcons jmp Eloop pastlimit lda #7 jmp Eloop1 ctrl cmp #0d ; Returnit Eloop cmp #20 bmi ctrl bit firsttime bmi $10 ; ; erase box ; jsr erasebox ldx #80 stx firsttime $10 cpy limit bpl pfirsttime, limit, buff, tempptr ; Calls: ; ebinit, erasebox, dobs ; Called by: ; ;======================================================================= Editprocess ldy #0 sty firsttime jsr ebinorm ; back to default of normal output rts ;======================================================================= ; Editprocess - processes user keypresses for edit box ; Returns: ; Global variables used: ; ctsubmenu clc ; get past maxitem and submenu type adc #2 sta tempptr lda actsubmenu+1 adc #0 sta tempptr+1 jsr outmptr lda #17. sta es used: ; Calls: ; outmptr ; Called by: ; ; norm, actsubmenu, tempptr ;======================================================================= Highsm lda #18. sta norm outsm lda a mitem beq $10 ; Always taken ;======================================================================= ; Outsm - Output a submenu title?? ; Highsm - Like Outsm except submenu is highlighted ; Returns: ; Global variabl jmp Ploop $30 jsr unhighlight inc mitem lda mitem ldy #0 ;*** index to maxitem field cmp (actsubmenu),y bmi $10 beq $10 lda #0 sta Calls: ; Called by: ; ;======================================================================= Ebinit pha lda actsubmenu sta tempptr lda actsubmenu+1 sta tempptr+1 lda #4 ; skip past itemcount,type,row,col tay ; of submenu title sec ; skip byte count and adc (tempptr),y ; title tay lda (tempp menuwidth, menuheight ; Calls: ; cout ; Called by: ; ;======================================================================= Drawframe lda #21. jsr cout lda #1 ; Turn off sta tempptr dex bpl $20 rts ;======================================================================= ; Drawframe - Draw the frame around the dialog ; Returns: ; Global variables used: ; sta tempptr+1 pla ldy #2 ldx mitem $20 clc adc (tempptr),y bcc $30 inc tempptr+1 clc $30 adc #3 bcc $40 inc tempptr+1 $40 oitem clc lda actsubmenu ; get pointer to submenu and adc #2 ; skip item count and type sta tempptr pha lda actsubmenu+1 adc #0 the number of the item to ; point to. ; Returns: ; Global variables used: ; actsubmenu, tempptr, mitem ; Calls: ; Called by: ; ;======================================================================= Gett norm jsr outmptr rts ;======================================================================= ; Gettoitem - Gets tempptr to point to the appropriate item of the currently ; active submenu. Uses mitem as ========================================================== Unhighlight ; ; goto string coordinate ; ; output 17 ; ; output string ; jsr gettoitem lda #17. sta ================================================================= ; Unhighlight - Unhighlight an item ; Returns: ; Global variables used: ; norm ; Calls: ; gettoitem, outmptr ; Called by: ; ;======================================== Highlight jsr gettoitem lda #18. sta norm jsr outmptr lda #17. sta norm ;default back to normal jsr cout rts ;====================================== ; Highlight - Highlight an item ; Returns: ; Global variables used: ; norm ; Calls: ; gettoitem, outmptr, cout ; Called by: ; ;============================================ (tempptr),x beq $20 tax lda #20 sta outconschar $10 SOS Write,Outcons dex bne $10 outstr relmsg $20 pla rts ;=======================================served ; Global variables used: ; tempptr, relmsg ; Calls: ; Called by: ; ;======================================================================= Erasebox pha outstr relmsg ldx #0 lda tempptr+1 pla sta tempptr ldy #0 pla rts ;======================================================================= ; Erasebox - Erase the string in an Editbox ; Returns: ; A is pretr),y sta col iny lda (tempptr),y sta row iny lda (tempptr),y sta limit iny lda (tempptr),y pha iny lda (tempptr),y sta scroll and wrap jsr cout lda #9. jsr cout ldx menuwidth dex dex lda #5f sta outconschar $10 SOS Write,outcons dex bpl $10 ldx menuheight $20 lda #0a jsr cout lda #7c jsr cout dex bne $20 lda #0c jsr cout lda #0a js ;# of files to transfer still (Binary II) checkspace .byte 0 ;boolean. True = check disk space to make sure ; file being received will fit myblock .byte 1 MAXRETRY .byte 10. ;Max amonable can never be set true. RLEenable .byte 0 ; user RLE enable check .word 0 foo .byte 0 appstuff .block blocksize bytestogo .block 3 ;# of bytes to transfer still filestogo .byte 0 ; DoCRC .byte 0 ; boolean. True = Use CRC in Xmodem transfer dobinary .byte 0 ; boolean. True = Use BNinary II translation RLEcapable .byte 0 ; system RLE capable ; if RLEcapable is false, then RLEebyte 1 ; Counter for File I/O retries setref .byte 0 ; reference for Xmodem.set file bscount .byte 0 ; # of chars sent since last return keymod .byte 0 ; modifier keys temp .byte 0 .byte 0 ;boolean. True = Ignore LF on inputs. capture .byte 0 ;boolean. True = capture is on. format .byte 0 speed .byte 0 dcount .byte 1 ; Counter for delay routine foretry . .byte 3a ;Prompt char to wait for ascii U/L. Def ':' linedelay .byte 1 ;Delay after CR in Ascii upload delay .byte 1 ;Delay for Xmodem usedir .byte 0 ;bit 7 for receive, bit 6 for transmit ignorelfter a CR. useprompt .byte 1 ;boolean. True = Wait for prompt on ascii U/L AttemptCRC .byte 0 ;boolean. True = try to use CRC first in Xmodem usebinary .byte 0 ;boolean. True = try Binary II translation promptchar 512. ; size of a logical disk block ;************ ; Variables * ;************ ; * These 10 are saved/restored in this order in Xmodem.set halfdup .byte 0 ;0=FULL, 80 = HALF sendlf .byte 0 ;boolean. True = Send LF af .macro savewindow .byte 90. .block 90. .block 1023. .block 900. .endm Inverse .equ 18. Normal .equ 17. blocksize .equ 128. ; Xmodem block size dblocksize .equ dex lda #9. jsr cout lda #5f sta outconschar $40 SOS Write,outcons dex bne $40 lda #12. ; Home cursor jsr cout rts r cout ldx menuheight $30 lda #7c jsr cout lda #8 jsr cout lda #0a jsr cout dex bne $30 ldx menuwidth unt of retries for errors errretry .byte 0 ;Retry count for I/O errors tmoretry .byte 0 ;Retry count for time-out errors xblock .byte 0 invblk .byte 0 suppress0 .byte 0 captoggle .byte 0ff ;Ascii capture toggle halfwidth .byte 0 lines .byte 0 length .byte 0 ; ; * Variables for menustuff ; submenunum .byte 0 ;# of currently active submenu mitem .byte 0 ;holds .byte 3 .byte 0 .byte 0 ;reset .word 0 keystatlist .byte 3 keynum .byte 0 .byte 5 .word gotin gotin .word 0 modstatlist .byte 3 .byte 0 .by********** ; Data structure for Device Number calls * ;***************************************** RSstatlist .byte 3 .byte 0 .byte 1 .word Rstatbuff Rstatbuff .byte 15. .block 15. RSresetlist cture for Device Number calls * ;***************************************** consnumlist .byte 2 .word consname consdev .byte 0 rs232numlist .byte 2 .word rsname rs232dev .byte 0 ;******************************* Copyright .byte 42. .byte 26.,6,4 .ascii "Xmodem /// (c) 1987, 1988 Gary M. Kato" Version .byte 14. .byte 26.,19.,6 .ascii "Version 1.8" ;***************************************** ; Data stru .ascii "P " .ascii " " .byte 127. .ascii "? for help" .byte normal,0d,0a,2 initscreen .byte 3 initref .byte 0 .word initstuff .word initscreen-initstuff 27. .ascii "A " .byte 127. .ascii "E " .byte 127. .ascii "Z " .byte 127. .ascii "S " .byte 127. .ascii "F " .byte 127. .ascii "T " .byte 127. ******************* initstuff .byte 28.,5,inverse .ascii " XMODEM /// Terminal program -- " .byte 127. .ascii "Q " .byte 127. .ascii "R " .byte 127. .ascii "W " .byte 1rd croptlist .byte 8 croptlist .byte 0 .word 0 .byte 0 .word 0,0 Destroylist .byte 1 .word 0 ;***************************** ; Data structure screen init * ;**********elist .byte 4 .word filename Fileref .byte 0 .word access .byte 1 access .byte 0 filename .byte 0 .block 128. createlist .byte 3 .word filename .woread/write grafname .byte 7 .ascii ".GRAFIX" .endc RS232list .byte 4 .word RSname RS232ref .byte 0 .word consopt .byte 1 RSname .byte 6 .ascii ".RS232" Fil ; read/write consname .byte 8 .ascii ".CONSOLE" .if RLE graflist .byte 4 .word grafname grafref .byte 0 .word grafopt .byte 1 grafopt .byte 3 ; .block 256. ;*************************** ; Data Structures for OPEN * ;*************************** conslist .byte 4 .word consname consref .byte 0 .word consopt .byte 1 consopt .byte 3 of 16 submenus here!! *** counter .byte 0 count2 .byte 0 temp1 .byte 0 maxitem .byte 0 numwindows .byte 0 ;total # of active windows firsttime .byte 0 limit .byte 0 buff # of currently selected item maxsubmenu .byte 0 ;# of submenus in the dialog selection .block 16.,0 ;array to hold #s of selected items ; in submenu[i] ;NOTE: *** Limitte 3 .word buffstatus buffstatus .block 8 ;******************************************* ; Data structures for Device Control calls * ;******************************************* Duplist .byte 3 dupdevnum .byte 0 .byte 0b .word halfdup nllist .byte 3 nldev .byte 0 .byte 2 .word nldata nldata .byte 80 .byte 0d Dclist .byte 3 .byte 0 ;dev num te 26.,8.,3 .ascii "No such device/volume/directory" .byte 26.,13.,4 .ascii "Error number was " Needdir .byte 29. .byte 26.,13.,3 .ascii "Prefix must be a directory" delayng .byte 39. .ascii " Can not create file named" FNFMsg .byte 33. .ascii " Can not find file named" Pre2long .byte 27. .byte 26.,13.,3 .ascii "Prefix name is too long." Prefixerr .byte 54. .byor" nowmsg .byte 39. .ascii " Write Protect on disk containing" iomsg .byte 35. .ascii " Too many errors writing to" OEmsg .byte 33. .ascii " Can not open file named" CREMsg .byte 34. ges ; UNKemsg .byte 30. .ascii " Unknown I/O Error #" onmsg .byte 3 .ascii " on" Accmsg .byte 33. .ascii " Not opened for write on" ovrmsg .byte 34. .ascii " No more room on disk f .byte 3 .byte 0 .word 0 .word 0 myvolname .byte 0 .block 15. volname .byte 0 .block 15. devname .byte 0 .block 15. gksetname .byte 10. .ascii "XMODEM.SET" ; ; Error Messa 4 .byte 0 .word inbuffer+1 .word 128. .word 0 inbuffer .block 128. SMlist .byte 3 smref .byte 0 .byte 0 ;absolute block value .word 0 .word 0 outstrlist tfilchar .block 128. geoflist .byte 2 .byte 0 ; ref num goes here .word 0,0 seoflist .byte 3 .byte 0 ; ref num .byte 0 .word 0,0 getline .bytechar .word 1 ; request count .word 0 ; actual bytes transferred infilechar .block 128. outfile .byte 3 outfilref .byte 0 .word outfilchar .word 1 ou .word 1 .word 0 inmodemchar .block 128. outmodem .byte 3 outmodref .byte 0 .word outmodchar .word 1 outmodchar .block 133. infile .byte 4 infileref .byte 0 .word infile .if RLE outgraf .byte 3 outgref .byte 0 .word outgrafchar .word 1 outgrafchar .block 64. outgptr .word outgrafchar .endc inmodem .byte 4 inmodemref .byte 0 .word inmodemchar word inconschar .word 2 .word 0 inconschar .block 128. outcons .byte 3 outref .byte 0 .word outconschar .word 1 outconschar .block 128. outptr .word outconschar .byte 2 .word prefix .byte maxprefix prefix .byte 3. .ascii ".D1" .block maxprefix-15. closelist .byte 1 closeref .byte 0 incons .byte 4 inref .byte 0 . $1 $1 .byte 1 ; 233-millisecond intervals ;********************************* ; Data structures for File calls * ;********************************* sprefixlist .byte 1 .word prefix .byte maxprefix gprefixlist.byte 3 ;set .console mode .word $1 $1 .byte 80 ;have it return both ascii and KBport BreakList .byte 3 .byte 0 ; RS232 device num goes here .byte 3 .word .byte 26.,8.,3 .ascii "Xmodem timeout value is not a number" lineng .byte 30. .byte 26.,13.,3 .ascii "Delay value is not a number" .IF RLE Nografix .byte 101. .byte 26.,11.,3 .ascii "Couldn't open .GRAFIX driver" .byte 26.,8.,4 .ascii "Check to make sure it's in SOS.DRIVER" .byte 26.,11.,5 .ascii "RLE Graphics being disabled" .endc NoRs232 .byte 89. .byte 26.,11.,3 ; storage_type .block 4 ; EOF .word 0 ; blocks used .block 4 ; last_mod date Ovrset .byte 4 .byte 24. Ovrcol .byte 0 .byte 25. Ovrrow .byte 1 Ovrmenu ord 0 free .word 0 fileinfo .byte 3 .word filename .word $1 .byte 15. $1 .byte 0 ; access .byte 0 ; file_type .word 0 ; aux_type .byte 0 evname .word $1 .byte 3 $1 .byte 0 ; slot # .byte 0 ; unit # .byte 0 ; dev type vinfolist .byte 4 .word devname .word volname total .w .byte 3 ; set viewport bottom Relmsg .byte 5 .byte 24. col .byte 0 .byte 25. row .byte 0 norm .byte 0 dinfolist .byte 4 .byte 0 ; devnum .word dupstr .byte 10. .byte 6 .byte 26. menuleft .byte 0 menutop .byte 0 .byte 2 ; set viewport top .byte 24. menuwidth .byte 0 .byte 25. menuheight .byte 0 ; ; SOS data structures for menustuff ; SaveViewlist ;Save Viewport .byte 3 .byte 0 ;dev num of .console here .byte 18. .word windowstack ;buffer address goes here Mset .byte 13. .byte 26.,18.,5 .ascii " " timemsg .byte 13. .byte 26.,18.,5 .ascii "Timeout " Nospace .byte 33. .byte 26.,10.,3 .ascii "Not enough disk space for file" 13. .byte 26.,18.,5. .ascii "Duplicate " resynch .byte 13. .byte 26.,18.,5 .ascii "Resynching" errorfound .byte 13. .byte 26.,18.,5 .ascii "Error " blanks ffmsg .byte 30. .byte 0d,0a,inverse .ascii "Ascii Capture Toggle Off" .byte normal,0d,0a swvolmsg .byte 36. .byte 26.,6,3 .ascii "Insert the disk with Xmodem on it" dupblks .byte scii "Ascii Upload done" upabortmsg .byte 23. .byte 26.,15.,3 .ascii "Ascii Upload Aborted" togonmsg .byte 29. .byte 0d,0a,inverse .ascii "Ascii Capture Toggle On" .byte normal,0d,0a togo3 .ascii "Ascii capture is already on" toffmsg .byte 34. .byte 26.,11.,3 .byte 7,Inverse .ascii "Turn off Ascii capture first" .byte Normal updonemsg .byte 20. .byte 26.,17.,3 .a .byte 26.,13.,4 .ascii "XModem Transmit Done" Blkxfermsg .byte 28. .byte 26.,13.,3 .ascii " 0 blocks transferred" Textstr .ascii ".text" CapOnmsg .byte 30. .byte 26.,11.,modem Receive Aborted" XRDoneMsg .byte 22. .byte 26.,16.,4 .ascii "XModem Receive Done" TXAbortMsg .byte 26. .byte 26.,13.,4 .ascii "Xmodem Transmit Aborted" XTDoneMsg .byte 23. .ascii "Couldn't open .RS232 driver" .byte 26.,8.,4 .ascii "Add .RS232 driver to SOS.DRIVER" .byte 26.,11.,5 .ascii "using System Utilities" RXAbortMsg .byte 25. .byte 26.,13.,4 .ascii "X .byte 10.,8,60.,7 .byte 0 .byte 23.,2 .byte 15. .ascii "already exists." .word $1 $1 .byte 2 .byte Radio .byte 23.,4 .byte 10. .ascii "Overwrite?" .byte 21.,6 .byte 3 .ascii "Yes" .byte 26.,6 .byte 2 .ascii "No" .byte 34.,6 .byte 6 .ascii "Cancel" precol .equ 5. prerow .equ 5 .list ftmenu .b .byte 8. .ascii "600 baud" .byte 3,10. .byte 9. .ascii "1200 baud" .byte 3,11. .byte 9. .ascii "1800 baud" .byte 3,12. .byte 9. .ascii "2400 baud" .b 5 .ascii "Speed" .byte 3,6 .byte 8. .ascii "110 baud" .byte 3,7 .byte 10. .ascii "134.5 baud" .byte 3,8 .byte 8. .ascii "300 baud" .byte 3,9. 16.,2 .byte 17. .ascii "Terminal Settings" .word $1 .word $2 .word $3 .word $4 $1 .byte 8. ; 9 items .byte Radio .byte 3,4 .byte .block 4. pchar .byte 1 .ascii ":" .block 4. newprefix .byte 0 .block maxprefix tsetmenu .byte 17.,3.,63.-17.,15. .byte 3. ; 4 submenus .byte " .byte 56.,11. .byte 13. .ascii "Download only" .byte 56.,12. .byte 4. .ascii "Both" .nolist Valstr .byte 1 .ascii "3" .block 4. XValstr .byte 1 .ascii "1" 53.,7. .byte 28. .ascii "Use pathnames in" .byte 26.,53.,8 .ascii "Binary II" .byte 56.,9. .byte 7 .ascii "Neither" .byte 56.,10. .byte 11. .ascii "Upload only.byte 0 ; 1 item .byte Editbox .byte 28.,15. .byte 14. .ascii "Xmodem timeout" .byte 31.,16. .byte 3 .word XValstr $8 .byte 3 .byte Radio .byte $6 .byte 1 .byte Radio .byte 28.,11. .byte 9. .ascii "BINARY II" .byte 31.,12. .byte 3 .ascii "Off" .byte 31.,13. .byte 2 .ascii "On" $7 ; 2 items .byte Radio .byte 28.,7 .byte 21. .ascii "Xmodem Error Checking" .byte 31.,8 .byte 12. .ascii "Use Checksum" .byte 31.,9. .byte 7 .ascii "Use CRC" .word pchar $4 .byte 0 ; 1 item .byte Editbox .byte 5,14. .byte 11. .ascii "Delay Value" .byte 9,15. .byte 3 .word Valstr $5 .byte 1 .byte 8.,9. .byte 10. .ascii "Use Prompt" $3 .byte 0 ; 1 item .byte Editbox .byte 5,11. .byte 11. .ascii "Prompt Char" .byte 9,12. .byte 1 x .word newprefix $2 .byte 1. ; 2 items .byte Radio .byte 5.,7 .byte 20. .ascii "After a line is sent" .byte 8.,8 .byte 9. .ascii "Use Delay" d $6 .word $7 .word $8 $1 .byte 0 ; 1 item .byte Editbox .byte 5.,4 .byte 6 .ascii "Prefix" .byte precol .byte prerow .byte maxprefiyte 3.,3.,76.,18. .byte 7. ; 8 submenus .byte 28.,2. .byte 22. .ascii "File Transfer Settings" .word $1 .word $2 .word $3 .word $4 .word $5 .woryte 3,13. .byte 9. .ascii "4800 baud" .byte 3,14. .byte 9. .ascii "9600 baud" $2 .byte 8. ; 9 items .byte Radio .byte 15.,4 .byte 6 .ascii "Format" .byte 15.,6. .byte 18. .ascii "7 bits, odd parity" .byte 15.,7. .byte 19. .ascii "7 bits, even parity" .byte 15.,8. .byte 19. .ascii "7 bits, MARK pari .ascii "Receive Xmodem" .byte 26.,3,3,Inverse .ascii "Filename:" .byte Normal,20 TXmsg .byte 33. .byte 26.,23.,1 .ascii "Transmit Xmodem" .byte 26.,3,3,Inverse .ascii .byte 15.,7 .byte 21. .ascii "Hit any key to return" .byte 2,4 .byte 1 .ascii " " emptywindow .byte 15.,4,48.,8. RXmsg .byte 32. .byte 26.,23.,1 rmat." errbox .byte 15.,4,48.,8. .byte 0 .byte 1,1 .byte 1 .ascii " " .word $1 $1 .byte 1 .byte Radio .byte 20.,2 .byte 9. .ascii "I/O Error" yte 26.,20.,2 .byte inverse .ascii "Sorry" .byte normal .byte 26.,2.,4 .ascii "You are not currently using 8 bit, no parity" .byte 26.,2.,5 .ascii "Xmodem requires that particular data fo" .byte 3,12. .byte 22. .byte 07f .ascii "T - Terminal Settings" .byte 3,13. .byte 24. .byte 07f .ascii "P - Send a BREAK signal" Not8bit .byte 104. .b .ascii "Z - Toggle Ascii Capture On/Off" .byte 3,10. .byte 23. .byte 07f .ascii "S - Stop File Transfer" .byte 3,11. .byte 27. .byte 07f .ascii "F - File Transfer Settings" .byte 3,7 .byte 18. .byte 07f .ascii "A - Ascii Capture" .byte 3,8 .byte 17. .byte 07f .ascii "E - Ascii Upload" .byte 3,9. .byte 32. .byte 07f .byte 9. .byte 07f .ascii "Q - Quit" .byte 3,5 .byte 19. .byte 07f .ascii "R - Receive Xmodem" .byte 3,6 .byte 20. .byte 07f .ascii "W - Transmit Xmodeme 1. .ascii " " .word $1 $1 .byte 10. .byte Radio .byte 13.,2 .byte 4 .ascii "Help" .byte 7,15. .byte 21. .ascii "Hit any key to return" .byte 3,4 .byte 38.,13. .byte 2 .ascii "NO" .byte 38.,14. .byte 3 .ascii "YES" Filebox .byte 10.,8,60.,4 Helpmenu .byte 18.,4.,36.,16. .byte 0 .byte 1,2 .byt $4 .byte 1 ; 2 items .byte Radio .byte 38.,10. .byte 15. .ascii "Add" .byte 10.,8,8,8 ; Kludge for a 2 line title .ascii "Linefeed" byte 1. ; 2 items .byte Radio .byte 38.,4 .byte 6. .ascii "Duplex" .byte 38.,6 .byte 4 .ascii "Full" .byte 38.,7 .byte 4 .ascii "Half" byte 15.,12. .byte 19. .ascii "6 bits, even parity" .byte 15.,13. .byte 19. .ascii "6 bits, MARK parity" .byte 15.,14. .byte 20. .ascii "6 bits, SPACE parity" $3 .ty" .byte 15.,9. .byte 20. .ascii "7 bits, SPACE parity" .byte 15.,10. .byte 17. .ascii "8 bits, no parity" .byte 15.,11. .byte 18. .ascii "6 bits, odd parity" . "Filename:" .byte Normal,20 Acapmsg .byte 31. .byte 26.,23.,1 .ascii "Ascii Capture" .byte 26.,3,3,Inverse .ascii "Filename:" .byte Normal,20 Aupmsg .byte 32. .byte 26.,23.,1 .ascii "Transmit Ascii" .byte 26.,3,3,Inverse .ascii "Filename:" .byte Normal,20 Filmsg .byte 15. .byte 26.,3,3,Inverse .ascii "Filename:" .byte 0 crc .word 0 ply .word 0 ;1021H is for x^16+x^12+x^5+1 lda #10 sta ply+1 rts ; ; getcrc - Get the current CRC into A (high byte) and Y (low byte) ; Getcrc ldy crc lda crc+1 rts value .byte tay pla plp rts ; ; Icrc16 - initializes crc and polynomial ; icrc16 lda #0 sta crc sta crc+1 lda #21 sta ply ;ply = 1021H eor ply+1 ;do high byte also crclp1 sta crc+1 dex bne crclp ;loop if not done with all 8 bits ;restore registers and exit pla tax pla nch if MSB of CRC is 1 ;bit 7 is 1 so EOR the CRC with the polynomial tay ;save crc high in y lda crc eor ply ;EOR low byte with the polynomial sta crc tya #80 ;mask off other bits eor crc+1 ;EOR bit 7 with bit 16 of the CRC asl crc ;shift crc left 1 bit - low byte rol a ; then high byte bcc crclp1 ;bra txa pha ;Loop through each bit generating the CRC ldx #8 ;8 bits per byte crclp asl value ;move bit 7 to Carry ror a ;move carry to bit 7 and nguage Routines" by Lance Levanthal and ; Winthrop Seville. Osborne/McGraw Hill Publications ; CRC16 ; Save the data byte sta value ; Save all registers php pha tya pha ; ; Title Generate CRC-16 ; Name: CRC16 ; ; Data byte to use is in A ; ; Purpose: Generate a 16 bit CRC based on the IBM binary ; synchronous communications protocol. ; ; From "6502 Assembly La"Start your program to receive." ; ; Viewport contents save area (5 viewport saveable)!!! ; windowstack savewindow savewindow savewindow savewindow savewindow Normal,20 anykeymsg .byte 26. .byte 26.,15.,7 .byte Inverse .ascii "Hit any key to return" .byte Normal rstartmsg .byte 50. .ascii "Ready to transmit. " .ascii ; ; mult10 - Multiply A by 10 ; mult10 asl a sta multtemp asl a asl a clc adc multtemp rts multtemp .byte 0 ; ; DAtoB - converts what's at (tempptr) to a number ; ldx #Caponmsg / 256. & 0ff jsr Alert rts $1 ; Set capture to true lda #0ff sta capture lda #2 sta access ;write-only access ; ; Ascii Up/Download Routines ; ; ; Acapture - Open a file and copy modem input to it. ; Acapture lda capture beq $1 ; output that ascii capture is already on lda #Caponmsg & 0ff quotient lsr divisor bne $10 ; always taken $30 tax lda quotient rts quotient .byte 0 divisor .byte 0 ldx #0 stx quotient ldx #shifted10 stx divisor ldx #5 $10 cmp divisor bcc $20 sbc divisor inc quotient $20 dex beq $30 asl lda cvbuff,x adc #30 sta (tempptr),y iny dex bpl $20 rts ; ; Amod10 - Return with remainder in X, quotient in A ; On entry, A has dividend ; shifted10 .equ 0a0 Amod10 bne $10 ; ; i = 0; ; while stlevel-- != 0 do ; tempptr[i++] = pop()+'0'; ; clc tya tax adc #1 ldy #0 sta (tempptr),y iny $20 toDA ; ; repeat ; push(A % 10); ; A = A div 10; ; stlevel++; ; until A<>0; ; ldy #0ff $10 jsr amod10 iny stx cvbuff,y cmp #0 ny dex bne $1 $10 clc pla tay lda sum rts $20 sec pla tay rts sum .byte 0 digit .byte 0 ; ; BtoDA - Binary to Decimal Ascii conversion ; Biny $1 lda (tempptr),y sec sbc #30 bmi $20 cmp #10. bpl $20 sta digit lda sum jsr mult10 clc adc digit sta sum i Number returned in A. C set if error ; ; *** USES tempptr in ZPage, so set it up before calling! ; DAtoB tya pha ldy #0 sty sum lda (tempptr),y tax  lda #4 sta croptlist ;ASCII text file if create needed lda #1 sta createlist+5 ;use only file type lda #0 sta mitem sta selection sta submenu jmp $40 ; got prompt. send next line $70 ; ; Do linedelay here ; jsr dodelay bcs $90 jmp $40 $80 lda #toffmsg & 0ff ldx #toffmsg / 256. & 0ff prompt beq $70 $60 jsr checkabort bcs $90 jsr modstat bcc $60 SOS READ,Inmodem lda inmodemchar tax jsr echo cpx promptchar bne $60 bne $40 ; if not, loop lda #0a ; echo a linefeed jsr echo ; ; End of line sent. Do linefeed stripping, linedelay, or ; wait for prompt char here. ; lda use jsr modstat bcc $57 SOS Read,inmodem lda inmodemchar jsr echo ;echo anything echoed back $57 lda infilechar cmp #0d ; Check for end of line infilechar sta outmodchar SOS WRITE,Outmodem ldx halfdup beq $55 lda infilechar jsr echo ;echo file char if half duplex jmp $57 $55 ;** GAG! Only 1 char at a time for now. sta infileref+3 $40 jsr checkabort bcs $90 SOS READ,Infile beq $50 jmp $120 ;On error (esp. EOF), stop upload. $50 lda lda inbuffer beq $20 jsr Dofilename jsr Addtext jsr tryopen bcc $30 $20 jmp $100 $30 lda fileref sta infileref lda #1 a foretry lda #0 sta mitem sta selection sta submenunum sta inbuffer ; for clearing the Editbox jsr ShowFbox outstr AupMsg jsr DoFbox d an ascii file to host ; Aupload lda capture ;make sure ascii capture is off beq $10 jmp $80 $10 lda #1 sta access ; Set for Read access lda MAXRETRY st sta closeref SOS Flush,Closelist SOS CLOSE,Closelist lda #1. sta outfilref+3 lda #5 jsr cout ; force cursor on JNU rts ; ; AUpload - Uploa jsr capscreen $10 rts $20 lda #0 sta capture rts Stopcapture lda capture beq JNU ; Capture wasn't on SC2 lda #0 sta capture lda fileref lda MAXRETRY sta foretry lda keymod and #2 ;was shift key down? beq $10 ;no ; ; yes. Capture screen to disk before exiting. ; t jsr trycreate bcs $20 lda #0ff sta captoggle ;Toggle is *on* initially lda fileref sta outfilref lda #1 sta outfilref+3 num sta inbuffer ; for clearing the Editbox jsr ShowFbox outstr AcapMsg jsr DoFbox lda inbuffer beq $20 jsr Dofilename jsr Addtex jsr Alert rts $90 lda infileref sta closeref SOS Close,Closelist $100 lda #upabortmsg & 0ff ldx #Upabortmsg / 256. & 0ff jsr Alert rts $110 lda infileref sta closeref SOS Close,Closelist lda #Updonemsg & 0ff ldx #Updonemsg / 256. & 0ff jsr Alert rts $120 cmp #EOFERR beq $110 jsr ioerr rts MANUAL.P2vK' '&NOTICE K!ACKNOWLEDGE K"%INDEXK $II.LK!' jsr Disposdialog rts tx outref+2 SOS Write,outcons lda #outconschar & 0ff sta outref+1 lda #outconschar / 256. & 0ff sta outref+2 lda #1 sta outref+3 SOS read,incons rame outstr anykeymsg ldy #0 lda (strptr),y sta outref+3 clc ldx strptr+1 lda strptr adc #1 sta outref+1 bcc $10 inx $10 sto be displayed. ; Alert sta strptr stx strptr+1 lda #errbox & 0ff sta tempptr lda #errbox / 256. & 0ff sta tempptr+1 jsr Makewindow jsr Drawf ; ; Alert - Put up an Alert box, display a message, wait for ; user to hit any key to kill Alert and return ; ; On entry, A and X hold the low and high bytes of ; a pointer to the message ;restore registers tay pla tax pla rts or the linedelay routine. clc clc clc dex bne $50 dey bne $40 jsr checkabort bcs $60 dec dcount bne $35 $60 pla pha clc lda linedelay beq $60 sta dcount $35 ldy #0ff $40 ldx #0ff $50 inc dcount ;These 2 lines don't do anything but waste dec dcount ;time f; ; Dodelay - timing loop linedelay. Delay value in seconds is in global ; variable "linedelay" ; ; Returns C=0 on normal exit, C=1 if aborted. ; dodelay pha ;save registers txa pha tya ON II.E, II.G, II.I. BAUD RATE II.C BINARY II STANDARD INTRO, I.B, I.C BOOTING I.E BREAK II.J CATALYST I.Subject Section Found ------------------------------------ --------------- ABORT SESSION/TRANSMISSION II.I ASCII CAPTURE/RECEIVE II.F ASCII TERMINAL INTRO, I.B, ID ASCII TRANSMISSI of Quark, Inc. Selector /// is a trademark of Sabre Software, Inc. Distributed by ON THREE, Inc. Program and Manual placed into Public Domain in 1989. XMODEM /// code Copyright 1987 by Gary Kato. Manual Copyright 1987 by Moore Enterprises. XMODEM /// is a registered trademark of Moore Enterprises. Apple /// and Apple Computer are registered trademarks of Apple Computer, Inc. Catalyst is a trademarkrved. This document may not, in whole or part, be copied, photocopied, reproduced, translated or reduced to any electronic medium or machine readable form without prior consent, in writing, from Moore Enterprises. States do not allow the exclusion or limitation of implied warranties or liability for incidental or consequential damages, so the above limitations and exclusions may not apply to buyer. The software and this manual are copyrighted. All rights are resen no event shall VENDOR be liable for direct, indirect, incdiental or consequential damages resulting from any defect in the software, even if VENDOR shall be solely liable only to replace defective software within ninty (90) days after purchase. Some ld or licensed "as is". The entire risk as to its quality and performance is with the buyer. Should the programs prove defective following their purchase, the buyer, and not VENDOR, its distributors or its retailers, assumes conseqquential damages. I out notice. DISCLAIMER OF ALL WARRANTIES AND LIABILITIES VENDOR makes no warranties, either expressed or implied, with respect to this manual, as to its quality, performance, merchantability or fitness for any particular purpose. VENDOR'S software is soNOTICE (From Original Manual before being placed into Public Domain) Both Pair Software and Hermit Software, hereinafter known as VENDOR, reserve the right to make modifications and improvements in the product described in this manual at any time and withF CHECKSUM I.B, II,B CONTROL-D II.L CONTROL-S II.L CONTROL-U II.L CONTROL-X II.L CRC I.NSMISSIONII.IASCII CAPTURE/RECEIVEII.FASCII TERMINALINTRO, I.B, ID&ASCII TRANSMISSIONII.E, II.G, II.I. BAUD RATEII.C$BINARY II STANDARDINTRO, I.B, I.C BOOTINGI.E BREAKII.JCATALYSTI.FCHECKSUM I.B, II,B CONTROL-DIIg a block, and instruct the remote terminal to send the block again. CONTROL-S This command key will instruct the remote computer that the last block was received and to send the next block in sequence. e remote computer that the transmission from your system has ended. Use only as a last resort if your system has finished transmission and has not returned to the terminal mode. CONTROL-U This command key will send a negative acknowledgement of receivin// a standardised XMODEM terminal. CONTROL-X This command key will abort and cancel an XMODEM receive or transmission. Use only if your system appears to 'lock-up' and you have no other options for aborting. CONTROL-D This command key will instruct thXMODEM /// COMMAND KEYS: XMODEM /// also has the four standard command keys for the XMODEM protocol that can be used during a XMODEM transmission or receive session. These keys are normally NOT used by the operator, and are included only to make XMODEM /OPEN APPLE> A II.F Z II.H TERMINAL SETTINGS II.C XMODEM, RECEIVE II.D XMODEM, TIMEOUT II.B XMODEM, TRANSMIT II.E IX, SYSTEM II.B PROMPT CHAR II.B QUIT II.K SAVE WITH PATHNAME II.B SCREEN CAPTURE II.F SELECTOR /// II.F < S II.I T II.C W II.E Z II.H PARITY II.C PATHNAME, BINARY II II.B PREFI.A A II.F E II.G F II.B P II.J Q II.K R II.D II.B FORMAT II.C HELP II.A LINE, AFTER SENT II.B LINEFEED II.C MODEM I.A / OR ? IB, II.B DELAY VALUE II.B DUPLEX, FULL II.C DUPLEX, HALF II.C ERROR CHECKING, TRANSMISSION I.B, II.B EXIT II.K FILE TRANSFER SETTINGS .L CONTROL-SII.L CONTROL-UII.L CONTROL-XII.LCRC I.B, II.B DELAY VALUEII.B DUPLEX, FULLII.C DUPLEX, HALFII.C(ERROR CHECKING, TRANSMISSION I.B, II.B EXITII.KFILE TRANSFER SETTINGSII.B FORMATII.C HELPII.ALIN