User Tag List

Страница 15 из 63 ПерваяПервая ... 111213141516171819 ... ПоследняяПоследняя
Показано с 141 по 150 из 699

Тема: SjASMPlus от z00m

Комбинированный просмотр

Предыдущее сообщение Предыдущее сообщение   Следующее сообщение Следующее сообщение
  1. #1

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    I think it would make some sense to collect these tricks/ideas/warnings about how to make your life easier while programming GB ROM into some kind of blog, or document, maybe even just `test/macro_examples` file?

    But I also want to avoid mentioning "GB" word or "N" word directly in sjasmplus git (also the reason of naming it "lr35902" everywhere, even if I can't remember that number and always have to check the other terminal with sjasmplus --help), so some external blog would be probably better place to describe all these intricacies, maybe even create the checksum macro, etc... show some ROM image build form scratch...

    (I'm not planning to get myself involved in this, my focus is ZX Next, so this is all open field for you guys, I will add more tests to verify the --lr35902 works correctly in sjasmplus, and that's my part "done", rest is on your ( = whoever wants to use sjasmplus for GB projects) shoulders. .... so these are like "advice how you can waste your spare time if you feel bored" )

  2. #1
    С любовью к вам, Yandex.Direct
    Размещение рекламы на форуме способствует его дальнейшему развитию

  3. #2

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    NEO: most of the tests added, few bugs fixed (Z80 opcodes generated for invalid instructions) ...
    https://github.com/z00m128/sjasmplus.../tests/lr35902

    I think this is now very closed to "done" (I just need to add few more tests for Z80/Z80N instructions and some tests for CLI option/device, but with a bit of luck I managed to fix all bugs with this last commit.

    The LR35902_specifics_exercise.asm (and .lst) contains small showcase of how the sjasmplus features/syntax work also for LR35902 instructions and how the valid values are checked.

    Please review it all and if you spot something ridiculous or wrong, let me know, thank you.

  4. #3

    Регистрация
    22.05.2011
    Адрес
    г. Дзержинск, Украина
    Сообщений
    6,829
    Спасибо Благодарностей отдано 
    483
    Спасибо Благодарностей получено 
    663
    Поблагодарили
    513 сообщений
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    для лучшего понимания

    Код:
    var1        db      0x34
    var2        dw      0x5678
    var3        db      0xAB
    var4        dw      0xCDEF
    лучше бы сделать

    Код:
    var_34        db      0x34
    var_5678      dw      0x5678
    var_AB        db      0xAB
    var_CDEF      dw      0xCDEF



    Код:
            ; legit ones
                stop                ; implicit 0
                stop    0
                stop    0xE0

    а что за stop e0 ? о_О
    генерируещее 10 E0

    сейчас в одном описании попался просто вариант $10 для stop o_O

    у stop та же ошибка что и у halt ?

    где про это написано?

    в http://www.pastraiser.com/cpu/gamebo...y_opcodes.html тоже упоминается вариант 10
    Instruction STOP has according to manuals opcode 10 00 and thus is 2 bytes long. Anyhow it seems there is no reason for it so some assemblers code it simply as one byte instruction 10.
    - - - Добавлено - - -

    проверил
    как такое трактуется в IDA
    Код:
    		ld	a, b
    ; ---------------------------------------------------------------------------
    		db $10		;short stop
    ; ---------------------------------------------------------------------------
    		ld	a, c
    		ld	a, d
    		ld	a, b
    ; ---------------------------------------------------------------------------
    		stop		;stop
    ; ---------------------------------------------------------------------------
    		ld	a, c
    		ld	a, d
    		ld	a, b
    ; ---------------------------------------------------------------------------
    		db $10		;stop E0
    		ld	[$FF79], a
    ; ---------------------------------------------------------------------------
    		ld	a, d
    		ld	a, b
    ; ---------------------------------------------------------------------------
    		halt		;halt
    ; ---------------------------------------------------------------------------
    		ld	a, c
    		ld	a, d
    		ld	a, b
    ; ---------------------------------------------------------------------------
    		halt		;halt : nop
    		nop
    ; ---------------------------------------------------------------------------
    		ld	a, c
    		ld	a, d
    ida дает
    Command "MakeCode" failed




    и как в bgb

    Код:
    ROM1:4000 78               ld   a,b
    ROM1:4001 10 79            <corrupted stop>	;short stop
    ROM1:4003 7A               ld   a,d
    
    ROM1:4004 78               ld   a,b
    ROM1:4005 10 00            stop			;stop
    ROM1:4007 79               ld   a,c
    ROM1:4008 7A               ld   a,d
    
    ROM1:4009 78               ld   a,b
    ROM1:400A 10 E0            <corrupted stop>	;stop E0
    ROM1:400C 79               ld   a,c
    ROM1:400D 7A               ld   a,d
    
    ROM1:400E 78               ld   a,b
    ROM1:400F 76               halt 		;halt
    ROM1:4010 79               ld   a,c
    ROM1:4011 7A               ld   a,d
    
    ROM1:4012 78               ld   a,b
    ROM1:4013 76               halt 		;halt : nop
    ROM1:4014 00               nop  
    ROM1:4015 79               ld   a,c
    ROM1:4016 7A               ld   a,d
    Последний раз редактировалось NEO SPECTRUMAN; 30.09.2019 в 21:19.

  5. #4

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Hey.. it just now occurred to me... GB is using banking to read all that ROM cartridge, right?
    any examples, how it is done, and if anything useful can be improved on sjasmplus side?
    Or is device like ZXSPECTRUM1024 + SAVEDEV large enough to build bigger ROM image easily and the 0x8000 slot sizes are native also to GB banking?

    I just added the "$$label" operator, it is returning label's page value, so now it is enough to do in source:
    Код:
        DEVICE ZXSPECTRUM1024 : SLOT 3
        ORG $c000, 4
    fn1:
    ; fn1page EQU $$   ;; not needed anymore
        nop : ...
    
    ; and the code which wants to know the page where the beginning of the code did land
    ; and set the bank, can use the $$ like this:
        ORG $8000
        ld a,$$fn1 + whatever_const   ; 4 + whatever_const
        out (c),a            ; switch bank
        call fn1              ; execute the code
    In ideal case this should help also with GB, so device with suitable slots/pages to define the page-of-label well may be needed. But I'm too lazy to read about GB specs, so if NEO or somebody else will post simple details here, what needs change, I will look into it.
    Последний раз редактировалось Ped7g; 02.10.2019 в 12:03. Причина: typo fixed

  6. #5

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    https://github.com/z00m128/sjasmplus...es/tag/v1.14.2

    v1.14.2 changelog:
    - added i8080 mode (--i8080 CLI option) (it's still Z80 Zilog syntax, just limited instruction set)
    - added Sharp LR35902 mode (--lr35902 CLI option) (100% syntax compatibility with IDA, 95% bgb)
    - new $$label operator to retrieve page of label
    - 1.14.0 include-path bugfix reverted, the "." is again automatically added (did break projects)
    - small improvements/polish/extra-info in docs, INSTALL, README, few new tests added
    - cmake script fix of SYSTEM_LUA=ON option, CirrusCI configs added for macOS and FreeBSD
    - few fixes of memory leaks, invalid memory access, double free/delete

    Documentation http://z00m128.github.io/sjasmplus/documentation.html (or in the package/cloned source).

    Should "just work".
    If you have any issue with it, and the docs doesn't explain why the assembler is doing what it is doing, please report it, so I can take a look
    (before I will forget how it works).

    Эти 2 пользователя(ей) поблагодарили Ped7g за это полезное сообщение:

    NEO SPECTRUMAN(04.10.2019), Protom(13.10.2019)

  7. #6

    Регистрация
    22.05.2011
    Адрес
    г. Дзержинск, Украина
    Сообщений
    6,829
    Спасибо Благодарностей отдано 
    483
    Спасибо Благодарностей получено 
    663
    Поблагодарили
    513 сообщений
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    прогнал свои дизассмы
    100% совпадение


    на
    ld hl, sp+$FA
    выдало
    error: Offset out of range (+250)
    но bin-анрник в итоге правильный


    хотя по GBCPUman.pdf
    ld hl,sp+n
    n - signed value о_О

    потом проверю как команда отрабатывает на эмуляторе
    и действительно ли там signed...
    вангую что это кривая IDA
    Последний раз редактировалось NEO SPECTRUMAN; 04.10.2019 в 23:56.

  8. #7

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    ld hl, sp+$FA
    выдало
    error: Offset out of range (+250)
    That's "correct" (but annoying), it's signed int8_t, so in source should be value -128 .. +127 ($FA = -6: `ld hl,sp-6` is correct syntax)
    ... it should have been just warning, but I'm reusing the check from `jr/djnz` routines which report these as error, and I was too lazy to change it.
    (but it's still producing the binary, so if you are lazy too, you can just ignore it... or edit the source and add -256 to such line = `ld hl,sp+$FA-256`= that will remove the error message)

    Thinking about it, there's no "(int8_t)" typecast like in C, so if IDA is producing 0..255 values, you really have to manually go over all error reports and add the -256 on those lines ... or actually, if the IDA is holding the $%02x formatting rigorously (and the whole instruction formatting), one sed line in bash like:
    Код:
    cat x.asm | sed -r "s/(\\bld\\s+hl,\\ sp\\+\\\$[89A-F][0-9A-F]\\s*\$)/\\1 -256 ; fixed by sed/" > x_fixed.asm
    (ARGH... took me 15min to build it with correct escaping for bash.. while in Java/C++ I would just write the regexp in 3min)

    (the regexp in it's final form is "s/(\bld\s+hl,\ sp\+\$[89A-F][0-9A-F]\s*$)/\1 -256 ; fixed by sed/" ... i.e. find all lines with ld hl, sp+$80..$FF values which have nothing after it except whitespace+endline, and adds " -256 " text after them. So you can even run this replacement on the already fixed file, shouldn't change it twice (because the endline condition is not fulfilled).
    Последний раз редактировалось Ped7g; 05.10.2019 в 01:14.

  9. #8

    Регистрация
    22.05.2011
    Адрес
    г. Дзержинск, Украина
    Сообщений
    6,829
    Спасибо Благодарностей отдано 
    483
    Спасибо Благодарностей получено 
    663
    Поблагодарили
    513 сообщений
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от Ped7g Посмотреть сообщение
    you can just ignore it...
    меня это не беспокоит
    я просто отписался о первой увиденной ошибке

    главное что теперь можно выкинуть rgbasm (затереть Gutmann-ом шесть раз подряд )
    и забыть про него
    Последний раз редактировалось NEO SPECTRUMAN; 05.10.2019 в 02:31.

  10. #9

    Регистрация
    22.05.2011
    Адрес
    г. Дзержинск, Украина
    Сообщений
    6,829
    Спасибо Благодарностей отдано 
    483
    Спасибо Благодарностей получено 
    663
    Поблагодарили
    513 сообщений
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    В общем
    генерация контрольной суммы не нужна!
    GB вроде бы ее не проверяет
    проверяется только $0134-$014D
    и логотип nintendo


    все что нужно для запуска своего кода
    Код:
    ; ---------------------------------------------------------------------------		
    			org $0100
    		nop
    		jp	start
    ; ---------------------------------------------------------------------------
    			org $0104
    
    		db $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D ;nintendo logo
    		db $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 ;do not change !!!
    		db $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E ;!!!
    
    check
    		db   "CHCK_SUM_TEZT! "		;rom name
    		db   00				;
    		db   00,00			;
    		db   00				;
    		db   00				;
    		db   00				;
    		db   00				;
    		db   00				;
    		db   00				;
    		db   00				;
    
    checksum_cnt = 0
    checksum = 0	
    		dup 25
    checksum = checksum + ({b check + checksum_cnt})
    checksum_cnt = checksum_cnt + 1
    		edup
    checksum = checksum + 25
    
    		db   low (256 - checksum)
    
    		db   $00,$00			;rom check sum (who cares?)
    ; ---------------------------------------------------------------------------
    - - - Добавлено - - -

    Если что
    могу проверить
    действительно ли контральтовая сумма не имеет значения
    на железном dmg-01

    - - - Добавлено - - -

    но для правильной работы эмуляторов и flash картриджей
    придется наверно все таки прописывать
    тип картриджа
    количество банок ПЗУ \ ОЗУ

    да и может есть тупые эмуляторы которые откажутся запускать без совпадения общей контрольной суммы

    - - - Добавлено - - -

    расчет не нужной контрольной суммы для 32К rom-а
    (помещать в конце исходника перед сохранением)

    Код:
    ;rom_00_check_sum
    
    full_checksum_cnt = 0
    full_checksum = 0	
    		dup $14E
    full_checksum = full_checksum + ({b full_checksum_cnt})
    full_checksum_cnt = full_checksum_cnt + 1
    		edup
    
    full_checksum_cnt = $150
    		dup $3EB0
    full_checksum = full_checksum + ({b full_checksum_cnt})
    full_checksum_cnt = full_checksum_cnt + 1
    		edup
    
    
    ;rom_01_check_sum
    
    full_checksum_cnt = $4000
    		dup $4000
    full_checksum = full_checksum + ({b full_checksum_cnt})
    full_checksum_cnt = full_checksum_cnt + 1
    		edup
    
    		org $014E
    		
    		db high full_checksum
    		db low full_checksum
    		
    	SAVEBIN "teZt.gb",$0000,$8000

    для больших картриджей
    скорей всего просто щелкать страницами
    (такой вариант я не проверял)
    Код:
    slot 0
    page 0
    ;rom_00_check_sum
    slot 1
    page 1
    ;rom_01_check_sum
    slot 1
    page 2
    ;rom_01_check_sum  (COPY)
    slot 1
    page 3
    ;rom_01_check_sum  (COPY)
    slot 1
    page 4
    ;rom_01_check_sum  (COPY)
    ...
    ...
    org $014E
    db high full_checksum
    db low full_checksum
    Последний раз редактировалось NEO SPECTRUMAN; 09.10.2019 в 19:30.

  11. #10

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    If you know the checksum was zero before running the checksum loop, you can just do full $4000 DUP on first area (no need to split it), the result should be same?
    (or you can clear it before checksumming with `ORG $14E : DW 0`)

    And then you can probably create macro for $4000x bank checksum with arguments for entry address+slot+page and use it for all parts...

    Etc... I'm generally not interested too much to include this directly into sjasmplus git (N-logo for sure *NOT*, the checksum macro... maybe, but it's trivial to write if you know the sjasmplus syntax).

    So I guess it's enough to have this documented here on the forum, or maybe somebody will write some public blog about "how to use sjasmplus for GB development"... (somebody not connected to sjasmplus project in any way and published on unrelated web not connected to the sjasmplus).

    Thank you very much NEO SPECTRUMAN for testing it and for the syntax research info - it was essential task to make this happen (I think any major issue would be already found by now, so I guess LR35902 feature is of decent quality). (of course if any bug is found, let me know, as always)

    Have fun.

Страница 15 из 63 ПерваяПервая ... 111213141516171819 ... ПоследняяПоследняя

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Похожие темы

  1. SjASMPlus Z80 кросс ассемблер
    от Aprisobal в разделе Программирование
    Ответов: 1663
    Последнее: 19.06.2021, 01:36
  2. Исходники TR-DOS для SjASMPlus
    от Keeper в разделе Программирование
    Ответов: 20
    Последнее: 11.02.2011, 11:57
  3. Запуск STS из .sna, сгенерированного sjasmplus.
    от siril в разделе Программирование
    Ответов: 7
    Последнее: 11.10.2010, 21:33
  4. Breakpoints в связке Sjasmplus+UnrealSpeccy
    от Kurles в разделе Программирование
    Ответов: 19
    Последнее: 26.01.2009, 12:36
  5. Disturbed COverMAnia ( music disk with z00m music collection)
    от kyv в разделе Музыка
    Ответов: 10
    Последнее: 27.03.2008, 10:01

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •