thedarkfreak

DCPU base program for experimenting

Jul 28th, 2014
877
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.  
  3.     hwn i
  4.     :hwloop
  5.     ife i,0
  6.     set pc, begin
  7.     sub i,1
  8.     hwq i
  9.     ife a,0xf615
  10.     ife b,0x7349
  11.     set pc,initDisplay
  12.     set pc,hwloop
  13.      
  14.     :initDisplay
  15.     set a,0
  16.     set b,[vidMemAddr]
  17.     hwi i
  18.     set [curPos], b
  19.     set pc, hwloop
  20.      
  21.     :mask
  22.     dat 0x7000
  23.      
  24.     :begin
  25.     set PUSH, helloWorldStr
  26.     jsr print
  27.     add SP, 1
  28.     set PUSH, testStr2
  29.     jsr print
  30.     add SP, 1
  31.      
  32.      
  33.     :infLoop
  34.     jsr cls
  35.     hlt
  36.      
  37.     :print
  38.     set PUSH, I
  39.     set PUSH, X
  40.     set I, [SP+3]
  41.      
  42.     set X, [curPos]
  43.     :printLoop
  44.         ife [I], 0
  45.             set PC, endPrintLoop
  46.            
  47.         ife [I], 13
  48.             set PC, printDoCR
  49.         ife [I], 10
  50.             set PC, printDoLF
  51.        
  52.         set [X], [I]
  53.         xor [X], [mask]
  54.         add X, 1
  55.         add I, 1
  56.         set PC, printLoop
  57.      
  58.     :printDoLF
  59.         add X, 32
  60.         add I, 1
  61.         set PC, printLoop
  62.      
  63.     :printDoCR
  64.         set A, X
  65.         mod A, 32
  66.         sub X, A
  67.         add I, 1
  68.         set PC, printLoop
  69.        
  70.     :endPrintLoop
  71.         set [curPos], X
  72.         set X, POP
  73.         set I, POP
  74.         set PC, POP
  75.      
  76.     :cls
  77.     :clear
  78.         set A, [vidMemAddr]
  79.        
  80.         :clsLoop
  81.             ife A, [curPos]
  82.                 set PC, endCls
  83.                
  84.             set [A], 0
  85.             add A, 1
  86.             set PC, clsLoop
  87.        
  88.         :endCls
  89.         set [curPos], [vidMemAddr]
  90.         ret
  91.        
  92.     :vidMemAddr
  93.     dat 0x8000
  94.     :curPos
  95.     dat 0
  96.     :helloWorldStr
  97.     dat "Hello, world!", 13, 10, 0
  98.      
  99.     :testStr2
  100.     dat "String 2", 0
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×