Share Pastebin
Guest
Public paste!

sometest_nbasic

By: a guest | Mar 20th, 2010 | Syntax: Z80 Assembler | Size: 2.12 KB | Hits: 70 | Expires: Never
Copy text to clipboard
  1. //header.bas
  2. asm
  3.   .inesprg 1 ;//one PRG bank
  4.   .ineschr 1 ;//one CHR bank
  5.   .inesmir 0 ;//mirroring type 0
  6.   .inesmap 0 ;//memory mapper 0 (none)
  7.   .org 32768
  8.   .bank 0
  9.   endasm
  10. start:
  11.   gosub waitvbl
  12.   1/>set 8192 %00100000
  13.   1/>set 8193 %00011110 //sprite/bg visible, no sprite/bg clipping
  14.   gosub waitvbl
  15.   gosub waitvbl
  16. //----------------------------------------------------------------
  17. //main.bas
  18. // paletb 0,&h30,&h20,&h2D,&h10
  19.   1/>set 8198 $3F
  20.   1/>set 8198 $00
  21.   1/>set 8199 $30
  22.   1/>set 8199 $20
  23.   1/>set 8199 $2D
  24.   1/>set 8199 $10
  25. // paletb 1,&h10,&h11,&h12,&h17
  26.   1/>set 8198 $3F
  27.   1/>set 8198 $04
  28.   1/>set 8199 $10
  29.   1/>set 8199 $11
  30.   1/>set 8199 $12
  31.   1/>set 8199 $17
  32. // paletb 2,&h24,&h25,&h26,&h12
  33.   1/>set 8198 $3F
  34.   1/>set 8198 $08
  35.   1/>set 8199 $24
  36.   1/>set 8199 $25
  37.   1/>set 8199 $26
  38.   1/>set 8199 $12
  39. // paletb 3,&h28,&h29,&h2A,&h1A
  40.   1/>set 8198 $3f
  41.   1/>set 8198 $0C
  42.   1/>set 8199 $28
  43.   1/>set 8199 $29
  44.   1/>set 8199 $2A
  45.   1/>set 8199 $1A
  46. // (...?) cls &h41
  47.   1/>set 8198 $20
  48.   1/>set 8198 $00
  49.   1/>set x 0
  50. z01_loop:
  51.   1/>set 8199 $41
  52.   1/>set 8199 $41
  53.   1/>set 8199 $41
  54.   1/>set 8199 $41
  55.   1/>inc x
  56.   if x <> 240 branchto z01_loop
  57. // color 0,0,0
  58. // color 2,0,1
  59. // color 0,2,2
  60. // color 2,2,3
  61.   1/>set $2006 $23
  62.   1/>set $2006 $C0
  63.   1/>set $2007 %11100100
  64. // (...?) repeating seq-vpoke some more times
  65.   1/>set x 0
  66. q0x_loop:
  67.   1/>set $2007 %11100100
  68.   1/>inc x
  69.   if x <> 63 branchto q0x_loop
  70. //the main program loop
  71. mainloop:
  72.   gosub waitvbl
  73.   goto mainloop
  74. //----------------------------------------------------------------
  75. // common.bas
  76. //wait until screen refresh
  77. waitvbl:
  78.   asm
  79.     lda $2002
  80.     bpl waitvbl ;//wait for start of retrace
  81.   waitvbl_1:
  82.     lda $2002
  83.     bmi waitvbl_1 ;//wait for end of retrace
  84.   endasm
  85.   1/>set 8197 0   //1/>set scroll 1/>and PPU base address
  86.   1/>set 8197 0
  87.   1/>set 8198 0
  88.   1/>set 8198 0
  89.   return
  90. //----------------------------------------------------------------
  91. // footer.bas
  92. asm
  93.   .bank 1 ;//jump table points to NMI, Reset, and IRQ start points
  94.   .org $fffa
  95.   .dw start, start, start
  96.   .bank 2 ;//include CHR ROM
  97.   .org $0000
  98.   .incbin "25ch.chr"
  99.   .incbin "25ch.chr"
  100. endasm
  101. //----------------------------------------------------------------