Everything and Anything ColecoVision!
You are not logged in.
Pages: 1
These are some code examples I'm trying to learn from and a way how to assemble your own code.
if anyone is interested in trying to make a comunity built game for coleco in assembly language please contact me. I have been trying to learn from 8-bit Mill's code and have made some interesting discoveries looking over his code.
Extract tasm to the folder you have your source file in
assemble using:
tasm filename.z80 -80 -b
rename using:
ren filename.obj filename.rom
dosbox download:
https://www.dosbox.com/download.php?main=1
tasm download:
https://www.ticalc.org/pub/dos/asm/
MSX/Coleco Sprite & Tile Set Editor:
https://www.electricadventures.net/Pages/Category/24
Ill be demonstrating how to code in z80 assembly for colecovision and adam.
Starting from baby steps as im just starting to learn myself
Everything you need to get started is posted here and should be easy to copy and paste and assemble
Added later 10 min 52 s:
Thanks to https://8bitmilligames.com/ for helping me with this code!
;cartridge header and title example
.org $8000
TitleControl .dw 055AAh
.dw 0,0,0,0, start
.dw 0,0,0,0,0,0,0,0,0,0,0
retn
.text "YOUR NAME/HELLO WORLD!/2022"
start:
jp $0000
.end
title and screen with hello world
.org $8000
TitleControl .dw 055AAh
.dw 0,0,0,0, start
.dw 0,0,0,0,0,0,0,0,0,0,0
retn
.text "YOUR NAME/HELLO WORLD!/2022"
start:
call $1f85 ; cv bios : mode_1
call $1fd6 ; cv bios : turn off sound
;clear video ram
ld a,0
ld hl,0
ld de,$4000
call $1f82 ; cv bios : fill_vram
;color white (f) on blue (4)
ld a,$f4
ld hl,$2000
ld de,32
call $1f82 ; cv bios : fill_vram
call $1f7f ; cv bios : load_ascii
; print "helloworld!"
ld de,$1800
ld hl,helloworld
ld bc,12
call $1fdf ; cv bios :write_vram
ld de,$1820
ld hl,nextline
ld bc,28
call $1fdf ; cv bios :write_vram
ld de,$1840
ld hl,helloworld
ld bc,12
call $1fdf ; cv bios :write_vram
; screen on
ld bc,$01c2
call $1fd9 ; cv bios :write_register
; infinite loop
end:
jp end
.end
helloworld:
.db "HELLO WORLD!"
nextline:
.db "this is the hello world demo"
Added later 14 min 50 s:
Last edited by Implite (2023-09-09 12:06:41)
Offline
Some improved Hello World code plus gives the user the ability to move the text anywhere on the screen:
; COLECOVISION - HELLO WORLD!
; By Daniel Bienvenu (newcoleco) and implite,2023
;tasm syntax
; BIOS (SOME) ENTRY POINTS
CALC_OFFSET: .equ $08c0
LOAD_ASCII: .equ $1f7f
FILL_VRAM: .equ $1f82
MODE_1: .equ $1f85
PUT_VRAM: .equ $1fbe
TURN_OFF_SOUND: .equ $1fd6
WRITE_REGISTER: .equ $1fd9
READ_REGISTER: .equ $1fdc
WRITE_VRAM: .equ $1fdf
; VRAM DEFAULT TABLES
VRAM_PATTERN: .equ $0000
VRAM_NAME: .equ $1800
VRAM_SPRATTR: .equ $1B00
VRAM_COLOR: .equ $2000
VRAM_SPRGEN: .equ $3800
.org $8000
; HEADER
.dw $55AA ; use $AA55 to avoid the default CV title screen
.dw 0,0,0,0
.dw Start
rst_8:
reti
nop
rst_10:
reti
nop
rst_18:
reti
nop
rst_20:
reti
nop
rst_28:
reti
nop
rst_30:
reti
nop
rst_38:
reti
nop
jp Nmi
TitleScreen .text "TEXT DEMO/HELLO WORLD!/2023"
; PROGRAM
Start:
im 1
; CLEAR VIDEO MEMORY
ld hl,$0000
ld de,$4000
xor a
call FILL_VRAM
; INIT DEFAULT SCREEN GRAPHIC MODE 1
call MODE_1
; NO SOUND
call TURN_OFF_SOUND
; DEFAULT FONT TO VIDEO MEMORY
call LOAD_ASCII
; COLOR WHITE ON BLUE BACKGROUND
ld hl,VRAM_COLOR ; COLOR TABLE
ld de,32
ld a,$f4 ; WHITE ON BLUE
call FILL_VRAM
; PRINT "HELLO WORLD!" CENTERED AT THE TOP OF THE SCREEN
; FORMULA = (32 CHARS PER LINE - 12 CHARS TO OUTPUT) / 2 = 10
call Calculated_Offset ;Static_Offset ; or use Calculated_Offset
call Write_HelloWorld ; or use Put_HelloWorld but make sure to not add VRAM NAME TABLE with the Offset
; 16KB VIDEO MEMORY, 16x16 NORMAL SPRITES, AND TURN ON SCREEN
ld bc,$01c2 ; $01e2 ; = AND ENABLE NMI EXECUTION
call WRITE_REGISTER
TheEnd:
jp TheEnd
.end
HelloWorld:
.db "HELLO WORLD!"
Static_Offset:
ld de,VRAM_NAME+330 ; VRAM NAME TABLE + OFFSET
ret
Calculated_Offset:
ld d,10 ; LINE = 0
ld e,10 ; COLUMN = 10
call CALC_OFFSET ; OFFSET = 32 * D + E
ld hl,VRAM_NAME
add hl,de
ex de,hl
ret
Write_HelloWorld:
ld hl,HelloWorld
ld bc,12 ; COUNT
jp WRITE_VRAM
Put_HelloWorld:
ld a,2 ; ID#2 = VRAM NAME TABLE
ld hl,HelloWorld
ld iy,12 ; COUNT
jp PUT_VRAM
Nmi:
; RANDOM COLOR ON BLACK BACKGROUND
ld hl,VRAM_COLOR ; COLOR TABLE
ld de,32
ld a,r ; REFRESH MEMORY STATE USED AS A RANDOM VALUE
and $f0 ; BLACK BACKGROUND
call FILL_VRAM
; ABSOLUTELY NEEDED
call READ_REGISTER
retn
Last edited by Implite (2023-09-08 21:37:29)
Offline
Very nice - but understand those VRAM equates are not set in stone, that just happens to be the ColecoVision BIOS defaults.
Some improved Hello World code plus gives the user the ability to move the text anywhere on the screen:
; COLECOVISION - HELLO WORLD! ; By Daniel Bienvenu (newcoleco) and implite,2023 ;tasm syntax ; BIOS (SOME) ENTRY POINTS CALC_OFFSET: .equ $08c0 LOAD_ASCII: .equ $1f7f FILL_VRAM: .equ $1f82 MODE_1: .equ $1f85 PUT_VRAM: .equ $1fbe TURN_OFF_SOUND: .equ $1fd6 WRITE_REGISTER: .equ $1fd9 READ_REGISTER: .equ $1fdc WRITE_VRAM: .equ $1fdf ; VRAM DEFAULT TABLES VRAM_PATTERN: .equ $0000 VRAM_NAME: .equ $1800 VRAM_SPRATTR: .equ $1B00 VRAM_COLOR: .equ $2000 VRAM_SPRGEN: .equ $3800 .org $8000 ; HEADER .dw $55AA ; use $AA55 to avoid the default CV title screen .dw 0,0,0,0 .dw Start rst_8: reti nop rst_10: reti nop rst_18: reti nop rst_20: reti nop rst_28: reti nop rst_30: reti nop rst_38: reti nop jp Nmi TitleScreen .text "TEXT DEMO/HELLO WORLD!/2023" ; PROGRAM Start: im 1 ; CLEAR VIDEO MEMORY ld hl,$0000 ld de,$4000 xor a call FILL_VRAM ; INIT DEFAULT SCREEN GRAPHIC MODE 1 call MODE_1 ; NO SOUND call TURN_OFF_SOUND ; DEFAULT FONT TO VIDEO MEMORY call LOAD_ASCII ; COLOR WHITE ON BLUE BACKGROUND ld hl,VRAM_COLOR ; COLOR TABLE ld de,32 ld a,$f4 ; WHITE ON BLUE call FILL_VRAM ; PRINT "HELLO WORLD!" CENTERED AT THE TOP OF THE SCREEN ; FORMULA = (32 CHARS PER LINE - 12 CHARS TO OUTPUT) / 2 = 10 call Calculated_Offset ;Static_Offset ; or use Calculated_Offset call Write_HelloWorld ; or use Put_HelloWorld but make sure to not add VRAM NAME TABLE with the Offset ; 16KB VIDEO MEMORY, 16x16 NORMAL SPRITES, AND TURN ON SCREEN ld bc,$01c2 ; $01e2 ; = AND ENABLE NMI EXECUTION call WRITE_REGISTER TheEnd: jp TheEnd .end HelloWorld: .db "HELLO WORLD!" Static_Offset: ld de,VRAM_NAME+330 ; VRAM NAME TABLE + OFFSET ret Calculated_Offset: ld d,10 ; LINE = 0 ld e,10 ; COLUMN = 10 call CALC_OFFSET ; OFFSET = 32 * D + E ld hl,VRAM_NAME add hl,de ex de,hl ret Write_HelloWorld: ld hl,HelloWorld ld bc,12 ; COUNT jp WRITE_VRAM Put_HelloWorld: ld a,2 ; ID#2 = VRAM NAME TABLE ld hl,HelloWorld ld iy,12 ; COUNT jp PUT_VRAM Nmi: ; RANDOM COLOR ON BLACK BACKGROUND ld hl,VRAM_COLOR ; COLOR TABLE ld de,32 ld a,r ; REFRESH MEMORY STATE USED AS A RANDOM VALUE and $f0 ; BLACK BACKGROUND call FILL_VRAM ; ABSOLUTELY NEEDED call READ_REGISTER retn
Offline
Very nice - but understand those VRAM equates are not set in stone, that just happens to be the ColecoVision BIOS defaults.
Thanks however I cannot take full credit for making this. Newcoleco made this I just changed some values and syntax however if someone copies and paste this code the the result should be this:
Side note:
Also displays the title text.
Offline
Pages: 1