home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 42
/
q42.d81
/
mgen128d.ebud
< prev
next >
Wrap
Text File
|
2022-08-28
|
2KB
|
127 lines
.org $2f00
.dvo 10
.obj "mgen128d.obj"
.dis "mgen128d.lis"
;-------------------------------------------
; mazegen128 - 80 col machine language maze generator
;
;-------------------------------------------
; define variables
;
chrout = $ffd2
;------------------------------------------
; start of code
;
init lda #$00
beq start
;-------------------------------------------
; working storage
table .byte 1 0 176 255 255 255 80 0
;-------------------------------------------
start lda #$a1
sta $fb
lda #$50
sta $fd
lda #$30
sta $fc
sta $fe
lda #$93
jsr chrout
ldx #$00
;------------------------------------------
fill ldy #$00
lda #$a0
;------------------------------------------
doline sta ($fd),y
iny
cpy #$4f
bne doline
clc
lda $fd
adc #$50
sta $fd
bcc nxtlin
inc $fe
;------------------------------------------
nxtlin inx
cpx #$17
bne fill
ldy #$00
lda #$04
sta ($fb),y
;------------------------------------------
rndgen lda #$ff
sta $d40f
lda #$80
sta $d412
lda $d41b
and #$03
sta $ad
;------------------------------------------
token1 tax
asl
tay
clc
lda table,y
adc $fb
sta $aa
lda table+1,y
adc $fc
sta $ab
clc
lda table,y
adc $aa
sta $fd
lda table+1,y
adc $ab
sta $fe
ldy #$00
lda ($fd),y
cmp #$a0
bne token2
txa
sta ($fd),y
lda #$20
sta ($aa),y
lda $fd
sta $fb
lda $fe
sta $fc
jmp rndgen
;------------------------------------------
token2 inx
txa
and #$03
cmp $ad
bne token1
lda ($fb),y
tax
lda #$20
sta ($fb),y
cpx #$04
beq end
txa
asl
tay
ldx #$02
;-----------------------------------------
nxtpos sec
lda $fb
sbc table,y
sta $fb
lda $fc
sbc table+1,y
sta $fc
dex
bne nxtpos
jmp rndgen
;-----------------------------------------
end ldx #$18
lda #$00
- sta $d400,x
dex
bpl -
rts