Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pro-nucleus.cts.com!tjohnson From: tjohnson@pro-nucleus.cts.com (Terry Johnson) Newsgroups: comp.sys.apple Subject: Peripheral Card I/O Message-ID: <8906040916.AA11105@crash.cts.com> Date: 3 Jun 89 18:58:06 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: pnet01!pro-sol!pro-nucleus!tjohnson@nosc.mil Organization: The Internet Lines: 49 I'm a beginning assembly language programmer and I am attempting to learn how to use peripheral cards. Currently I'm trying to learn by writing "dumb" terminal program for my Hayes Smartmodem 1200A on my Apple enhanced //e. This is what I have so far: (ORG $300) JSR $FC58 ; A weak attempt at neatness. You'll see things get messier. LDA #02 ; My modem is in slot 2. This and the following instruction JSR $FE95 ; do the same thing as "PR#2" or "2CTRL-P" (i.e. activate ; modmem). JSR $FD6A ; Lazy use of subroutine to get a line. This is where I type LDY #$00 ; "AT DT XXX-XXXX return." Length of line is stored in X-reg. *LDA $0200,Y ; Line stored starting at $200. Get first character and put JSR $FDF0 ; it on the screen so can at least see if I typed it right. JSR $FDED ; Also, send same character to the "current" output device ; (modem since JSR $FE95). INY ; Increment Y to get next character. DEX ; Decrement length of line stored in X. BNE $30D (*) ; Get next character and repeat (BNE "*") until X-reg=0. ; Since the modem will execute the command sent to it's ; buffer once the return is sent that I typed at the end ; of the command string during the $FD6A subroutine, the ; result up to this point is that the modem dials the ; number and connects. Here's the problem--> LDA #$02 ; I assumed that if I did a "IN#2" with this line and JSR $FE8B ; this line, input would come "from" the modem. LDA #00 ; With this, "PR#0," I assumed that output from the modem JSR $FE95 ; would go to the screen. In other words, I assumed I would BRK ; see the introduction screen to the BBS that I was calling. Was I ever wrong. Remember that the reason I wrote this sloppy, throw-it-together program was to experiment to see if I could get some insight as to how these things work. So allow me to apologize for such an unprofessional and "far from elegant" program. What is required for this method to work? Am I going about this totally wrong due to some misunderstanding I have of PR# and IN#? Should I be using PASCAL firmware protocol entry points that my manual mentions with explainations incomprehensible to me? Thanks zillions in advance for any help since I haven't found many people in my area that are interested, willing to help me or that know anything about the subject. Terry Johnson Biochem Student U.C. Riverside