I think that last post of yours may have gotten cut off. Smile Nevertheless, I got the basic idea of it. Now it makes sense lo me. I'm working on that off-by-one error with the scrollbar.
funny that the post got cut off, but basically the pieces is where the variety comes in and thats what all the sprites are for.
Yup, figured that. I thought the maps had terrain of some sort. In other news, making progress with that scrollbar problem.
allow me to refer you back to this Wink

Quote:
the game looks like this: http://upload.wikimedia.org/wikipedia/en/c/c4/Sc3.jpg (Not dial-up friendly)
But I see land/water... wouldn't those be tiles, not sprites?
KermMartian wrote:
But I see land/water... wouldn't those be tiles, not sprites?


exactly, only the land and water are stored in the map.

scroll around the picture, the cities and the other stuff are the pieces
But wait, if you're using the single bit to store the explored/not explored stuff, where do land and water get stored?
KermMartian wrote:
But wait, if you're using the single bit to store the explored/not explored stuff, where do land and water get stored?


in a different map of the exact same size
So, what progress? Got that new source code for me to debug? I'd love to see the map generator in action.
hopefully tonight mom and dad will let me set up my Ubuntu machine as a temporary router for the wireless compies in the house. until then, nada.
You couldn't even put it on removeable media? Sad Well, I guess I'll have to wait until then.
KermMartian wrote:
You couldn't even put it on removeable media? Sad Well, I guess I'll have to wait until then.


tuesday is my busiest day of the week, craploads of homework, plus leading scout meetings (im my troops senior patrol leader), plus grandparents visiting.
That's wonderful, but today is Wednesday. Very Happy Just Joking, I suppose you'll find time eventually then.

Code:
.nolist
#include "dcs6.inc"
_strcpy      =$44E3
_MultAbyE   =$8042
savesscreen =$86EC
.list
   .org progstart
#IFDEF TI83P
   .db $BB,$6D
#ENDIF
INIT:
   xor d
#IFDEF TI83P
   .db $C9
#ENDIF

   jr Start
   .dw $0000
   .db $06,$00
   .dw Icon
   .dw $0000
   .dw Apstart         ;the routine to open files.  DCS will start you here instead of at $9D95
                  ;if a file is pending
   .db $31,$7F         ;argh, this be an APMain
   .db $01            ;number of accepted filetypes
   .db $00,$01,$00         ;game saves, strategy games, strategic conquest
Icon:            ;a 16x16 icon
   .db $3C,$09,$66,$3F,$C3,$7E,$C1,$10,$60,$00,$3C,$3E,$06,$63,$83,$41
   .db $C3,$40,$66,$40,$3C,$C1,$01,$63,$76,$3E,$FF,$81,$FF,$8E,$63,$1F
IconAP:            ;a 16x16 icon
   .db $FF,$F8,$E6,$34,$C3,$72,$C1,$1F,$E0,$01,$BC,$3F,$86,$63,$83,$41
   .db $C3,$41,$E6,$47,$BC,$C1,$81,$63,$F6,$3F,$FF,$81,$FF,$8F,$FF,$FE
START:
   call dispttl ;   the title
   bcall(_cleargbuf) ;clear the buffer
   bcall(_ClrLcdf) ;now clear the screen
   call OpenGUIStack ;setup the GUI

   ld hl,stwin
   ld de,stwin_1-stwin
   ld a,$01 ;small window
   call PushGUIStack
   ld hl,smb
   ld de,smb_1-smb
   ld a,$07 ;button
   call PushGUIStack
   ld hl,quitb
   ld de,quitb_1-quitb
   ld a,$07 ;button
   call PushGUIStack
   ;;;draw stuff
   ld hl,logo
   ld de,logo_1-logo
   ld a,$11
   call PushGUIStack
   ld hl,city
   ld de,city_1-city
   ld a,$11
   call PushGUIStack
   ld hl,smoke
   ld de,smoke_1-smoke
   ld a,$11
   call PushGUIStack
   ld hl,tank
   ld de,tank_1-tank
   ld a,$11
   call PushGUIStack
   ld hl,inverse
   ld de,inverse_1-inverse
   ld a,$11
   call PushGUIStack
   ;;;mode selection
   ld hl,GameType1
   ld de,GameType_1-GameType1
   ld a,$0A
   call PushGUIStack
   ld hl,GameType2
   ld de,GameType_2-GameType2
   ld a,$0A
   call PushGUIStack
   ld hl,GameType3
   ld de,GameType_3-GameType3
   ld a,$0A
   call PushGUIStack
   ld hl,GameType4
   ld de,GameType_4-GameType4
   ld a,$0A
   call PushGUIStack
   ;;;Level Selector
   ld hl,LevelScroll
   ld de,LevelScroll_1-LevelScroll
   ld a,$14
   call PushGUIStack
   ld hl,LevelTxt
   ld de,LevelTxt_1-LevelTxt
   ld a,$04
   call PushGUIStack
   ;;;Render UP
rerender:
   call RenderGUI
   call GUIMouse
   ret
loadmap:
   bcall(_cleargbuf)
   bcall(_ClrLcdf)
   call seed
   ld hl,savesscreen
   ld de,plotsscreen
   ld bc,768
   ldir
   
   call ionFastCopy
   call pause
   call quit
   ret
quit:
   call ResetAppPage
   call CloseGUIStack
   ret
Apstart:
   bcall(_ClrLcdf)
   ld hl,0
   ld (pencol),hl
   push ix
   pop hl
   bcall(_vputs)
   call Pause
   ret
nullw:
   .db $FF;
stwin:
   .db %01110000;
   .db %10001000;
   .db %10000000;
   .db %10001000;
   .db %01110000;
   .db "New Game",0;
stwin_1:
smb:
   .db 5,45;
   .dw loadmap
   .db "Start Game!",0
smb_1:
quitb:
   .db 75,45;
   .dw quit
   .db "Quit",0
quitb_1:
logo:
   .db 1,1,2,16
   .db $3C,$09,$66,$3F,$C3,$7E,$C1,$10,$60,$00,$3C,$3E,$06,$63,$83,$41
   .db $C3,$40,$66,$40,$3C,$C1,$01,$63,$76,$3E,$FF,$81,$FF,$8E,$63,$1F
logo_1:
GameType1:
   .db 3,18
   .db 1,1
   .db "1 Player",0
GameType_1:
GameType2:
   .db 3,24
   .db 1,0
   .db "2 Player",0
GameType_2:
GameType3:
   .db 40,18
   .db 1,0
   .db "Cn2 Master",0
GameType_3:
GameType4:
   .db 40,24
   .db 1,0
   .db "Cn2 Slave",0
GameType_4:
LevelScroll:
   ;x,y,width,ID,per,min,max,cur,onScrollUp,onScrollDown
   .db 1,37,75,0
   .dw 1,1,16,1
   .dw edittxt,edittxt
LevelScroll_1:
LevelTxt:
   .db 3,30,0
   .db "AI Level :: 01",0
LevelTxt_1:
edittxt:
   call GUIFindFirst ;start game button
   ld b,11 ;11 elements after that
lgetloop:
   push bc
   call GUIFindNext
   pop bc
   djnz lgetloop
   push hl
   push de ;;save them for later
   ld de,13 ;get the current slider
   add hl,de
   ld a,(hl) ;load it into a
   pop de
   pop hl
   push af
   call GUIFindNext
   pop af
   push hl
   dec a ;0-14
   ld e,3
   bcall(_MultAbyE) ;kk stored offset in HL
   push hl
   pop ix ;load it into ix
   pop de
   ld hl,18
   add hl,de
   ex de,hl ;de is now the address of the level digits
   push de
   push ix
   pop hl
   ld de,ltxt
   add hl,de
   pop de
   bcall(_strcpy)
   ret

city:
 .db 34,1,2,16
 .db $FF,$FF,$80,$00,$80,$00,$86,$00,$86,$00,$86,$30,$86,$32,$86,$32
 .db $86,$32,$9F,$32,$9B,$3F,$9B,$3F,$7F,$35,$FF,$FF,$FF,$FF,$AA,$AA
city_1:
smoke:
 .db 34,1,2,16
 .db $7F,$FF,$00,$2A,$00,$15,$01,$80,$00,$00,$00,$08,$00,$02,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
smoke_1:
tank:
 .db 67,1,2,16
 .db $00,$10,$00,$10,$00,$10,$00,$10,$00,$10,$03,$F0,$7F,$F8,$0E,$B8
 .db $0E,$A8,$18,$28,$7F,$FE,$6A,$56,$6A,$56,$7F,$FE,$3F,$FC,$00,$00
tank_1:
inverse:
 .db 34,1,2,16
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
inverse_1:

ltxt:
 .db "01",0,"02",0
 .db "03",0,"04",0
 .db "05",0,"06",0
 .db "07",0,"08",0
 .db "09",0,"10",0
 .db "11",0,"12",0
 .db "13",0,"14",0
 .db "15",0
ltxt_1:
;;;;map generation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
seed:
   ld de,savesscreen
   ld hl,plotsscreen
   ld bc,768
   ldir
   ld b,10
   call ionRandom
   add a,10
   ld b,a
   ld (numseeds),a
   
seedjump:
   push bc
   ld b,60
   call ionRandom
   inc a
   inc a
   ld e,a
   ld b,92
   call ionRandom
   inc a
   inc a
   ld (coordx),a
   ld a,e
   ld (coordy),a
   call getMapPixel
   OR (HL)
   LD (HL), A
   call popisland
   pop bc
   djnz seedjump
   ret   

popisland:
   ld a,(numseeds)
   ld e,a
   ld d,0
   ld hl,25
   or a
   sbc hl,de
   ld a,l
   ld (mdist),a
   ld e,a
   ld h,a
   call H_Times_E
   add HL,HL
islandloop:
   push hl
   ld a,(mdist)
   push af
   ld b,5
   call ionRandom
   ld b,a
   pop af
   add a,b
   ld b,a
   call ionRandom
   ld e,a
   ld a,(coordy)
   add a,e
   ld e,a
   ld a,(mdist)
   ld b,a
   call ionRandom
   ld b,a
   ld a,(coordx)
   add a,b
   call getMapPixel
   OR (HL)
   LD (HL),A
   pop hl
   dec hl
   ld a,h
   or l
   jr nz,islandloop
   ret
   
numseeds:
   .db 0
coordx:
   .db 0
coordy:
   .db 0
mdist:
   .db 0

H_Times_E:           ; HL = H ? E
   LD     D, 0       ; Zero D and L
   LD     L, D
   LD     B, 8
_loop:
   ADD    HL, HL     ; Get most-significant bit of HL
   JR     NC, _skip
   ADD    HL, DE
_skip:
   DJNZ   _loop
   RET
   
getMapPixel:
   ld   d,$00
   ld   h,d
   ld   l,e
   add   hl,de
   add   hl,de
   add   hl,hl
   add   hl,hl
   ld   de,savesscreen
   add   hl,de
   ld   b,$00
   ld   c,a
   and   %00000111
   srl   c
   srl   c
   srl   c
   add   hl,bc
   ld   b,a
   inc   b
   ld   a,%00000001
getPixelLoop:
   rrca
   djnz   getPixelLoop
   ret
;;;;my hacked rigview title screen
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

dispttl:
   di
   ld   hl,RLE_Image
   ld   de,PlotsScreen
   call   DispRLE
   ld   de,AppBackupScreen
   call   DispRLE

CopyAgain:
   call   RIGCopyTBLR

   ld   bc,$07FE
KeyCheck:
   ld   a,$FF
   out   (1),a
   ld   a,c
   out   (1),a
   in   a,(1)
   inc   a
   jr   nz,exttl
   rlc   c
   djnz   KeyCheck

   ld   c,128
DoDelay:
   ld   b,10
   djnz   $
   dec   c
   jr   nz,DoDelay
   
   ld   bc,308
FixedDelay:
   dec   bc
   ld   a,b
   or   c
   jr   nz,FixedDelay

   jr   CopyAgain

exttl:
   ei
   bcall(_ClrLcdf)
   bcall(_HomeUp)
   bcall(_GetCSC)
   ret

RC_L1   = PlotsScreen
RC_L2   = AppBackupScreen

RIGCopyTBLR:
   ;Move To Top
   ld   a,$80      ;7
   out   ($10),a      ;11

   ;Preserve SP (used as temp register)
   ld   (RC_SP+1),sp   ;20
   ld   sp,RC_L1-RC_L2   ;10
   
   ld   hl,RC_Rotate+1   ;10
   dec   (hl)      ;11
   jp   p,RC_SkipHL2   ;10/1
   ld   (hl),2      ;10
RC_SkipHL2:

   ld   de,RC_L2   ;10
   ld   a,$20      ;7
RC_HLoop:
   ;Set Horizontal Position
   out   ($10),a      ;11

   ld   (RC_LdA+1),a   ;13
   ld   b,64      ;7
RC_Rotate:
   ld   c,1      ;7
RC_VLoop:
   dec   c      ;4
   ld   h,d      ;4
   ld   l,e      ;4

   jp   p,RC_Wait   ;10/1
   or   a      ;4 (waste)
   ld   c,2      ;7
   add   hl,sp      ;11
RC_NotL1:
   

   ld   a,(hl)      ;4
   out   ($11),a      ;11

   inc   de      ;6

   djnz   RC_VLoop   ;13/8

   ld   a,c      ;4
   ld   (RC_Rotate+1),a   ;13

RC_LdA:
   ld   a,0      ;7
   inc   a      ;4
   cp   $2C      ;7
   jp   nz,RC_HLoop   ;10/1
   
RC_SP:
   ld   sp,$0000   ;10
   ret         ;10

RC_Wait:
   jr   RC_NotL1   ;12 (waste)


RLE_Image:
   .db   $91,$FF,$20,$E0,$91,$DF,$07,$FB,$F3,$FF,$91,$EF,$04,$E7,$8B,$B4
   .db   $CC,$F7,$D7,$06,$FE,$F0,$91,$FF,$0E,$FE,$FC,$F9,$F8,$FE,$FF,$F7
   .db   $F0,$91,$FF,$12,$00,$FF,$FE,$FF,$DC,$CF,$EF,$E0,$CF,$E9,$FF,$FE
   .db   $B6,$91,$FF,$04,$7F,$1F,$7F,$7F,$FE,$FF,$7F,$91,$FF,$0E,$3D,$F9
   .db   $F0,$71,$3B,$3B,$7B,$F9,$91,$FF,$12,$00,$FF,$FF,$FF,$6F,$FB,$1B
   .db   $5F,$38,$A1,$E9,$40,$7F,$FF,$FF,$FF,$01,$62,$74,$FF,$BB,$01,$91
   .db   $FF,$12,$62,$E3,$F7,$F7,$73,$41,$91,$FF,$0D,$FE,$FD,$FB,$FB,$F3
   .db   $03,$FB,$FC,$FE,$EA,$1E,$3F,$DF,$EE,$9E,$F6,$FB,$FB,$F3,$F3,$E7
   .db   $CF,$7F,$24,$DA,$53,$21,$91,$FF,$12,$F1,$FD,$E1,$D9,$98,$C8,$91
   .db   $FF,$0D,$3F,$3F,$F8,$F4,$F6,$E6,$A2,$F0,$91,$FF,$0F,$1C,$EF,$B8
   .db   $C2,$91,$FF,$10,$EF,$CF,$83,$8F,$DE,$DE,$DA,$CB,$91,$FF,$0F,$C1
   .db   $46,$6C,$6E,$66,$84,$91,$FF,$06,$F5,$FF,$FB,$91,$FF,$06,$E7,$DF
   .db   $F7,$0F,$91,$FF,$12,$87,$66,$04,$7C,$74,$1E,$FF,$FC,$91,$FF,$0D
   .db   $C0,$D9,$9B,$9B,$0B,$01,$FB,$C1,$FF,$FF,$BF,$3F,$FF,$FF,$BF,$91
   .db   $FF,$04,$E3,$F5,$ED,$FD,$F7,$C6,$91,$FF,$12,$04,$DE,$DF,$CF,$9E
   .db   $18,$BF,$7F,$91,$FF,$0D,$11,$33,$BA,$BA,$10,$81,$91,$FF,$08,$AF
   .db   $91,$FF,$04,$DF,$FF,$1C,$BD,$DB,$0C,$91,$FF,$10,$3F,$FF,$3E,$39
   .db   $7B,$73,$31,$18,$91,$FF,$0F,$87,$66,$06,$7F,$74,$1C,$91,$FF,$0D
   .db   $CF,$FF,$F3,$EE,$FE,$93,$91,$FF,$12,$3F,$BF,$FF,$FF,$3F,$3F,$91
   .db   $FF,$0E,$FE,$8C,$4C,$3E,$1E,$9E,$7E,$91,$FF,$0F,$38,$1F,$FF,$20
   .db   $91,$FF,$25,$7F,$7F,$1F,$7F,$FF,$FF,$DF,$5F,$91,$FF,$0F,$66,$DD
   .db   $F5,$8E,$91,$FF,$3C,$61,$BF,$36,$44,$91,$FF,$0A
   ;next frame
   .db   $91,$FF,$21,$91,$E0,$06,$E1,$E7,$EF,$EF,$91,$FF,$05,$87,$D3,$84
   .db   $96,$B6,$0E,$FE,$F0,$91,$FF,$0E,$FC,$F9,$F8,$F8,$FC,$FF,$F6,$F0
   .db   $91,$FF,$13,$00,$01,$02,$23,$30,$70,$FF,$F0,$FE,$FE,$91,$FF,$07
   .db   $1F,$BF,$7F,$7E,$FF,$7F,$91,$FF,$0E,$39,$B9,$F0,$79,$31,$31,$31
   .db   $70,$91,$FF,$13,$00,$00,$00,$98,$5C,$F7,$FF,$F7,$63,$00,$91,$FF
   .db   $05,$01,$15,$10,$99,$BB,$01,$91,$FF,$12,$62,$F1,$E3,$E3,$67,$C1
   .db   $91,$FF,$0D,$FC,$F9,$F1,$F3,$F3,$F3,$01,$08,$05,$1D,$E1,$C1,$E1
   .db   $F1,$F1,$F9,$91,$FD,$04,$F9,$F1,$81,$60,$0A,$58,$01,$91,$FF,$12
   .db   $60,$F8,$C0,$88,$91,$91,$01,$80,$91,$FF,$0D,$3F,$BF,$B8,$F2,$E6
   .db   $E6,$24,$71,$91,$FF,$0F,$08,$AE,$40,$40,$91,$FF,$10,$CF,$CF,$83
   .db   $CF,$8E,$8E,$8A,$87,$91,$FF,$0F,$C0,$64,$46,$44,$CC,$84,$91,$FF
   .db   $06,$F4,$F1,$F3,$91,$FF,$06,$C7,$4F,$E7,$07,$91,$FF,$12,$8E,$26
   .db   $04,$7C,$24,$04,$FF,$FC,$91,$FF,$0D,$E0,$41,$19,$19,$91,$91,$01
   .db   $43,$F3,$C1,$FF,$FF,$FF,$BF,$BF,$BF,$1B,$91,$FF,$04,$E1,$F5,$F5
   .db   $E5,$E9,$C2,$91,$FF,$12,$04,$0F,$8E,$9E,$9E,$18,$1F,$3F,$91,$FF
   .db   $0D,$11,$99,$10,$10,$32,$01,$91,$FF,$04,$CF,$8F,$AF,$AF,$9F,$91
   .db   $FF,$04,$DF,$FF,$1C,$DB,$BB,$08,$91,$FF,$10,$3F,$FF,$3C,$39,$33
   .db   $33,$73,$18,$91,$FF,$0F,$8F,$26,$06,$7F,$25,$04,$91,$FF,$0D,$CF
   .db   $EF,$63,$46,$C6,$12,$91,$FF,$12,$3F,$BF,$FF,$FF,$BF,$7F,$91,$FF
   .db   $0D,$FE,$FE,$0C,$6E,$1C,$1C,$9C,$3C,$91,$FF,$0F,$1A,$19,$FB,$00
   .db   $91,$FF,$25,$7F,$7F,$1F,$7F,$7F,$7F,$5F,$3F,$91,$FF,$0F,$C6,$CC
   .db   $E5,$84,$91,$FF,$3C,$21,$A4,$AD,$44,$91,$FF,$0A


.end
END
so...ummm...yeah...Kerm, you taken a look at this yet?
Very nice! Generated with SourceCoder 2, I see, eh? I look forward to map generation working...
KermMartian wrote:
Very nice! Generated with SourceCoder 2, I see, eh? I look forward to map generation working...


if you want to see map generation at work, compile and run this:
my current problem is getting that to work properly in the framework of my main strategic conquest program.


Code:
.nolist
#include "ion.inc"
_strcpy   =$44E3
_MultAbyE   =$8042
.list
   
#IFDEF TI83P
   .org progstart -2
   .db $BB,$6D
#ENDIF

   ret
   jr nc,Start
   .db "Map Generator Demo",0
Start:
   bcall(_cleargbuf)
   bcall(_ClrLcdf)
   call seed
   ld de,gbuf
   ld hl,saferam1
   ld bc,768
   ldir
   call ionFastCopy
   bcall(_getkey)
   ret

seed:
   ld de,saferam1
   ld hl,gbuf
   ld bc,768
   ldir
   ld b,10
   call ionRandom
   add a,10
   ld b,a
   ld (numseeds),a
   
seedjump:
   push bc
   ld b,60
   call ionRandom
   inc a
   inc a
   ld e,a
   ld b,92
   call ionRandom
   inc a
   inc a
   ld (coordx),a
   ld a,e
   ld (coordy),a
   call getMapPixel
   OR (HL)
   LD (HL), A
   call popisland
   pop bc
   djnz seedjump
   ret   

popisland:
   ld a,(numseeds)
   ld e,a
   ld d,0
   ld hl,25
   or a
   sbc hl,de
   ld a,l
   ld (mdist),a
   ld e,a
   ld h,a
   call H_Times_E
   add HL,HL
islandloop:
   push hl
   ld a,(mdist)
   push af
   ld b,5
   call ionRandom
   ld b,a
   pop af
   add a,b
   ld b,a
   call ionRandom
   ld e,a
   ld a,(coordy)
   add a,e
   ld e,a
   ld a,(mdist)
   ld b,a
   call ionRandom
   ld b,a
   ld a,(coordx)
   add a,b
   call getMapPixel
   OR (HL)
   LD (HL),A
   pop hl
   dec hl
   ld a,h
   or l
   jr nz,islandloop
   ret
   
numseeds:
   .db 0
coordx:
   .db 0
coordy:
   .db 0
mdist:
   .db 0

H_Times_E:           ; HL = H × E
   LD     D, 0       ; Zero D and L
   LD     L, D
   LD     B, 8
_loop:
   ADD    HL, HL     ; Get most-significant bit of HL
   JR     NC, _skip
   ADD    HL, DE
_skip:
   DJNZ   _loop
   RET
   
getMapPixel:
   ld   d,$00
   ld   h,d
   ld   l,e
   add   hl,de
   add   hl,de
   add   hl,hl
   add   hl,hl
   ld   de,saferam1
   add   hl,de
   ld   b,$00
   ld   c,a
   and   %00000111
   srl   c
   srl   c
   srl   c
   add   hl,bc
   ld   b,a
   inc   b
   ld   a,%00000001
getPixelLoop:
   rrca
   djnz   getPixelLoop
   ret
 
.end
END
ok, this f***ing pissing me off

compare the code of these two programs, the first works, the second makes it the end of the loop like its supposed to and even pause then quits but wont display a d*** thing


Code:
.nolist
#include "dcs6.inc"
_strcpy   =$44E3
_MultAbyE   =$8042
OCEAN       =$00
LAND      =$00
savesscreen =$86EC
.list
   .org progstart
#IFDEF TI83P
   .db $BB,$6D
#ENDIF
INIT:
   xor d
#IFDEF TI83P
   .db $C9
#ENDIF

   jr Start
   .dw $0000
   .db $06,$00
   .dw Icon
   .dw $0000
   .dw $0000
Icon:            ;a 16x16 icon
   .db $3C,$09,$66,$3F,$C3,$7E,$C1,$10,$60,$00,$3C,$3E,$06,$63,$83,$41
   .db $C3,$40,$66,$40,$3C,$C1,$01,$63,$76,$3E,$FF,$81,$FF,$8E,$63,$1F
Start:
   bcall(_cleargbuf)
   bcall(_ClrLcdf)
   call seed
   ld de,plotsscreen
   ld hl,savesscreen
   ld bc,768
   ldir
   call ionFastCopy
   call pause
   ret

seed:
   ld de,savesscreen
   ld hl,plotsscreen
   ld bc,768
   ldir
   ld b,10
   call ionRandom
   add a,10
   ld b,a
   ld (numseeds),a
   
seedjump:
   push bc
   ld b,60
   call ionRandom
   inc a
   inc a
   ld e,a
   ld b,92
   call ionRandom
   inc a
   inc a
   ld (coordx),a
   ld a,e
   ld (coordy),a
   call getMapPixel
   OR (HL)
   LD (HL), A
   call popisland
   pop bc
   djnz seedjump
   ret   

popisland:
   ld a,(numseeds)
   ld e,a
   ld d,0
   ld hl,25
   or a
   sbc hl,de
   ld a,l
   ld (mdist),a
   ld e,a
   ld h,a
   call H_Times_E
   add HL,HL
islandloop:
   push hl
   ld a,(mdist)
   push af
   ld b,5
   call ionRandom
   ld b,a
   pop af
   add a,b
   ld b,a
   call ionRandom
   ld e,a
   ld a,(coordy)
   add a,e
   ld e,a
   ld a,(mdist)
   ld b,a
   call ionRandom
   ld b,a
   ld a,(coordx)
   add a,b
   call getMapPixel
   OR (HL)
   LD (HL),A
   pop hl
   dec hl
   ld a,h
   or l
   jr nz,islandloop
   ret
   
numseeds:
   .db 0
coordx:
   .db 0
coordy:
   .db 0
mdist:
   .db 0

H_Times_E:           ; HL = H × E
   LD     D, 0       ; Zero D and L
   LD     L, D
   LD     B, 8
_loop:
   ADD    HL, HL     ; Get most-significant bit of HL
   JR     NC, _skip
   ADD    HL, DE
_skip:
   DJNZ   _loop
   RET
   
getMapPixel:
   ld   d,$00
   ld   h,d
   ld   l,e
   add   hl,de
   add   hl,de
   add   hl,hl
   add   hl,hl
   ld   de,savesscreen
   add   hl,de
   ld   b,$00
   ld   c,a
   and   %00000111
   srl   c
   srl   c
   srl   c
   add   hl,bc
   ld   b,a
   inc   b
   ld   a,%00000001
getPixelLoop:
   rrca
   djnz   getPixelLoop
   ret
 
.end
END



Code:
.nolist
#include "dcs6.inc"
_strcpy      =$44E3
_MultAbyE   =$8042
savesscreen =$86EC
.list
   .org progstart
#IFDEF TI83P
   .db $BB,$6D
#ENDIF
INIT:
   xor d
#IFDEF TI83P
   .db $C9
#ENDIF

   jr Start
   .dw $0000
   .db $06,$00
   .dw Icon
   .dw $0000
   .dw Apstart         ;the routine to open files.  DCS will start you here instead of at $9D95
                  ;if a file is pending
   .db $31,$7F         ;argh, this be an APMain
   .db $01            ;number of accepted filetypes
   .db $00,$01,$00         ;game saves, strategy games, strategic conquest
Icon:            ;a 16x16 icon
   .db $3C,$09,$66,$3F,$C3,$7E,$C1,$10,$60,$00,$3C,$3E,$06,$63,$83,$41
   .db $C3,$40,$66,$40,$3C,$C1,$01,$63,$76,$3E,$FF,$81,$FF,$8E,$63,$1F
IconAP:            ;a 16x16 icon
   .db $FF,$F8,$E6,$34,$C3,$72,$C1,$1F,$E0,$01,$BC,$3F,$86,$63,$83,$41
   .db $C3,$41,$E6,$47,$BC,$C1,$81,$63,$F6,$3F,$FF,$81,$FF,$8F,$FF,$FE
START:
   call dispttl ;   the title
   bcall(_cleargbuf) ;clear the buffer
   bcall(_ClrLcdf) ;now clear the screen
   call OpenGUIStack ;setup the GUI

   ld hl,stwin
   ld de,stwin_1-stwin
   ld a,$01 ;small window
   call PushGUIStack
   ld hl,smb
   ld de,smb_1-smb
   ld a,$07 ;button
   call PushGUIStack
   ld hl,quitb
   ld de,quitb_1-quitb
   ld a,$07 ;button
   call PushGUIStack
   ;;;draw stuff
   ld hl,logo
   ld de,logo_1-logo
   ld a,$11
   call PushGUIStack
   ld hl,city
   ld de,city_1-city
   ld a,$11
   call PushGUIStack
   ld hl,tank
   ld de,tank_1-tank
   ld a,$11
   call PushGUIStack
   ;;;mode selection
   ld hl,GameType1
   ld de,GameType_1-GameType1
   ld a,$0A
   call PushGUIStack
   ld hl,GameType2
   ld de,GameType_2-GameType2
   ld a,$0A
   call PushGUIStack
   ld hl,GameType3
   ld de,GameType_3-GameType3
   ld a,$0A
   call PushGUIStack
   ld hl,GameType4
   ld de,GameType_4-GameType4
   ld a,$0A
   call PushGUIStack
   ;;;Level Selector
   ld hl,LevelScroll
   ld de,LevelScroll_1-LevelScroll
   ld a,$14
   call PushGUIStack
   ld hl,LevelTxt
   ld de,LevelTxt_1-LevelTxt
   ld a,$04
   call PushGUIStack
   ;;;Render UP
rerender:
   call RenderGUI
   call GUIMouse
   ret
loadmap:
   bcall(_cleargbuf)
   bcall(_ClrLcdf)
   call seed
   ;ld de,plotsscreen
   ;ld hl,savesscreen
   ;ld bc,768
   ;ldir
   call ionFastCopy
   call pause
   call quit
   ret
quit:
   call ResetAppPage
   call CloseGUIStack
   ret
Apstart:
   bcall(_ClrLcdf)
   ld hl,0
   ld (pencol),hl
   push ix
   pop hl
   bcall(_vputs)
   call Pause
   ret
nullw:
   .db $FF;
stwin:
   .db %01110000;
   .db %10001000;
   .db %10000000;
   .db %10001000;
   .db %01110000;
   .db "New Game",0;
stwin_1:
smb:
   .db 5,45;
   .dw loadmap
   .db "Start Game!",0
smb_1:
quitb:
   .db 75,45;
   .dw quit
   .db "Quit",0
quitb_1:
logo:
   .db 1,1,2,16
   .db $3C,$09,$66,$3F,$C3,$7E,$C1,$10,$60,$00,$3C,$3E,$06,$63,$83,$41
   .db $C3,$40,$66,$40,$3C,$C1,$01,$63,$76,$3E,$FF,$81,$FF,$8E,$63,$1F
logo_1:
GameType1:
   .db 3,18
   .db 1,1
   .db "1 Player",0
GameType_1:
GameType2:
   .db 3,24
   .db 1,0
   .db "2 Player",0
GameType_2:
GameType3:
   .db 40,18
   .db 1,0
   .db "Cn2 Master",0
GameType_3:
GameType4:
   .db 40,24
   .db 1,0
   .db "Cn2 Slave",0
GameType_4:
LevelScroll:
   ;x,y,width,ID,per,min,max,cur,onScrollUp,onScrollDown
   .db 1,37,75,0
   .dw 1,1,16,1
   .dw edittxt,edittxt
LevelScroll_1:
LevelTxt:
   .db 3,30,0
   .db "AI Level :: 01",0
LevelTxt_1:
edittxt:
   call GUIFindFirst ;start game button
   ld b,11 ;11 elements after that
lgetloop:
   push bc
   call GUIFindNext
   pop bc
   djnz lgetloop
   push hl
   push de ;;save them for later
   ld de,13 ;get the current slider
   add hl,de
   ld a,(hl) ;load it into a
   pop de
   pop hl
   push af
   call GUIFindNext
   pop af
   push hl
   dec a ;0-14
   ld e,3
   bcall(_MultAbyE) ;kk stored offset in HL
   push hl
   pop ix ;load it into ix
   pop de
   ld hl,18
   add hl,de
   ex de,hl ;de is now the address of the level digits
   push de
   push ix
   pop hl
   ld de,ltxt
   add hl,de
   pop de
   bcall(_strcpy)
   ret

city:
 .db 34,1,2,16
 .db $FF,$FF,$7F,$D5,$7E,$6A,$79,$FF,$79,$F7,$79,$CF,$79,$CD,$79,$CD
 .db $79,$CD,$60,$CD,$64,$C0,$64,$C0,$80,$CA,$00,$00,$00,$00,$55,$55
city_1:
tank:
 .db 67,1,2,16
 .db $00,$10,$00,$10,$00,$10,$00,$10,$00,$10,$03,$F0,$7F,$F8,$0E,$B8
 .db $0E,$A8,$18,$28,$7F,$FE,$6A,$56,$6A,$56,$7F,$FE,$3F,$FC,$00,$00
tank_1:

;;;sprites
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
spr_battleship:
 .db $00,$00,$00,$09,$BA,$FF,$7E,$00
spr_bomber:
 .db $00,$12,$32,$FE,$FC,$00,$08,$00
spr_carrier:
 .db $00,$00,$0C,$1E,$8C,$FF,$7E,$00
spr_city:
 .db $00,$20,$24,$24,$74,$57,$FF,$00
spr_destroyer:
 .db $C0,$10,$08,$18,$7F,$7E,$00,$00
spr_fighter:
 .db $00,$30,$A0,$FC,$7E,$90,$00,$00
spr_land:
 .db $FF,$81,$81,$81,$81,$81,$81,$FF
spr_invert:
 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
spr_smoke:
 .db $10,$03,$00,$00,$00,$00,$00,$00
spr_sub:
 .db $00,$00,$10,$10,$3F,$FE,$00,$00
spr_tank:
 .db $00,$01,$3A,$64,$FF,$FF,$66,$00
spr_transport:
 .db $00,$00,$C0,$C0,$1E,$FE,$FE,$00
spr_water
 .db $00,$00,$22,$00,$08,$00,$22,$00


ltxt:
 .db "01",0,"02",0
 .db "03",0,"04",0
 .db "05",0,"06",0
 .db "07",0,"08",0
 .db "09",0,"10",0
 .db "11",0,"12",0
 .db "13",0,"14",0
 .db "15",0
ltxt_1:
;;;;map generation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
seed:
   ;ld de,savesscreen
   ;ld hl,plotsscreen
   ;ld bc,768
   ;ldir
   ld b,10
   call ionRandom
   add a,10
   ld b,a
   ld (numseeds),a
   
seedjump:
   push bc
   ld b,60
   call ionRandom
   inc a
   inc a
   ld e,a
   ld b,92
   call ionRandom
   inc a
   inc a
   ld (coordx),a
   ld a,e
   ld (coordy),a
   call getMapPixel
   OR (HL)
   LD (HL), A
   call popisland
   pop bc
   djnz seedjump
   ret   

popisland:
   ld a,(numseeds)
   ld e,a
   ld d,0
   ld hl,25
   or a
   sbc hl,de
   ld a,l
   ld (mdist),a
   ld e,a
   ld h,a
   call H_Times_E
   add HL,HL
islandloop:
   push hl
   ld a,(mdist)
   push af
   ld b,5
   call ionRandom
   ld b,a
   pop af
   add a,b
   ld b,a
   call ionRandom
   ld e,a
   ld a,(coordy)
   add a,e
   ld e,a
   ld a,(mdist)
   ld b,a
   call ionRandom
   ld b,a
   ld a,(coordx)
   add a,b
   call getMapPixel
   OR (HL)
   LD (HL),A
   pop hl
   dec hl
   ld a,h
   or l
   jr nz,islandloop
   ret
   
numseeds:
   .db 0
coordx:
   .db 0
coordy:
   .db 0
mdist:
   .db 0

H_Times_E:           ; HL = H × E
   LD     D, 0       ; Zero D and L
   LD     L, D
   LD     B, 8
_loop:
   ADD    HL, HL     ; Get most-significant bit of HL
   JR     NC, _skip
   ADD    HL, DE
_skip:
   DJNZ   _loop
   RET
   
getMapPixel:
   ld   d,$00
   ld   h,d
   ld   l,e
   add   hl,de
   add   hl,de
   add   hl,hl
   add   hl,hl
   ld   de,plotsscreen
   add   hl,de
   ld   b,$00
   ld   c,a
   and   %00000111
   srl   c
   srl   c
   srl   c
   add   hl,bc
   ld   b,a
   inc   b
   ld   a,%00000001
getPixelLoop:
   rrca
   djnz   getPixelLoop
   ret
;;;;my hacked rigview title screen
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

dispttl:
   di
   ld   hl,RLE_Image
   ld   de,PlotsScreen
   call   DispRLE
   ld   de,AppBackupScreen
   call   DispRLE

CopyAgain:
   call   RIGCopyTBLR

   ld   bc,$07FE
KeyCheck:
   ld   a,$FF
   out   (1),a
   ld   a,c
   out   (1),a
   in   a,(1)
   inc   a
   jr   nz,exttl
   rlc   c
   djnz   KeyCheck

   ld   c,128
DoDelay:
   ld   b,10
   djnz   $
   dec   c
   jr   nz,DoDelay
   
   ld   bc,308
FixedDelay:
   dec   bc
   ld   a,b
   or   c
   jr   nz,FixedDelay

   jr   CopyAgain

exttl:
   ei
   bcall(_ClrLcdf)
   bcall(_HomeUp)
   bcall(_GetCSC)
   ret

RC_L1   = PlotsScreen
RC_L2   = AppBackupScreen

RIGCopyTBLR:
   ;Move To Top
   ld   a,$80      ;7
   out   ($10),a      ;11

   ;Preserve SP (used as temp register)
   ld   (RC_SP+1),sp   ;20
   ld   sp,RC_L1-RC_L2   ;10
   
   ld   hl,RC_Rotate+1   ;10
   dec   (hl)      ;11
   jp   p,RC_SkipHL2   ;10/1
   ld   (hl),2      ;10
RC_SkipHL2:

   ld   de,RC_L2   ;10
   ld   a,$20      ;7
RC_HLoop:
   ;Set Horizontal Position
   out   ($10),a      ;11

   ld   (RC_LdA+1),a   ;13
   ld   b,64      ;7
RC_Rotate:
   ld   c,1      ;7
RC_VLoop:
   dec   c      ;4
   ld   h,d      ;4
   ld   l,e      ;4

   jp   p,RC_Wait   ;10/1
   or   a      ;4 (waste)
   ld   c,2      ;7
   add   hl,sp      ;11
RC_NotL1:
   

   ld   a,(hl)      ;4
   out   ($11),a      ;11

   inc   de      ;6

   djnz   RC_VLoop   ;13/8

   ld   a,c      ;4
   ld   (RC_Rotate+1),a   ;13

RC_LdA:
   ld   a,0      ;7
   inc   a      ;4
   cp   $2C      ;7
   jp   nz,RC_HLoop   ;10/1
   
RC_SP:
   ld   sp,$0000   ;10
   ret         ;10

RC_Wait:
   jr   RC_NotL1   ;12 (waste)


RLE_Image:
   .db   $91,$FF,$20,$E0,$91,$DF,$07,$FB,$F3,$FF,$91,$EF,$04,$E7,$8B,$B4
   .db   $CC,$F7,$D7,$06,$FE,$F0,$91,$FF,$0E,$FE,$FC,$F9,$F8,$FE,$FF,$F7
   .db   $F0,$91,$FF,$12,$00,$FF,$FE,$FF,$DC,$CF,$EF,$E0,$CF,$E9,$FF,$FE
   .db   $B6,$91,$FF,$04,$7F,$1F,$7F,$7F,$FE,$FF,$7F,$91,$FF,$0E,$3D,$F9
   .db   $F0,$71,$3B,$3B,$7B,$F9,$91,$FF,$12,$00,$FF,$FF,$FF,$6F,$FB,$1B
   .db   $5F,$38,$A1,$E9,$40,$7F,$FF,$FF,$FF,$01,$62,$74,$FF,$BB,$01,$91
   .db   $FF,$12,$62,$E3,$F7,$F7,$73,$41,$91,$FF,$0D,$FE,$FD,$FB,$FB,$F3
   .db   $03,$FB,$FC,$FE,$EA,$1E,$3F,$DF,$EE,$9E,$F6,$FB,$FB,$F3,$F3,$E7
   .db   $CF,$7F,$24,$DA,$53,$21,$91,$FF,$12,$F1,$FD,$E1,$D9,$98,$C8,$91
   .db   $FF,$0D,$3F,$3F,$F8,$F4,$F6,$E6,$A2,$F0,$91,$FF,$0F,$1C,$EF,$B8
   .db   $C2,$91,$FF,$10,$EF,$CF,$83,$8F,$DE,$DE,$DA,$CB,$91,$FF,$0F,$C1
   .db   $46,$6C,$6E,$66,$84,$91,$FF,$06,$F5,$FF,$FB,$91,$FF,$06,$E7,$DF
   .db   $F7,$0F,$91,$FF,$12,$87,$66,$04,$7C,$74,$1E,$FF,$FC,$91,$FF,$0D
   .db   $C0,$D9,$9B,$9B,$0B,$01,$FB,$C1,$FF,$FF,$BF,$3F,$FF,$FF,$BF,$91
   .db   $FF,$04,$E3,$F5,$ED,$FD,$F7,$C6,$91,$FF,$12,$04,$DE,$DF,$CF,$9E
   .db   $18,$BF,$7F,$91,$FF,$0D,$11,$33,$BA,$BA,$10,$81,$91,$FF,$08,$AF
   .db   $91,$FF,$04,$DF,$FF,$1C,$BD,$DB,$0C,$91,$FF,$10,$3F,$FF,$3E,$39
   .db   $7B,$73,$31,$18,$91,$FF,$0F,$87,$66,$06,$7F,$74,$1C,$91,$FF,$0D
   .db   $CF,$FF,$F3,$EE,$FE,$93,$91,$FF,$12,$3F,$BF,$FF,$FF,$3F,$3F,$91
   .db   $FF,$0E,$FE,$8C,$4C,$3E,$1E,$9E,$7E,$91,$FF,$0F,$38,$1F,$FF,$20
   .db   $91,$FF,$25,$7F,$7F,$1F,$7F,$FF,$FF,$DF,$5F,$91,$FF,$0F,$66,$DD
   .db   $F5,$8E,$91,$FF,$3C,$61,$BF,$36,$44,$91,$FF,$0A
   ;next frame
   .db   $91,$FF,$21,$91,$E0,$06,$E1,$E7,$EF,$EF,$91,$FF,$05,$87,$D3,$84
   .db   $96,$B6,$0E,$FE,$F0,$91,$FF,$0E,$FC,$F9,$F8,$F8,$FC,$FF,$F6,$F0
   .db   $91,$FF,$13,$00,$01,$02,$23,$30,$70,$FF,$F0,$FE,$FE,$91,$FF,$07
   .db   $1F,$BF,$7F,$7E,$FF,$7F,$91,$FF,$0E,$39,$B9,$F0,$79,$31,$31,$31
   .db   $70,$91,$FF,$13,$00,$00,$00,$98,$5C,$F7,$FF,$F7,$63,$00,$91,$FF
   .db   $05,$01,$15,$10,$99,$BB,$01,$91,$FF,$12,$62,$F1,$E3,$E3,$67,$C1
   .db   $91,$FF,$0D,$FC,$F9,$F1,$F3,$F3,$F3,$01,$08,$05,$1D,$E1,$C1,$E1
   .db   $F1,$F1,$F9,$91,$FD,$04,$F9,$F1,$81,$60,$0A,$58,$01,$91,$FF,$12
   .db   $60,$F8,$C0,$88,$91,$91,$01,$80,$91,$FF,$0D,$3F,$BF,$B8,$F2,$E6
   .db   $E6,$24,$71,$91,$FF,$0F,$08,$AE,$40,$40,$91,$FF,$10,$CF,$CF,$83
   .db   $CF,$8E,$8E,$8A,$87,$91,$FF,$0F,$C0,$64,$46,$44,$CC,$84,$91,$FF
   .db   $06,$F4,$F1,$F3,$91,$FF,$06,$C7,$4F,$E7,$07,$91,$FF,$12,$8E,$26
   .db   $04,$7C,$24,$04,$FF,$FC,$91,$FF,$0D,$E0,$41,$19,$19,$91,$91,$01
   .db   $43,$F3,$C1,$FF,$FF,$FF,$BF,$BF,$BF,$1B,$91,$FF,$04,$E1,$F5,$F5
   .db   $E5,$E9,$C2,$91,$FF,$12,$04,$0F,$8E,$9E,$9E,$18,$1F,$3F,$91,$FF
   .db   $0D,$11,$99,$10,$10,$32,$01,$91,$FF,$04,$CF,$8F,$AF,$AF,$9F,$91
   .db   $FF,$04,$DF,$FF,$1C,$DB,$BB,$08,$91,$FF,$10,$3F,$FF,$3C,$39,$33
   .db   $33,$73,$18,$91,$FF,$0F,$8F,$26,$06,$7F,$25,$04,$91,$FF,$0D,$CF
   .db   $EF,$63,$46,$C6,$12,$91,$FF,$12,$3F,$BF,$FF,$FF,$BF,$7F,$91,$FF
   .db   $0D,$FE,$FE,$0C,$6E,$1C,$1C,$9C,$3C,$91,$FF,$0F,$1A,$19,$FB,$00
   .db   $91,$FF,$25,$7F,$7F,$1F,$7F,$7F,$7F,$5F,$3F,$91,$FF,$0F,$C6,$CC
   .db   $E5,$84,$91,$FF,$3C,$21,$A4,$AD,$44,$91,$FF,$0A


.end
END
Does this have anything to do with it? Razz

Code:
   ;ld de,plotsscreen
   ;ld hl,savesscreen
   ;ld bc,768
   ;ldir
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
» View previous topic :: View next topic  
Page 4 of 7
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement