home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / com4swap.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-26  |  2.2 KB  |  51 lines

  1. '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 323                                          Date: 18 Apr 94  08:47:00
  3. '  From: Paul Smith                                   Read: Yes    Replied: No 
  4. '    To: Brian Copeland                               Mark:                     
  5. '  Subj: com 4 & Swapping
  6. '──────────────────────────────────────────────────────────────────────────────
  7. 'You can switch the com 2 & 4 interrupt addresses in memory... hehe...
  8. 'Remember to switch em back when your program is about to exit!  Might
  9. 'also include it as part of your error routine.
  10.  
  11. 'eg:
  12. '  Put 2's address in 4's place & 4's in 2's then address com2: it will
  13. '  really be using Com4:
  14.  
  15. 'How to: ( In case you don't know  dos stores in reverse byte order)
  16.  
  17. 'Com1: Address = &h0000:0400      'INFO ONLY
  18. 'Com2: Address = &h0000:0402
  19. 'Com3: Address = &h0000:0404
  20. 'Com4: Address = &h0000:0406
  21.  
  22. 'SO
  23. Def Seg = &h0                      'Point ds to bottom of memory
  24. HiCom2Addr = &h0403                'get addresses straight
  25. LoCom2Addr = &h0402                'in our heads & code
  26. HiCom4Addr = &h0407
  27. LoCom4Addr = &h0406
  28.  
  29. HiTempValCom2 = Peek(HiCom2Addr)   'Save com2:'s values so we
  30. LoTempValCom2 = Peek(LoCom2Addr)   'don't overwrite & lose 'em
  31.                                    'test this before we do it
  32.  
  33. Print"Com2: should show 02F8 & a check shows it to be";
  34. Print Hex$(HiTempValCom2); Hex$(LoTempValCom2)
  35. Print"If you see 02F8 or 2F8 then ";
  36. Print"you can un rem the statements below"
  37.  
  38. 'Poke HiCom2Addr,Peek(HiCom4Addr)   'Copy Com4:'s address to Com2:
  39. 'Poke LoCom2Addr,Peek(LoCom4Addr)
  40. 'Poke HiCom4Addr,HiTempValCom2      'Put Com2:'s Address into Com4:
  41. 'Poke LoCom4Addr,LoTempValCom2
  42. Def Seg                             'Point ds to Dgroup again
  43.                                     'Def seg must not be rem'd out
  44.  
  45.  
  46. 'Tested....  Was ok.  If garbled in transfer & pblms just reboot
  47. 'When you run the message, it will report it's findinge in respect
  48. 'to com2:. if there's a match it made it to you intact.
  49. 'Qb only allows byte pokes... pb allows words, bytes, & strings...
  50. 'I suppose an assembly word peek & poke would simplify this.
  51.