Hello, all, Below are the preliminary data for drawing on the double hires screen. You will probably want to copy and paste this into a text viewer with a fixed font, as it will be much easier to read. About the information below: I know that it will change dramatically, even the memory map I posted earlier will be changed. But I posted this so people will know the state so far of the SimCity-type game. The next post I do will be pseudocode for the actual calculations of each square as the game runs. I figure it will be along the lines of Life, which I used before. I am also getting the file format for the original SimCity, so a saved file will be able to be moved to a Mac or IBM PC and used on the real programs. I need to ask if anyone has the ProDOS 8 MLI call information, or where I can find it on the internet. I need the layout for each of the ProDOS 8 MLI calls so I will be able to read and write to the disk. Any comments or suggestions will be more than gladly accepted! Take care, all. ------- Cut Here ------- Hires Memory Locations Line Address Line Address Line Address Unused 00 2000.2027 40 2028.204F 80 2050.2077 2078.207F 01 2400.2427 41 2428.244F 81 2450.2477 2478.247F 02 2800.2827 42 2828.284F 82 2850.2877 2878.287F 03 2C00.2C27 43 2C28.2C4F 83 2C50.2C77 2C78.2C7F 04 3000.3027 44 3028.304F 84 3050.3077 3078.307F 05 3400.3427 45 3428.344F 85 3450.3477 3478.347F 06 3800.3827 46 3828.384F 86 3850.3877 3878.387F 07 3C00.3C27 47 3C28.3C4F 87 3C50.3C77 3C78.3C7F 08 2080.20A7 48 20A8.20CF 88 20D0.20F7 20F8.20FF 09 2480.24A7 49 24A8.24CF 89 24D0.24F7 24F8.24FF 0A 2880.28A7 4A 28A8.28CF 8A 28D0.28F7 28F8.28FF 0B 2C80.2CA7 4B 2CA8.2CCF 8B 2CD0.2CF7 2CF8.2CFF 0C 3080.30A7 4C 30A8.30CF 8C 30D0.30F7 30F8.30FF 0D 3480.34A7 4D 34A8.34CF 8D 34D0.34F7 34F8.34FF 0E 3880.38A7 4E 38A8.38CF 8E 38D0.38F7 38F8.38FF 0F 3C80.3CA7 4F 3CA8.3CCF 8F 3CD0.3CF7 3CF8.3CFF 10 2100.2127 50 2128.214F 90 2150.2177 2178.217F 11 2500.2527 51 2528.254F 91 2550.2577 2578.257F 12 2900.2927 52 2928.294F 92 2950.2977 2978.297F 13 2D00.2D27 53 2D28.2D4F 93 2D50.2D77 2D78.2D7F 14 3100.3127 54 3128.314F 94 3150.3177 3178.317F 15 3500.3527 55 3528.354F 95 3550.3577 3578.357F 16 3900.3927 56 3928.394F 96 3950.3977 3978.397F 17 3D00.3D27 57 3D28.3D4F 97 3D50.3D77 3D78.3D7F 18 2180.21A7 58 21A8.21CF 98 21D0.21F7 21F8.21FF 19 2580.25A7 59 25A8.25CF 99 25D0.25F7 25F8.25FF 1A 2980.29A7 5A 29A8.29CF 9A 29D0.29F7 29F8.29FF 1B 2D80.2DA7 5B 2DA8.2DCF 9B 2DD0.2DF7 2DF8.2DFF 1C 3180.31A7 5C 31A8.31CF 9C 31D0.31F7 31F8.31FF 1D 3580.35A7 5D 35A8.35CF 9D 35D0.35F7 35F8.35FF 1E 3980.39A7 5E 39A8.39CF 9E 39D0.39F7 39F8.39FF 1F 3D80.3DA7 5F 3DA8.3DCF 9F 3DD0.3DF7 3DF8.3DFF 20 2200.2227 60 2228.224F A0 2250.2277 2278.227F 21 2600.2627 61 2628.264F A1 2650.2677 2678.267F 22 2A00.2A27 62 2A28.2A4F A2 2A50.2A77 2A78.2A7F 23 2E00.2E27 63 2E28.2E4F A3 2E50.2E77 2E78.2E7F 24 3200.3227 64 3228.324F A4 3250.3277 3278.327F 25 3600.3627 65 3628.364F A5 3650.3677 3678.367F 26 3A00.3A27 66 3A28.3A4F A6 3A50.3A77 3A78.3A7F 27 3E00.3E27 67 3E28.3E4F A7 3E50.3E77 3E78.3E7F 28 2280.22A7 68 22A8.22CF A8 22D0.22F7 22F8.22FF 29 2680.26A7 69 26A8.26CF A9 26D0.26F7 26F8.26FF 2A 2A80.2AA7 6A 2AA8.2ACF AA 2AD0.2AF7 2AF8.2AFF 2B 2E80.2EA7 6B 2EA8.2ECF AB 2ED0.2EF7 2EF8.2EFF 2C 3280.32A7 6C 32A8.32CF AC 32D0.32F7 32F8.32FF 2D 3680.36A7 6D 36A8.36CF AD 36D0.36F7 36F8.36FF 2E 3A80.3AA7 6E 3AA8.3ACF AE 3AD0.3AF7 3AF8.3AFF 2F 3E80.3EA7 6F 3EA8.3ECF AF 3ED0.3EF7 3EF8.3EFF 30 2300.2327 70 2328.234F B0 2350.2377 2378.237F 31 2700.2727 71 2728.274F B1 2750.2777 2778.277F 32 2B00.2B27 72 2B28.2B4F B2 2B50.2B77 2B78.2B7F 33 2F00.2F27 73 2F28.2F4F B3 2F50.2F77 2F78.2F7F 34 3300.3327 74 3328.334F B4 3350.3377 3378.337F 35 3700.3727 75 3728.374F B5 3750.3777 3778.377F 36 3B00.3B27 76 3B28.3B4F B6 3B50.3B77 3B78.3B7F 37 3F00.3F27 77 3F28.3F4F B7 3F50.3F77 3F78.3F7F 38 2380.23A7 78 23A8.23CF B8 23D0.23F7 23F8.23FF 39 2780.27A7 79 27A8.27CF B9 27D0.27F7 27F8.27FF 3A 2B80.2BA7 7A 2BA8.2BCF BA 2BD0.2BF7 2BF8.2BFF 3B 2F80.2FA7 7B 2FA8.2FCF BB 2FD0.2FF7 2FF8.2FFF 3C 3380.33A7 7C 33A8.33CF BC 33D0.33F7 33F8.33FF 3D 3780.37A7 7D 37A8.37CF BD 37D0.37F7 37F8.37FF 3E 3B80.3BA7 7E 3BA8.3BCF BE 3BD0.3BF7 3BF8.3BFF 3F 3F80.3FA7 7F 3FA8.3FCF BF 3FD0.3FF7 3FF8.3FFF Which lets us make the following lookup table: * NOTE: REALLY GOOD IDEA TO SEI BEFORE JSRing TO THIS CODE! * SHOULD HAVE A RTL SOMEWHERE IN HERE (NEEDS TO BE WORKED OUT LATER) * PROBABLY WITH A DISPATCHER ROUTINE * NOTE: ALSO, THIS IS IN BANK 05 GBASL EQU $26 GBASH EQU $27 ****************************************** * ON ENTRY: * Y = LINE #0 (0) - BF (191) * ON EXIT: * Y = UNCHANGED * A = UNDEFINED * 26.27 = BASE LOCATION OF HIRES LINE ****************************************** 0000:B9 CB 00 FINDBAS LDA HIBYTES,Y 0003:85 27 STA GBASH 0005:B9 0B 00 LDA LOBYTES,Y 0008:85 26 STA GBASL 000A:60 RTS 000B: LOBYTES HEX 00000000000000008080808080808080 001B: HEX 00000000000000008080808080808080 002B: HEX 00000000000000008080808080808080 003B: HEX 00000000000000008080808080808080 004B: HEX 2828282828282828A8A8A8A8A8A8A8A8 005B: HEX 2828282828282828A8A8A8A8A8A8A8A8 006B: HEX 2828282828282828A8A8A8A8A8A8A8A8 007B: HEX 2828282828282828A8A8A8A8A8A8A8A8 008B: HEX 5050505050505050D0D0D0D0D0D0D0D0 009B: HEX 5050505050505050D0D0D0D0D0D0D0D0 00AB: HEX 5050505050505050D0D0D0D0D0D0D0D0 00BB: HEX 5050505050505050D0D0D0D0D0D0D0D0 00CB: HIBYTES HEX 2024282C3034383C2024282C3034383C 00DB: HEX 2125292D3135393D2125292D3135393D 00EB: HEX 22262A2E32363A3E22262A2E32363A3E 00FB: HEX 23272B2F33373B3F23272B2F33373B3F 010B: HEX 2024282C3034383C2024282C3034383C 011B: HEX 2125292D3135393D2125292D3135393D 012B: HEX 22262A2E32363A3E22262A2E32363A3E 013B: HEX 23272B2F33373B3F23272B2F33373B3F 014B: HEX 2024282C3034383C2024282C3034383C 015B: HEX 2125292D3135393D2125292D3135393D 016B: HEX 22262A2E32363A3E22262A2E32363A3E 017B: HEX 23272B2F33373B3F23272B2F33373B3F CODE FOR BYTE PLACEMENT: * ENTRY: Y = LINE #, X = BYTE #, A = DISPLAY BITMAP(256 POSSIBLE) * EXIT: Y,X,A = UNKNOWN 018B:84 25 STY $25 (CV) 018D:86 24 STX $24 (CH) 018F:85 1F STA $1F (TEMPLOC) 0191:20 00 00 JSR FINDBAS ;PUTS BASE ADDRESS INTO 26.27 * SINCE ONLY WHOLE BYTES ARE PUT ON SCREEN, X = 0 - $4F (79) * ODD # COLUMNS IN MAIN MEMORY, EVEN # COLUMNS IN AUXILIARY MEMORY 0194:46 24 LSR $24 ;DIVIDE BY 2 0196:90 1E BCC ALTMEM ;BYTE IN AUXILIARY MEMORY 0198:2C 54 C0 BIT MAINMEM ;SET TO WRITE TO MAIN MEM 019B:A4 1F CONT01 LDY $1F ;GET OFFSET FOR BITMAP TO DISPLAY 019D:20 00 00 JSR SETLOC ;SET OFFSET LOCATION FOR BITMAP Y IN 28.29 * NOTE: SETLOC NOT DETERMINED YET, SO ADDRESS = 0000 01A0:A2 07 LDX #$07 ;DISPLAY ALL 8 BYTES ON SCREEN 01A2:A0 00 LOOP01 LDY #$00 ;Y=0 SO WE ONLY GET THE FIRST BYTES 01A4:B1 28 LDA ($28),Y ;GET EACH SUCCESSIVE BYTE 01A6:A4 24 LDY $24 ;OFFSET ON SCREEN 01A8:91 26 STA ($26),Y ;PUT IT ON SCREEN 01AA:E6 29 INC $29 ;INCREMENT THE LOW-BYTE 01AC:A4 25 LDY $25 ;HAVE TO INCREMENT THE LINE # 01AE:C8 INY ;ADD 1 TO IT (NEXT LINE DOWN) 01AF:20 00 00 JSR FINDBAS ;PUT NEW ADDRESS INTO 26.27 01B2:CA DEX ;GO THROUGH EACH BYTE 01B3:10 EC BPL LOOP01 ;IF NOT DONE (X=>0) 01B5:60 RTS 01B6:2C 55 C0 ALTMEM BIT AUXMEM ;IF EVEN COLUMN, DISPLAY IN AUXMEM 01B9:4C 9B 01 JMP CONT01 ;WHY REWRITE CODE? :-) Hello, all, As promised, here is the pseudocode for figuring out what happens to each square in the city. It is not complete, but you can see what will need to go into the actual program. Again, to make it look alright, you'll want to copy and paste it into a fixed font word processor. Any comments, questions or suggestions are gladly accepted. Take care all. ------ Cut here ------ SimCity Calculations done twice for each month (hopefully not too slow!) The main city dimensions are: 128 x 128 = 16384 total squares each square uses two bytes (total bytes = 32768, 1/2 bank) Pseudocode for figuring out what happens to each square: Loop1 0 - 127 Loop2 0 - 127 if (Loop1,Loop2) = empty or water or forest/grass goto endloops if (Loop1,Loop2) = non-growth square (power plant, etc.) if (Loop1,Loop2) = Coal power plant, pollute(Loop1,Loop2) = pollute + 52 add 1 for each surrounding forest/grass/park if totplants > 5, pollute = pollute / 2 if totplants > 10, pollute = pollute / 2 goto endloops if (Loop1,Loop2) = Nuclear power plant and lengthplaced > 49, goto explode goto endloops if (Loop1,Loop2) <> residential goto nextcheck1 if residential = low,low and tax < 5, if surrounding squares > low,low respop = respop + 10% temp1 = distance to police station temp2 = distance to fire station if temp1 > 10, crime = crime + 4 if 5 < temp1 < 11, crime unchanged if temp1 < 6 then crime = crime - 2 if temp2 > 10, needs(fire) = needs(fire) + 1 if 5 < temp2 < 11, needs(fire) unchanged if temp2 < 6, needs(fire) = needs(fire) - 1 if surrounding squares have no roads, respop = respop / 2 if surrounding squares = low,low respop = respop + 5% temp1 = distance to police station temp2 = distance to fire station if temp1 > 10, crime = crime + 4 if temp1 < 11 and temp1 > 5, crime unchanged if temp1 < 6 then crime = crime - 2 if temp2 > 10, needs(fire) = needs(fire) + 1 if 5 < temp2 < 11, needs(fire) unchanged if temp2 < 6, needs(fire) = needs(fire) - 1 if surrounding squares have no roads, respop = respop / 2 if residential = low,low and 4 < tax < 10 if surrounding squares > low,low respop = respop + 10% temp1 = distance to police station temp2 = distance to fire station if temp1 > 10, crime = crime + 4 if temp1 < 11 and temp1 > 5, crime unchanged if temp1 < 6 then crime = crime - 2 if temp2 > 10, needs(fire) = needs(fire) + 1 if 5 < temp2 < 11, needs(fire) unchanged if temp2 < 6, needs(fire) = needs(fire) - 1 if surrounding squares have no roads, respop = respop / 2 (Include checks for res,com,ind {low,low} {low,med} {low,hi} {med,low} {med,med} {med,hi} {hi,low} {hi,med} {hi,hi} {top}) endloops: if needs(fire) > 100 display "Citizens demand more fire protection" if crime > 120 display "Citizens demand more police protection" if totres < 10 display "More residential zones needed", graphres = graphres + 2 if totcom < 10 display "More commercial zones needed", graphcom = graphcom + 2 if totind < 10 display "More industrial zones needed", graphcom = graphcom + 2 if totcompercent > 20 and year < 30 then graphcom = graphcom - 5 if totindpercent > 80 and year < 30 then graphind = graphind - 5 if totres < totcom + totind then graphres = graphres + 5 if year < 30 and totcom > totind / 2 then graphcom = graphcom - 5, graphind = graphind + 5 if 29 < year < 61 and totcom <> totind then if totcom > totind, graphcom = graphcom - 2, graphind = graphind + 2 if totcom < totind, graphcom = graphcom + 2, graphind = graphind - 2 if year > 60 and totcom < totind then graphcom = graphcom + 5, graphind = graphind - 5 if totcom > 256 and airport = 0, then display "Commercial needs airport" if totind > 256 and seaport = 0, then display "Industrial needs seaport" Next Loop2 Check keyboard for keypress if keypress, goto handle keypress if boat exists, do move boat if airplane exists, do move airplane if helicopter exists, do move helicopter Next Loop1 My guess is that the above routines will take about half of a bank 0000.7FFF Arrays used: 7F x 7F (128 x 128) = Main grid of city (32768 bytes) 7F x 7F (128 x 128) = Grid for pollution (Hi nibble), traffic (Lo nibble) (16384 bytes) 7 x 8 = Bitmap for each square displayed one residential square = 3 bytes wide x 2 deep (21 pixels x 16 pixels) Actual bitmaps for display take up a separate file, so they can easily be replaced if a different set wants to be used (medieval, future, etc.) Scrolling is hard-coded to be as quick as possible Each up,down,left or right scroll is one square at a time Scroll routines in bank 02 (might need whole bank for them) Inside city display, cursor is a square for whatever tool is selected Outside city display, cursor is standard arrow Any dialog boxes displayed: Move page one to page two, display box, and accept input When dialog box closed, return to display page one, no need to erase page two Hello, all, Below is the boot framework for SimCityGS. The game is slowly but surely making its way to completion. As always, any comments, questions or suggestions are more than welcome! Take care, all. ----- Cut Here ----- Boot Section of SimCity Here is some code and pseudocode for the boot section of SimCity: SC.SYSTEM A$2000 L$? 2000:4C 00 40 ENTRY JMP ENTRY2 ;JUMP OVER HIRES SPLASH SCREEN 2003.3FFF - Hires Splash Screen 4000:A9 FF ENTRY2 LDA #$FF ;CLEAN UP THE HIRES IMAGE 4002:8D 00 20 STA $2000 ;BY ERASING THE JMP 4005:8D 01 20 STA $2001 ; AT LOCATIONS 4008:8D 02 20 STA $2002 ; 2000.2002 400B:2C 52 C0 BIT FULL ;SHOW THE HIRES SCREEN 400E:2C 57 C0 BIT HIRES ;WHILE WE DO OUR INITIAL 4011:2C 50 C0 BIT GRAPHIC ;PROGRAM LOADING * NOW THAT SPLASH SCREEN IS DONE, WE HAVE TO LOAD THE PROGRAM 4014:EA EA EA EA NOP *4 ;PUT A LITTLE SPACE IN HERE, 4018:EA EA EA EA NOP *4 ;JUST IN CASE WE NEED IT 401C:EA EA EA EA NOP *4 ;AT A LATER DATE * STANDARD NAMES FOR PROGRAM PIECES WILL BE: * SC.SYSTEM Loader program and ProDOS interface * MONTH.PASS Figures what happens to each square each month * DHIRES All the double-hires routines, incl. text and dialog box * SQUARE.DATA Bitmaps for each square * SCROLL Routines to scroll up, right, down and left 4020: Check if this is really an Apple IIGS, If not, then display error message 4030: Using hard-coded names for files, load each one into memory DHIRES goes into Bank 05 - First MONTH.PASS goes into Bank 04 - Second SCROLL goes into Bank 02 - Third SQUARE.DATA goes into Bank 03 - Last Load them this way: Load first piece into 8000.9FFF (Main Memory - can be bigger) Use MVN to move it to final memory bank Load second piece over first at 8000.9FFF (Main memory - can be bigger) Use MVN to move it to final memory bank Continue until done Load next file exactly the same way 4800: Now that files loaded, switch to double hires and display main menu MAIN MENU: START NEW CITY LOAD SAVED CITY EXIT If "LOAD SAVED CITY" go to loader If "EXIT" do ProDOS "QUIT" call Else * Start new city: * Original version of program will have set map to start with. * If, When this is done, someone wants to add a terrain generation routine * Great! * * Otherwise, we need to put these data into our initial map. * We could add default data to the the end of (probably) the SQUARE.DATA file * then we would just have to load that into bank 06 Some excess notes: I could have fleshed this out more, but I'm still looking for the MLI CALL tables. If anyone has these, or knows where I can find them on the internet, please post a note in this newsgroup. I have yet to post the SimCity city data particulars, mainly because the book I had detailing these is sitting over at my sister's house. As soon as I can get over there, I will type them in and post them. I am also working on mathematics routines so I can figure out totals, taxes, etc. When they are finished I will post the source code on this newsgroup. Whenever we go from the program to ProDOS, we need to switch to emulation mode, then when we go back to the program, we need native mode. I know MVN needs native mode to work correctly. I should include code for mouse and keyboard control, using the keys in the original SimCity.