A82: WHOA, weird problem


[Prev][Next][Index][Thread]

A82: WHOA, weird problem



This file seems to crash TASM every time.  When invoked, TASM displays lots of
weird stuff - sometimes many colors of weird stuff - and the whole computer
freezes.  I tried other files, and they compiled fine exept they made TASM
display a few strange characters
I reinstalled TASM and nothing bad happens with other files, but this one
still crashes it.
If someone would take a look at it (it's basically just some macros, aliases,
and a small amount of test code), I'd really appreciate it

~Adamman
;3D Game - This is just a primitive demo
;Make sure wordwrap (line break) is off!

#include ti82.h

;Player attributes:
PLAYER_EPISODE = TEXT_MEM			;Word, address of player's current episode
PLAYER_LEVEL = TEXT_MEM+2				;Word, address of player's current level
PLAYER_SECTOR = TEXT_MEM+4			;Word, address of player's current sector
PLAYER_X = TEXT_MEM+6				;Word, x coord of player
PLAYER_Y = TEXT_MEM+8				;Word, y coord of player
PLAYER_ANGLE = TEXT_MEM+10			;Word, angle player is facing
PLAYER_HEIGHT = TEXT_MEM+12			;Byte, height of player
PLAYER_XRATE = TEXT_MEM+13			;Byte, changing value added to PLAYER_X
PLAYER_YRATE = TEXT_MEM+14			;Byte, changing value added to PLAYER_Y
PLAYER_TURNRATE = TEXT_MEM+15			;Byte, changing value added to PLAYER_ANGLE
PLAYER_HEIGHTRATE = TEXT_MEM+16			;Byte, changing value added to PLAYER_HEIGHT
FIELD_OF_VIEW = 60				;Player has a 60 degree field of vision

;Screen attributes:
PROJECTION_PLANE_WIDTH = 96			;Width of screen
PROJECTION_PLANE_HEIGHT = 60			;Height of screen
PROJECTION_PLANE_CENTER = TEXT_MEM+17		;Byte, Center of the screen (for looking up/down)
PROJECTION_PLANE_DISTANCE = 83			;Distance to the projection plane
						;	Lower = smaller picture
						;	Highter = larger picture

;Convert 0-360 angles to extended 0-579 (magic) angles.
;This way we never get decimal places, so it's easy to put things into tables.  MAGIC!
#DEFINE angles(angle_argument) angle_argument*PROJECTION_PLANE_WIDTH/FIELD_OF_VIEW

;Easy macros for world databases:
#DEFINE EPISODE(ep_firstlevel,ep_nextepisode,ep_title) .dw ep_firstlevel,ep_nextepisode \ .db ep_title,0
#DEFINE LEVEL(lev_firstsector,lev_nextlevel,lev_skytexture,lev_title) .dw lev_firstsector,lev_nextlevel,lev_skytexture \ .db lev_title,0
#DEFINE SECTOR(sect_firstseg,sect_nextsect,sect_startx,sect_starty,sect_startang,sect_startheight,sect_currentseg,sect_leftangle,sect_rightangle)
	#DEFCONT \ .dw sect_firstseg,sect_nextsect,sect_startx,sect_starty,sect_startang \ .db sect_startheight \ .dw sect_currentseg,sect_leftangle,sect_rightangle
#DEFINE SIDE(side_sector,side_nextseg,side_texture,side_transparent) .dw side_sector,side_nextseg,side_texture \ .db side_transparent
#DEFINE SEGMENT(seg_x1,seg_y1,seg_x2,seg_y2,seg_side1,seg_side2,seg_sector,seg_angle) .dw seg_x1,seg_y1,seg_x2,seg_y2,seg_side1,seg_side2,seg_sector,seg_angle

;Add these to a structure to obtain the requested element:
	;Episodes:
		FIRST_LEVEL = 0
		NEXT_EPISODE = 2
		EPISODE_TITLE = 4
	;Levels:
		FIRST_SECTOR = 0
		NEXT_LEVEL = 2
		SKY_TEXTURE = 4
		LEVEL_TITLE = 6
	;Sectors:
		FIRST_SEGMENT = 0
		NEXT_SECTOR = 2
		START_X = 4
		START_Y = 6
		START_ANGLE = 8
		START_HEIGHT = 10
		THE_SEGMENT = 11
		LEFT_ANGLE = 13
		RIGHT_ANGLE = 15
	;Sides:
		SIDE_SECTOR = 0
		NEXT_SEGMENT = 2
		SIDE_TEXTURE = 4
		CLEAR_SIDE = 6
	;Segments:
		FIRST_X = 0
		FIRST_Y = 2
		SECOND_X = 4
		SECOND_Y = 6
		SIDE_1 = 8
		SIDE_2 = 10
		SEGMENT_SECTOR = 12
		SEGMENT_ANGLE = 14

.org START_ADDR
.db "-3D Game- Demo by Adamman", 0

	ld hl, 0
	ld (CURSOR_POS), hl
	ld hl, FIRST_EPISODE
	add hl, EPISODE_TITLE
	ROM_CALL(D_ZT_STR)
	ROM_CALL(NEXT_LINE)
	ld hl, FIRST_EPISODE
	add hl, FIRST_LEVEL
	call LD_HL_MHL
	add hl, LEVEL_TITLE
	ROM_CALL(D_ZT_STR)
	ROM_CALL(KEY_HAND)
	ret

;Episodes: FIRST_LEVEL,NEXT_EPISODE,EPISODE_TITLE
;Levels: FIRST_SECTOR,NEXT_LEVEL,SKY_TEXTURE,LEVEL_TITLE
;Sectors: FIRST_SEGMENT,NEXT_SECTOR,START_X,START_Y,START_ANGLE,START_HEIGHT,THE_SEGMENT,LEFT_ANGLE,RIGHT_ANGLE
;Sides: SIDE_SECTOR,NEXT_SEGMENT,SIDE_TEXTURE,CLEAR_SIDE
;Segments: FIRST_X,FIRST_Y,SECOND_X,SECOND_Y,SIDE_1,SIDE_2,SEGMENT_SECTOR,SEGMENT_ANGLE

;World database:
FIRST_EPISODE = Episode1
	Episode1:	EPISODE(Level1,Episode1,"Happy Land!")
	Level1:		LEVEL(Sector1,Level1,0,"Place of Donuts")
	Sector1:	SECTOR(Segment1,Sector1,150,150,45,32,0,0,0)
	Segment1:	SEGMENT(0,0,0,300,Side1,0,Sector1,0)
	Segment2:	SEGMENT(0,300,300,300,Side2,0,Sector1,0)
	Segment3:	SEGMENT(300,300,300,0,Side3,0,Sector1,0)
	Segment4:	SEGMENT(300,0,0,0,Side4,0,Sector1,0)
	Side1:		SIDE(Sector1,Segment2,0,0)
	Side2:		SIDE(Sector1,Segment3,0,0)
	Side3:		SIDE(Sector1,Segment4,0,0)
	Side4:		SIDE(Sector1,Segment1,0,0)

#include fixpoint.asm
.end