This is a real hardware question . I'm going to build something of an old C64 computer, I only want to take the processor, and as few components as possible.
I'm going to do a hardware that displays time in binary. I'll need the ROM to, or at least another ROM, the program I want to write is like this in assembly:
org 100h
xor cx,cx
xor dx,dx
start:
inc eax
cmp eax,07FFFFFh ;clockspeed in hz
je sec
jmp start
sec:
xor eax,eax
inc bl
push dx
push ax
mov ch,bl
call printANuminCHwithSpace
mov ch,cl
call printANuminCHwithSpace
mov ch,dl
call printANuminCH
MOV dl, 13 ; print char
MOV ah, 02h
INT 21h
MOV dl, 10 ; print char
MOV ah, 02h
INT 21h
pop ax
pop dx
cmp bl,60
je min
jmp start
min:
xor bl,bl
inc cl
cmp cl,60
je h
jmp start
h:
xor cl,cl
inc dl
cmp dl,24
je day
jmp start
day:
xor dl,dl
jmp start
printANuminCH:
push ax
push dx
xor ax, ax
mov al, ch ;2 char
mov dh, 100 ;1 char skipping this for now
div dh
add al, 30h
MOV dl, al ; print char
MOV ah, 02h
INT 21h
xor ax, ax
mov al, ch ;2 char
mov dh, 100
div dh
mov al,ah
xor ah,ah
mov dh,10
div dh
add al, 30h
MOV dl, al ; print char
MOV ah, 02h
INT 21h
xor ax, ax
mov al, ch ;last char
mov dh, 10
div dh
add ah, 30h
MOV dl, ah ; print char
MOV ah, 02h
INT 21h
pop dx
pop ax
ret
printANuminCHwithSpace:
push dx
push ax
call printANuminCH
MOV dl, 20h ; print char
MOV ah, 02h
INT 21h
pop ax
pop dx
ret
The displaying code isn't going to be there.
Here's how it could look like when implemented:
The ports should be replaced and represented by their appropriate value.
org 100h
xor cx,cx
xor dx,dx
start:
inc ax
cmp ax,0FFFFh ;clockspeed in hz
je sec
jmp start
sec:
xor ax,ax
inc bl
out bl,0h
cmp bl,60
je min
jmp start
min:
xor bl,bl
inc cl
out cl,1h
cmp cl,60
je h
jmp start
h:
xor cl,cl
inc dl
out dl,2h
cmp dl,24
je day
jmp start
day:
xor dl,dl
jmp start
Is there any good company, (europe should be best, I live in Sweden), that makes ROMs? How much could it cost. I don't want to use to much money.
I need 17 outputs, do I need a multiplexer? Where could I get one?
How is the machine code in the C64?
Thanks in advance
Niklas Ulvinge aka IDK
-- modified at 13:29 Saturday 10th September, 2005
|