News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: hello world on sega genesis /megadrive  (Read 2586 times)

humbertomoura

  • Newbie
  • *
  • Posts: 1
    • View Profile
hello world on sega genesis /megadrive
« on: February 20, 2017, 09:58:00 pm »
Hello guys,
I made a hello world code based in Big evil corporation tutorial (https://bigevilcorporation.co.uk/2012/03/23/sega-megadrive-4-hello-world/), a great start tutorial.
I think I understood the code, I made several changes, it runs well in emulators like Gens and others. But when I try to run the code in the Mega Drive (Genesis) Hardware Throught "Everdrive" cartridge, it doesn't run. The screen stays black after the "licenced by Sega tm" words.

I compile my code in two forms:
asm68k /k /p /o ae- main.asm, final.bin >errors.txt, , hello.lst
asm68k /p main.asm,final.bin

The code compiles without error, but no runs on Megadrive 1 JP with everdrive. I tried with SNASM68k too. Same thing. Compiles well, ran on emulator, but everdrive doesn't.

After compile, I also used this two utilities to generate checksum:

gen-cksum.py final.bin
fixheadr.exe final.bin

I don't know what's going wrong, because I compile the Sonic 1 project hack at the same form and runs on mega drive with everdrive well.

I post all the source here:
https://www.dropbox.com/s/j7e0ja0gspwl911/hello.zip?dl=0

Thanks for any help, .
----------------------------------------------------------------------------------------------------
Code: [Select]
;main.asm
include 'init.asm'
include 'globals.asm'

__main:

move.w #0x8F02, vdp_control ; Configura o auto-incremento para 2 bytes
move.l #vdp_write_palettes, vdp_control ; configura a VDP para escrever na CRAM 0x0000C3

lea Paletas, a0 ; Carrega endereço da paleta para o registrador a0
move.l #0x07, d0 ; 32 bytes de dados (8 longwords, menos 1 para o contador) na paleta (2 pal = 0F)

.CorLoop:
move.l (a0)+, vdp_data ; Move os dados para a porta de dados da VDP, e incrementa o endereço de origem
dbra d0, .CorLoop

move.w #0x8706, vdp_control ; Configura a cor de fundo para paleta 0 cor 6 - amarelo

move.l #0x40200000, vdp_control ; Configura a VDP pra escrever no endereço da VRAM 0x0020
lea Caracteres, a0 ; Carrega endereço dos caracteres no a0
move.l #0x87, d0 ; (8 longwords * 8 letras = 64 longwords, menos 1 para contador) na fonte

@Loop:
move.l (a0)+, vdp_data ; Move dados para porta de dados da VDP, e incrementa endereço de origem
dbra d0, @Loop

move.l #vdp_write_plane_a, vdp_control ; Configura a VDP para escrever no endereço VRAM 0xC00000 (Plano A)

;plano A, paleta 0, sem girar, mais id do bloco (tile).
move.w #0x0008, vdp_data ; Pattern ID 09 - H
move.w #0x000F, vdp_data ; Pattern ID 07 - U
move.w #0x000B, vdp_data ; Pattern ID 0C - M
move.w #0x0002, vdp_data ; Pattern ID 0D - B
move.w #0x0005, vdp_data ; Pattern ID 00 - E
move.w #0x000D, vdp_data ; Pattern ID 17 - R
move.w #0x000E, vdp_data ; Pattern ID 01 - T
move.w #0x000C, vdp_data ; Pattern ID 10 - O
move.w #0x0000, vdp_data ; Pattern ID 00 -
move.w #0x000B, vdp_data ; Pattern ID 04 - M
move.w #0x000C, vdp_data ; Pattern ID 12 - O
move.w #0x000F, vdp_data ; Pattern ID 15 - U
move.w #0x000D, vdp_data ; Pattern ID 07 - R
move.w #0x0001, vdp_data ; Pattern ID 10 - A




include 'cores.asm'
include 'letras.asm'

__end ;

st!

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: hello world on sega genesis /megadrive
« Reply #1 on: March 01, 2017, 08:46:53 am »
I'm not into 68k coding yet but looking at you code I don't see any vblank handling. I mean the part after you feed vdp w/ pattern ids to display your name.
cores.asm and letras.asm contain data only. So apparently it gets executed and result is quite unexpected.

Code: [Select]
vblank:
jmp vblank

include 'cores.asm'
include 'letras.asm'

That's pretty ugly but should work. Usually you halt cpu there, wait for interrupt, do what should be done and loop again. Or just disable interrupts and handle
it by yourself.

yugisokubodai

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • Assembly
Re: hello world on sega genesis /megadrive
« Reply #2 on: April 06, 2017, 09:47:20 am »

Kallisto

  • Sr. Member
  • ****
  • Posts: 479
    • View Profile
Re: hello world on sega genesis /megadrive
« Reply #3 on: April 06, 2017, 07:17:40 pm »
What in the world?

Avicalendriya

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • Avi Morgan dot com
Re: hello world on sega genesis /megadrive
« Reply #4 on: April 06, 2017, 10:47:38 pm »
More like "What in the word?"