Newsgroups: comp.sys.apple2.programmer Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!cs.utexas.edu!wupost!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson From: dempson@swell.actrix.gen.nz (David Empson) Subject: Re: Graphics and ML Organization: Actrix Information Exchange Date: Mon, 10 Jan 1994 11:49:13 GMT Message-ID: References: <100467@cup.portal.com> Sender: dempson@actrix.gen.nz (David Empson) Lines: 79 In article <100467@cup.portal.com> ScottM@cup.portal.com (Scott - Maxwell) writes: > I've finally decided to start programming hi-res graphics in assembler. > The question I have is if a ProDOS .system file is supposed to load at > $2000 and the hi-res screen is supposed to begin at the same address > what would be the best way to organize a program so it would load and > not be smashed by activating the hi-res screen? Are there any code > examples I might look at? ANy help appreciated. The best solution is to use a front-end relocator (mover, actually) on your program to move it elsewhere in memory. Where to move it to depends on how big it is and what other areas you need. It is easiest to move the program down in memory, so put it in $0800-$1FFF if it will fit. Here is how I would do it in a Merlin source file. TYP SYS ORG $2000 * Put any one-off code you need in here, such as setting up the ProDOS * global page, initializing the stack pointer, etc. * Move the program to its final run location. * Note: RUNLOC must be less than $2000 for this routine to work. RUNLOC EQU $0800 ; This is where we're moving to SRCPTR EQU $003C ; Pointer to source data ENDPTR EQU $003E ; Pointer to last byte of source data DSTPTR EQU $0042 ; Pointer to dest area MEMMOVE EQU $FE2C ; Monitor memory move routine LDA #MAINPROG STA SRCPTR+1 LDA #MAINEND STA ENDPTR+1 LDA #RUNLOC STA DSTPTR+1 LDY #0 ; Must set Y to zero to call MEMMOVE JSR MEMMOVE ; Copy the program JMP RUNLOC ; Go to the rest of the program MAINPROG ORG RUNLOC * Your program goes here ORG ; Restore original address RELOCLEN EQU *-MAINPROG MAINEND EQU *-1 SAV MYPROG END If you want to move the program up in memory, you need to use a different loop. MEMMOVE just causes repeat patterns if you try to move up in memory. Somewhere I have some code to move data up in memory, but I don't want to type it in off the top of my head. -- David Empson dempson@swell.actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand