Home
Projects
Matt's fract
IVehcs
Ultrasonic head-tracker
Microcontroller MIDI
Turing Machine Editor
FAT FS Drivers
Mandelbrot Generator
Javascript Vic-20 emulator
Javascript Vic-20 Emulator Inline via Bookmark
Imaginary 6502 Emulator / Assembler
Other
Pure CSS Accordian
Pure CSS Tabs - Horizontal
Pure CSS Tabs - Vertical
Pure CSS Radio/Checkboxes
C++ XML escape function
C++ POSIX compliant way of reading a directory listing
VR4 car door disassembly
Contact
Imaginary 6502 Emulator / Assembler (Work in progress)
Compile
Execute
; initialise device locations device.display $200 ; *** _Must_ initialise display *** ; display hardware regs at 0x200 org $200 ; display at 0x300 ; palette at palette ; 256 x 192 x 4bpp @ 25fps dcw $300,palette,256,192,4,25 ; *** Reset vector _must_ be set *** org $FFFC dcw start ; Program goes here org $7000 start: ; stars will live at $0 and be a 16bit number for position ldx #0 init: jsr rand_8 sta 0,x inx genagain: jsr rand_8 cmp #$60 bcs genagain clc adc #$3 ; add screen base sta 0,x inx cpx #192 bne init draw: ldx #192 ; index jsr drawloop_clearStars ldx #128 ; index jsr drawloop_clearStars ldx #64 ; index jsr drawloop_clearStars end: jmp draw drawloop_clearStars: ; clear star lda #0 sta (0,x) dec 0,x ; subtract 1 txa sta (0,x) ; draw star dex dex bne drawloop_clearStars frameloop: lda $210 ; device.display + 16 bne frameloop rts ; init rng ; rng with 2^32-1 length rand_8: asl r_seed rol r_seed2 rol r_seed3 rol r_seed4 lda r_seed bcc carry_not_set eor #$AF sta r_seed carry_not_set: rts r_seed: dcb 1 r_seed2: dcb 14 ; prng seed byte, must not be zero r_seed3: dcb 2 r_seed4: dcb 0 ; *** Initialise palette *** palette: dcl 000000, $444444, $444444, $444444, $444444, $555555, $666666, $666666, $666666, $AAAAAA, $AAAAAA, $bbbbbb, $cccccc, $dddddd, $eeeeee, $ffffff
Feedback:
TODO
TODO