Author Topic: So what next?  (Read 9157 times)

0 Members and 1 Guest are viewing this topic.

Offline thydowulays

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 184
  • Rating: +12/-1
  • Don't gimme dat lip
    • View Profile
    • Thy Gaming Forum
Re: So what next?
« Reply #15 on: January 10, 2012, 06:40:02 pm »
Cool! Anyways, it turns out I need help real quick with my game. (lol). I figure I might as well post the entire code so far to show you. The problem is that I can't seem to move my character up. I am using a variable called Ypos for the Y position of the character in the penCol. He doesn't move at all. Also, I am using Mimas for this, if that helps any.

Code: [Select]
....
Start:
BCALL ClrLCDFull
LD HL,$02
LD (curRow),HL
LD HL,Str1 ; This is my ASCII Adventures string
BCALL PutS
LD HL,$231E
LD (penCol),HL
LD HL,Str2 ; This is my Version 1.0 string
BCALL VPutS
LD HL,$2D1B
LD (penCol),HL
LD HL,Str3 ; This is my Press any key string
BCALL VPutS
BCALL GetKey ; I would have used GetCSC for this, but that would have required a loop and I want to optimize as much as possible
Game:
BCALL ClrLCDFull
LD A,Xpos ; This gets my variable Xpos.
LD (penRow),A ; This makes it in the penRow
LD A,Ypos
LD (penCol),A
LD HL,Plyr ; This is my Theta string ( I know I could use a character, I just wanted a string.....)
KeyLoop:
BCALL GetCSC
CP 0
JR Z, KeyLoop ; I know. Super n00b way of doing things, but it works.
CP skClear
RET Z
CP skUp
JR Z, MoveUp ; It's in this routine that I'm having trouble with things.
MoveUp:
LD A, Ypos
Sub 1
LD (Ypos),A
JR Game ; Don't know if this is the problem or not
Str1:
DB "ASCII Adventures",0
Str2:
DB "Version 0.1",0
Str3:
DB "Press any key",0
Plyr:
DB "(theta)",0
Xpos EQU 46 ; These could be the problems too
Ypos EQU 26

Thanks for all your help!

« Last Edit: January 10, 2012, 07:05:15 pm by thydowulays »
Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus




Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: So what next?
« Reply #16 on: January 10, 2012, 07:02:05 pm »
Ah, I think I've got it:

Line 35 should be "LD A, (YPos)"  You forgot the parenthesis ;D

Also, in line 36, use DEC A.  It's smaller and faster than sub 1.  In addition, use OR A instead of CP 0 in line 26

Offline thydowulays

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 184
  • Rating: +12/-1
  • Don't gimme dat lip
    • View Profile
    • Thy Gaming Forum
Re: So what next?
« Reply #17 on: January 10, 2012, 07:05:04 pm »
Okay thanks! I'll try that....
Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus




Offline thydowulays

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 184
  • Rating: +12/-1
  • Don't gimme dat lip
    • View Profile
    • Thy Gaming Forum
Re: So what next?
« Reply #18 on: January 10, 2012, 07:22:42 pm »
Hmm, it didn't work. I think it's a problem with the variables Xpos and Ypos, because the coordinates (46,26) are in the middle of the screen, and it was over in the top left.
Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus




Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: So what next?
« Reply #19 on: January 10, 2012, 07:41:49 pm »
Try replacing the last two lines:

Xpos:
 .db 46 ; These could be the problems too
Ypos:
 .db 26
 
EQU turned Xpos and Ypos into constants.  DB will help with making them variables.
« Last Edit: January 10, 2012, 07:46:37 pm by Hot_Dog »

Offline thydowulays

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 184
  • Rating: +12/-1
  • Don't gimme dat lip
    • View Profile
    • Thy Gaming Forum
Re: So what next?
« Reply #20 on: January 10, 2012, 07:56:30 pm »
Okay let me try that. Oh and for some reason I crashed my calc completely earlier, so I have to rewrite this all over again, ugh.
Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus




Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: So what next?
« Reply #21 on: January 11, 2012, 05:27:54 am »
Also, check this part here:
Code: [Select]
Game:
BCALL ClrLCDFull
LD A,Xpos ; This gets my variable Xpos.
LD (penRow),A ; This makes it in the penRow
LD A,Ypos
LD (penCol),A
Two things, first: penRow is the row, aka the y position. penCol is the X position. Next, you forgot the parenthesis again. It works initially because you have them defined as equates, so it essentially converts Xpos into the number equated as Xpos. Try making the change Hot_dog proposed (changing the equates into .db statements) and adding in the parenthesis. :)

Offline thydowulays

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 184
  • Rating: +12/-1
  • Don't gimme dat lip
    • View Profile
    • Thy Gaming Forum
Re: So what next?
« Reply #22 on: January 11, 2012, 07:39:18 am »
Thanks! Yes, I tried all these. And guess what, it works! By actually using a different method from Xpos and Ypos, I was able to get it (partially) working. The only problem is, it moves up, but it also moves to the right as well. I am not sure why.....
Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus




Offline NanoWar

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 140
  • Rating: +18/-6
    • View Profile
Re: So what next?
« Reply #23 on: January 11, 2012, 10:21:16 am »
Just saying it in other words: In ASM there are no named variables, only registers (very limited set) and memory locations. But there are compiler "variables" like labels and defines. But those only exist before compile time in your code. By doing "Ypos = 26", you define the memory location 26 to a compiler variable named Ypos.

Hardware thinking in ASM!

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: So what next?
« Reply #24 on: January 11, 2012, 11:18:58 am »
Can you post your updated code?