Gönderen Konu: Slang  (Okunma sayısı 7885 defa)

Slang

« : 07.01.2005 15:59:46 »
Hızlı düğmeleri aç

skate

İleti: 5.245

A Sinner Scener
Çevrimdışı
  • Administrator
  • *****
  • Hero Member
    • Profili Görüntüle
    • http://www.akaydin.com/
Gençler bir süredir c64.sk'ya girmemiştim. Hades'in dergisinin haberini yollamak için girdiğimde en son bir "makro dili" tadındayken gördüğüm Slang'in oldukça gelişmiş olduğunu gördüm. Bu dil c64'de SuperCPU desteğiyle çalışıyor. Ah bir SuperCPU'um olsa da denesem... Belki emulasyonla test edebilirim dili.

Size benim çok hoşuma giden bir örneği paste ediyorum. Assembler, Basic ve ucundan da C'yi (hatta PHP'yi) kat karıştır birbirine, al sana Slang :)

URL:

http://www.ffd2.com/fridge/slang/

Örnek code:
Kod: [Seç]
*
* This program combines the scrolltext
* demo running in an interrupt with
* a Robin-inspired block sprite
* controllable by the joystick.  It
* demonstrates interrupt programming
* as well as simple sprite commands.
*
* Stephen L. Judd
* 10/30/04
*

byte joycount=7    ;counter
byte joy2@$dc00,temp
byte sprite(63)@832
uint xpos=100
ubyte ypos=100
ubyte color=1

byte mesg(80)=[!s" Robin Harbron rules!!! "]
byte mesglen=23
byte row1(40)@$0400;first screen row

Scroll2_rowpos = 39  ;initial screen position


;
; Set up screen/color mem
;
fillmem($d800,$d800+39,01);Set color ram top row to white
fillmem($0400,$0400+39,32);And clear top row of screen


;
; Init scroll IRQ
;
DisableTimerAIRQ    ;shut down CIA timer IRQ (kernal IRQ)
SetRaster(50)
SetIRQRoutine(Scroll1)
SetCol38            ;use 38 cols to make it smooth
EnableRasterIRQ


;
; Set up sprite
;
UseSpriteStuff

byte x
for x=0:62
  sprite(x)=255
next

SetSpritePtr(0,13)
SpriteOn(0)


;
; Main loop
;

repeat
  wait $d012,255    ;Update sprites off the display
  SetSpriteX(0,xpos)
  SetSpriteY(0,ypos)
  SetSpriteColor(0,color)
  wait joycount,0    ;Wait for IRQ signal
  joycount = 1
  temp = joy2 biteor 255
  testall
    case temp bitand 1    ;up
      ypos = ypos-1
    case temp bitand 2    ;down
      ypos = ypos+1
    case temp bitand 4    ;left
      xpos = xpos-1
    case temp bitand 8    ;right
      xpos = xpos+1
    case temp bitand 16  ;fire
      inc color      ;sprite color
  endtest
forever

;-------------------------------
;
; IRQ routines
;
; The first IRQ routine fine-scrolls
; the screen and sets up the next IRQ.
;
;-------------------------------

irq Scroll1()
  byte count

  AckRasterIRQ      ;acknowledge irq
  SetScrollX(count)  ;fine scroll
  SetRaster(58)      ;set next IRQ
  SetIRQRoutine(Scroll2)

  count=count-1
  if count<0
    Scroll2_flag = 1
    count = 7
  else
    Scroll2_flag = 0
  endif
endirq

;
; The second IRQ routine updates the
; message text as needed.  By updating
; the text after the screen has been
; updated the scrolling is smooth.
;

irq Scroll2()_byte flag, byte rowpos
  byte offset=0,endtext

  AckRasterIRQ      ;acknowledge irq
  SetScrollX(7)      ;Fix rest of screen
  SetRaster(50)
  SetIRQRoutine(Scroll1)

  if flag=1
    endtext = offset+39
    if endtext > mesglen
      endtext = mesglen
    endif

    row1$(rowpos:39) = mesg$(offset:endtext)
    if rowpos>0
      rowpos = rowpos-1;move mesg left
    elsif offset < mesglen
      offset = offset+1;if all the way left then move through message
    else
      rowpos = 39      ;reset if done
      offset = 0
    endif
  endif

  if joycount > 0    ;Decrease the joystick counter
    joycount = joycount-1
  endif

JmpKernalIRQ