Título: using rnd from bios mathpack Publicado por: nitrofurano en 08 de Enero de 2006, 09:33:57 pm hi!
after unsuccessfully trying Robsy's suggestion for rnd in assembler (sorry, man...) - i started to try using the rnd routine from bios mathpack - otherwise i didn't tried with CBios yet (i think wouldn't work) btw, i'm not sure if the random amplitude is fine, maybe the code needs some adjusts (it uses only 2 'call' commands to bios addresses, and gets result from msxbasic variable area) Código: ;- rnd mathpack experiments from Paulo Silva ;- (this code may have stuff from Milos Bazelides, Robsy Petrus and Alfonso Dioniso) ;----------------------------------------------- ;- asmsx startup .bios .page 2 .rom .start INICIO ;----------------------------------------------- ;- vram address labels CHRTBL equ 0x0000 NAMTBL equ 0x1800 CLRTBL equ 0x2000 SPRTBL equ 0x3800 SPRATR equ 0x1B00 DAC_02 equ 0xF7F8 ;----------------------------------------------- ;- declaring variables .page 3 V_DELAY: ds 2 V_TMPR: ds 2 V_1A: ds 2 V_2A: ds 2 V_3A: ds 2 V_4A: ds 2 S_DEC01: ds 5 S_DEC01_E: ds 1 ;----------------------------------------------- ;- code start .page 2 .org 0x8010 INICIO: ;- V_DELAY=400 (50=1sec) ld hl,V_DELAY ld de,400 ld [hl],d inc hl ld [hl],e ;- COLOR 4,6,12 ld hl,0xF3E9 ld [hl],4 inc hl ld [hl],6 inc hl ld [hl],12 ;- SCREEN 2,2 call INIGRP ld bc,0xE201 call WRTVDP ;- copy pattern to 3 blocks of screen2 (size 12*6 bytes= 72bytes) ld hl,PTTRN1 ld de,CHRTBL ld bc,256*8 call LDIRVM ld hl,PTTRN1+0x0800 ld de,CLRTBL ld bc,256*8 call LDIRVM ld hl,PTTRN1 ld de,CHRTBL+0x0800 ld bc,256*8 call LDIRVM ld hl,PTTRN1+0x0800 ld de,CLRTBL+0x0800 ld bc,256*8 call LDIRVM ld hl,PTTRN1 ld de,CHRTBL+0x1000 ld bc,256*8 call LDIRVM ld hl,PTTRN1+0x0800 ld de,CLRTBL+0x1000 ld bc,256*8 call LDIRVM ;- CLS (with character 0x0E) ld hl,NAMTBL ld bc,768 ld a,0x0E call FILVRM ;----------------------------------------------- ;- program start ;- LOCATE 4,2: PRINT "TextExample" ld hl,C_PRINTAT_STRING01 ld de,NAMTBL+(32*4)+2 ld bc,C_PRINTAT_END01-C_PRINTAT_STRING01 call LDIRVM jp C_PRINTAT_END01 C_PRINTAT_STRING01: db "S_DEC01$=str$(DAC_02)" C_PRINTAT_END01: ;- DAC_02=58213 ld hl,DAC_02 ld de,58213 ld[hl],d inc hl ld[hl],e ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 6,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*6)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 8,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*8)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 10,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*10)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 12,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*12)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 14,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*14)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 16,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*16)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 18,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*18)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 20,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*20)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- trying random call 0x2BDF call 0x2F8A ;- S_DEC01$=str$(DAC_02) ld hl,DAC_02 ld b,[hl] inc hl ld c,[hl] ld h,b ld l,c ld de,S_DEC01 call S_NUM2DEC_ST01 ;- LOCATE 22,2: PRINT S_DEC01$ ld hl,S_DEC01 ld de,NAMTBL+(32*22)+2 ld bc,S_DEC01_E-S_DEC01 call LDIRVM ;- do L_DL_DO01: L_DL_LOOP01: jp L_DL_DO01 ;---------------------- ;-- sub-routines S_NUM2DEC_ST01: ld bc,-10000 call S_NUM2DEC_NUM1 ld bc,-1000 call S_NUM2DEC_NUM1 ld bc,-100 call S_NUM2DEC_NUM1 ld c,-10 call S_NUM2DEC_NUM1 ld c,-1 S_NUM2DEC_NUM1: ld a,-1 S_NUM2DEC_NUM2: inc a add hl,bc jr c,S_NUM2DEC_NUM2 sbc hl,bc or $30 ld [de],a inc de ret ;- do L_DL_DO02: L_DL_LOOP02: jp L_DL_DO02 ;----------------------------------------------- ;- binary data .org 0x9000 ;- whole 4kb pattern bank here ;(this forum is saying El mensaje excede la longitúd máxima permitida (20000 caracteres). ) Título: Re: using rnd from bios mathpack Publicado por: nitrofurano en 08 de Enero de 2006, 09:36:17 pm because the forum limit, i had to split the code (...?)
the second and last split is below: Código: PTTRN1: ;- bitmap table at 0x?000 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$CF,$87,$87,$CF,$CF,$FF,$CF,$FF .db $93,$93,$93,$FF,$FF,$FF,$FF,$FF,$93,$93,$01,$93,$01,$93,$93,$FF .db $CF,$83,$3F,$87,$F3,$07,$CF,$FF,$FF,$39,$33,$E7,$CF,$99,$39,$FF .db $C7,$93,$C7,$89,$23,$33,$89,$FF,$9F,$9F,$3F,$FF,$FF,$FF,$FF,$FF .db $E7,$CF,$9F,$9F,$9F,$CF,$E7,$FF,$9F,$CF,$E7,$E7,$E7,$CF,$9F,$FF .db $FF,$99,$C3,$00,$C3,$99,$FF,$FF,$FF,$CF,$CF,$03,$CF,$CF,$FF,$FF .db $FF,$FF,$FF,$FF,$FF,$8F,$CF,$9F,$FF,$FF,$FF,$03,$FF,$FF,$FF,$FF .db $FF,$FF,$FF,$FF,$FF,$CF,$CF,$FF,$F9,$F3,$E7,$CF,$9F,$3F,$7F,$FF .db $87,$33,$23,$03,$13,$33,$87,$FF,$CF,$0F,$CF,$CF,$CF,$CF,$03,$FF .db $87,$33,$F3,$C7,$9F,$33,$03,$FF,$87,$33,$F3,$C7,$F3,$33,$87,$FF .db $E3,$C3,$93,$33,$01,$F3,$F3,$FF,$03,$3F,$07,$F3,$F3,$33,$87,$FF .db $C7,$9F,$3F,$07,$33,$33,$87,$FF,$03,$33,$F3,$E7,$CF,$9F,$9F,$FF .db $87,$33,$33,$87,$33,$33,$87,$FF,$87,$33,$33,$83,$F3,$E7,$8F,$FF .db $FF,$FF,$CF,$CF,$FF,$CF,$CF,$FF,$FF,$FF,$CF,$CF,$FF,$8F,$CF,$9F .db $E7,$CF,$9F,$3F,$9F,$CF,$E7,$FF,$FF,$FF,$03,$FF,$03,$FF,$FF,$FF .db $9F,$CF,$E7,$F3,$E7,$CF,$9F,$FF,$87,$33,$F3,$E7,$CF,$FF,$CF,$FF .db $83,$39,$21,$21,$21,$3F,$87,$FF,$CF,$87,$33,$33,$03,$33,$33,$FF .db $03,$99,$99,$83,$99,$99,$03,$FF,$C3,$99,$3F,$3F,$3F,$99,$C3,$FF .db $03,$93,$99,$99,$99,$93,$03,$FF,$01,$9D,$97,$87,$97,$9D,$01,$FF .db $01,$9D,$97,$87,$97,$9F,$0F,$FF,$C3,$99,$3F,$3F,$31,$99,$C1,$FF .db $33,$33,$33,$03,$33,$33,$33,$FF,$87,$CF,$CF,$CF,$CF,$CF,$87,$FF .db $E1,$F3,$F3,$F3,$33,$33,$87,$FF,$19,$99,$93,$87,$93,$99,$19,$FF .db $0F,$9F,$9F,$9F,$9D,$99,$01,$FF,$39,$11,$01,$29,$39,$39,$39,$FF .db $39,$19,$09,$21,$31,$39,$39,$FF,$C7,$93,$39,$39,$39,$93,$C7,$FF .db $03,$99,$99,$83,$9F,$9F,$0F,$FF,$87,$33,$33,$33,$23,$87,$E3,$FF .db $03,$99,$99,$83,$87,$93,$19,$FF,$87,$33,$1F,$C7,$E3,$33,$87,$FF .db $03,$4B,$CF,$CF,$CF,$CF,$87,$FF,$33,$33,$33,$33,$33,$33,$03,$FF .db $33,$33,$33,$33,$33,$87,$CF,$FF,$39,$39,$39,$29,$01,$11,$39,$FF .db $39,$39,$93,$C7,$93,$39,$39,$FF,$33,$33,$33,$87,$CF,$CF,$87,$FF .db $01,$33,$67,$CF,$9D,$39,$01,$FF,$87,$9F,$9F,$9F,$9F,$9F,$87,$FF .db $3F,$9F,$CF,$E7,$F3,$F9,$FD,$FF,$87,$E7,$E7,$E7,$E7,$E7,$87,$FF .db $EF,$C7,$93,$39,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$00 .db $CF,$CF,$E7,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$87,$F3,$83,$33,$89,$FF .db $1F,$9F,$83,$99,$99,$99,$43,$FF,$FF,$FF,$87,$33,$3F,$33,$87,$FF .db $E3,$F3,$F3,$83,$33,$33,$89,$FF,$FF,$FF,$87,$33,$03,$3F,$87,$FF .db $C7,$93,$9F,$0F,$9F,$9F,$0F,$FF,$FF,$FF,$89,$33,$33,$83,$F3,$07 .db $1F,$9F,$93,$89,$99,$99,$19,$FF,$CF,$FF,$8F,$CF,$CF,$CF,$87,$FF .db $E7,$FF,$87,$E7,$E7,$E7,$27,$8F,$1F,$9F,$99,$93,$87,$93,$19,$FF .db $8F,$CF,$CF,$CF,$CF,$CF,$87,$FF,$FF,$FF,$13,$01,$29,$39,$39,$FF .db $FF,$FF,$07,$33,$33,$33,$33,$FF,$FF,$FF,$87,$33,$33,$33,$87,$FF .db $FF,$FF,$23,$99,$99,$83,$9F,$0F,$FF,$FF,$89,$33,$33,$83,$F3,$E1 .db $FF,$FF,$27,$93,$93,$9F,$0F,$FF,$FF,$FF,$83,$3F,$87,$F3,$07,$FF .db $EF,$CF,$83,$CF,$CF,$CB,$E7,$FF,$FF,$FF,$33,$33,$33,$33,$89,$FF .db $FF,$FF,$33,$33,$33,$87,$CF,$FF,$FF,$FF,$39,$39,$29,$01,$93,$FF .db $FF,$FF,$39,$93,$C7,$93,$39,$FF,$FF,$FF,$33,$33,$33,$83,$F3,$07 .db $FF,$FF,$03,$67,$CF,$9B,$03,$FF,$E3,$CF,$CF,$1F,$CF,$CF,$E3,$FF .db $E7,$E7,$E7,$FF,$E7,$E7,$E7,$FF,$1F,$CF,$CF,$E3,$CF,$CF,$1F,$FF .db $89,$23,$FF,$FF,$FF,$FF,$FF,$FF,$EF,$C7,$93,$39,$39,$39,$01,$FF .db $87,$33,$3F,$33,$87,$E7,$F3,$87,$FF,$33,$FF,$33,$33,$33,$81,$FF .db $E3,$FF,$87,$33,$03,$3F,$87,$FF,$81,$3C,$C3,$F9,$C1,$99,$C0,$FF .db $33,$FF,$87,$F3,$83,$33,$81,$FF,$1F,$FF,$87,$F3,$83,$33,$81,$FF .db $CF,$CF,$87,$F3,$83,$33,$81,$FF,$FF,$FF,$83,$3F,$3F,$83,$F9,$C3 .db $81,$3C,$C3,$99,$81,$9F,$C3,$FF,$33,$FF,$87,$33,$03,$3F,$87,$FF .db $1F,$FF,$87,$33,$03,$3F,$87,$FF,$33,$FF,$8F,$CF,$CF,$CF,$87,$FF .db $83,$39,$C7,$E7,$E7,$E7,$C3,$FF,$1F,$FF,$8F,$CF,$CF,$CF,$87,$FF .db $33,$CF,$87,$33,$33,$03,$33,$FF,$CF,$CF,$FF,$87,$33,$03,$33,$FF .db $E3,$FF,$03,$9F,$87,$9F,$03,$FF,$FF,$FF,$80,$F3,$80,$33,$80,$FF .db $C1,$93,$33,$01,$33,$33,$31,$FF,$87,$33,$FF,$87,$33,$33,$87,$FF .db $FF,$33,$FF,$87,$33,$33,$87,$FF,$FF,$1F,$FF,$87,$33,$33,$87,$FF .db $87,$33,$FF,$33,$33,$33,$81,$FF,$FF,$1F,$FF,$33,$33,$33,$81,$FF .db $FF,$33,$FF,$33,$33,$03,$F3,$07,$39,$C7,$83,$39,$39,$83,$C7,$FF .db $33,$FF,$33,$33,$33,$33,$87,$FF,$E7,$E7,$81,$3F,$3F,$81,$E7,$E7 .db $C7,$93,$9B,$0F,$9F,$19,$03,$FF,$33,$33,$87,$03,$CF,$03,$CF,$FF .db $0F,$27,$27,$0B,$33,$21,$33,$F1,$F1,$E4,$E7,$81,$E7,$E7,$27,$8F .db $E3,$FF,$87,$F3,$83,$33,$81,$FF,$C7,$FF,$8F,$CF,$CF,$CF,$87,$FF .db $FF,$E3,$FF,$87,$33,$33,$87,$FF,$FF,$E3,$FF,$33,$33,$33,$81,$FF .db $FF,$07,$FF,$07,$33,$33,$33,$FF,$03,$FF,$33,$13,$03,$23,$33,$FF .db $C3,$93,$93,$C1,$FF,$81,$FF,$FF,$C3,$99,$99,$C3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F,$C0,$FF,$FF,$FF,$FF,$FF,$C0,$CF,$C8,$C9,$C9,$C9 .db $C9,$C9,$08,$FF,$00,$FF,$FF,$FF,$FF,$FF,$00,$FF,$08,$C9,$C9,$C9 .db $C9,$C9,$C8,$CF,$C8,$C9,$C9,$C9,$FF,$FF,$00,$FF,$00,$FF,$FF,$FF .db $C9,$C9,$08,$FF,$08,$C9,$C9,$C9,$E7,$E7,$00,$FF,$00,$FF,$FF,$FF .db $C9,$C9,$C9,$C9,$00,$FF,$FF,$FF,$FF,$FF,$00,$FF,$00,$E7,$E7,$E7 .db $FF,$FF,$FF,$FF,$00,$C9,$C9,$C9,$C9,$C9,$C9,$C9,$C0,$FF,$FF,$FF .db $E7,$E7,$E0,$E7,$E0,$FF,$FF,$FF,$FF,$FF,$E0,$E7,$E0,$E7,$E7,$E7 .db $FF,$FF,$FF,$FF,$C0,$C9,$C9,$C9,$C9,$C9,$C9,$C9,$08,$C9,$C9,$C9 .db $E7,$E7,$00,$FF,$00,$E7,$E7,$E7,$E7,$E7,$E7,$E7,$07,$FF,$FF,$FF .db $FF,$FF,$FF,$FF,$E0,$E7,$E7,$E7,$00,$00,$00,$00,$00,$00,$00,$00 .db $FF,$FF,$FF,$FF,$00,$00,$00,$00,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F .db $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$00,$00,$00,$00,$FF,$FF,$FF,$FF .db $FF,$FF,$89,$23,$37,$23,$89,$FF,$FF,$87,$33,$07,$33,$07,$3F,$3F .db $FF,$01,$39,$3F,$3F,$3F,$3F,$FF,$FF,$01,$93,$93,$93,$93,$93,$FF .db $01,$99,$CF,$E7,$CF,$99,$01,$FF,$FF,$FF,$81,$33,$33,$33,$87,$FF .db $FF,$99,$99,$99,$99,$83,$9F,$3F,$FF,$89,$23,$E7,$E7,$E7,$E7,$FF .db $03,$CF,$87,$33,$33,$87,$CF,$03,$C7,$93,$39,$01,$39,$93,$C7,$FF .db $C7,$93,$39,$39,$93,$93,$11,$FF,$E3,$CF,$E7,$83,$33,$33,$87,$FF .db $FF,$FF,$81,$24,$24,$81,$FF,$FF,$F9,$F3,$81,$24,$24,$81,$9F,$3F .db $C3,$9F,$3F,$03,$3F,$9F,$C3,$FF,$87,$33,$33,$33,$33,$33,$33,$FF .db $FF,$03,$FF,$03,$FF,$03,$FF,$FF,$CF,$CF,$03,$CF,$CF,$FF,$03,$FF .db $9F,$CF,$E7,$CF,$9F,$FF,$03,$FF,$E7,$CF,$9F,$CF,$E7,$FF,$03,$FF .db $F1,$E4,$E4,$E7,$E7,$E7,$E7,$E7,$E7,$E7,$E7,$E7,$E7,$27,$27,$8F .db $CF,$CF,$FF,$03,$FF,$CF,$CF,$FF,$FF,$8D,$63,$FF,$8D,$63,$FF,$FF .db $C7,$93,$93,$C7,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$E7,$E7,$FF,$FF,$FF .db $FF,$FF,$FF,$FF,$E7,$FF,$FF,$FF,$F0,$F3,$F3,$F3,$13,$93,$C3,$E3 .db $87,$93,$93,$93,$93,$FF,$FF,$FF,$87,$F3,$C7,$9F,$83,$FF,$FF,$FF .db $FF,$FF,$C3,$C3,$C3,$C3,$FF,$FF,$44,$FF,$44,$FF,$44,$FF,$44,$FF ;- colour table at 0x?400 (too much $F1) .db $00,$00,$00,$00,$00,$00,$00,$00,$11,$11,$11,$11,$11,$11,$11,$11 .db $22,$22,$22,$22,$22,$22,$22,$22,$33,$33,$33,$33,$33,$33,$33,$33 .db $44,$44,$44,$44,$44,$44,$44,$44,$55,$55,$55,$55,$55,$55,$55,$55 .db $66,$66,$66,$66,$66,$66,$66,$66,$77,$77,$77,$77,$77,$77,$77,$77 .db $88,$88,$88,$88,$88,$88,$88,$88,$99,$99,$99,$99,$99,$99,$99,$99 .db $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$BB,$BB,$BB,$BB,$BB,$BB,$BB,$BB .db $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC,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$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 .db $F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4,$F1,$F4 Título: Re: using rnd from bios mathpack Publicado por: jltursan en 09 de Enero de 2006, 01:33:02 pm I can't remember the Robsy's solution; but you can find here some easy random number generator routines:
http://baze.au.com/misc/z80bits.html#3 ..and about the use of a new character table. If you only need a quick & dirty hack to print some texts in graphic modes and don't want to waste such amount of memory, you can use the ROM provided char table. The table is usually located at $1BBF; but the right address is found doing : Código: print hex$(peek(4)+peek(5)*256) So, if you change PTTRN1 by the address found above you'll save 4 Kb (of course the font will be a bit dull; but it's only to do some tests, isn't it? :)). Título: Re: using rnd from bios mathpack Publicado por: nitrofurano en 11 de Enero de 2006, 10:39:22 pm the solution Robsy sent me didn't work (afaik - recall i still very newbie, and that time i were much more... )
on one hand, simple solutions are very interesting and useful, and on another hand, some snippets here exploring mathpack would be very interesting too (for math calculations seems to be much more complicated doing in 'pure' assember (afaik)) Título: Re: using rnd from bios mathpack Publicado por: jltursan en 11 de Enero de 2006, 11:19:14 pm Citar exploring mathpack would be very interesting too Right, if you need to do some calculations it's a good solution to use the BIOS calls; but remember that they are overpowered and returns (I can't remember the exact number) a lot of decimals; so they're terribly slow. You can't use them to realtime animate a game, maybe one like "scorched earth", no more :). Citar for math calculations seems to be much more complicated doing in 'pure' assember (afaik) Not really. Usually you don't need a lot of precision, so have you think about the use of a 16 bit register to hold a number with an integer 8 bit half (high byte) and a decimal 8 bit half (low byte)...?. It's lightning fast... ;) Título: Re: using rnd from bios mathpack Publicado por: nitrofurano en 12 de Enero de 2006, 03:50:39 pm Citar and returns (I can't remember the exact number) a lot of decimals what i used on the rnd mathpack example: Código: call 0x2BDF call 0x2F8A what i think is, afaik, call 0x2BDF is the rnd function, using the 14 character mantissa (8 bytes, 7 for mantissa and 1 for signal and float point position), and... (the meaning point) call 0x2F8A converts this 8 byte numerical value into a 2 byte integer - of course there are lots of performance lost converting 2byte values to 8byte dac values and vice-versa :-( - not as fast as using 'pure' asm, but seems to be a bit better than interpreted msx-basic btw... (performance and coding laziness compromise...) Citar ..and about the use of a new character table. If you only need a quick & dirty hack to print some texts in graphic modes and don't want to waste such amount of memory, you can use the ROM provided char table. The table is usually located at $1BBF; but the right address is found doing : Código: print hex$(peek(4)+peek(5)*256) So, if you change PTTRN1 by the address found above you'll save 4 Kb (of course the font will be a bit dull; but it's only to do some tests, isn't it? Smiley). the first point were i didn't knew about 20kb text code posting limit... (that's why i hurried to split the code to at least having all there instead of editing the code to fit just in time) - laziness and intuition mixed... i knew about the rom char table - all asm code i have are patch over a template i use for all examples i coded, and the 4kb custom char table were on all there - i have to optimize all my code to use both ways without much brain effort needed... (my laziness is always annoying guyver800 too, ehehehehe ;-) ) - about char table, the idea from Konami using the characters 0x00 to 0x15 for empty char blocks with colours 0x00 to 0x15 i adopted as excellent (unless we really need all 256 characters) otherwise, the zxspectrum char table is 768 bytes long (characters 0x20 to 0x7F), maybe no bad idea at all using it instead... Título: Re: using rnd from bios mathpack Publicado por: pitpan en 13 de Enero de 2006, 07:07:02 pm Small -and less random- random routine
Código: RANDOMIZE: ; Init R register - call ONLY ONCE xor a ld r,a ret RANDOM: ; Return a 8-bit random number in A ld a,r push hl push bc ld hl,RANDOM_TABLE ld c,a ld b,0 add hl,bc ld a,[hl] ret RANDOM_TABLE: rept 128 db random(256) endr You would need asMSX 0.12b or higher to assemble this code. It worked fine for MINESWEEPER, for example. Título: Re: using rnd from bios mathpack Publicado por: jltursan en 13 de Enero de 2006, 07:12:04 pm :)
Btw, clever use of the REPT and RANDOM pseudo commands! Título: Re: using rnd from bios mathpack Publicado por: nitrofurano en 14 de Enero de 2006, 07:00:15 pm thanks Robsy!
(let me guess: you introduced rept into asMSX since version 0.12b?) |