Can all registered uses please login, even just for a few minutes..
It helps build a picture where our "good traffic" is coming from..
Thanks :)

ASM detect CPU type ?

News,announcements,programming,fixes,game patches & discussions.
User avatar
exxos
Site Admin
Site Admin
Posts: 28977
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: ASM detect CPU type ?

Post by exxos »

mfro wrote: Thu Dec 08, 2022 3:14 pm Now it depends on where "appropriate" is. You are calling a GEMDOS function now. That's supposed to fail as well until GEMDOS is fully initialised.
Dammit... So how are you supposed to draw text after the logo them because it looks like the code uses the same stuff anyway..

Code: Select all

crcmsg: dc.b 'WARNING: BAD ROM CRC IN CHIP ',0
crcmsg2 dc.b '.',13,10,0
crcfail:
        move.l    a5,d5
        pea.l     crcmsg
        move.w    #9,-(a7)
        trap      #1
        move.b    #$45,d0            /* 'E' - even */
        btst      #0,d5
        beq.s     chipE
        move.b    #$4F,d0            /* 'O' - odd */
All I am really doing is trying to output different text.. And my code is directly under that..
User avatar
mfro
Posts: 125
Joined: Thu Dec 13, 2018 7:32 am

Re: ASM detect CPU type ?

Post by mfro »

exxos wrote: Thu Dec 08, 2022 3:17 pm
mfro wrote: Thu Dec 08, 2022 3:14 pm Now it depends on where "appropriate" is. You are calling a GEMDOS function now. That's supposed to fail as well until GEMDOS is fully initialised.
Dammit... So how are you supposed to draw text after the logo them because it looks like the code uses the same stuff anyway..
Then it probably *is* appropriate. Anyway, if TOS succeeds and you fail with the apparent same call, then it's who's fault, probably? :lol:

(SCNR. But can't help you any further if you don't show surrounding code. Maybe you destroyed a register that later code depends on?)
And remember: Beethoven wrote his first symphony in C.
User avatar
exxos
Site Admin
Site Admin
Posts: 28977
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: ASM detect CPU type ?

Post by exxos »

mfro wrote: Thu Dec 08, 2022 3:32 pm
Then it probably *is* appropriate. Anyway, if TOS succeeds and you fail with the apparent same call, then it's who's fault, probably? :lol:

(SCNR. But can't help you any further if you don't show surrounding code. Maybe you destroyed a register that later code depends on?)
Well here is all the code If you want to have a bash at it, it is only from TOS anyway. I was adding my code around line 1745.. I have taken it out for now because I cannot get anything but the single character code to output anything anyway.

startup.zip
(34.78 KiB) Downloaded 116 times
User avatar
mfro
Posts: 125
Joined: Thu Dec 13, 2018 7:32 am

Re: ASM detect CPU type ?

Post by mfro »

at least in your previous code post, it appears you are missing a terminating 0 byte after the string.
And remember: Beethoven wrote his first symphony in C.
User avatar
exxos
Site Admin
Site Admin
Posts: 28977
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: ASM detect CPU type ?

Post by exxos »

mfro wrote: Thu Dec 08, 2022 4:11 pm at least in your previous code post, it appears you are missing a terminating 0 byte after the string.
ohhhhhh

Capture.PNG
Capture.PNG (61.33 KiB) Viewed 3165 times
User avatar
mfro
Posts: 125
Joined: Thu Dec 13, 2018 7:32 am

Re: ASM detect CPU type ?

Post by mfro »

exxos wrote: Thu Dec 08, 2022 4:23 pm ohhhhhh
Good start. At least the string is there. And TOS is still able to properly throw bombs, so you probably didn't do too much damage ;)

GEMDOS calls trash registers D0,D1 and A0-A2. If the surrounding code requires it, you'll have to save and restore these.
And remember: Beethoven wrote his first symphony in C.
User avatar
exxos
Site Admin
Site Admin
Posts: 28977
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: ASM detect CPU type ?

Post by exxos »

mfro wrote: Thu Dec 08, 2022 4:53 pm Good start. At least the string is there. And TOS is still able to properly throw bombs, so you probably didn't do too much damage ;)
:D
mfro wrote: Thu Dec 08, 2022 4:53 pm GEMDOS calls trash registers D0,D1 and A0-A2. If the surrounding code requires it, you'll have to save and restore these.
Currently trying to figure out a comparison..

Code: Select all

	move.l		$59e.w,a0
	move.l		#0,d0
	cmp.l		a0,d0

but geez, I have not done assembly since like 1994 and that was with the Z80 :lol:

Instructions says it affects flags but I'm not sure how you supposed to check the result. If I remember rightly there was something where it would skip the next instruction on a comparison or something like that :shrug:

By all accounts it a short stack frame which is zero, and I need to check for that and output the message saying "hello world" :lol:
czietz
Posts: 587
Joined: Sun Jan 14, 2018 1:02 pm

Re: ASM detect CPU type ?

Post by czietz »

Perhaps the bombs are due to the absence of a boot device. (No floppy drive configured, maybe?) EDIT: Then again, Hatari has a built-in debugger, so it should be easy to find out where and why it bombs.

Hmm... If only there was an open-source, actively developed OS written in a higher level language than assembler, which users could modify as much as they like (as long as they follow the GPL terms) by adding C code... Hmm... :lol:
User avatar
exxos
Site Admin
Site Admin
Posts: 28977
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: ASM detect CPU type ?

Post by exxos »

czietz wrote: Thu Dec 08, 2022 4:58 pm Perhaps the bombs are due to the absence of a boot device. (No floppy drive configured, maybe?)
The bombs are expected because it is running a 68000 CPU on a 030 build of TOS. Hence trying to construct a routine which handles this more elegantly.
czietz wrote: Thu Dec 08, 2022 4:58 pm Hmm... If only there was an open-source, actively developed OS written in a higher level language than assembler, which users could modify as much as they like (as long as they follow the GPL terms) by adding C code... Hmm... :lol:
Yeah shame :lol: Though I think I hate C code more than assembler. I was actually pretty good at assembly back in the day, while on the Z80 and even did some bits on the ST as well back in early 90s. was pretty good at PIC assembler as well more recently. But C code, nope, never touch the stuff.

I'm only playing about really at the end of the day, not looking to rewrite a whole operating system :)
User avatar
exxos
Site Admin
Site Admin
Posts: 28977
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: ASM detect CPU type ?

Post by exxos »

So this seems to be causing it to crash even just by itself :shrug:

Code: Select all

infoText:  dc.b 'Hello World',0
Post Reply

Return to “SOFTWARE PROGRAMMING & DISCUSSION”