F1DE
F1DE is 0x10c DCPU 1.7 Compliant -   [Editor]   [Dcpu]   [0x10c]   [About]
Project 21rnsl : Demo

; Example project - Now RC_1 compliant: ; ; This project demonstrates some of the basics of F1DE ; ; Note the use of ; Include - Include a file ; Org - Set the location of subsequent code (multiple orgs are supported) ; Equ - Constant equates ; Dat - Data expressions, ; Pack - Byte packed data ; Define - Simple text substitution ; If/Else - Conditional assembly ; List/Nolist - Turn assembly output on/off ; Macros - No parameters (yet!) ; ; Expressions are supported throughout, with full operator precendence. ; Available operators : + - * / % & | ^ ! ~ << >> ( ) ; ; Numeric literals are base 10 by default. Other radixes are: ; 0xABCD - Hex, 0b10111 - Binary, 0o756 - Octal ; ; Multiple pass assembly uses short form addresses where possible ; ; org 0x000 set pc, start include "kernel.dasm" org 0x200 :start jsr setup set a, 1 add a, 5 jsr print dat "Hello there!", 0 jsr newline jsr print dat "F1DE is RC_1 compliant", 0 :end set pc,end dat "Strings" pack "Byte packed data", 1,2,3
; Simple include file - ; Select Main.dasm and click assemble to assemble the full program ; :screen_addr equ 0xe000 :char_addr equ 0xe180 :screen_width equ 32 nolist if screen_width != 32 error "screen width must be 32" end_if define jmp_ set pc, define push_ set push, list :cursor dat screen_addr + screen_width * 4 + 4 :colour dat 0x9100 :store_a dat 0 :store_b dat 0 ; Print out a zero terminated string immediately following the ; instruction that called this routine ; eg. jsr print ; dat "my String",0 ; ..code continues from here ; No registers are affected by this routine ; :print jmp_ print_start ; Move the cursor to the next line :newline jmp_ do_newline ; ; ; ; Set up the monitor, keyboard and clock ; At the moment, this simply initialises the screen buffer to ; a known address ; ; This uses registers a,b,c,x,y,i,j ; :setup jmp_ setup_hw ; ; System error is called if a fatal error occurs ; ; :system_error jmp_ system_error :setup_hw hwn i :hw_loop ife i, 0 set pc, hw_discovered sub i, 1 hwq i ife a, 0xf615 ife b, 0x7349 set [monitor_idx], i ife a, 0xb402 ife b, 0x12d0 set [clock_idx], i ife a, 0x7406 ife b, 0x30cf set [keyboard_idx], i set pc, hw_loop ; These are set up by the hardware discovery loop above: ; :NOT_FOUND equ 0xffff :monitor_idx dat NOT_FOUND ; Index of first monitor connected to cpu, or 0xffff :clock_idx dat NOT_FOUND ; Index of first clock connected to cpu, or 0xffff :keyboard_idx dat NOT_FOUND ; Index of first keyboard connected to cpu, or 0xffff ; Now set up the screen with default palette and font :hw_discovered ife [monitor_idx], NOT_FOUND set pc, system_error set a, 0 set b, screen_addr hwi [monitor_idx] set pc, pop ;----------------------------------------------- :do_newline set [store_a], a set a,[cursor] and a, 0xffe0 add a, screen_width set [cursor],a set a, [store_a] set pc, pop ;----------------------------------------------- :print_start set [store_a], a set [store_b], b set a, pop set b, [cursor] loop set [b], [a] add [b], [colour] add a,1 add b,1 ifn [a], 0 jmp_ loop add a,1 push_ a set a, [store_a] set b, [store_b] set pc, pop ; End of Kernel ;--------------------------------------------
 
...
   
  • A
    0x0000

    []
    0x0000
  • B
    0x0000

    []
    0x0000
  • C
    0x0000

    []
    0x0000
  • X
    0x0000

    []
    0x0000
  • Y
    0x0000

    []
    0x0000
  • Z
    0x0000

    []
    0x0000
  • I
    0x0000

    []
    0x0000
  • J
    0x0000

    []
    0x0000
  • SP
    0x0000

    []
    0x0000
  • PC
    0x0000

    []
    0x0000
  • EX
    0x0000

    []
    0x0000
  • IA
    0x0000

    []
    0x0000


copy current project files
NOTE: You do not need to save to assemble a project. Just click assemble.

This is a public project. If you wish to save your changes, you must fork it. This will create a new project from your changes, that you alone will be able to edit.

Loading...
About F1DE
X

F1DE - The DCPU Development Tool for 0x10c

Latest Update 23th May 2012 - Version 0.9.20

F1DE is securely hosted on Amazon Web Services for emulation and file storage.
Database is backed up daily.

Example project is here:
http://fasm.elasticbeanstalk.com/?proj=21rnsl

Comments? Suggestions? Ideas? Join us on http://www.0x10cforum.com

DCPU Instructions:
X
Instruction Effect
SETb, asets b to a
ADDb, asets b to b+a, sets EX to 0x0001 if there's an overflow, 0x0 otherwise
SUBb, asets b to b-a, sets EX to 0xffff if there's an underflow, 0x0 otherwise
MULb, asets b to b*a, sets EX to ((b*a)>>16)&0xffff (treats b, a as unsigned)
MLIb, alike MUL, but treat b, a as signed
DIVb, asets b to b/a, sets EX to ((b<<16)/a)&0xffff. if a==0, sets b and EX to 0 instead. (treats b, a as unsigned)
DVIb, alike DIV, but treat b, a as signed. Rounds towards 0
MODb, asets b to b%a. if a==0, sets b to 0 instead.
MDIb, alike MOD, but treat b, a as signed. (MDI -7, 16 == -7)
ANDb, asets b to b&a
BORb, asets b to b|a
XORb, asets b to b^a
SHRb, asets b to b>>>a, sets EX to ((b<<16)>>a)&0xffff (logical shift)
ASRb, asets b to b>>a, sets EX to ((b<<16)>>>a)&0xffff (arithmetic shift) (treats b as signed)
SHLb, asets b to b<<a, sets EX to ((b<<a)>>16)&0xffff
IFBb, aperforms next instruction only if (b&a)!=0
IFCb, aperforms next instruction only if (b&a)==0
IFEb, aperforms next instruction only if b==a
IFNb, aperforms next instruction only if b!=a
IFGb, aperforms next instruction only if b>a
IFAb, aperforms next instruction only if b>a (signed)
IFLb, aperforms next instruction only if b<a
IFUb, aperforms next instruction only if b<a (signed)
ADXb, asets b to b+a+EX, sets EX to 0x0001 if there is an over-flow, 0x0 otherwise
SBXb, asets b to b-a+EX, sets EX to 0xFFFF if there is an under-flow, 0x0 otherwise
STIb, asets b to a, then increases I and J by 1
STDb, asets b to a, then decreases I and J by 1
JSRapushes the address of the next instruction to the stack, then sets PC to a
HCFa---
INTatriggers a software interrupt with message a
IASasets IA to a
IAGasets a to IA
RFIadisables interrupt queueing, pops A from the stack, then pops PC from the stack
IAQaif a is nonzero, interrupts will be added to the queue instead of triggered. if a is zero, interrupts will be triggered as normal again
HWNasets a to number of connected hardware devices
HWQasets A, B, C, X, Y registers to information about hardware a
A+(B<<16) is a 32 bit word identifying the hardware id
C is the hardware version
X+(Y<<16) is a 32 bit word identifying the manufacturer
HWIasends an interrupt to hardware a
Editor Key Shortcuts:
X
PC (Windows/Linux) Mac action
Ctrl-U Ctrl-U change to upper case
Ctrl-Shift-U Ctrl-Shift-U change to lower case
Ctrl-Alt-Down Command-Option-Down copy lines down
Ctrl-Alt-Up Command-Option-Up copy lines up
Ctrl-F Command-F find
Ctrl-K Command-G find next
Ctrl-Shift-K Command-Shift-G find previous
Ctrl-End,Ctrl-Down Command-End,Command-Down go to end
Ctrl-L Command-L go to line
Alt-Right,End Command-Right,End,Ctrl-E go to line end
Alt-Left,Home Command-Left,Home,Ctrl-A go to line start
Ctrl-Home,Ctrl-Up Command-Home,Command-Up go to start
Ctrl-Left Option-Left go to word left
Ctrl-Right Option-Right go to word right
Tab Tab indent
Alt-Down Option-Down move lines down
Alt-Up Option-Up move lines up
Shift-Tab Shift-Tab outdent
Insert Insert overwrite
Ctrl-Shift-Z,Ctrl-Y Command-Shift-Z,Command-Y redo
Ctrl-D Command-D remove line
Ctrl-K remove to line end
Option-Backspace remove to linestart
Alt-Backspace,Ctrl-Alt-Backspace remove word left
Alt-Delete remove word right
Ctrl-R Command-Option-F replace
Ctrl-Shift-R Command-Shift-Option-F replace all
Ctrl-A Command-A select all
Shift-Down Shift-Down select down
Shift-Left Shift-Left select left
Shift-End Shift-End select line end
Shift-Home Shift-Home select line start
Shift-PageDown Shift-PageDown select page down
Shift-PageUp Shift-PageUp select page up
Shift-Right Shift-Right select right
Ctrl-Shift-End,Alt-Shift-Down Command-Shift-Down select to end
Alt-Shift-Right Command-Shift-Right select to line end
Alt-Shift-Left Command-Shift-Left select to line start
Ctrl-Shift-Home,Alt-Shift-Up Command-Shift-Up select to start
Shift-Up Shift-Up select up
Ctrl-Shift-Left Option-Shift-Left select word left
Ctrl-Shift-Right Option-Shift-Right select word right
Ctrl-O split line
Ctrl-T Ctrl-T transpose letters
Ctrl-Z Command-Z undo