Post by VDC 8x2 on Jul 15, 2016 1:48:47 GMT
Finally got the linker code to load the init module. Working on that now.
Implemented a data stack using the basic stack since, working strictly in assembly once the basic loader is done.
//linker
.label disk = $0f12
.label file = $0f11
.label lowStack = $0800
.label highStack = $0900
.label irqNorm = $1c03
.label Loader = $1c06
.label modSA = $1100
.import source "myMacros.asm"
.pc = $1000 "code"
start: :mov #$00 ; stackP //set data bank pointer to 0
:mov #%01111110 ; MMUCR //set bank to ram 1 with i.o
main: lda file
bne !skip+ //file gen?
:mov disk ; $4bee
:mov #$01 ; disk
!skip: :bankSub(irqNorm,$00) //cust jsr in anther bank (Address, MMUCR bits)
:mov #$00 ; $0bfc
tay
!loop: sta $4941,y
dey
bne !loop-
reload: lda #<modSA
ldy #>modSA
jsr PushD // 1
lda #$1 //data bank
ldy #$1 //filename bank
jsr PushD //2
ldx file
lda fnlow,x
ldy fnhigh,x
jsr PushD //3
ldx file
lda length,x
jsr PushD //4
:bankSub(Loader,$00)
lda $0bf1 //zero if load is good
beq !skip+
brk
nop
jsr $413b //not implemented yet
:branch reload
!skip: jsr modSA
:branch main
.pc = * "PushD"
PushD: ldx stackP //push .a and .y to our 2 byte stack
dex //do this first to be interupt proof
sta lowStack,x
tya
sta highStack,x
stx stackP
rts
.pc = * "PopD"
PopD: ldx stackP //pop .a and .y from our 2 byte stack
lda lowStack,x
ldy highStack,x
inx
stx stackP
rts
.pc = * "data"
file0: .text "GEN"
file1: .text "DUNGEON"
file2: .text "COMBAT"
file3: .text "INIT"
file4: .text "COMPREP"
file5: .text "POSTCOM"
file6: .text "SBAT"
file7: .text "CAMP"
length: .byte 03,07,06,04,07,07,04,04
fnlow: .byte <file0,<file1,<file2,<file3,<file4,<file5,<file6,<file7
fnhigh: .byte >file0,>file1,>file2,>file3,>file4,>file5,>file6,>file7
Implemented a data stack using the basic stack since, working strictly in assembly once the basic loader is done.