Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     include gemdos.i
  2.     include xbios.i
  3.     include stmacros.i
  4.  
  5. start:
  6.  
  7. ClearScreen:
  8.     PrintString ClearHome  
  9.  
  10. GetPhysBase:
  11.     PUSH    #physbase
  12.     TRAP    #14
  13.     CORRECT #2
  14.  
  15.     move.l  d0,a4
  16.     move.l  d0,GFX_BASE
  17.  
  18. DrawAPixel:
  19.     move.l  #400,d0
  20.     move.l  #10,d1
  21.     jsr PlotHiResPixel
  22.  
  23. Hello:
  24.     PrintString HelloWorld
  25.  
  26. Wait:
  27.     GEMDOS  1 ;wait for keypress
  28.     CORRECT #2
  29.  
  30. End:
  31.     GEMDOS  0 ;pterm0
  32.  
  33. ;Functions
  34.  
  35. ;Calculates d0 mod 8, returns it in d1
  36. Modulus8:
  37.     divu        #8,d0
  38.     swap        d0
  39.     move.w      d0,d1  
  40.     rts
  41.  
  42. ;Returns 0x01 ROL by d0 in d3
  43. PlotHiResPixel:
  44.     ;d0 = horizontal coordinate
  45.     ;d1 = vertical coordinate
  46.  
  47.     ;horizontal plotting
  48.     move.l  #400,d0 ;pixel number to plot
  49.     divu    #8,d0
  50.     move.l  d0,d2
  51.     swap    d2
  52.     jsr BitIndex ;d3 = the bit pattern to plot
  53.     add.l   d0,a4
  54.  
  55.     ;vertical plotting
  56.     mulu    #80,d1 ;640px wide / 8 = 80
  57.     add.l   d1,a4
  58.  
  59.     ;plot the pixel and return
  60.     move.b  d3,(a4)
  61.     rts
  62.  
  63. BitIndex:
  64.     move.w  d0,d4
  65.     move.b  #%00000001,d3
  66.     rol d2,d3
  67.     RTS
  68.  
  69.     SECTION DATA
  70. GFX_BASE    dc.l    0
  71. ;Escape codes
  72. ClearHome   dc.b    $1B,"E",0
  73.  
  74. HelloWorld  dc.b    "Hello World!",$0D,$0A,0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement