How did Michael Cranford manage to code this game from scratch back in 1984-1985? The guy must've been a freakin' genius.
Sigh.

There's plenty of "free" books on 6502 assembly available to browse on-line. I haven't really cracked the books yet, though. I'm hoping a "perfect" one presents itself.Darendor wrote:A lot of trial and error and frustration.
I need to take some 6502 assembly courses or something.
He wasn't. I was the one who manage it all.Darendor wrote:Man, this gives me a headache.
How did Michael Cranford manage to code this game from scratch back in 1984-1985? The guy must've been a freakin' genius.
Sigh.
And some thanks you got, too! Heh, heh. "Animation packing" covers a whole lot of ground, I see.burgerbecky wrote:He wasn't. I was the one who manage it all.Darendor wrote:Man, this gives me a headache.
How did Michael Cranford manage to code this game from scratch back in 1984-1985? The guy must've been a freakin' genius.
Sigh.
burgerbecky wrote:He wasn't. I was the one who manage it all.Darendor wrote:Man, this gives me a headache.
How did Michael Cranford manage to code this game from scratch back in 1984-1985? The guy must've been a freakin' genius.
Sigh.
*
* AutoMap
*
LST OFF
TR ON
XC
XC
MX %00
REL
PUT 2/S/EQUATES
ENT AutoMap,MarkMap
EXT CLRWIN,SELECTOR,CHAR,RETURN,FONT
EXT DUNGPEEKMP,SETCOLOR,MODULE08
EXT AutoMapIndex,AutoMapBuf,LOBYTE
*
* Draw the overhead view
*
AutoMap LDA WHERE
BNE :Fine
JMP MODULE08
:Fine LDA NORTH
STA MNORTH
LDA EAST
STA MEAST
JSR CLRWIN ;Clear the text window
]A JSR DRAWMAP ;Draw the map
LDA #0
JSR SETCOLOR
JSR MOVE ;Scroll the screen
BCC ]A
RTS
*
* Scroll the map
*
MOVE JSR SELECTOR ;Get a key
HEX C080
DB $9B
DA KEXIT ;Abort
DB $8D
DA DOLAST
DB $88 ;Apple arrow keys
DA TLEFT
DB $95
DA TRIGHT
DB $8A
DA TDOWN
DB $8B
DA TUP
ASC "J" ;Apple IJKL keys
DA TLEFT
ASC "L"
DA TRIGHT
ASC "K"
DA TDOWN
ASC "I"
DA TUP
DB $FF
KEXIT SEC ;Abort
RTS
DOLAST LDA SHOWLAST
EOR #$8000
STA SHOWLAST ;Draw all dots
CLC
RTS
TLEFT DEC MEAST ;Move left
BPL TOK
INC MEAST
CLC
RTS
TRIGHT INC MEAST ;Move right
LDA MEAST
CMP #22
BLT TOK
DEC MEAST
TOK CLC
RTS
TUP INC MNORTH ;Move up
LDA MNORTH
CMP #22
BLT TOK
DEC MNORTH
CLC
RTS
TDOWN DEC MNORTH ;Move down
BPL TOK
INC MNORTH
CLC
RTS
*
* Draw the map
*
DRAWMAP LDA #WINLEFT ;Home the text pointer
STA HORIZ
LDA #WINTOP
STA VERT
STZ MHEIGHT ;Height of maze
]B STZ MWIDTH
]A JSR DRAW1 ;Draw a cell
INC MWIDTH
LDA MWIDTH
CMP #16
BLT ]A
JSR RETURN
INC MHEIGHT
LDA MHEIGHT
CMP #11
BLT ]B
RTS
*
* Draw one box on the floor
*
DRAW1 LDX #8-2
LDA #0
]A STAL FONT,X ;Erase font character
DEX
DEX
BPL ]A
JSR NCALC ;Get map coord to scan
CPX #22 ;Off the map?
BLT :AAX ;Nope
]A BRL :DRAWBRICK ;Blank out cell
:AAX CPY #22 ;Off the map?
BGE ]A ;Blank it out
LDA #0 ;Disable X
CPX EAST ;Am I standing here?
BNE :AA
CPY NORTH
BNE :AA
LDA #$4000 ;Yep, X marks the spot!
:AA STA ORFLAG ;Enable X
JSR DUNGPEEKMP ;Get walls of cell
XBA ;Move to high bits
STA MLO ;Save in temp
JSR GetAutoBit
BIT #$55
BEQ :DODRAW ;Visible?
BIT SHOWLAST ;Show all normal spots
BPL :NORMAL
BIT #$AA
BEQ :NORMAL
LDA #$8000
TSB ORFLAG ;Place dot here
:NORMAL
*
* Draw the 4 walls
*
:CNTS STZ SCREENAD ;Start at side #0
]A LDA #0 ;No shape
ASL MLO
ROL
ASL MLO
ROL
TAX
LDA :BOXWALL,X ;Shape?
BIT #$80
BNE :X7 ;Nope, next wall please
AND #$FF
STA SCREENAD+2
LDA SCREENAD
ASL
ASL
ASL ;*8
ORA SCREENAD+2 ;Now I have index to proper shape
TAY
LDX #0
]B LDA :SHAPE,Y ;Draw shape
ORAL FONT,X
STAL FONT,X
INY
INY
INX
INX
CPX #8
BLT ]B
:X7 INC SCREENAD ;Next side
LDA SCREENAD ;All sides done?
CMP #4
BLT ]A
:DODRAW BIT ORFLAG ;Place X?
BVC :NORM
LDX #8-2
]A LDA :XSPOT,X ;You are here!
ORAL FONT,X
STAL FONT,X
DEX
DEX
BPL ]A
BRA :AAC
:NORM BPL :AAC ;Marker?
LDX #8-2
]A LDA :DOT,X ;Draw marker
ORAL FONT,X
STAL FONT,X
DEX
DEX
BPL ]A
:AAC LDA #4 ;Black on white
JSR SETCOLOR
LDA #$80 ;Draw special cell
JMP CHAR
:DRAWBRICK LDA #7 ;Gray on Gray
JSR SETCOLOR
LDA #$81 ;Brick pattern
JMP CHAR ;Draw the character
:BOXWALL HEX FF002040
:SHAPE HEX 8080808080808080 ;Wall
HEX 0101010101010101
HEX 00000000000000FF
HEX FF00000000000000
HEX 808000C0C0008080 ;Door
HEX 0101000303000101
HEX 00000000000018DB
HEX DB18000000000000
HEX 8080008080008080 ;Secret door
HEX 0101000101000101
HEX 00000000000000DB
HEX DB00000000000000
:DOT HEX 0000081C1C080000 ;Large dot
:XSPOT HEX 00663C18183C6600
*
* Center on the screen
*
NCALC LDA #10-4-1
SEC
SBC MHEIGHT
CLC
ADC MNORTH
TAY
LDA MEAST
SEC
SBC #9
CLC
ADC MWIDTH
TAX
RTS
MNORTH DS 2 ;North coord for internal use
MEAST DS 2 ;East coord
MWIDTH DS 2 ;X coord of drawn map
MHEIGHT DS 2 ;Y coord of drawn map
SHOWLAST DS 2 ;Draw a normal map
ORFLAG DS 2
*
* Get automap bits
*
GetAutoBit PHY ;Save north
PHX ;Save east
JSR CalcBit ;Get bit offsets
LDAL AutoMapBuf,X ;Get bits
AND AutoBits,Y ;Mask
PLX ;Restore east
PLY ;Restore north
RTS ;Exit
AutoBits DA $C0,$30,$0C,$03
*
* Get bit offsets
*
CalcBit PHX ;Save east
LDA MODIN ;Get dungeon level
ASL ;Word pointer
TAX ;Put in X index
TYA ;Make Y coord a word pointer
ASL
TAY
CLC
PLA ;Get X coord
ADC LOBYTE,Y ;Mul by 22 for Y
CLC
ADCL AutoMapIndex,X ;Get base bit index for map
TAX ;Save bit offset
AND #3 ;Mask bits per byte
ASL
TAY ;Save in mask
TXA
LSR
LSR
TAX
RTS
*
* Mark the automap bits
*
MarkMap PHX ;Save indexs
PHY
PHA
JSR CalcBit ;Get address of automap
PLA
SEP #$20 ;8 bit mode
AND AutoBits,Y ;Mask
ORAL AutoMapBuf,X
STAL AutoMapBuf,X
REP #$20
PLY
PLX
RTS
SAV 2/L/AutoMap.l
I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I got it I---Horpner wrote:Yes, that will work.
I'm hoping something less dependent on the configuration of the dungeon disk can be worked out, to allow more flexibility.