For some reason, I can't get DASM to compile a BIOS I am creating for custom 6502-based microcomputers. The following is the code:
Code:
processor 6502
;; This is a simple BIOS for a 6502 machine.
;; The BIOS code assumes the following:
;; Random Number generator lives at $fe
;; ASCII keypress is stored at $ff (pseudo-readonly, value only changes when new keypress occurs.
;; You can write to the location but it changes with next keypress.)
;; Stack will live at $100-$1ff
;; BIOS starts at $600 and ends at $fff (2560 bytes)
;; Screen pixels mapped at $200-$5ff with following color info:
;; $0: Black
;; $1: White
;; $2: Red
;; $3: Cyan
;; $4: Purple
;; $5: Green
;; $6: Blue
;; $7: Yellow
;; $8: Orange
;; $9: Brown
;; $a: Light red
;; $b: Dark gray
;; $c: Gray
;; $d: Light green
;; $e: Light blue
;; $f: Light gray
;; The BIOS also assumes that color info gets ANDed with $0f (not by the BIOS) to always get a valid color.
;; To read the color of a pixel, the BIOS will read from the pixel address. (e.g., to read $200: lda $200)
;; NMI means serious hardware issue
;; IRQ resets processor
;; Interrupt vectors at $fffa
;; Anything not mentioned is RAM space.
;; Assemble with DASM.
;; Let's begin some code, shall we?
ORG $600
Reset
;; Register Immediate addressing mode check
lda #$ff
ldx #$ff
ldy #$ff
cmp #$ff
bne die ;Stop on error
cpx #$ff
bne die
cpy #$ff
bne die
;; Register transfer test
and #$00
tax
tay
cpx #$00
bne die
cpy #$00
bne die
;; store to RAM test
lda #$ea
sta $00
ldx $00
cpx #$ea
bne die
and #$00
tax
sta $00
;; 'White Dot' test
lda #$01
sta $200
ldx $200
cpx #$01
bne die
and #$00
tax
sta $200
;; Your code goes here
jmp Reset ;Simple filler instruction. Remove if you wish.
die
;; Red screen of death
lda #$02
ldx #$00
loop
sta $200, x
inx
cpx #$ff
bne loop
loop2
sta $2ff, x
inx
cpx #$ff
bne loop2
loop3
sta $3ff, x
inx
cpx #$ff
bne loop3
loop4
sta $4ff,x
inx
cpx #$ff
bne loop4
jmp loop
ORG $fffa
InterruptVectors
.word die ;NMI
.word Reset ;RESET
.word Reset ;IRQ
END
DASM fails with this message (with -v5):
Quote:
dasm bios.asm -obios.bin -lbios.txt -v5
DASM V2.20.07, Macro Assembler (C)1988-2003
START OF PASS: 1
----------------------------------------------------------------------
SEGMENT NAME INIT PC INIT RPC FINAL PC FINAL RPC
INITIAL CODE SEGMENT 0600 0600
----------------------------------------------------------------------
10 references to unknown symbols.
11 events requiring another assembler pass.
- Expression in mnemonic not resolved.
- Label defined after it has been referenced (forward reference).
--- Unresolved Symbol List
x 0000 ???? (R )
--- 1 Unresolved Symbol
START OF PASS: 2
----------------------------------------------------------------------
SEGMENT NAME INIT PC INIT RPC FINAL PC FINAL RPC
INITIAL CODE SEGMENT 0600 0600
----------------------------------------------------------------------
3 references to unknown symbols.
3 events requiring another assembler pass.
- Expression in mnemonic not resolved.
--- Unresolved Symbol List
x 0000 ???? (R )
--- 1 Unresolved Symbol
START OF PASS: 3
----------------------------------------------------------------------
SEGMENT NAME INIT PC INIT RPC FINAL PC FINAL RPC
INITIAL CODE SEGMENT 0600 0600
----------------------------------------------------------------------
3 references to unknown symbols.
3 events requiring another assembler pass.
- Expression in mnemonic not resolved.
--- Unresolved Symbol List
x 0000 ???? (R )
--- 1 Unresolved Symbol
--- Unresolved Symbol List
x 0000 ???? (R )
--- 1 Unresolved Symbol
Fatal assembly error: Source is not resolvable.
I can't seem to figure out why
.
My command line is:
Code:
dasm bios.asm -obios.bin -lbios.txt -v5