Nightmaretony wrote:
The Kowalski will go into several formats, several hex and bin. you need an eprom programmer program, though.
///nother Kowalski lover
//since it is now abandonware, I can make a page to host it, can we get a project to udpate it for other things like 816 or 32 or org32?
Incidentally, I have developed a macro set that allows most of the 65C816 native mode instructions to be assembled in the Kowalski simulator. BRL when the branch target is forward of the instruction will not work, as there is a forward reference involved.
Code:
;================================================================================
;
;W65C816S INSTRUCTION MACROS
;
; ---------------------------------------------------------
; These macros implement W65C816S native mode instructions,
; as well as 65C02 instructions that are not recognized by
; the Kowalski assembler (e.g., STP & WAI).
; ---------------------------------------------------------
;
.if !.ref(brl)
;
brl .macro .op ;long relative branch...
.if .op ;won't work for forward...
.isize =3 ;branches because of forward...
.os =*+.isize ;address reference
.os =.op-.os
.if .os > 32767
.error %1 + ": FORWARD BRANCH OUT OF RANGE"
.endif
.if .os < -32768
.error %1 + ": BACKWARD BRANCH OUT OF RANGE"
.endif
.byte $82
.word .os
.else
.error "INSTRUCTION REQUIRES TARGET ADDRESS"
.endif
.endm
;
cop .macro .op ;co-processor
.if .op > $ff
.error "SIGNATURE MUST BE $00 - $FF"
.endif
.byte $02,.op
.endm
;
jsl .macro .bk,.ad ;JSL <bank><addr>
.byte $22
.word .ad
.byte .bk
.endm
;
jsrix .macro .op ;JSR (<addr>,X)
.byte $fc
.word .op
.endm
;
mvn .macro .s,.d ;move next <sbnk>,<dbnk>
.if .s > $ff
.error "SOURCE BANK MUST BE $00 - $FF"
.endif
.if .d > $ff
.error "DESTINATION BANK MUST BE $00 - $FF"
.endif
.byte $54,.d,.s
.endm
;
mvp .macro .s,.d ;move prev <sbnk>,<dbnk>
.if .s > $ff
.error "SOURCE BANK MUST BE $00 - $FF"
.endif
.if .d > $ff
.error "DESTINATION BANK MUST BE $00 - $FF"
.endif
.byte $44,.d,.s
.endm
;
pea .macro .op ;pea <addr>
.byte $f4
.word .op
.endm
;
pei .macro .op ;pei (<addr>)
.if .op > $ff
.error "INDIRECT ADDRESS MUST BE $00 - $FF"
.endif
.byte $d4,.op
.endm
;
phb .macro ;push data bank register
.byte $8b
.endm
;
phd .macro ;push direct page register
.byte $0b
.endm
;
phk .macro ;push program bank register
.byte $4b
.endm
;
plb .macro ;pull data bank register
.byte $ab
.endm
;
pld .macro ;pull direct page register
.byte $2b
.endm
;
rep .macro .op ;clear status register bits
.if .op > $ff
.error "OPERAND MUST BE $00 - $FF"
.endif
.byte $c2,.op
.endm
;
sep .macro .op ;set status register bits
.if .op > $ff
.error "OPERAND MUST BE $00 - $FF"
.endif
.byte $e2,.op
.endm
;
stp .macro ;halt MPU
.byte $db
.endm
;
tcd .macro ;transfer .C to direct page register
.byte $5b
.endm
;
tcs .macro ;transfer .C to stack pointer
.byte $1b
.endm
;
tdc .macro ;transfer direct page register to .C
.byte $7b
.endm
;
tsc .macro ;transfer stack pointer to .C
.byte $3b
.endm
;
txy .macro ;transfer .X to .Y
.byte $9b
.endm
;
tyx .macro ;transfer .Y to .X
.byte $bb
.endm
;
wai .macro ;wait for interrupt
.byte $cb
.endm
;
xba .macro ;swap B & A accumulators
.byte $eb
.endm
;
xce .macro ;swap carry & emulation bits
.byte $fb
.endm
;
;
; stack-based accumulator instructions...
;
; ---------------------------------------------------------------------
; Stack-based accumulator instructions take the form ***S or ***SI, the
; latter for indexed indirect operations. *** represents the parent
; instruction. For example, LDAS 1 is equivalent to LDA 1,S & LDASI 1
; is the equivalent of LDA (1,S),Y. The actual macro names are lower
; case. The macro comment indicates the official WDC assembly language
; syntax for the instruction being synthesized.
; ---------------------------------------------------------------------
;
adcs .macro .op ;ADC <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $63,.op
.endm
;
adcsi .macro .op ;ADC (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $73,.op
.endm
;
ands .macro .op ;AND <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $23,.op
.endm
;
andsi .macro .op ;AND (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $33,.op
.endm
;
cmps .macro .op ;CMP <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $c3,.op
.endm
;
cmpsi .macro .op ;CMP (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $d3,.op
.endm
;
eors .macro .op ;EOR <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $43,.op
.endm
;
eorsi .macro .op ;EOR (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $53,.op
.endm
;
ldas .macro .op ;LDA <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $a3,.op
.endm
;
ldasi .macro .op ;LDA (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $b3,.op
.endm
;
oras .macro .op ;ORA <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $03,.op
.endm
;
orasi .macro .op ;ORA (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $13,.op
.endm
;
sbcs .macro .op ;SBC <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $e3,.op
.endm
;
sbcsi .macro .op ;SBC (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $f3,.op
.endm
;
stas .macro .op ;STA <offset>,S
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $83,.op
.endm
;
stasi .macro .op ;STA (<offset>,S),Y
.if .op > $ff
.error "OFFSET MUST BE $00 - $FF"
.endif
.byte $93,.op
.endm
;
;
; 16 bit immediate mode instructions...
;
; --------------------------------------------------------------------
; Immediate mode instructions that are able to accept 16 bit operands
; take the form ***W, where *** is the parent 8 bit instruction. For
; example, ADCW is the 16 bit form of ADC. The actual macro names are
; lower case. It is the responsibility of the programmer to assure
; that MPU register sizes have been correctly configured before using
; ***W instructions. For example:
;
; LONGA ;16 bit .A & memory
; LDAW $1234 ;equivalent to LDA #$1234
; SHORTA ;8 bit .A & memory
; LDAW $1234 ;won't work as expected!!!
;
; The macro comment indicates the official WDC assembly language syn-
; tax for the instruction being synthesized.
; --------------------------------------------------------------------
;
adcw .macro .op ;ADC #nnnn
adc #<.op
.byte >.op
.endm
;
andw .macro .op ;AND #nnnn
and #<.op
.byte >.op
.endm
;
bitw .macro .op ;BIT #nnnn
bit #<.op
.byte >.op
.endm
;
cmpw .macro .op ;CMP #nnnn
cmp #<.op
.byte >.op
.endm
;
cpxw .macro .op ;CPX #nnnn
cpx #<.op
.byte >.op
.endm
;
cpyw .macro .op ;CPY #nnnn
cpy #<.op
.byte >.op
.endm
;
eorw .macro .op ;EOR #nnnn
eor #<.op
.byte >.op
.endm
;
ldaw .macro .op ;LDA #nnnn
lda #<.op
.byte >.op
.endm
;
ldxw .macro .op ;LDX #nnnn
ldx #<.op
.byte >.op
.endm
;
ldyw .macro .op ;LDY #nnnn
ldy #<.op
.byte >.op
.endm
;
oraw .macro .op ;ORA #nnnn
ora #<.op
.byte >.op
.endm
;
sbcw .macro .op ;SBC #nnnn
sbc #<.op
.byte >.op
.endm
;
;
; register size macros...
;
; --------------------------------------------------------------------
; These macros are a convenient way to change the MPU's register sizes
; without having to remember the correct bit pattern for the REP & SEP
; instructions.
; --------------------------------------------------------------------
;
longa .macro ;16 bit accumulator & memory
rep $20
.endm
;
longr .macro ;16 bit all registers
rep $30
.endm
;
longx .macro ;16 bit index registers
rep $10
.endm
;
shorta .macro ;8 bit accumulator & memory
sep $20
.endm
;
shortr .macro ;8 bit all registers
sep $30
.endm
;
shortx .macro ;8 bit index registers
sep $10
.endm
;
;
; INT instruction - assembles as BRK followed by operand...
;
int .macro .op ;INT <intnum>
.if .op > $ff
.error "INTERRUPT NUMBER MUST BE $00 - $FF"
.endif
.byte $00,.op
.endm
;
.endif
.end
Incidentally, the simulator *assembles* programs, not *compiles* them.
-----
I updated the macro listing to fix a typo that was recently discovered.
--BDD