A86: Can somebody help me with this code?
[Prev][Next][Index][Thread]
A86: Can somebody help me with this code?
I am nearly brand new as far as assembly programming- I'm trying to
teach myself from the few tutorials available and lookin at other
people's code.. It's pretty tough- I knwo Turbo pascal but this is WAY
different.. Anyways, I thought I'd try writing a routine to just move
a character around, allowing you to change the directions of it.. It
seems to me like this code should work, but what happens is this: It
seems to me, from some experimentation by inversing the video, and
then moving the un-inverse command around to pinpoint the problem,
that the program just exits at the end of the Display: fuinction.. It
doesn't return back to the function it's called from.
Could somebody maybe give me some insight on this one? Any comments
are appreciated.
here's the code:
#include "asm86.h"
#include "ti86asm.inc"
#include "ti86math.inc"
#include "ti86ops.inc"
#include "ti86abs.inc"
.org _asm_exec_ram
call _clrScrn
ld bc,$0202
set textInverse,(iy+textflags)
Right:
inc b
jp Display
jp CheckEdges
jp CheckKeys
jp Right
Left:
dec b
jp Display
jp CheckEdges
jp CheckKeys
jp Left
Up:
dec c
jp Display
jp CheckEdges
jp CheckKeys
jp Up
Down:
inc c
jp Display
jp CheckEdges
jp CheckKeys
jp Down
CheckKeys:
call _getkey
cp kRight
jp z,Right
cp kLeft
jp z,Left
cp kUp
jp z,Up
cp kDown
jp z,Down
cp kExit
jp z,Leave
ret
CheckEdges:
;push af ;if needed
ld a,$00
cp b
jp z,ResetLeft
cp c
jp z,ResetTop
ld a,$14
cp b
jp z,ResetRight
ld a,$07
cp c
jp z,ResetBottom
;pop af
ret
ResetLeft:
;jp Display
ld b,$15
ret
ResetRight:
;jp Display
ld b,$00
ret
ResetTop:
;jp Display
ld c,$08
ret
ResetBottom:
;jp Display
ld c,$00
ret
Display:
;push af
ld a,$058
ld (_curRow),bc
call _putmap
; res textInverse,(iy+textflags) PROBLEMS RIGHT HERE! i
think..
;pop af
; ret
; jp Right ; <-- Thought I'd force it to ;
;return to the loop it was
;called from. This just simply crashed the
calculator..
; res textInverse,(iy+textflags)
.end
I know certain areas like the checkedges routine won't work very well,
and I know it'll leave a trail right now. I'm just messing around, and
am completely stumped!!
Thanks,
Rolf
References: