changeset 17:4cb7785c9827

Make graphics data more readable with some labels and macros Created macros for graphics data to make the meaning clearer. Also added descriptive labels to most graphics data.
author William Astle <lost@l-w.ca>
date Thu, 01 Jan 2015 21:01:55 -0700
parents a8f7ce03f08b
children 78f1cbcf49b9
files dod.s
diffstat 1 files changed, 829 insertions(+), 484 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Thu Jan 01 11:36:38 2015 -0700
+++ b/dod.s	Thu Jan 01 21:01:55 2015 -0700
@@ -183,6 +183,70 @@
 		dod S1C
 		endm
 
+; These macros are used by the graphics definitions.
+__gfxendrel	macro noexpand
+		fcb 0
+__gfxinrel	set 0
+		endm
+__gfxstartrel	macro noexpand
+		fcb $fc
+__gfxinrel	set 1
+		endm
+__gfxsrel	macro noexpand
+		ifeq __gfxinrel
+		__gfxstartrel
+		endc
+		endm
+__gfxerel	macro noexpand
+		ifne __gfxinrel
+		__gfxendrel
+		endc
+		endm
+gfxbegin	macro noexpand
+__gfxinrel	set 0
+		endm
+gfxret		macro noexpand
+		__gfxerel
+		fcb $fa
+		endm
+gfxnewpoly	macro noexpand
+		ifne __gfxinrel
+		__gfxerel
+		else
+		fcb $ff
+		endc
+		endm
+gfxend		macro noexpand
+		__gfxerel
+		fcb $fe
+__gfxinrel	set 0
+		endm
+gfxfallthru	macro noexpand
+		__gfxerel
+		endm
+gfxcall		macro noexpand
+		__gfxerel
+		fcb $fb
+		fdb \1
+		endm
+gfxjmp		macro noexpand
+		__gfxerel
+		fcb $fd
+		fdb \1
+__gfxinrel	set 0
+		endm
+gfxcoord	macro noexpand
+		ifne __gfxinrel
+		warning Absolute coordinate after gfxrel starts a new polygon
+		endc
+		__gfxerel
+		fcb \1,\2
+		endm
+gfxrel		macro noexpand
+		__gfxsrel
+		fcb (((\1/2)&15)*16)|((\2/2)&15)
+		endm
+
 BLKTYP		equ $7c
 BLKLEN		equ $7d
 CBUFAD		equ $7e
@@ -2489,7 +2553,7 @@
 		ldb facing			; get the direction we're facing
 		ldu #neighbourbuff		; point to neighbor table
 		leau b,u			; offset neighbor table
-		ldy #LDBDE			; point to direction rendering table (pointers to graphic elements)
+		ldy #imgtab_door		; point to direction rendering table (pointers to graphic elements)
 LCE96		lda ,y+				; get table entry flag/direction
 		bmi LCED8			; brif end of table
 		ldb a,u				; get direction data
@@ -2529,20 +2593,20 @@
 		tfr x,y				; save creature pointer
 		ldb 13,y			; get creature tpe
 		lslb				; double it
-		ldx #LDAA3			; point to creature graphics table
+		ldx #imgtab_creature		; point to creature graphics table
 		ldx b,x				; get graphic data
 		bsr LCEC8			; go render graphic
 LCEEB		ldb #3				; right hand
-		ldx #LDCB0			; point to graphic
+		ldx #img_leftcreat		; point to graphic
 		bsr LCEB2			; go render graphic if there's a door
 		ldb #1				; left hand
-		ldx #LDCB9			; point to graphic
+		ldx #img_rightcreat		; point to graphic
 		bsr LCEB2			; go render graphic if there's a door
-		ldx #LDD3C			; point to graphic
+		ldx #img_upblank		; point to graphic
 		ldd temploc			; get current location
 		jsr LCFE1			; get hole information
 		bmi LCF09			; brif no hole
-		ldx #LDCC2			; point to graphic table for holes
+		ldx #imgtab_hole		; point to graphic table for holes
 		lsla				; two bytes per pointer entry
 		ldx a,x				; get actual graphic for the hole present
 LCF09		bsr LCECE			; go render the graphic
@@ -3559,12 +3623,13 @@
 		com levbgmask			; invert mask
 		rts				; return to caller
 ; This is top and bottom lines during a turn sweep
-LD6C6		fcb 16,0
-		fcb 16,255
-		fcb $ff
-		fcb 136,0
-		fcb 136,255
-		fcb $fe
+LD6C6		gfxbegin
+		gfxcoord 16,0
+		gfxcoord 16,255
+		gfxnewpoly
+		gfxcoord 136,0
+		gfxcoord 136,255
+		gfxend
 cmd_move	ldx #kwlist_dir			; point to direction list
 		jsr LCBEC			; look up direction
 		blt LD693			; brif bad direction
@@ -4011,16 +4076,16 @@
 		fcb $03				; 1 leather shield each, level 1-3
 		fcb $04				; 1 wooden sword each, level 1-4
 ; pointers to creature images
-LDAA3		fdb LDE26			; spider
-		fdb LDFCA			; viper
-		fdb LDD41			; club giant
-		fdb LDE59			; blob
-		fdb LDE82			; knight
-		fdb LDD51			; axe giant
-		fdb LDE3F			; scorpion
-		fdb LDE9D			; shield knight
-		fdb LDE07			; wraith
-		fdb LDDA3			; galdrog
+imgtab_creature	fdb img_spider			; spider
+		fdb img_viper			; viper
+		fdb img_clubgiant		; club giant
+		fdb img_blob			; blob
+		fdb img_swrdknight		; knight
+		fdb img_axegiant		; axe giant
+		fdb img_scorpion		; scorpion
+		fdb img_shldknight		; shield knight
+		fdb img_wraith			; wraith
+		fdb img_galdrog			; galdrog
 		fdb img_wizardgen		; wizard's image
 		fdb img_wizard			; wizard
 ; This is the creature data table. Each entry is 8 bytes organized as follows:
@@ -4088,481 +4153,761 @@
 ; This table is for rendering walls in specific directions. There is one entry each
 ; for left, right, and forward. Each entry has four pointers to graphics, for no door,
 ; physical door, magical door, and solid wall.
-LDBDE		fcb 3
-		fdb LDC4F
-		fdb LDC6B
-		fdb LDC9B
-		fdb LDC33
+imgtab_door	fcb 3
+		fdb img_leftopen
+		fdb img_leftdoor
+		fdb img_leftmagic
+		fdb img_leftwall
 		fcb 0
-		fdb LDC6A
-		fdb LDC8B
-		fdb LDCA9
-		fdb LDC45
+		fdb img_fwdopen
+		fdb img_fwddoor
+		fdb img_fwdmagic
+		fdb img_fwdwall
 		fcb 1
-		fdb LDC5D
-		fdb LDC7B
-		fdb LDCA2
-		fdb LDC3C
+		fdb img_rightopen
+		fdb img_rightdoor
+		fdb img_rightmagic
+		fdb img_rightwall
 		fcb $ff
 
 ; image data for a shield
-img_shield	fcb 134,172
-		fcb 128,192
-		fcb 122,186
-		fcb 128,168
-		fcb $fc
-		fcb $3e,$04,$00
-		fcb $fe
+img_shield	gfxbegin
+		gfxcoord 134,172
+		gfxcoord 128,192
+		gfxcoord 122,186
+		gfxcoord 128,168
+		gfxrel 6,-4
+		gfxrel 0,8
+		gfxend
 ; image data for a torch
-img_torch	fcb 118,60
-		fcb $fc
-		fcb $f7,$ff,$2a,$00
-		fcb $fe
+img_torch	gfxbegin
+		gfxcoord 118,60
+		gfxrel -2,14
+		gfxrel -2,-2
+		gfxrel 4,-12
+		gfxend
 ; image data for a sword
-img_sword	fcb 114,80
-		fcb 124,100
-		fcb $ff
-		fcb 118,82
-		fcb 114,86
-		fcb $fe
-
+img_sword	gfxbegin
+		gfxcoord 114,80
+		gfxcoord 124,100
+		gfxnewpoly
+		gfxcoord 118,82
+		gfxcoord 114,86
+		gfxend
 ; image data for a flask
-img_flask	fcb 110,162
-		fcb $fc
-		fcb $51,$0e,$b1,$00
-		fcb $fe
+img_flask	gfxbegin
+		gfxcoord 110,162
+		gfxrel 10,2
+		gfxrel 0,-4
+		gfxrel -10,2
+		gfxend
 ; image data for a ring
-img_ring	fcb 122,60
-		fcb $fc
-		fcb $11,$1f,$ff,$f1,$00
-		fcb $fe
+img_ring	gfxbegin
+		gfxcoord 122,60
+		gfxrel 2,2
+		gfxrel 2,-2
+		gfxrel -2,-2
+		gfxrel -2,2
+		gfxend
 ; image data for a scroll
-img_scroll	fcb 118,194
-		fcb $fc
-		fcb $1f,$34,$f1,$dc,$00
-		fcb $fe
-
-; Creature around corner to the left indicator graphic
-LDC33		fcb 16,27		
-		fcb 38,64
-		fcb 114,64
-		fcb 136,27
-		fcb $fe
-; Creature around corner to the right indicator graphic
-LDC3C		fcb 16,229
-		fcb 38,192
-		fcb 114,192
-		fcb 136,229
-		fcb $fe
-LDC45		fcb 38,64
-		fcb 38,192
-		fcb $ff
-		fcb 114,64
-		fcb 114,192
-		fcb $fe
-LDC4F		fcb 38,29
-		fcb 38,64
-		fcb 114,64
-		fcb 114,27
-		fcb $ff
-		fcb 16,27
-		fcb 38,64
-		fcb $fe
-LDC5D		fcb 38,229
-		fcb 38,192
-		fcb 114,192
-		fcb 114,229
-		fcb $ff
-		fcb 16,229
-		fcb 38,192
-LDC6A		fcb $fe
-LDC6B		fcb 128,40
-		fcb 65,40
-		fcb 68,56
-		fcb 119,56
-		fcb $ff
-		fcb 92,48
-		fcb 93,52
-		fcb $fd
-		fdb LDC33
-LDC7B		fcb 128,216
-		fcb 65,216
-		fcb 68,200
-		fcb 119,200
-		fcb $ff
-		fcb 92,208
-		fcb 93,204
-		fcb $fd
-		fdb LDC3C
-LDC8B		fcb 114,108
-		fcb 67,108
-		fcb 67,148
-		fcb 114,148
-		fcb $ff
-		fcb 94,126
-		fcb 94,130
-		fcb $fd
-		fdb LDC45
-LDC9B		fcb 128,40
-		fcb 66,50
-		fcb 117,58
-		fcb $fe
-LDCA2		fcb 128,216
-		fcb 66,206
-		fcb 117,198
-		fcb $fe
-LDCA9		fcb 113,108
-		fcb 67,128
-		fcb 114,148
-		fcb $fe
-LDCB0		fcb 100,28
-		fcb $fc
-		fcb $44,$2e,$42,$4c,$00
-		fcb $fe
-LDCB9		fcb 100,228
-		fcb $fc
-		fcb $4c,$22,$4e,$44,$00
-		fcb $fe
+img_scroll	gfxbegin
+		gfxcoord 118,194
+		gfxrel 2,-2
+		gfxrel 6,8
+		gfxrel -2,2
+		gfxrel -6,-8
+		gfxend
+img_leftwall	gfxbegin
+		gfxcoord 16,27
+		gfxcoord 38,64
+		gfxcoord 114,64
+		gfxcoord 136,27
+		gfxend
+img_rightwall	gfxbegin
+		gfxcoord 16,229
+		gfxcoord 38,192
+		gfxcoord 114,192
+		gfxcoord 136,229
+		gfxend
+img_fwdwall	gfxbegin
+		gfxcoord 38,64
+		gfxcoord 38,192
+		gfxnewpoly
+		gfxcoord 114,64
+		gfxcoord 114,192
+		gfxend
+img_leftopen	gfxbegin
+		gfxcoord 38,29
+		gfxcoord 38,64
+		gfxcoord 114,64
+		gfxcoord 114,27
+		gfxnewpoly
+		gfxcoord 16,27
+		gfxcoord 38,64
+		gfxend
+img_rightopen	gfxbegin
+		gfxcoord 38,229
+		gfxcoord 38,192
+		gfxcoord 114,229
+		gfxnewpoly
+		gfxcoord 16,229
+		gfxcoord 38,192
+		gfxfallthru
+img_fwdopen	gfxend
+img_leftdoor	gfxbegin
+		gfxcoord 128,40
+		gfxcoord 65,40
+		gfxcoord 68,56
+		gfxcoord 119,56
+		gfxnewpoly
+		gfxcoord 92,48
+		gfxcoord 93,52
+		gfxjmp img_leftwall
+img_rightdoor	gfxbegin
+		gfxcoord 128,216
+		gfxcoord 65,216
+		gfxcoord 119,200
+		gfxnewpoly
+		gfxcoord 92,208
+		gfxcoord 93,204
+		gfxjmp img_rightwall
+img_fwddoor	gfxbegin
+		gfxcoord 114,108
+		gfxcoord 67,108
+		gfxcoord 67,148
+		gfxcoord 114,148
+		gfxnewpoly
+		gfxcoord 94,126
+		gfxcoord 94,130
+		gfxjmp img_fwdwall
+img_leftmagic	gfxbegin
+		gfxcoord 128,40
+		gfxcoord 66,50
+		gfxcoord 117,58
+		gfxend
+img_rightmagic	gfxbegin
+		gfxcoord 128,216
+		gfxcoord 66,206
+		gfxcoord 117,198
+		gfxend
+img_fwdmagic	gfxbegin
+		gfxcoord 113,108
+		gfxcoord 67,128
+		gfxcoord 114,148
+		gfxend
+img_leftcreat	gfxbegin
+		gfxcoord 100,28
+		gfxrel 8,8
+		gfxrel 4,-4
+		gfxrel 8,4
+		gfxrel 8,-8
+		gfxend
+img_rightcreat	gfxbegin
+		gfxcoord 100,228
+		gfxrel 8,-8
+		gfxrel 4,4
+		gfxrel 8,-4
+		gfxrel 8,8
+		gfxend
 ; Table of pointers to hole/ladder graphics
-LDCC2		fdb LDD0E
-		fdb LDCCA
-		fdb LDD2A
-		fdb LDCD0
-LDCCA		fcb $fb
-		fdb LDCD6
-		fcb $fd
-		fdb LDD0E
-LDCD0		fcb $fb
-		fdb LDCD6
-		fcb $fd
-		fdb LDD2A
-LDCD6		fcb 24,116
-		fcb 128,116
-		fcb $ff
-		fcb 24,140
-		fcb 128,140
-		fcb $ff
-		fcb 28,116
-		fcb 28,140
-		fcb $ff
-		fcb 40,116
-		fcb 40,140
-		fcb $ff
-		fcb 52,116
-		fcb 52,140
-		fcb $ff
-		fcb 64,116
-		fcb 64,140
-		fcb $ff
-		fcb 76,116
-		fcb 76,140
-		fcb $ff
-		fcb 88,116
-		fcb 88,140
-		fcb $ff
-		fcb 100,116
-		fcb 100,140
-		fcb $ff
-		fcb 112,116
-		fcb 112,140
-		fcb $ff
-		fcb 123,116
-		fcb 123,140
-		fcb $ff
-		fcb $fa
-LDD0E		fcb 34,100
-		fcb 24,92
-		fcb 24,164
-		fcb 34,156
-		fcb 34,100
-		fcb 24,100
-		fcb $ff
-		fcb 34,156
-		fcb 24,156
-		fcb $ff
-		fcb 28,47
-		fcb 28,96
-		fcb $ff
-		fcb 28,161
-		fcb 28,210
-		fcb $fe
-LDD2A		fcb 118,100
-		fcb 128,92
-		fcb 128,164
-		fcb 118,156
-		fcb 118,100
-		fcb 128,100
-		fcb $ff
-		fcb 118,156
-		fcb 128,156
-		fcb $ff
-LDD3C		fcb 28,47
-		fcb 28,210
-		fcb $fe
-LDD41		fcb 104,98
-		fcb $fc
-		fcb $d7,$d4,$14,$12,$30,$1d,$0d,$fd
-		fcb $29,$00
-		fcb $fd
-		fdb LDD62
-LDD51		fcb 104,98
-		fcb 94,124
-		fcb 96,126
-		fcb 106,100
-		fcb $ff
-		fcb 102,132
-		fcb 92,114
-		fcb 102,118
-		fcb 110,114
-LDD62		fcb 102,132
-		fcb $fc
-		fcb $02,$56,$56,$17,$ee,$02,$ea,$bb
-		fcb $bb,$ea,$ea,$00
-		fcb 78,92
-		fcb $fc
-		fcb $c2,$51,$3e,$cf,$fc,$42,$13,$00
-		fcb 106,90
-		fcb $fc
-		fcb $1e,$11,$f3,$62,$39,$e2,$0c,$e4
-		fcb $8a,$e2,$00
-		fcb 86,84
-		fcb $fc
-		fcb $54,$65,$2e,$ca,$ba,$a1,$d4,$ee
-		fcb $12,$d2,$13,$e1,$20,$f6,$24,$72
-		fcb $58,$ee,$c5,$be,$00
-		fcb $fe
-LDDA3		fcb 80,124
-		fcb 94,114
-		fcb 110,120
-		fcb 132,112
-		fcb 104,78
-		fcb 132,48
-		fcb 68,72
-		fcb 84,32
-		fcb 22,88
-		fcb 52,114
-		fcb 92,128
-		fcb 52,142
-		fcb 22,168
-		fcb 88,224
-		fcb 68,184
-		fcb 132,208
-		fcb 112,178
-		fcb 132,144
-		fcb 110,136
-		fcb 94,142
-		fcb 80,132
-		fcb $ff
-		fcb 132,112
-		fcb $fc
-		fcb $c5,$92,$be,$c3,$43,$5e,$72,$45
-		fcb $00
-		fcb 82,122
-		fcb $fc
-		fcb $78,$e9,$8d,$ec,$33,$0c,$24,$72
-		fcb $47,$e7,$00
-		fcb 22,168
-		fcb $fc
-		fcb $2d,$c2,$3d,$30,$4b,$4b,$ed,$b2
-		fcb $9d,$71,$3d,$dd,$91,$7d,$52,$63
-		fcb $a3,$2d,$ed,$2d,$cb,$cb,$d0,$dd
-		fcb $42,$ed,$00
-		fcb $fe
-LDE07		fcb 62,68
-		fcb 68,88
-		fcb 56,100
-		fcb $ff
-		fcb 74,90
-		fcb 70,74
-		fcb $fc
-		fcb $33,$f5,$f5,$c1,$5a,$62,$0e,$00
-		fcb 100,80
-		fcb $fc
-		fcb $b3,$17,$34,$eb,$0a,$3d,$00
-		fcb $fe
-LDE26		fcb 124,160
-		fcb $fc
-		fcb $c2,$22,$e4,$24,$2c,$ec,$04,$04
-		fcb $e2,$42,$00
-		fcb 124,168
-		fcb $fc
-		fcb $c1,$21,$12,$f2,$e1,$41,$00
-		fcb $fe
-LDE3F		fcb 112,74
-		fcb $fc
-		fcb $e0,$ee,$2c,$42,$14,$14,$20,$0c
-		fcb $cc,$22,$0c,$22,$00
-		fcb 124,90
-		fcb $fc
-		fcb $e0,$0c,$2c,$20,$04,$00
-		fcb $fe
-LDE59		fcb 82,130
-		fcb $fc
-		fcb $28,$7d,$5f,$50,$5b,$f5,$2f,$d5
-		fcb $17,$17,$f3,$22,$e1,$14,$dd,$8f
-		fcb $8d,$db,$ec,$00
-		fcb 86,130
-		fcb $fc
-		fcb $33,$31,$1b,$91,$3b,$5f,$f5,$00
-		fcb 108,116
-		fcb 114,118
-		fcb 120,144
-		fcb $fe
-LDE82		fcb 34,124
-		fcb $fc
-		fcb $04,$1f,$0e,$ff,$00
-		fcb 80,142
-		fcb 64,136
-		fcb 46,146
-		fcb 64,156
-		fcb 82,140
-		fcb 76,136
-		fcb 64,146
-		fcb 58,140
-		fcb $fd
-		fdb LDEB3
-LDE9D		fcb 30,126
-		fcb $fc
-		fcb $50,$0f,$e0,$00
-		fcb 44,150
-		fcb 52,166
-		fcb 76,164
-		fcb 92,150
-		fcb 76,136
-		fcb 52,134
-		fcb 44,150
-		fcb $ff
-LDEB3		fcb 80,140
-		fcb 128,152
-		fcb 132,160
-		fcb 132,144
-		fcb 126,144
-		fcb 84,130
-		fcb $ff
-		fcb 84,126
-		fcb 126,110
-		fcb 132,110
-		fcb 132,92
-		fcb 128,102
-		fcb 80,116
-		fcb $ff
-		fcb 80,140
-		fcb $fc
-		fcb $3a,$d9,$83,$de,$ad,$e6,$a1,$e2
-		fcb $22,$61,$26,$ea,$20,$3d,$dd,$e0
-		fcb $00
-		fcb 52,128
-		fcb 20,128
-		fcb $fc
-		fcb $0e,$21,$02,$e1,$0e,$00
-		fcb 74,102
-		fcb $fc
-		fcb $e0,$02,$d0,$08,$30,$02,$20,$01
-		fcb $30,$02,$d0,$01,$87,$00
-		fcb 46,110
-		fcb 64,102
-		fcb 64,100
-		fcb 30,102
-		fcb 20,98
-		fcb 30,94
-		fcb 64,96
-		fcb 64,98
-		fcb 20,98
-		fcb $FE
+imgtab_hole	fdb img_uphole
+		fdb img_upladder
+		fdb img_downhole
+		fdb img_downladder
+img_upladder	gfxbegin
+		gfxcall imgsub_ladder
+		gfxjmp img_uphole
+img_downladder	gfxbegin
+		gfxcall imgsub_ladder
+		gfxjmp img_downhole
+imgsub_ladder	gfxbegin
+		gfxcoord 24,116
+		gfxcoord 128,116
+		gfxnewpoly
+		gfxcoord 24,140
+		gfxcoord 128,140
+		gfxnewpoly
+		gfxcoord 40,116
+		gfxcoord 40,140
+		gfxnewpoly
+		gfxcoord 52,116
+		gfxcoord 52,140
+		gfxnewpoly
+		gfxcoord 64,116
+		gfxcoord 64,140
+		gfxnewpoly
+		gfxcoord 76,116
+		gfxcoord 76,140
+		gfxnewpoly
+		gfxcoord 88,116
+		gfxcoord 88,140
+		gfxnewpoly
+		gfxcoord 100,116
+		gfxcoord 100,140
+		gfxnewpoly
+		gfxcoord 112,116
+		gfxcoord 112,140
+		gfxnewpoly
+		gfxcoord 123,116
+		gfxcoord 123,140
+		gfxnewpoly
+		gfxret
+img_uphole	gfxbegin
+		gfxcoord 34,100
+		gfxcoord 24,92
+		gfxcoord 24,164
+		gfxcoord 34,156
+		gfxcoord 34,100
+		gfxcoord 24,100
+		gfxnewpoly
+		gfxcoord 34,156
+		gfxcoord 24,156
+		gfxnewpoly
+		gfxcoord 28,47
+		gfxcoord 28,96
+		gfxnewpoly
+		gfxcoord 28,161
+		gfxcoord 28,210
+		gfxend
+img_downhole	gfxbegin
+		gfxcoord 118,100
+		gfxcoord 128,92
+		gfxcoord 128,164
+		gfxcoord 118,156
+		gfxcoord 118,100
+		gfxcoord 128,100
+		gfxnewpoly
+		gfxcoord 118,156
+		gfxcoord 128,156
+		gfxnewpoly
+		gfxfallthru
+img_upblank	gfxbegin
+		gfxcoord 28,47
+		gfxcoord 28,210
+		gfxend
+img_clubgiant	gfxbegin
+		gfxcoord 104,98
+		gfxrel -6,14
+		gfxrel -6,8
+		gfxrel 2,8
+		gfxrel 2,4
+		gfxrel 6,0
+		gfxrel 2,-6
+		gfxrel 0,-6
+		gfxrel -2,-6
+		gfxrel 4,-14
+		gfxjmp img_giant
+img_axegiant	gfxbegin
+		gfxcoord 104,98
+		gfxcoord 94,124
+		gfxcoord 96,126
+		gfxcoord 106,100
+		gfxnewpoly
+		gfxcoord 102,132
+		gfxcoord 92,114
+		gfxcoord 102,118
+		gfxcoord 110,114
+		gfxfallthru
+img_giant	gfxbegin
+		gfxcoord 102,132
+		gfxrel 0,4
+		gfxrel 10,12
+		gfxrel 10,12
+		gfxrel 2,14
+		gfxrel -4,-4
+		gfxrel 0,4
+		gfxrel -4,-12
+		gfxrel -10,-10
+		gfxrel -10,-10
+		gfxrel -4,-12
+		gfxrel -4,-12
+		gfxnewpoly
+		gfxcoord 78,92
+		gfxrel -8,4
+		gfxrel 10,2
+		gfxrel 6,-4
+		gfxrel -8,-2
+		gfxrel -2,-8
+		gfxrel 8,4
+		gfxrel 2,6
+		gfxnewpoly
+		gfxcoord 106,90
+		gfxrel 2,-4
+		gfxrel 2,2
+		gfxrel -2,6
+		gfxrel 12,4
+		gfxrel 6,-14
+		gfxrel -4,4
+		gfxrel 0,-8
+		gfxrel -4,8
+		gfxrel -16,-12
+		gfxrel -4,4
+		gfxnewpoly
+		gfxcoord 86,84
+		gfxrel 10,8
+		gfxrel 12,10
+		gfxrel 4,-4
+		gfxrel -8,-12
+		gfxrel -10,-12
+		gfxrel -12,2
+		gfxrel -6,8
+		gfxrel -4,-4
+		gfxrel 2,4
+		gfxrel -6,4
+		gfxrel 2,6
+		gfxrel -4,2
+		gfxrel 4,0
+		gfxrel -2,12
+		gfxrel 4,8
+		gfxrel 14,4
+		gfxrel 10,-16
+		gfxrel -4,-4
+		gfxrel -8,10
+		gfxrel -10,-4
+		gfxend
+img_galdrog	gfxbegin
+		gfxcoord 80,124
+		gfxcoord 94,114
+		gfxcoord 110,120
+		gfxcoord 132,112
+		gfxcoord 104,78
+		gfxcoord 132,48
+		gfxcoord 68,72
+		gfxcoord 84,32
+		gfxcoord 22,88
+		gfxcoord 52,114
+		gfxcoord 92,128
+		gfxcoord 52,142
+		gfxcoord 22,168
+		gfxcoord 88,224
+		gfxcoord 68,184
+		gfxcoord 132,208
+		gfxcoord 112,178
+		gfxcoord 132,144
+		gfxcoord 110,136
+		gfxcoord 94,142
+		gfxcoord 80,132
+		gfxnewpoly
+		gfxcoord 132,112
+		gfxrel -8,10
+		gfxrel -14,4
+		gfxrel -10,-4
+		gfxrel -8,6
+		gfxrel 8,6
+		gfxrel 10,-4
+		gfxrel 14,4
+		gfxrel 8,10
+		gfxnewpoly
+		gfxcoord 82,122
+		gfxrel 14,-16
+		gfxrel -4,-14
+		gfxrel -16,-6
+		gfxrel -4,-8
+		gfxrel 6,6
+		gfxrel 0,-8
+		gfxrel 4,8
+		gfxrel 14,4
+		gfxrel 8,14
+		gfxrel -4,14
+		gfxnewpoly
+		gfxcoord 22,168
+		gfxrel 4,-6
+		gfxrel -8,4
+		gfxrel 6,-6
+		gfxrel 6,0
+		gfxrel 8,-10
+		gfxrel 8,-10
+		gfxrel -4,-6
+		gfxrel -10,4
+		gfxrel -14,-6
+		gfxrel 14,2
+		gfxrel 6,-6
+		gfxrel -6,-6
+		gfxrel -14,2
+		gfxrel 14,-6
+		gfxrel 10,4
+		gfxrel 12,6
+		gfxrel -12,6
+		gfxrel 4,-6
+		gfxrel -4,-6
+		gfxrel 4,-6
+		gfxrel -8,-10
+		gfxrel -8,-10
+		gfxrel -6,0
+		gfxrel -6,-6
+		gfxrel 8,4
+		gfxrel -4,-6
+		gfxend
+img_wraith	gfxbegin
+		gfxcoord 62,68
+		gfxcoord 68,88
+		gfxcoord 56,100
+		gfxnewpoly
+		gfxcoord 74,90
+		gfxcoord 70,74
+		gfxrel 6,6
+		gfxrel -2,10
+		gfxrel -2,10
+		gfxrel -8,2
+		gfxrel 10,-12
+		gfxrel 12,4
+		gfxrel 0,-4
+		gfxnewpoly
+		gfxcoord 100,80
+		gfxrel -10,6
+		gfxrel 2,14
+		gfxrel 6,8
+		gfxrel -4,-10
+		gfxrel 0,-12
+		gfxrel 6,-6
+		gfxend
+img_spider	gfxbegin
+		gfxcoord 124,160
+		gfxrel -8,4
+		gfxrel 4,4
+		gfxrel -4,8
+		gfxrel 4,8
+		gfxrel 4,-8
+		gfxrel -4,-8
+		gfxrel 0,8
+		gfxrel 0,8
+		gfxrel -4,4
+		gfxrel 8,4
+		gfxnewpoly
+		gfxcoord 124,168
+		gfxrel -8,2
+		gfxrel 4,2
+		gfxrel 2,4
+		gfxrel -2,4
+		gfxrel -4,2
+		gfxrel 8,2
+		gfxend
+img_scorpion	gfxbegin
+		gfxcoord 112,74
+		gfxrel -4,0
+		gfxrel -4,-4
+		gfxrel 4,-8
+		gfxrel 8,4
+		gfxrel 2,8
+		gfxrel 2,8
+		gfxrel 4,0
+		gfxrel 0,-8
+		gfxrel -8,-8
+		gfxrel 4,4
+		gfxrel 0,-8
+		gfxrel 4,4
+		gfxnewpoly
+		gfxcoord 124,90
+		gfxrel -4,0
+		gfxrel 0,-8
+		gfxrel 4,-8
+		gfxrel 4,0
+		gfxrel 0,8
+		gfxend
+img_blob	gfxbegin
+		gfxcoord 82,130
+		gfxrel 4,-16
+		gfxrel 14,-6
+		gfxrel 10,-2
+		gfxrel 10,0
+		gfxrel 10,-10
+		gfxrel -2,10
+		gfxrel 4,-2
+		gfxrel -6,10
+		gfxrel 2,14
+		gfxrel 2,14
+		gfxrel -2,6
+		gfxrel 4,4
+		gfxrel -4,2
+		gfxrel 2,8
+		gfxrel -6,-6
+		gfxrel -16,-2
+		gfxrel -16,-6
+		gfxrel -6,-10
+		gfxrel -4,-8
+		gfxnewpoly
+		gfxcoord 86,130
+		gfxrel 6,6
+		gfxrel 6,2
+		gfxrel 2,-10
+		gfxrel -14,2
+		gfxrel 6,-10
+		gfxrel 10,-2
+		gfxrel -2,10
+		gfxnewpoly
+		gfxcoord 108,116
+		gfxcoord 114,118
+		gfxcoord 120,144
+		gfxend
+img_swrdknight	gfxbegin
+		gfxcoord 34,124
+		gfxrel 0,8
+		gfxrel 2,-2
+		gfxrel 0,-4
+		gfxrel -2,-2
+		gfxnewpoly
+		gfxcoord 80,142
+		gfxcoord 64,136
+		gfxcoord 46,146
+		gfxcoord 64,156
+		gfxcoord 82,140
+		gfxcoord 76,136
+		gfxcoord 64,146
+		gfxcoord 58,140
+		gfxjmp img_knight
+img_shldknight	gfxbegin
+		gfxcoord 30,126
+		gfxrel 10,0
+		gfxrel 0,-2
+		gfxrel -4,0
+		gfxnewpoly
+		gfxcoord 44,150
+		gfxcoord 52,166
+		gfxcoord 76,164
+		gfxcoord 92,150
+		gfxcoord 76,136
+		gfxcoord 52,134
+		gfxcoord 44,150
+		gfxnewpoly
+		gfxfallthru
+img_knight	gfxbegin
+		gfxcoord 80,140
+		gfxcoord 128,152
+		gfxcoord 132,160
+		gfxcoord 132,144
+		gfxcoord 126,144
+		gfxcoord 84,130
+		gfxnewpoly
+		gfxcoord 84,126
+		gfxcoord 126,110
+		gfxcoord 132,110
+		gfxcoord 132,92
+		gfxcoord 128,102
+		gfxcoord 80,116
+		gfxnewpoly
+		gfxcoord 80,140
+		gfxrel 6,-12
+		gfxrel -6,-14
+		gfxrel -16,6
+		gfxrel -6,-4
+		gfxrel -12,-6
+		gfxrel -4,12
+		gfxrel -12,2
+		gfxrel -4,4
+		gfxrel 4,4
+		gfxrel 12,2
+		gfxrel 4,12
+		gfxrel -4,-12
+		gfxrel 4,0
+		gfxrel 6,-6
+		gfxrel -6,-6
+		gfxrel -4,0
+		gfxnewpoly
+		gfxcoord 52,128
+		gfxcoord 20,128
+		gfxrel 0,-4
+		gfxrel 4,2
+		gfxrel 0,4
+		gfxrel -4,2
+		gfxrel 0,-4
+		gfxnewpoly
+		gfxcoord 74,102
+		gfxrel -4,0
+		gfxrel 0,4
+		gfxrel -6,0
+		gfxrel 0,-16
+		gfxrel 6,0
+		gfxrel 0,4
+		gfxrel 4,0
+		gfxrel 0,2
+		gfxrel 6,0
+		gfxrel 0,4
+		gfxrel -6,0
+		gfxrel 0,2
+		gfxrel -16,14
+		gfxnewpoly
+		gfxcoord 46,110
+		gfxcoord 64,102
+		gfxcoord 64,100
+		gfxcoord 30,102
+		gfxcoord 20,98
+		gfxcoord 30,94
+		gfxcoord 64,96
+		gfxcoord 64,98
+		gfxcoord 20,98
+		gfxend
 ; Image for the Wizard
-img_wizard	fcb 46,98
-		fcb $fc
-		fcb $21,$2f,$2d,$fd,$ce,$c2,$f2,$12
-		fcb $0f,$1e,$3f,$21,$12,$e3,$e0,$00
-		fcb 104,154
-		fcb $fc
-		fcb $21,$2f,$2d,$fd,$ce,$c2,$f2,$12
-		fcb $0f,$1e,$3f,$22,$12,$e2,$e0,$00
-		fcb $fd
-		fdb img_wizardgen
+img_wizard	gfxbegin
+		gfxcoord 46,98
+		gfxrel 4,2
+		gfxrel 4,-2
+		gfxrel 4,-6
+		gfxrel -2,-6
+		gfxrel -8,-4
+		gfxrel -8,4
+		gfxrel -2,4
+		gfxrel 2,4
+		gfxrel 0,-2
+		gfxrel 2,-4
+		gfxrel 6,-2
+		gfxrel 4,2
+		gfxrel 2,4
+		gfxrel -4,6
+		gfxrel -4,0
+		gfxnewpoly
+		gfxcoord 104,154
+		gfxrel 4,2
+		gfxrel 4,-2
+		gfxrel 4,-6
+		gfxrel -2,-6
+		gfxrel -8,-4
+		gfxrel -8,4
+		gfxrel -2,4
+		gfxrel 2,4
+		gfxrel 0,-2
+		gfxrel 2,-4
+		gfxrel 6,-2
+		gfxrel 4,4
+		gfxrel 2,4
+		gfxrel -4,4
+		gfxrel -4,0
+		gfxjmp img_wizardgen
 ; Image for the "good" wizard
-img_goodwiz	fcb 40,86
-		fcb 64,92
-		fcb 42,100
-		fcb 54,82
-		fcb 56,104
-		fcb 40,86
-		fcb $ff
-		fcb 66,140
-		fcb $fc
-		fcb $70,$ad,$35,$1b,$b3,$00
-		fcb 96,146
-		fcb 120,148
-		fcb 100,136
-		fcb 106,154
-		fcb 116,138
-		fcb 96,146
-		fcb $ff
-		fcb 80,116
-		fcb $fc
-		fcb $53,$ec,$e4,$4d,$b0,$00
-img_wizardgen	fcb 64,124
-		fcb $fc
-		fcb $4e,$c0,$7b,$9c,$d4,$e4,$e1,$e1
-		fcb $dd,$1c,$96,$03,$00
-		fcb 28,130
-		fcb $fc
-		fcb $03,$45,$71,$da,$1e,$11,$e1,$00
-		fcb 48,134
-		fcb 54,142
-		fcb 116,164
-		fcb 132,132
-		fcb 130,118
-		fcb 120,94
-		fcb 90,110
-		fcb 132,132
-		fcb 72,106
-		fcb $ff
-		fcb 64,102
-		fcb $fc
-		fcb $1f,$bd,$f1,$53,$00
-		fcb 66,102
-		fcb $fc
-		fcb $1e,$32,$11,$73,$00
-		fcb 88,112
-		fcb 72,120
-		fcb $ff
-		fcb 62,132
-		fcb 20,128
-		fcb 52,122
-		fcb 64,122
-		fcb 60,124
-		fcb 114,128
-		fcb 80,130
-		fcb 68,130
-		fcb 62,132
-		fcb $ff
-		fcb 40,130
-		fcb $fc
-		fcb $ff,$1e,$11,$f2,$3f,$20,$0f,$c0
-		fcb $ff,$31,$00
-		fcb $fe
-LDFCA		fcb 132,130
-		fcb 112,122
-		fcb 92,124
-		fcb 94,126
-		fcb 94,130
-		fcb 92,132
-		fcb 112,130
-		fcb 128,140
-		fcb 132,136
-		fcb 132,114
-		fcb 120,108
-		fcb 106,118
-		fcb 120,112
-		fcb 124,116
-		fcb 124,126
-		fcb $ff
-		fcb 100,120
-		fcb $fc
-		fcb $e0,$e2,$ee,$e0,$f1,$22,$ee,$06
-		fcb $2e,$e2,$11,$20,$2e,$22,$20,$00
-		fcb $fe
+img_goodwiz	gfxbegin
+		gfxcoord 40,86
+		gfxcoord 64,92
+		gfxcoord 42,100
+		gfxcoord 54,82
+		gfxcoord 56,104
+		gfxcoord 40,86
+		gfxnewpoly
+		gfxcoord 66,140
+		gfxrel 14,0
+		gfxrel -12,-6
+		gfxrel 6,10
+		gfxrel 2,-10
+		gfxrel -10,6
+		gfxnewpoly
+		gfxcoord 96,146
+		gfxcoord 120,148
+		gfxcoord 100,136
+		gfxcoord 106,154
+		gfxcoord 116,138
+		gfxcoord 96,146
+		gfxnewpoly
+		gfxcoord 80,116
+		gfxrel 10,6
+		gfxrel -4,-8
+		gfxrel -4,8
+		gfxrel 8,-6
+		gfxrel -10,0
+		gfxnewpoly
+		gfxfallthru
+img_wizardgen	gfxbegin
+		gfxcoord 64,124
+		gfxrel 8,-4
+		gfxrel -8,0
+		gfxrel 14,-10
+		gfxrel -14,-8
+		gfxrel -6,8
+		gfxrel -4,8
+		gfxrel -4,2
+		gfxrel -4,2
+		gfxrel -6,-6
+		gfxrel 2,-8
+		gfxrel -14,12
+		gfxrel 0,6
+		gfxnewpoly
+		gfxcoord 28,130
+		gfxrel 0,6
+		gfxrel 8,10
+		gfxrel 14,2
+		gfxrel -6,-12
+		gfxrel 2,-4
+		gfxrel 2,2
+		gfxrel -4,2
+		gfxnewpoly
+		gfxcoord 48,134
+		gfxcoord 54,142
+		gfxcoord 116,164
+		gfxcoord 132,132
+		gfxcoord 130,118
+		gfxcoord 120,94
+		gfxcoord 90,110
+		gfxcoord 132,132
+		gfxcoord 72,106
+		gfxnewpoly
+		gfxcoord 64,102
+		gfxrel 2,-2
+		gfxrel -10,-6
+		gfxrel -2,2
+		gfxrel 10,6
+		gfxnewpoly
+		gfxcoord 66,102
+		gfxrel 2,-4
+		gfxrel 6,4
+		gfxrel 2,2
+		gfxrel 14,6
+		gfxnewpoly
+		gfxcoord 88,112
+		gfxcoord 72,120
+		gfxnewpoly
+		gfxcoord 62,132
+		gfxcoord 20,128
+		gfxcoord 52,122
+		gfxcoord 64,122
+		gfxcoord 60,124
+		gfxcoord 114,128
+		gfxcoord 80,130
+		gfxcoord 68,130
+		gfxcoord 62,132
+		gfxnewpoly
+		gfxcoord 40,130
+		gfxrel -2,-2
+		gfxrel 2,-4
+		gfxrel 2,2
+		gfxrel -2,4
+		gfxrel 6,-2
+		gfxrel 4,0
+		gfxrel 0,-2
+		gfxrel -8,0
+		gfxrel -2,-2
+		gfxrel 6,2
+		gfxend
+img_viper	gfxbegin
+		gfxcoord 132,130
+		gfxcoord 112,122
+		gfxcoord 92,124
+		gfxcoord 94,126
+		gfxcoord 94,130
+		gfxcoord 92,132
+		gfxcoord 112,130
+		gfxcoord 128,140
+		gfxcoord 132,136
+		gfxcoord 132,114
+		gfxcoord 120,108
+		gfxcoord 106,118
+		gfxcoord 120,112
+		gfxcoord 124,116
+		gfxcoord 124,126
+		gfxnewpoly
+		gfxcoord 100,120
+		gfxrel -4,0
+		gfxrel -4,4
+		gfxrel -4,-4
+		gfxrel -4,0
+		gfxrel -2,2
+		gfxrel 4,4
+		gfxrel -4,-4
+		gfxrel 0,12
+		gfxrel 4,-4
+		gfxrel -4,4
+		gfxrel 2,2
+		gfxrel 4,0
+		gfxrel 4,-4
+		gfxrel 4,4
+		gfxrel 4,0
+		gfxend
 		fcc 'KSK'
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; The code in this area is the general file I/O handling system. It contains various bits to call into the Disk Basic ROM as