home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 January / Ahoy_Magazine_86-01_1986_Double_L.d64 / relocater.src (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  1KB  |  32 lines

  1. 1000 ;********************************
  2. 1002 ;* source code for basic reloc. *
  3. 1004 ;*       by  james hosek        *
  4. 1006 ;********************************
  5. 1008 ;
  6. 1020 *= 2063; assemble program into rem statement
  7. 1021 j = 25; offset for new location
  8. 1023 k = 27; temp. zero page pointer
  9. 1024 l = 29; temp. zero page pointer
  10. 1025 txttab = 43; pointer to start of basic program
  11. 1026 vartab = 45; pointer to end of program
  12. 1040 ldy 41082; get a zero from rom
  13. 1060 sec: lda memto: sta txttab+1; point txttab to new location
  14. 1065 sbc #8: sta j; calculate offset
  15. 1070 clc: lda vartab: sta k: sta l; get lo byte of top of program
  16. 1075 lda vartab+1: sta k+1: adc j: sta l+1; set up transfer pointers
  17. 1077 sta vartab+1; point vartab to new location
  18. 1080 loop lda k: bne cont1: dec k+1: dec l+1
  19. 1090 cont1 dec k: dec l; decrement pointers
  20. 1100 lda (k),y: sta (l),y; transfer one byte of memory
  21. 1110 lda k: bne cont1: lda k+1: cmp #8: bne loop; check if done (k = $0800)
  22. 1120 inc l; set up 'l' to look at pointer to next basic line, in the first line
  23. 1160 loop2 lda (l),y: iny: ora (l),y: beq out; check for end of program
  24. 1170 clc: lda (l),y: adc j: sta (l),y: sta 2; recalculate pointer with offset
  25. 1180 dey: lda (l),y: sta l: lda 2: sta l+1: jmp loop2; point to the next line
  26. 1200 out ldx 41070; get a $0d from rom
  27. 1205 stx 632: stx 635: ldx #49: stx 631; set up keyboard queue
  28. 1210 ldx #82: stx 633: ldx #117: stx 634: ldx #5: stx 198: rts
  29. 1220 memto .byte 16; page to transfer to
  30. 1230 .byte 34 0 0 0; set up end of line
  31. 1300 .end relocater.src
  32.