home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 83 / asm / source / sos / protect.z80 < prev    next >
Encoding:
Text File  |  2001-07-01  |  18.7 KB  |  567 lines

  1. ; ╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½
  2. ; ╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗ AutoDetect Protection Program ½½½½½½½½½½½½½½½½½½½½½½½½½½½½
  3. ; ╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗╗½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½
  4. ;
  5. ;
  6. ; This is a "little" program that I wrote. When you run it, everything is pretty much
  7. ; self explainatory.  
  8. ;
  9. ; I tried to explain as much stuff as possible, if you don't understand anything
  10. ; just email me and I'll try to help you out.  Please understand that I am still
  11. ; learning also.  ;-]
  12. ;
  13. ; ______________________________________________________________________________
  14. ; ╗╗ You are free to use this but a little thanks to me would be appreciated. ½½ 
  15. ; ______________________________________________________________________________
  16. ;
  17. ;
  18. ; Please send all questions to Jimmy Conner at ╗╗ TIMagic@yahoo.com ½½
  19. ; http://www.geocities.com/Silicon Valley/Network/6963/       TI-XX Page
  20. ;
  21. ;
  22. ;  This should always be opened in Ultra Edit
  23. ;
  24.  
  25.  
  26. .NOLIST                ; Required
  27. #define equ .equ        ; Include these so the program will compile right
  28. #define EQU .equ        ;  ''       ''  ''  ''    ''    ''     ''    ''
  29. #define END .end        ;  ''       ''  ''  ''    ''    ''     ''    ''
  30. #define curlist    8265h        ; My var for the current program list
  31. #define prog     8266h        ; My var for the number of the programs
  32. #define type     8267h        ; My var for the type of the program
  33. #define nprog     8268h        ; My var for the number of the current program
  34. #define load     8269h        ; My var for if its done passing the programs on the pages in front of it
  35. #define loadn     826Ah        ; My var for which program to change the type on
  36. #define curloc     826Bh        ; My var for the current program you are on
  37. #define old     826Dh        ; My var for the pixels on screen
  38. #define row    826Eh        ; Old start for direct input
  39. #define row2    826Fh        ; End of where it should reverse
  40. #define rev    8271h        ; Reverse??
  41. #define noxor    8272h        ; Not ot reverse
  42. #define nextl    8273h        ; Show a > arrow or not
  43. #include "ti83asm.inc"        ; Include these so the program will compile right
  44. #include "tokens.inc"        ;  ''       ''  ''  ''    ''    ''     ''    ''
  45. .LIST                    ; Required
  46.  
  47. .org 9327h                ; ALL TI-83 Programs start here in memory
  48.  
  49.     ccf                ; Makes the program invisible to AShell.
  50.     jr    prog_start
  51.     .dw    $0000            ; pointer to the libraries
  52.                     ; use $0000 if no libraries are used
  53.     .dw    description        ; pointer to a description string
  54.                     ; (0 terminated)
  55.  
  56. prog_start:
  57.     set    plotloc, (iy+plotFlags)    
  58.     call    _runIndicOff        ; Turns off Runindicator
  59.     call    _clrLCDFull        ; Clear Screen
  60.     call    _grbufclr        ; Clear the GraphBuffer
  61.     xor    a            ; Reset our current list
  62.     ld    (loadn), a        ; Reset our current Load program
  63.     inc    a            ; Increase or cursor location
  64.     ld    (curlist), a        ; Store it
  65.     ld    (curloc), a        ; Store it
  66. mainloop:
  67.     call    display1        ; Call the display 
  68.     call    detect2            ; Call my detection routine
  69.     ld    hl, 0800h        ; Load the coordinates for pencol
  70.     ld     (pencol), hl        ; Set these coordinates
  71.     call    reversetext
  72.     jp    marp            ; Call the run routine
  73.     ret                ; This exits completely
  74. display1:
  75.     ld    bc, 3800h        ; Load the coordinates
  76.     ld    de, 383Fh        ; Load the coordinates
  77.     ld    h, 01h            ; Tell it a solid line
  78.     call    _iline            ; Draw the line
  79.     ld    bc, 4000h        ; Load the coordinates
  80.     ld    de, 403Fh        ; Load the coordinates
  81.     call    _iline            ; Draw the line
  82.     ld    bc, 3000h        ; Load the coordinates
  83.     ld    de, 303Fh        ; Load the coordinates
  84.     call    _iline            ; Draw the line
  85.     ld    hl, 0033h        ; Load the coordinates
  86.     ld     (pencol), hl        ; Set them up
  87.     ld    a, 50h            ; Load a 'P'
  88.     call    _vputmap        ; Put it on the screen
  89.     ld    hl, 003Bh        ; Load the coordinates
  90.     ld     (pencol), hl        ; Set them up
  91.     ld    a, 55h            ; Load a 'U'
  92.     call    _vputmap        ; Put it on the screen
  93.     ld    bc, 0            ; Load the coordinates
  94.     ld     (pencol), bc        ; Set them up
  95.     ld    hl, author        ; Protect Program
  96.     call    _vputs            ; Put it on the screen
  97.     ld    bc, 0842h        ; Load the coordinates
  98.     ld     (pencol), bc        ; Set them up
  99.     ld    hl, author1        ; "2nd  -"
  100.     call    _vputs            ; Put it on the screen
  101.     ld    bc, 1042h        ; Load the coordinates
  102.     ld     (pencol), bc        ; Set them up
  103.     ld    hl, author2        ; "Changes"
  104.     call    _vputs            ; Put it on the screen
  105.     ld    bc, 1C42h        ; Load the coordinates
  106.     ld     (pencol), bc        ; Set them up
  107.     ld    hl, author3        ; "Clear"
  108.     call    _vputs            ; Put it on the screen
  109.     ld    bc, 244Dh        ; Load the coordinates
  110.     ld     (pencol), bc        ; Set them up
  111.     ld    hl, author4        ; "Quits"
  112.     call    _vputs            ; Put it on the screen
  113.     set    textEraseBelow, (iy+textflags)
  114.     set     textinverse, (iy+textflags)    ; Toggle text inverse on
  115.     ld    bc, 0041h        ; Load the coordinates
  116.     ld     (pencol), bc        ; Set them up
  117.     ld    hl, thankyou        ; "TIMagic"
  118.     call    _vputs            ; Put it on the screen
  119.     res     textinverse, (iy+textflags)    ; Reset text inverse (off)
  120.     ret                ; End this sub routine
  121. delay:
  122.     ld     bc, 7FFFh        ; Delay length->bc
  123. delayLoop:
  124.     dec    bc            ; bc-1->bc
  125.     ld     a, b            ; Find where it is at
  126.     or     c            ; ''     ''   ' '   '
  127.     jr    nz, delayLoop        ; If not done reloop
  128.     ret                ; Return the call
  129. reversetext:
  130.     ld    a, (penrow)        ; Get the penrow 
  131.     add    a, 80h            ; Add 80h
  132.     ld    (row), a        ; Store that to the row
  133.     add    a, 7            ; Add 7 more to make the end of the row
  134.     ld    (row2), a        ; Store it
  135.     call    hlight            ; Call the reversing routine
  136.     ret
  137. marp:
  138.     xor    a            ; Reset our load program
  139.     ld    (loadn), a        ; Store it
  140.     ld    a, (curloc)        ; What it the current Cursor location??
  141.     ld    (nprog), a        ; Store it
  142.     ld    h, a            ; Store it to h
  143.     ld    l, 7            ; Store 7 to l
  144.     call    _htimesl        ; Multiply them to find penrow
  145.     inc    hl            ; Go down one
  146.     ld    h, l            ; Load penrow to h
  147.     ld    l, 00h            ; Load the coordinates for pencol
  148.     ld     (pencol), hl        ; Set these coordinates
  149. getkey:
  150.     ld     a, 0ffh            ; Reset keyport
  151.     out     (1), a            ; Necessary code
  152.     ld     a, 0bfh            ; Enable row with clear
  153.     out     (1), a            ; Necessary code
  154.     in     a, (1)            ; Get # of any key pressed->a
  155.     cp     254            ; Is it Clear??
  156.     jp     z, exit            ; If so then exit
  157.     ld    a, 0ffh            ; Reset keyport
  158.     out    (1), a            ; Necessary code
  159.     ld     a, 0bfh            ; Enable row with Y=
  160.     out     (1), a            ; Necessary code
  161.     in     a, (1)            ; Get # of any key pressed->a
  162.     cp     239            ; Is it the # for Y=
  163.     jp     z, pressed2nd        ; If so then go there
  164.     ld     a, 0ffh            ; Reset keyport
  165.     out     (1), a            ; Necessary code
  166.     ld     a, 0feh            ; Enable row with arrows
  167.     out     (1), a            ; Necessary code
  168.     in     a, (1)            ; Get # of any key pressed->a
  169.     cp    0            ; Was there no key
  170.     jp     z, getkey        ; If no key then loop again
  171.     cp     254            ; Down?
  172.     jp     z, down            ; If so then go there
  173.     cp     247            ; Up?
  174.     jp     z, up            ; If so then go there
  175.     cp     253            ; Left?
  176.     jp    z, left            ; If so then go there
  177.     cp     251            ; Right?
  178.     jp    z, right        ; If so then go there
  179.     jp     getkey            ; If anything else then reloop    
  180. left:
  181.     ld    a, (curlist)        ; Get the current cursor list pointer
  182.     cp    1            ; Is it 1??
  183.     jp    z, getkey        ; If so then dont go back a page
  184.     dec    a            ; If not then decrease the list
  185.     jp    nprog2            ; Jump to the page turner routine
  186. right:
  187.     ld    a, (nextl)        ; Do we have a >???
  188.     cp    1            ; Do we???
  189.     jp    nz, getkey        ; If not then don't go to the next page
  190.     ld    a, (curlist)        ; Get the current cursor list pointer
  191.     inc    a            ; Increase the page number
  192. nprog2:
  193.     ld    (curlist), a        ; Get the current cursor list pointer
  194.     ld    a, 1            ; Reset the program number
  195.     ld    (nprog), a        ; Store it the number of the current program
  196.     ld    (curloc), a        ; Store it the current location
  197.     call    _clrLCDFull         ; Clear Screen    
  198.     call    display1        ; Call the display
  199.     call    detect2            ; Call my detection
  200.     ld    hl, 0800h        ; Load the coordinates for pencol
  201.     ld     (pencol), hl        ; Set these coordinates
  202.     call    reversetext        ; Call the reverse text routine
  203.     xor    a            ; Reset our load program
  204.     ld    (load), a        ; Store it
  205.     jp    marp            ; Jump back up to the recalibrate
  206. down:
  207.     call    reversetext        ; Call the reverse text routine
  208.     ld    a, (nprog)        ; Get the number of programs
  209.     ld    c, a            ; Store it in c
  210.     call    down2            ; Ckeck if its not the last page
  211.     ld    a, (prog)        ; Get the current program number
  212.     cp    c            ; Is it the same??
  213.     jp    z, noloop        ; If zero then don't move down
  214.     ld    a, (penrow)        ; Get the corrdinates
  215.     add    a, 7            ; Move down one notch
  216.     ld    (penrow), a        ; Store it back
  217.     ld    a, (nprog)        ; What program number??
  218.     inc    a            ; Well increase it
  219.     ld    (nprog), a        ; Store it back
  220.     call    reversetext        ; Call the reverse text routine
  221.     call    delay            ; Call the delay routine
  222.     jp    getkey            ; Go move the arrow
  223. down2:
  224.     ld    a, (nextl)        ; Do we have a next page??
  225.     cp    1            ; Yes??
  226.     ret    nz            ; If not then ret
  227.     inc    c            ; If so then increase c
  228.     ret                ; Return to the down routine
  229. up:
  230.     call    reversetext        ; Call the reverse text routine
  231.     ld    a, (penrow)        ; Get what row we are at
  232.     cp    8            ; Is it the top program? 
  233.     jp    z, noloop        ; If so then don't move up
  234.     ld    a, (penrow)        ; Get what row we are at
  235.     add    a, -7            ; Go Up one program
  236.     ld    (penrow), a        ; Store it back
  237.     ld    a, (nprog)        ; What program number???
  238.     dec    a            ; Well decrease it
  239.     ld    (nprog), a        ; Store it back
  240. noloop:
  241.     call    reversetext        ; Call the reverse text routine
  242.     call    delay            ; Call the delay routine
  243.     jp    getkey            ; Go move the arrow
  244.  
  245. pressed2nd:
  246.     ld    a, (nprog)        ; What program number??
  247.     ld    (curloc), a        ; Store it
  248.     ld     a, 0ffh            ; Reset keyport
  249.     out     (1), a            ; Necessary code
  250.     ld    a, (nprog)        ; What program number??
  251.     ld    (loadn), a        ; This is where we want to change the type
  252.     ld    (curloc), a        ; Store it to the cursor location
  253.     call    display1        ; Call the display
  254.     call    detect2            ; Call my detection routine
  255.     xor    a            ; Reset our load program
  256.     ld    (load), a        ; Store it
  257.     jp    marp            ; Go back to the run routine
  258. detect2:    
  259.     ld    a, (curlist)        ; Get the current list
  260.     cp    1            ; Is it 1??
  261.     call    nz, bnng        ; If not then put a <
  262.     ld    a, -2            ; Load back two programs  (skip programs # and !)
  263.     ld    (prog), a        ; Store it
  264.     xor    a            ; Reset our load program
  265.     ld    (load), a        ; store it
  266.     ld    (nextl), a        ; Reset out Next List variable
  267. detect:
  268.     ld    hl, 0801h        ; Load the coordinates
  269.     ld     (pencol), hl        ; Set them up
  270.     ld    hl, (progptr)        ; Start here to look for programs
  271. startdetect:
  272.     ld    a, (hl)            ; Get the type
  273.     and    %00011111        ; Need to mask out bits 0-4
  274.     cp    6h            ; Is it a protected program?
  275.     jp    z, program        ; If so jump to the program
  276.     cp    5h            ; Is it a program, but not protected?
  277.     jp    z, program        ; If so jump to the program
  278.     cp    1h            ; Is it a list?
  279.     jp    z,list            ; If so jump to the list loop    
  280.     cp    0Dh            ; Is it a complex list?
  281.     jp    z,list            ; If so jump to the list loop
  282.     ld    h, 1            ; Tell it to draw a solid line
  283.     ld    bc, 0038h        ; Load the coordinates
  284.     ld    de, 6038h        ; Load the coordinates
  285.     call    _iline            ; Draw the line
  286.     ld    a, (curlist)
  287.     cp    1
  288.     jp    z, returnfromdetect
  289. displaydash:
  290.     ld    hl, 384Dh        ; Load the coordinates
  291.     ld    (pencol), hl        ; Store it
  292.     ld    hl, dash        ; Load the Store Symbol
  293.     call    _vputs            ; Put it on the screen
  294. returnfromdetect:
  295.     ret                ; Nothing left so quit
  296. program:
  297.     ld    a, (curlist)        ; What list??
  298.     cp    1            ; The first??
  299.     jp    z, suckyprograms    ; If so then go
  300.     jp    ndset            ; If not then go on
  301.  
  302. continueon:
  303.     push    hl            ; Store this for later
  304.     xor    a            ; Reset a to 0
  305.     ld    (rev), a        ; Store this to tell us if we changed types
  306.     ld    a, (prog)        ; Get the number of programs
  307.     ld    c, a            ; Store this in c
  308.     ld    a, (loadn)        ; Get the current program number
  309.     cp    c             ; Compare our two sets
  310.     jp    z, changetype        ; If they are the same then change the type
  311. donewithtype:
  312.     ld    a, (rev)        ; Did we change types??
  313.     cp    1            ; Did we??
  314.     call    z, blankout        ; If so then put spaces where the old square was
  315.     ld    a, (hl)            ; Get the type
  316.     ld    (type), a        ; Store the type again
  317.     dec    hl            ; Skip past var type
  318.     dec    hl            ; Skip the first pointer
  319.     dec    hl            ; Skip the second pointer
  320.     ld    a, (hl)            ; Put the length in 'a'
  321.     ld    b, a            ; Put the length in b
  322. programloop:
  323.     dec     hl            ; Get the next letter
  324.     ld    a, (hl)            ; Find out what it is
  325.     call    _vputmap        ; Put it on the screen
  326.     djnz    programloop        ; Loop until past the letters
  327.     ld    a, (penrow)        ; What row are we at??
  328.     dec    a            ; Decrease it to put on block
  329.     ld    (penrow), a        ; Store it back
  330.     ld    a, (type)        ; Get the type
  331.     ld    c, 33h            ; Move to the first place to put it
  332.     cp    5            ; Are we unprotected?
  333.     jp    z, markoutother        ; If so then don't mark in this spot
  334.     ld    c, 3Bh            ; If not then load the second place
  335. markoutother:
  336.     ld    a, c            ; Store the place
  337.     ld    (pencol), a        ; Put it in the pencol
  338.     ld    hl, spaces        ; Load the spaces
  339.     call    _vputs            ; Put them on the screen
  340.     ld    a, (rev)        ; Did we change the type??
  341.     cp    1            ; 1 if so..
  342.     call    z, blankout2        ; If so then blank out the second spot
  343.     ld    a, (type)        ; Load what type
  344.     cp    6            ; Is it unprotected
  345.     jp    z, nopro        ; Then goto there
  346.     ld    a, 3Bh            ; Else load the coordinates for the block
  347.     ld    (pencol), a        ; Set them
  348.     jp    movenext        ; Go put them on
  349. nopro:
  350.     ld    a, 33h            ; Load the coordinates for the block
  351.     ld    (pencol), a        ; Set them
  352. movenext:
  353.     ld    a, 0Ah            ; Get the block
  354.     call    _vputmap        ; Put it where it is supposed to be
  355.     ld    a, (penrow)        ; What row??
  356.     add    a, 8            ; Add 8 (One extra to make up for the dec a earlier)
  357.     ld    (penrow), a        ; Store it back
  358.     ld    a, 1            ; Put the original column back
  359.     ld    (pencol), a        ; Store it
  360. nextprog:
  361.     pop    hl             ; Go back to the length
  362. list:
  363.     dec    hl            ; Skip the first part of the ptr
  364.     dec    hl            ; Skip the last part of the pointer
  365.     dec    hl            ; Should be at the length
  366.     ld    b, (hl)            ; Get the length
  367. nextprogloop:    
  368.     dec    hl            ; Dec hl to get to next letter
  369.     djnz    nextprogloop         ; Loop until we get past the name
  370.     dec    hl            ; Goto address of next list\program    
  371.     jp    startdetect        ; Go find the next one
  372. blankout:
  373.     ld    a, 1            ; Load 1
  374.     ld    (noxor), a        ; Stick it in noxor
  375.     call    reversetext        ; Reverse the text
  376.     xor    a            ; A = 0
  377.     ld    (noxor), a        ; Load that
  378.     ret                ; Return
  379. blankout2:
  380.     ld    a, (penrow)        ; Get the penrow
  381.     inc    a            ; Increase it because of the earlier work
  382.     ld    (penrow), a        ; Store it back
  383.     call    reversetext        ; Reverse it
  384.     ld    a, (penrow)        ; Get the row again
  385.     dec    a            ; Decrease it to go back to work
  386.     ld    (penrow), a        ; Store it
  387.     ret                ; Return
  388. ndset:
  389.     ld    a, (load)         ; Already did this enough??
  390.     cp    1            ; Did we???
  391.     jp    z, suckyprograms    ; If so then skip this crap
  392.     push    hl            ; Keep this in a safe spot
  393.     ld    a, (prog)        ; Load number of programs    
  394.     inc    a            ; Add 1
  395.     ld    (prog), a        ; Store it back
  396.     ld    b, a            ; Store it to b
  397.     ld    a, (curlist)        ; Get the current list
  398.     ld    h, a            ; Store that
  399.     ld    l, 8            ; Store 8 inot l so we can get the row
  400.     call    _htimesl        ; Multiply them
  401.     ld    a, l            ; Store the multipled answer in a
  402.     add    a, -7            ; Take away 7
  403.     ld    b, a             ; Store it to b
  404.     pop    hl            ; Take it out of hiding
  405.     ld    a, (prog)        ; Load number of programs
  406.     cp    b            ; Past the programs yet
  407.     jp    nz, list        ; If not then skip this program
  408.     xor    a            ; Load program 0
  409.     ld    (prog), a        ; Load number of programs    
  410.     inc    a            ; Load 1
  411.     ld    (load), a        ; Do this so we don't have to go through this again
  412. suckyprograms:
  413.     ld    a, (prog)        ; What program is it??
  414.     inc    a            ; Goto next program
  415.     ld    (prog), a        ; Store it
  416.     cp    -1            ; Is it the first unwanted one??
  417.     jp    z, list            ; If so then outta here
  418.     cp    0            ; Is it the other one???
  419.     jp    z, list            ; Then good bye
  420.     cp    9            ; Are there 9 programs on the screen??
  421.     jp    z, full            ; If so then jump here
  422.     jp    continueon        ; Go print the program
  423. changetype:
  424.     ld    a, 1            ; Load 1
  425.     ld    (rev), a        ; Say that we changed types
  426.     ld    a, (hl)            ; Get the type
  427.     inc    a            ; Increase it (to 6 or 7)
  428.     ld    (hl), a            ; Store it
  429.     cp    6            ; Is it 6
  430.     jp    z, donewithtype        ; If so then go back
  431.     ld    a, 5             ; If not then it needs to be 5
  432.     ld    (hl), a            ; Store it
  433.     jp    donewithtype        ; Go back
  434. bnng:
  435.     ld    hl, 3848h        ; Load the coordinates
  436.     ld    (pencol), hl        ; Store it
  437.     ld    hl, backarrow        ; Load the Store Symbol
  438.     call    _vputs            ; Put it on the screen
  439.     ret                ; Do this for now but display "->" later
  440.  
  441. full:
  442.     ld    h, 1            ; Tell it to draw a solid line
  443.     ld    bc, 0038h        ; Load the coordinates
  444.     ld    de, 6038h        ; Load the coordinates
  445.     call    _iline            ; Draw the line
  446.     ld    hl, 3856h        ; Load the coordinates
  447.     ld    (pencol), hl        ; Store it
  448.     ld    hl, fowardarrow        ; Load the Store Symbol
  449.     call    _vputs            ; Put it on the screen
  450.     ld    a, 1            ; Load 1
  451.     ld    (nextl), a        ; Say that we have another list of programs
  452.     jp    displaydash    
  453. exit:
  454.     call    _clrLCDFull        ; Clear the Current Screen
  455.     ld    a, 0ffh            ; Reset keyport
  456.     out    (1), a            ; Necessary code
  457.     call    delay            ; Call the delay routine
  458.     ret                ; Quit the assembly program
  459.  
  460. ;
  461. ; ------------------------------------- MESSAGES ------------------------------------
  462. ;
  463. backarrow:
  464.     .db    0CFh, 0            ; Arrow saying we can go back a page
  465. fowardarrow:
  466.     .db    005h, 0            ; Arrow saying we can forward back a page
  467. dash:
  468.     .db    "--", 0            ; Arrow saying we can go back a page
  469. author:    
  470.     .db    "Protect v7.5", 0        ; Title
  471. author1:    
  472.     .db    "Y= -", 0            ; My directions
  473. author2:        
  474.     .db    " Changes", 0            ; My directions 
  475. author3:    
  476.     .db    "Graph -", 0            ; My directions
  477. author4:    
  478.     .db    "Quits", 0            ; My directions
  479. spaces: 
  480.     .db    "    ", 0            ; My Spaces
  481. thankyou:
  482.         .db    "  TIMagic  ", 0        ; 0 terminated string
  483.  
  484. ;
  485. ; ------------------------------------- Reverse Text ------------------------------------
  486. ;
  487.  
  488. Description:
  489.  .db "Protection by Jimmy Conner",0        ; My description
  490. hlight:
  491.     di                ; Disable interrupts (you have to)
  492.     ld    a, 05h            ; Set y inc mode
  493.     call    lcdbusy            ; Must make this call before writing to LCD
  494.     out    (lcdinstport), a    ; Send to LCD
  495.  
  496.     ld    a, 20h            ; Set to leftmost col
  497.     ld    e, a            ; Store to e
  498. loop2:
  499.     call    lcdbusy            ; Must make this call before writing to LCD
  500.     out    (lcdinstport), a    ; Send to LCD
  501.  
  502.     ld    a, (row)        ; Set to top row
  503.     ld    d, a            ; Store it in d
  504. loop:
  505.     call    lcdbusy            ; Must make this call before writing to LCD
  506.     out    (lcdinstport), a    ; Send to LCD
  507.  
  508.     call    lcdbusy            ; Dummy read
  509.     in    a, (lcddataport)    ; Get from the LCD
  510.  
  511.     call    lcdbusy            ; Dummy read
  512.     in    a, (lcddataport)    ; Read byte from display
  513.  
  514.     ld    (old), a        ; Store old data
  515.  
  516.     ld    a, d            ; Get the row
  517.     call    lcdbusy            ; Must make this call before writing to LCD
  518.     out    (lcdinstport), a    ; Send to LCD
  519.  
  520.     ld    a, e            ; Get Leftmost column
  521.     call    lcdbusy            ; Dummy read
  522.     out    (lcdinstport), a    ; Send to the LCD
  523.  
  524.     
  525.     ld    a, (noxor)        ; Did we have to xor?
  526.     cp    1            ; Yes?
  527.     ld    a, (old)        ; Load the old stuff
  528.     ld    b, 255            ; Load the new
  529.     jp    z, notxoring        ; If not then  skip this
  530.     xor    b            ; Reverse the bytes
  531.     jp    xoring            ; Skip the next part
  532. notxoring:
  533.     ld    a, 0h            ; Get 0 to erase the spot
  534. xoring:
  535.     call    lcdbusy            ; Dummy read
  536.     out    (lcddataport),a        ; Send to LCD
  537.  
  538.     inc    d            ; Increase the row
  539.     ld    a, (row2)        ; Get final row
  540.     cp    d            ; Is it the final row
  541.     ld    a, d            ; Load row to a
  542.     jr    nz, loop        ; Loop until done
  543.     inc    e            ; Increase the column
  544.     ld    a, e            ; Store in a
  545.     cp    26h            ; Is it hte last column?
  546.     jr    nz, loop2        ; If not then loop again
  547.     ei                ; Enable the interrupts
  548.     ret                ; Return
  549.     
  550. ;---------------= lcdbusy =-------------
  551.  
  552. lcdbusy:
  553.         push    af        ; Create a small delay before
  554.         inc     hl        ; Communicating with LCD
  555.         dec     hl        ; Waste time here
  556.         pop     af        ; Waste time here
  557.         ret            ; Return
  558.  
  559.  
  560.  
  561. .end
  562. END
  563.  
  564. ;
  565. ; ╗╗╗╗╗╗╗ TIMagic@yahoo.com  ½½½½½½½
  566. ;