Skip to content

Commit

Permalink
add sd card sample (that doesn't work in emulator)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeastplume committed Feb 22, 2020
1 parent 0ca9b5f commit be06068
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Don't run make from this directory, run
# from subdirs

X16_RUN = $(X16_EMU) -rom $(X16_ROM) $(X16_EMU_FLAGS) $(DEBUG)
X16_RUN = $(X16_EMU) -rom $(X16_ROM) $(X16_EMU_FLAGS) $(DEBUG) $(SD_CARD)

# Ensure ld65 and ca65 are on your path
# Assembly flags
Expand All @@ -26,7 +26,7 @@ run_fresh:
$(X16_RUN)

run_asm: OBJS_$(NAME)
$(X16_RUN) -prg $(NAME).prg
$(X16_RUN) -prg $(NAME).prg

run_bas: $(NAME).assembled.bas
$(X16_RUN) -bas $(NAME).assembled.bas
Expand Down
22 changes: 22 additions & 0 deletions samples/sd_card/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include ../Makefile.vars

NAME = sd_card
RESOURCES = kq5.png

project.av: $(RESOURCES)
rm -rf project.av ./output/
$(ALOEVERA) create project project.av
$(ALOEVERA) -p project.av palette import kq5_pal kq5.png
$(ALOEVERA) -p project.av imageset import kq5_screen 320 200 kq5.png
$(ALOEVERA) -p project.av imageset format kq5_screen kq5_pal 8
$(ALOEVERA) -p project.av bitmap init kq5_bmp kq5_screen
$(ALOEVERA) create sd_image kq5.img
$(ALOEVERA) -p project.av asm -s kq5.img -f bin . select -a 0x0000 kq5_bmp KQ5.BIN
$(ALOEVERA) -p project.av asm -f bin . select -a 0x0000 kq5_bmp KQ5.BIN
$(ALOEVERA) -p project.av asm -s kq5.img -f bin . select -a 0x0000 kq5_pal KQ5PAL.BIN

generate_resources: project.av

SD_CARD = -sdcard kq5.img

include ../common/Makefile
Binary file added samples/sd_card/kq5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions samples/sd_card/sd_card.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
.include "../common/header.inc"
.include "../common/macros.inc"

.code
jmp start
.proc set_mode ;target layer 1
;set layer 1 mode to tiled Bitmap Mode 8bpp
v_address_set $F2000, 1
lda #$E1 ;8bpp bitmap, on
;lda #$81 ;tiled, 8bpp, on
sta VERA_DATA0
lda #$0 ;TileW is 320
sta VERA_DATA0
;map base not used
lda #$00
sta VERA_DATA0
lda #$00
sta VERA_DATA0
;set tileset (bmp data) address to $00000
lda #$00
sta VERA_DATA0
lda #$00
sta VERA_DATA0
lda #$00
sta VERA_DATA0
lda #$00
sta VERA_DATA0 ; palette offset 0
;set hscale, vscale
v_address_set $F0001, 1
lda #$40
sta VERA_DATA0
lda #$40
sta VERA_DATA0
rts
.endproc

;.proc load_palette
; v_address_set $F1000, 1
; set_const_16 $00, palette

; TARGET = 512;loop until size reached

; loop:
; lda ($00),y
; sta VERA_DATA0
; add_constant_16 $00, 1
; loop_till_eq_16 $00, (palette + TARGET), loop
; rts
;.endproc

;.code
;jmp start
;.proc load_bitmap
; v_address_set $00000, 1
; set_const_16 $00, bitmap
; TARGET = 32000;loop until size reached
;
; loop:
; lda ($00),y
; sta VERA_DATA0
; add_constant_16 $00, 1
; loop_till_eq_16 $00, (bitmap + TARGET), loop
; rts
;.endproc

start:
;jsr set_mode
; jsr load_palette
; jsr load_bitmap
;jsr clear_map
;jsr load_tilemap
;turn off layer 2 to see our handiwork
; v_address_set $F3000, 0
; lda #$0 ;default, off
; sta VERA_DATA0
rts

0 comments on commit be06068

Please sign in to comment.