flat assembler
Message board for the users of flat assembler.

Index > Heap > New Z-Cube PC. Cigar Box ITX

Author
Thread Post new topic Reply to topic
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
A portable efficient desktop PC built from a cigar box that's more powerful than my old netbook.

* Zotac ION ITX motherboard + CPU (1.6GHZ dual core)
+ 1G RAM + 19V power adapter: Paid $42 used
* Case: Free cigar box from local tobacco shop
* Spray paint, primer, handle: $10
* Multi-color 60mm CPU fan, blue 80mm fan,
atomic chrome grill: $20 ($3-$7 each)
------------------------------------------------
Total: About $72


Description:
Filesize: 289.54 KB
Viewed: 4293 Time(s)

Z_CUBE.jpg


Description:
Filesize: 77.69 KB
Viewed: 4292 Time(s)

ITX.jpg


Post 10 Jan 2014, 17:33
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Preview of recent code. Sprite Fight Demo: Animation, Sound+Music, Input. Almost finished.
Code:
  if can.jump
    if.gamepad B
      if.gamepad RIGHT
        go .jumpf
      end
      get.gamepad.thumb.lx
      if r0>4096
        go .jumpf
      end
      if.gamepad LEFT
        go .jumpb
      end
      get.gamepad.thumb.lx
      if r0<-4096
        go .jumpb
      end
      go .jumpu
    end
    if.keys S
      if.keys RIGHT
        .jumpf:
        animate player, JUMP, JUMPF, jumpf.a,\
         JUMP.SPEED, 0
        go .jumpe
      end
      if.keys LEFT
        .jumpb:
        animate player, JUMP, JUMPB, jumpb.a,\
         JUMP.SPEED, 0
        go .jumpe
      end
      .jumpu:
      animate player, JUMP, JUMPU, jumpu.a,\
       JUMP.SPEED, 0
      .jumpe:
      JUMP.HEIGHT=400
      . [player.state]=SS.JUMP
      . [player.ascend]='a'
      . r0=[player.y], [player.start.y]=r0
      . r0-JUMP.HEIGHT, [player.end.y]=r0
      go .paint
    end
  end

  if can.walk
    . walk?=NO
    . can.move.up=NO, can.move.down=NO
    . can.move.left=NO, can.move.right=NO
    . move.u=NO, move.d=NO
    . move.l=NO, move.r=NO

    if [player.y]>0
      . can.move.up=YES
    end
    . r0=[screen.h], r0-[player.h], r0-16
    if [player.y]<r0
      . can.move.down=YES
    end
    if [player.x]>0
      . can.move.left=YES
    end
    . r0=[screen.w], r0-[player.w]
    if [player.x]<r0
      . can.move.right=YES
    end

    SPEED.X=10
    SPEED.Y=8

    if can.move.up
      if.keys UP
        . move.u=YES
      end
      if.gamepad UP
        . move.u=YES
      end
      get.gamepad.thumb.ly
      if r0>4096
        . move.u=YES
      end
      if move.u
        . [player.y]-SPEED.Y, walk?=YES
      end
    end
    if can.move.down
      if.keys DOWN
        . move.d=YES
      end
      if.gamepad DOWN
        . move.d=YES
      end
      get.gamepad.thumb.ly
      if r0<-4096
        . move.d=YES
      end
      if move.d
        . [player.y]+SPEED.Y, walk?=YES
      end
    end
    if can.move.left
      if.keys LEFT
        . move.l=YES
      end
      if.gamepad LEFT
        . move.l=YES
      end
      get.gamepad.thumb.lx
      if r0<-4096
        . move.l=YES
      end
      if move.l
        . [player.x]-SPEED.X, walk?=YES
        . [player.invert.x]=YES
      end
    end
    if can.move.right
      if.keys RIGHT
        . move.r=YES
      end
      if.gamepad RIGHT
        . move.r=YES
      end
      get.gamepad.thumb.lx
      if r0>4096
        . move.r=YES
      end
      if move.r
        . [player.x]+SPEED.X, walk?=YES
        . [player.invert.x]=NO
      end
    end
    if walk?
      animate player, WALK, 0, walk.a, 4, 0
      go .paint
    end
  end

; adjectives: 1-7 scale

texts a7.ta[]= 'best', 'fastest', 'strongest',\
 'smartest', 'greatest', 'all'
texts a6.ta[]= 'better', 'faster', 'stronger',\
 'smarter', 'greater', 'most'
texts a5.ta[]= 'good', 'fast', 'strong',\
 'smart', 'great', 'more'
texts a4.ta[]= 'medium', 'average',\
 'normal', 'some'
texts a3.ta[]= 'weak', 'slow', 'dumb', 'less'
texts a2.ta[]= 'weaker', 'slower',\
 'dumber', 'lesser'
texts a1.ta[]= 'worst', 'weakest', 'slowest',\
 'dumbest', 'least', 'none'
                             
;;;;;;;;;;;;;;;;;;;; EFFECTS ;;;;;;;;;;;;;;;;;;;;;

; stars, explosions, lasers, projectiles

align

ARRAY effect.images[IMAGE]
integer effect.index, effect.count

EFFECT.SPEED=1

text effect.folder='EFFECT\'  ; SPRITE\EFFECT
texts effect.files[]=\
 '1', '2', '3', '4', '5'

function load.effects, scale
  locals i, n, image, file
  set.sprite.folder
  set.folder effect.folder    ; \EFFECT\
  . n=effect.files.$          ; # filenames
  try @size effect.images, n  ; allocate
 
  loop i=0 to n
    @ image=effect.images[i]
    . r0=i, file=[effect.files+r0*4]
    try load.image.t image, file
    try size.image.p image, scale
  endl
  . [effect.index]=0, [effect.count]=0
endf 1

function draw.effect, x, y
  locals i, n, image
  . i=[effect.index]
  . n=[effect.count]
  @ image=effect.images[i]
  draw.image image, x, y
  . n++
  if n>EFFECT.SPEED
    . i++
    . n=0
  end
  if i>=effect.files.$
    . i=0
  end
  . [effect.index]=i
  . [effect.count]=n
endf

; ?????????????????? SOUND.INC ???????????????????

structure SOUND
 void s, s2     ; PDIRECTSOUNDBUFFER[2]
 integer status
 boolean music, replay, playing, played
ends ?sound

; load .wav. return PDIRECTSOUNDBUFFER

function load.wav, file
  locale wav,\
   wav.data(20),\     ; MMCKINFO
   fmt.data(20),\     ; same
   wav.format(18),\   ; WAVEFORMATEX
   ds.desc(20),\      ; DSBUFFERDESC
   sound,\            ; PDIRECTSOUNDBUFFER
   audio1, audio2,\   ; circular buffers
   length1, length2   ; sizes

  . r0=&wav
  memory.zero r0, ..locals.size

  try wav=mmioOpenA file, 0, MMIO_ALLOCBUF

  . r0=&wav.data              ; find 'WAVE'
  . dword [r0+8]=45564157h
  mmioDescend wav,\
   r0, 0, MMIO_FINDRIFF

  . r0=&fmt.data              ; find 'fmt '
  . dword [r0+8]=20746D66h
  . r1=&wav.data
  mmioDescend wav, r0, r1, 0

  . r0=&wav.format
  mmioRead wav, r0, 18
  . r0=&fmt.data
  mmioAscend wav, r0, 0
  . r0=&fmt.data              ; find 'data'
  . dword [r0]=61746164h
  . r1=&wav.data
  mmioDescend wav,\
   r0, r1, MMIO_FINDCHUNK

  . r0=&ds.desc      ; sound buffer description
  . dword [r0]=20    ; size
  . dword [r0+4]=224 ; flags=DSBCAPS_CTRLDEFAULT
  . r1=&fmt.data
  . r1=[r1+4]        ; fmt.data.cksize
  . dword [r0+8]=r1  ; dwBufferBytes
  . r1=&wav.format
  . dword [r0+16]=r1 ; lpwfxFormat
  . r1=&sound
  callx [dsound],\   ; CreateSoundBuffer
   12, r0, r1, 0
  if true            ; error
    . sound=0
    jmp .close
  end
  . audio1=0
  . audio2=0         ; circular buffers
  push 0             ; IDirectSoundBuffer.Lock
  . r0=&length2
  push r0
  . r0=&audio2
  push r0
  . r0=&length1
  push r0
  . r0=&audio1
  push r0
  . r0=&fmt.data
  . r0=[r0+4]
  push r0
  push 0
  callx \
   sound, DS.Lock
  cmp audio1, 0      ; read from file
  jbe .us            ; write to sound buffers
  mmioRead wav,\
   audio1, length1
  .us:
  cmp audio2, 0
  jbe .us2
  mmioRead wav,\
   audio2, length2
  .us2:
  callx sound,\      ; IDirectSoundBuffer.Unlock
   DS.Unlock,\
   audio1, length1,\
   audio2, length2
  .close:
  mmioClose wav, 0
endf sound

; load "sound" effect (play once) or "music"
; (replay and allow simultaneous sounds
; to be playing in the background)

function load.sound, sound, file
  try load.wav file
  . r1=sound, [?sound.s+r1]=r0
endf 1

function load.music, sound, file
  try load.sound sound, file
  . r0=sound, r1=[?sound.s+r0]
  . r2=&[?sound.s2+r0]
  . [?sound.replay+r0]=1
  callx [dsound],\
   DS.DuplicateSoundBuffer, r1, r2
  if true
    return 0
  end
endf 1    
Post 10 Jan 2014, 18:07
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8901
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
cool!
Post 10 Jan 2014, 18:22
View user's profile Send private message Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
m3ntal

I think that you may build a few copies of that kind of PC and try to sell it via eBay. I'm sure you can find customers for that product.
Post 10 Jan 2014, 18:44
View user's profile Send private message Visit poster's website Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:34; edited 1 time in total
Post 10 Jan 2014, 20:02
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
COOOOOOOOOOOOOOOL! (Shamelessly copying DOS386's post)
Looks great, especially that joystick, better than my Xbox. Never
knew you were *that* efficient in making advertising posters, looks as if, It's
from an official company like Google or Apple.
Post 11 Jan 2014, 01:28
View user's profile Send private message Reply with quote
malpolud



Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
Very cool stuff, I like it a lot.
Post 11 Jan 2014, 13:46
View user's profile Send private message Visit poster's website Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 821
Location: Jakarta, Indonesia
TmX
That's cool.
I'm thinking of buying a box PC, mosty for personal web development and torrent downloading, because it's more space & power efficient.

BTW have you ever thought of making an ARM box?

Smile
Post 13 Jan 2014, 07:04
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Post 05 Oct 2014, 03:42
View user's profile Send private message Visit poster's website Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 216
Location: %x
badc0de02
i dont understand why it called Z-Cube
Post 06 Oct 2014, 14:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.