home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 42 / q42.d81 / mgen128d.ebud < prev    next >
Text File  |  2022-08-28  |  2KB  |  127 lines

  1. .org $2f00
  2. .dvo 10
  3. .obj "mgen128d.obj"
  4. .dis "mgen128d.lis"
  5. ;-------------------------------------------
  6. ; mazegen128 - 80 col machine language maze generator
  7. ;
  8. ;-------------------------------------------
  9. ; define variables
  10. ;
  11. chrout = $ffd2
  12. ;------------------------------------------
  13. ;  start of code
  14. ;
  15. init lda #$00
  16. beq   start
  17. ;-------------------------------------------
  18. ;  working storage
  19. table .byte 1 0 176 255 255 255 80 0
  20. ;-------------------------------------------
  21. start lda #$a1
  22. sta $fb
  23. lda #$50
  24. sta $fd
  25. lda #$30
  26. sta $fc
  27. sta $fe
  28. lda #$93
  29. jsr chrout
  30. ldx #$00
  31. ;------------------------------------------
  32. fill ldy #$00
  33. lda #$a0
  34. ;------------------------------------------
  35. doline sta ($fd),y
  36. iny
  37. cpy #$4f
  38. bne doline
  39. clc
  40. lda $fd
  41. adc #$50
  42. sta $fd
  43. bcc nxtlin
  44. inc $fe
  45. ;------------------------------------------
  46. nxtlin inx
  47. cpx #$17
  48. bne fill
  49. ldy #$00
  50. lda #$04
  51. sta ($fb),y
  52. ;------------------------------------------
  53. rndgen lda #$ff
  54. sta $d40f
  55. lda #$80
  56. sta $d412
  57. lda $d41b
  58. and #$03
  59. sta $ad
  60. ;------------------------------------------
  61. token1 tax
  62. asl
  63. tay
  64. clc
  65. lda table,y
  66. adc $fb
  67. sta $aa
  68. lda table+1,y
  69. adc $fc
  70. sta $ab
  71. clc
  72. lda table,y
  73. adc $aa
  74. sta $fd
  75. lda table+1,y
  76. adc $ab
  77. sta $fe
  78. ldy #$00
  79. lda ($fd),y
  80. cmp #$a0
  81. bne token2
  82. txa
  83. sta ($fd),y
  84. lda #$20
  85. sta ($aa),y
  86. lda $fd
  87. sta $fb
  88. lda $fe
  89. sta $fc
  90. jmp rndgen
  91. ;------------------------------------------
  92. token2 inx
  93. txa
  94. and #$03
  95. cmp $ad
  96. bne token1
  97. lda ($fb),y
  98. tax
  99. lda #$20
  100. sta ($fb),y
  101. cpx #$04
  102. beq end
  103. txa
  104. asl
  105. tay
  106. ldx #$02
  107. ;-----------------------------------------
  108. nxtpos sec
  109. lda $fb
  110. sbc table,y
  111. sta $fb
  112. lda $fc
  113. sbc table+1,y
  114. sta $fc
  115. dex
  116. bne nxtpos
  117. jmp rndgen
  118. ;-----------------------------------------
  119. end ldx #$18
  120. lda #$00
  121. - sta $d400,x
  122. dex
  123. bpl -
  124. rts
  125.  
  126.  
  127.