home *** CD-ROM | disk | FTP | other *** search
-
-
- program does and how it functions when they reuse the code a year after
- they wrote it.This also helps the person reading the code and gives them
- insight into why the author wrote the routine the way they did.
-
- You are allowed to use the Bellterm code on a few conditions. The main ones
- being the signing of a license for the code if used commercially. It is
- covered in the "README" file within the SFX files.
-
- >It seems to me that ML is very difficult to edit.
- That is the value of the source code! I uploaded some ML tutor programs a
- year
- or so back. Check them out.
- ------------
- Category 5, Topic 33
- Message 20 Thu Aug 19, 1993
- CBM-ED [e.g.bell] at 08:49 EDT
-
- Well put John!
- ------------
- Category 5, Topic 33
- Message 21 Tue Aug 24, 1993
- M.SEABRUM at 20:35 EDT
-
- Ok. Ok. I have done some reading on a trip to Kansas and on the way back and
- everything is kinda falling into place. I have Jim Butterfields book and it's
- helping me out alot.
-
- Tell me this. I guess I will have to buy a SYMBOLIC ASSEMBLER from TENEX or
- somewhere. If I had the source code for say this ML that I am working with, I
- can change the address from within the source and it will load at it's new
- location changing all the JMPS and JSR's along the way. Right?
-
- I guess this might depend on the programmers style. I would like to thank
- everyone for introducing me to ML. Now I have ran into something that I'm
- total confused about. It's the Logical operators.
-
- AND, OR, and EOR. I understand that AND turns bits off, OR does the opposite,
- and EOR flips the bit (0 becomes 1, 1 becomes 0).
-
- What's the purpose of these operators. I have read and read and still don't
- understand them.
-
- I know that they are dealing with bits and are very confusing. I'm writing ML
- programs [Hand on Experience] thanks to Mr. Butterfield. Little things, not
- biggies yet.
-
- I'm curious. If I change the error vectors and point them to a area of memory
- where I will store a ML program to reboot my BBS if a error occrs, how will I
- say Load "Filename",8 in ML?
-
- I know I must disable the interrupts before my routine and enable them after
- it is complete. Just before I say load the program I guess. Any help?
-
- ------------
- Category 5, Topic 33
- Message 22 Tue Aug 24, 1993
- C128.JBEE at 20:56 EDT
-
- >M.SEABRUM
- >If I had the source code for say this ML that I am working with, I can
- >change the address from within the source and it will load at it's new
- >location changing all the JMPS and JSR's along the way. Right?
-
- Yes, it is usually as simple as that.
- ------------
- Category 5, Topic 33
- Message 23 Wed Aug 25, 1993
- R.KNOP1 [Rob Knop] at 01:17 EDT
-
- Re: AND and OR and EOR. The easiest way to understand these is with a truth
- table. Consider a single bit (with apologies to those in 40 columns):
-
- input2 input2
- AND ------ OR ------
- 1 0 1 0
- input1: 1 1 0 input1: 1 1 1
- 0 0 0 0 1 0
-
- EOR input2
- ------
- 1 0
- input1: 1 0 1
- 0 1 0
-
- When you do this to the whole byte, you do it bit-by-bit, so, for example:
-
- $35 AND $6D = %0011 1001
- AND %0110 1101
- ----------
- %0010 1001 = $29
-
- $35 OR $6D = %0011 1001
- OR %0110 1101
- ----------
- %0111 1101 = $7D
-
- As to why would you use this. Well, once you learn how they work and get a
- feel for them, you will start seeing circumstances in which they will be
- useful. For intance, suppose you wanted to test to see if the joystick
- firebutton was held down. However, the register for the joystick actually has
- 5 bits controlled by the 'stick: for directions (up, down, left, right) and
- the button. Given that the button is controlled by the highest bit, bit 7,
- you could extract the state of the button using:
-
- lda $DC00 ;Control register for Joystick port 2
- and #$80 ;$80 = %1000000
-
- At this point, the accumulator holds $80 if the button is up, $00 if the
- button is pressed, regardless of the direction in which the joystick is being
- pushed.
-
- Hope this is of some help.
-
- Re: buying a symbolic assembler, before you do so be sure to ask folks here
- for advise. There are some that are better than others. Once you get to the
- good ones, though, you will never get all of us here to agree as to which is
- the best! Some will swear by Buddy, others won't budge from Merlin, while
- others are addicted to LADS and derivatives.
-
- Are you on a 64 or a 128?
-
- -Rob
- ------------
- Category 5, Topic 33
- Message 24 Wed Aug 25, 1993
- CBM-ED [e.g.bell] at 08:50 EDT
-
- Michael: You have already gotten some good answers from John and
- Rob, but I'll add a few logs too...
-
- MR> I know that they are dealing with bits and are very confusing.
- MR> I'm writing ML programs [Hand on Experience] thanks to Mr.
- MR> Butterfield. Little things, not biggies yet.
-
- Rob's answer was very good. I was going to use sprites as an example.
- Sprites are bit controlled... for example, the sprite control register
- turns the eight sprites on and off using a corresponding bit for each
- sprite. To turn on sprite 1 without affecting the rest of the sprites
- you would, for example, use the instructions:
-
- lda 53269
- ora %00000001
- sta 53269
-
- To turn it off, you would use the instruction:
-
- lda 53269
- and %11111110
- sta 53269
-
- The AND and OR are used so that you can affect just the desired bit or
- bits and leave the ones you don't want to change alone.
-
- EOR has a more practical use, or one that I use all the time. I use it
- to toggle bits. For example, if I want something to happen when a flag
- is set (greater than zero) and something else when it is not set (equal
- to zero) I use EOR to toggle a bit in the flag. This way, I only need
- 1 routine with 1 entry point to toggle the flag. For example:
-
- lda flag
- eor %00000001
- sta flag
-
- Every time you used this bit of code, the variable 'flag' would change
- from 0 to 1 (assuming no other bits are being used as flags).
-
- MR> I'm curious. If I change the error vectors and point them to a
- MR> area of memory where I will store a ML program to reboot my
- MR> BBS if a error occurs, how will I say Load "Filename",8 in ML?
-
- Depends on whether you are doing it in BASIC or ML. If in BASIC, you
- will just execute your BASIC program at the appropriate line number,
- something beyond the scope of this answer (tho not all that difficult).
- If in ML, an example might be:
-
- lda length-of-name:ldx #<name.low:ldy #>name.high:jsr setnam
- lda #0:tax:jsr setbnk; (c128 mode only)
- lda channel:ldx drive number:ldy #$01:jsr setlfs:jsr load
-
- This will do a 'relocating' load to the address in the file header, which
- should work ok for most of your program files. However, this will not
- do all that you want if the file being loaded is a BASIC file, because
- you will still have to RUN it. But what you are asking about the error
- vectors will work if you do it right.
-
- MR> I know I must disable the interrupts before my routine and
- MR> enable them after it is complete. Just before I say load the
- MR> program I guess. Any help?
-
- Not sure why you have to do this. The vectors are not really involved
- with the interrupts, at least not the error vector. & Y N6 j
- ^ I don't think it
- would hurt tho.
- ------------
- Category 5, Topic 33
- Message 25 Wed Aug 25, 1993
- R.KNOP1 [Rob Knop] at 22:26 EDT
-
- Another clever little use of ora is to check multi-byte values vs. zero.
- Suppose you want to test if a 2-byte variable is zero; the most boneheaded way
- to do this is (pardon my geoProgrammer accent):
-
- lda var
- cmp #$00
- bne 10$
- lda var+1
- cmp #$00
- bne 10$
- ; -- code for var=0
- rts
-
- 10$ ; -- code for var<>0
- rts
-
- Now, of course, the cmp's are wholly gratuitous here, since lda will set the Z
- flag, so you can shave off four bytes by cutting the code to:
-
- lda var
- bne 10$
- lda var+1
- bne 10$
- ; -- code for var=0
- rts
-
- 10$ ; -- code for var<>0
- rts
-
- However, with the use of the ORA opcode, you can cut of another two bytes:
-
- lda var
- ora var+1
- bne 10$
- ; -- code for var=0
- rts
-
- 10$ ; -- code for var<>0
-
- If you then go to variables longer than two bytes, the savings becomes more
- significant. I have used this method routinely myself in code that needed to
- repeatedly check various four-byte variables vs. 0. Instead of four lda's and
- four bne's, I have one lda, three ora's, and one bne -- a savings of three
- bne's, or six bytes.
-
- -Rob
- ------------
- Category 5, Topic 33
- Message 26 Fri Aug 27, 1993
- M.SEABRUM at 00:29 EDT
-
- Thank you guys for all of your input! I really appreciate it. I have saved all
- the comments/suggestion concerning this matter and will save it to disk to try
- to make some sense out of it. I have a new question now. Don't I always :)!
-
- Here we go. As mentioned in a previous statement, I'm basically thru with GM-
- BBS V4.0 and it has been released.
-
- Since the release, I have noticed a few minor bug. These are dealing with
- LINEFEEDS of all things. I was not responsible enough to check the ML to see
- if it sends out linefeeds after each carriage return. The linefeeds are added
- automatically if the characters going out is sent from within the program.
- However, no linefeeds are going out if I read something from a disk. Like a
- SEQ file or something. I know if you open the modem channel above 127
- linefeeds will follow carriage return. Is that correct? It really does not
- matter because it will be too much trouble to go back and change it open
- statement. Wait a minute, it should not be that much trouble after all. So I
- can get that open as a option. Anyway, the BBS is located at 40960 (A000) and
- ends at 42040 (a438).
-
- As you can see, the ML is located at the bottom of basic! How in the world can
- he get a prgram to enter the bottom of basic [Basic Rom]. I thought ROM meant
- 'Read Only Memory' and that it could not be written to. Somehow there's a
- trick that lets him do this. Another question, why when I go to disassemble
- this ML it does not work.
-
- My procedure for editing this ML is as follows:
-
- 1) Turn off computer
-
- 2) Load Supermon + (w/,8) 3) Type Run [Once in Supermon] l "gm-bbsml-2",08
- [Calls the BBSML into memory]. Remember, it's at the bottom of BASIC.
-
- After the ML has loaded, I do the following:
-
- d +40960
-
- It's suppose to disassemble the ML, instead it gives me a whole diffrent
- reading... For example:
-
- Address 40960 (A000) in the BBS ML read ... brk
-
- Ok.. But when I disassemble that address I get something else not the BRK.
-
- In other words, I have printed out the ML and when I disassemble it things are
- not matching as they suppose to. All the address when disassembled are
- something diffrent from what's on the printer paper...
-
- Now the second half of the problem ... LINEFEEDS!!
-
- When the ML reads a seq or something of the disk LINEFEEDS are not coming thru
- or being sent to the modem. I will include the section of the ML that reads
- from disk and sends it to the modem. Here we go...
-
- 41298 jsr clrchn 41301 ldy #0 41303 sty 41297 41306 sty 41296 41309 ldx #8
- 41311 lda #0 41313 jsr chkin 41316 cmp #8 41318 beq 41321 41320 rts
-
- 41321 jsr getin 41324 sta 41256,y 41327 iny 41328 cmp #13 41330 beq 41344
- 41332 cpy #40 41334 beq 41344 41336 ldx +144 [?] 41338 stx +155 [?] 41340 cpx
- #64 41342 bne 41321
-
- 41344 ldx +144 [?] 41346 stx +255 [?] 41348 sty 41297 41351 jsr clrchn 41354
- ldy #0 41356 lda 41256,y 41359 sta 41019 41362 jsr chrout 41365 ldx 831 send2
- modem 0=n 255=y 41368 cpx #0 41370 bne 41395 41372 ldx #5 [Modem] 41374 jsr
- chkout 41377 lda 41019 41380 ldx 832 [0=graphics 255=ASC] 41383 cpx #0 41385
- cpx #0 [Twice, why?] 41387 beq 41392 41389 jsr 40961 41392 jsr chrout 41395
- jsr clrchn 41398 ldx 41296 41401 cpx #0 41403 bne 41408 41405 jsr 41432 41408
- iny 41409 cpy 41297 41412 bne 41356 41414 ldx +255 41416 cpx #64 41418 beq
- 41426 41420 jmp 41471 [* not included] 41423 jmp 41301 41426 lda #8 41428 jsr
- close 41431 close
-
- 41432 sty 40960 41435 jsr getin 41438 cmp #0 41440 bne 41461 41442 ldx 831
- 41445 cpx #0 41447 bne 41467 41449 ldx #5 41451 jsr chkin 41454 jsr getin
- 41457 cmp #0 41459 beq 41467 41461 sta 41296 41464 jsr clrchn 41467 ldy 40960
- 41470 rts
-
- 40960 brk 40961 cmp #65 40963 bcc 40973 40965 cmp #91 40967 bcs 40973 40969
- ora #32 [?] 40971 bne 40983 40973 cmp #93 40975 bcc 40983 40977 cmp #219 40979
- bcs 40983 40981 and #127 40983 RTS
-
- Ok, there you have it. I was thinking if I relocated the area at location
- 40960 and placed it somewhere after the ML at 42040 say 42045 and added a
- routine to check the accumlator for a return key ($0D) then print it. A
- linefeed ($0A) will loaded into the accumulator and printed right after the
- return ($0D). I guess I will have to stash the contents of the accumulator
- away before I load it with the carriage return and linefeed. This area we are
- working in is a CALL FROM JSR. Therefore I was thinking the accumulator should
- be exactly what it was when the routine was called. So I'll stash the
- accumulator away when the routine is first called and will load it contents
- back in from memory when this routine is finished. This way, the accumulator
- is not altered.
-
- How does this all sound? You think it will work? Please help.
-
- DON'T FORGET to instruct me how to disassmeble this thing from the BOTTOM OF
- BASIC.
-
- Notes on ML program listed above:
-
- [?]= What's the function of the statement.
-
- All of this just to add a LINEFEED to data going out from disk. Is there a
- easier way?
-
- P.S. I know I will have to ADD JMP at address 40961. The JMP will point to the
- new address location (42045)
-
- Any help. I know it's quite a shopping list.
-
- ------------
- Category 5, Topic 33
- Message 27 Mon Aug 30, 1993
- CBM-MARK at 23:46 EDT
-
- Whenever you want to send a formatted list, like the source listing in the
- previous message, use '*sn' to send the message. The formatting won't be
- all messed up.
-
- Mark ;)
- ------------
- Category 5, Topic 33
- Message 28 Tue Aug 31, 1993
- M.SEABRUM at 03:35 EDT
-
- I see. You can delete the message because the problem has been solved.
- Thanks..
- ------------
-
- 5